public void ApplicationViewTest() { _driver.FindElement(By.XPath("//button[@data-sid='openApplicationLauncherButton']")).Click(); var applicationChoice = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//span[contains(text(), 'Selenium Test Name')]")); if (applicationChoice == null) { Assert.Fail("Could not load the 'Selenium Test Name' choice in under 5 seconds!"); } Waits.ImplicitWait(TimeSpan.FromSeconds(1)); applicationChoice.Click(); var dropdownRoot = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//a[contains(text(),' SeleniumTestDataTypeGrid ')]")); Actions actions = new Actions(_driver); actions.MoveToElement(dropdownRoot).Build().Perform(); var gridViewFromDropdown = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//a[contains(text(),'SeleniumTestDataTypeGrid DefaultView')]")); gridViewFromDropdown.Click(); var addNewRowButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[text()='Add New']")); if (addNewRowButton == null) { Assert.Fail("Could not load the 'Add New' button in under 5 seconds!"); } }
public void TextTemplatesCreateTest() { _driver.FindElement(By.CssSelector("a[routerlink = 'create']")).Click(); var newTextTemplateNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@name='nameButton']")); if (newTextTemplateNameInput == null) { Assert.Fail("Could not load the 'Name' input in under 5 seconds!"); } newTextTemplateNameInput.SendKeys("Selenium Test Name"); var textAreaFrame = _driver.FindElement(By.CssSelector("iframe[class = 'k-iframe']")); _driver.SwitchTo().Frame(textAreaFrame); var textArea = _driver.FindElement(By.CssSelector("div[contenteditable = 'true']")); textArea.Click(); textArea.SendKeys("Selenium Test Content"); _driver.SwitchTo().DefaultContent(); Waits.ImplicitWait(TimeSpan.FromSeconds(0.5)); _driver.FindElement(By.XPath("//button[@data-sid='createButton']")).Click(); var newTextTemplateButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("a[routerlink = 'create']")); if (newTextTemplateButton == null) { Assert.Fail("Could not load the 'New Text Templates' button in under 5 seconds!"); } var textTemplateEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'Selenium Test Name')]")); if (textTemplateEntry == null) { Assert.Fail("Could not create (or display on the list) a Text Template!"); } Console.WriteLine("Text Template created successfully!"); Assert.Pass("Text Template created successfully!"); }
public void TextTemplatesEditTest() { var textTemplateEntry = _driver.FindElement(By.XPath("//div[contains(text(), 'Selenium Test Name')]")); var dataSid = int.Parse(textTemplateEntry.GetAttribute("data-sid").Replace("element", "")); var textTemplateEditButton = _driver.FindElement(By.XPath($"//a[@data-sid='editButton{dataSid}']")); textTemplateEditButton.Click(); var nextButton = Helpers.Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[text()='Next']")); if (nextButton == null) { Assert.Fail("The 'Choose language' dialog did not appear!"); } nextButton.Click(); Waits.ImplicitWait(TimeSpan.FromSeconds(0.5)); var editTextTemplateNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("input[name = 'nameButton']")); if (editTextTemplateNameInput == null) { Assert.Fail("Could not load the 'Name' input in under 5 seconds!"); } editTextTemplateNameInput.SendKeys(" EDITED"); var textAreaFrame = _driver.FindElement(By.CssSelector("iframe[class = 'k-iframe']")); _driver.SwitchTo().Frame(textAreaFrame); var textArea = _driver.FindElement(By.XPath("//div[@contenteditable='true']")); textArea.Click(); textArea.SendKeys("\nSelenium Test Content Edited"); _driver.SwitchTo().DefaultContent(); Waits.ImplicitWait(TimeSpan.FromSeconds(0.5)); _driver.FindElement(By.XPath("//*[text()='Update']")).Click(); var newTextTemplateButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("a[routerlink = 'create']")); if (newTextTemplateButton == null) { Assert.Fail("Could not load the 'New Text Templates' button in under 5 seconds!"); } textTemplateEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'Selenium Test Name EDITED')]")); if (textTemplateEntry == null) { Assert.Fail("Could not edit (or display on the list) the name of a Text Template!"); } dataSid = int.Parse(textTemplateEntry.GetAttribute("data-sid").Replace("element", "")); var textTemplateViewButton = _driver.FindElement(By.XPath($"//a[@data-sid='viewButton{dataSid}']")); textTemplateViewButton.Click(); var paragraph = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//p[text()='Selenium Test Content Edited']")); if (paragraph == null) { Assert.Fail("Could not load the content of the Text Template in under 5 seconds (or the content is incorrectly edited)!"); } _driver.Navigate().Back(); newTextTemplateButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("a[routerlink = 'create']")); if (newTextTemplateButton == null) { Assert.Fail("Could not load the 'New Text Templates' button in under 5 seconds!"); } textTemplateEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'Selenium Test Name EDITED')]")); if (textTemplateEntry == null) { Assert.Fail("Could not edit (or display on the list) a Text Template!"); } Console.WriteLine("Text Template edited successfully!"); Assert.Pass("Text Template edited successfully!"); }