public void IsDefaultValuesWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); createButton.Click(); _driver.Navigate().Refresh(); _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, after the default values had been used!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using default values!"); } }
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 CanLocalAdminViewApplicationsTab() { _avatarButton.Click(); var designButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Design']")); if (designButton == null) { Assert.Fail("Could not load the 'Design' button in under 5 seconds!"); } designButton.Click(); var applicationsButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Applications']")); if (applicationsButton == null) { Assert.Pass("Could not load the 'Applications' button in under 5 seconds!"); } else { Assert.Fail("Local admin has access to the applications tab!"); } }
public void GridsListTest() { _avatarButton.Click(); var designButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div/a[contains(text(),'Design')]/..")); if (designButton == null) { Assert.Fail("Could not load the 'Design' button in under 5 seconds!"); } designButton.Click(); var gridsButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//div/a[contains(text(),'Grids')]/..")); if (gridsButton == null) { Assert.Fail("Could not load the 'Grids' button in under 5 seconds!"); } gridsButton.Click(); var newGridButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'New Grid')]")); if (newGridButton == null) { Assert.Fail("Could not load the 'New Grid' button in under 5 seconds!"); } Console.WriteLine("List of Grids loaded successfully!"); Assert.Pass("List of Grids loaded successfully!"); }
public void TextTemplatesListTest() { _avatarButton.Click(); var designButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Design']")); if (designButton == null) { Assert.Fail("Could not load the 'Design' button in under 5 seconds!"); } designButton.Click(); var textTemplatesButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Text Templates']")); if (textTemplatesButton == null) { Assert.Fail("Could not load the 'Text Templates' button in under 5 seconds!"); } textTemplatesButton.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!"); } Console.WriteLine("List of Text Templates loaded successfully!"); Assert.Pass("List of Text Templates loaded successfully!"); }
public void TextTemplatesDeleteTest() { var textTemplateEntry = _driver.FindElement(By.XPath("//div[contains(text(), 'Selenium Test Name EDITED')]")); var dataSid = int.Parse(textTemplateEntry.GetAttribute("data-sid").Replace("element", "")); var textTemplateDeleteButton = _driver.FindElement(By.XPath($"//a[@data-sid='deteButton{dataSid}']")); textTemplateDeleteButton.Click(); var nextButton = Helpers.Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[text()='Delete']")); if (nextButton == null) { Assert.Fail("The 'Delete element' dialog did not appear!"); } nextButton.Click(); _driver.Navigate().Refresh(); 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 delete a Text Template!"); } Console.WriteLine("Text Template deleted successfully!"); Assert.Pass("Text Template deleted successfully!"); }
public void TextTemplatesViewTest() { var textTemplateEntry = _driver.FindElement(By.XPath("//div[contains(text(), 'Selenium Test Name')]")); var 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']")); if (paragraph == null) { Assert.Fail("Could not load the content of the Text Template in under 5 seconds (or the content is incorrect)!"); } _driver.Navigate().Back(); 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')]")); if (textTemplateEntry == null) { Assert.Fail("Could not create (or display on the list) a Text Template!"); } Console.WriteLine("Text Template viewed successfully!"); Assert.Pass("Text Template viewed successfully!"); }
public void IsListWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); var textInput = _driver.FindElement(By.XPath("//select[@ng-reflect-name='List']")); textInput.Click(); var numericOption = Helpers.Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//select[@ng-reflect-name='List']/option[contains(text(), 'Urgent')]")); if (numericOption == null) { Assert.Fail("Could not load the List options in under 5 seconds!"); } numericOption.Click(); createButton.Click(); _driver.Navigate().Refresh(); _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, after the text value had been set!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using \"1. Highest - Urgent\" list value!"); } var testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//td[@kendogridlogicalcell and @role='gridcell']//select[@ng-reflect-model='0']")); if (testCell == null) { Assert.Fail("There is no cell with \"1. Highest - Urgent\" list value!"); } }
public void IsPictureAndFileWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); var filesInput = _driver.FindElements(By.XPath("//input[@name='files']")); foreach (IWebElement element in filesInput) { element.SendKeys("C:/Selenium/001.jpg"); } //Wait 2 seconds to finish upload Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(1), By.XPath("//input[@id='0']")); createButton.Click(); _driver.Navigate().Refresh(); _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, after the text value had been set!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using picture and file value!"); } var testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//td[@kendogridlogicalcell and @role='gridcell']/a[text()='001.jpg']")); if (testCell == null) { Assert.Fail("There is no cell with file set correctly!"); } testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//img")); if (testCell == null) { Assert.Fail("There is no cell with picture set correctly!"); } }
public void IsDateWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); var textInput = _driver.FindElement(By.XPath("//span[@class='k-dateinput-wrap']/input[@role='spinbutton']")); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys(Keys.ArrowLeft); textInput.SendKeys("61520001200"); createButton.Click(); _driver.Navigate().Refresh(); _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, after the date value had been set!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using \"6/15/2000 12:00 AM\" date value!"); } var testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//td[@kendogridlogicalcell and @role='gridcell' and text()='6/15/2000 12:00 AM']")); if (testCell == null) { Assert.Fail("There is no cell with \"6/15/2000 12:00 AM\" date value!"); } }
public static bool RemoveRow(IWebDriver _driver, IWebElement row) { var rowIndex = row.GetAttribute("data-kendo-grid-item-index"); var colIdCell = _driver.FindElement(By.XPath($"//td[@data-kendo-grid-column-index='0' and @ng-reflect-data-row-index='{rowIndex}']")); Actions actions = new Actions(_driver); actions.ContextClick(colIdCell).Perform(); var deleteRowButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Delete')]")); if (deleteRowButton == null) { Assert.Fail("Failed to delete a row!"); return(false); } actions.MoveToElement(deleteRowButton).Click().Perform(); return(true); }
public void TextTemplatesCreateTest() { _driver.FindElement(By.CssSelector("a[routerlink = 'create']")).Click(); var newTextTemplateNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("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(); _driver.FindElement(By.XPath("//*[text()='Create']")).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 IsCalculationalWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); var numericInput = _driver.FindElement(By.XPath("//span[@class='k-numeric-wrap']/input[@role='spinbutton']")); numericInput.SendKeys("44"); var calcInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='Calculational']")); calcInput.SendKeys("[2]+66"); createButton.Click(); _driver.Navigate().Refresh(); _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, after the text value had been set!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using \"[2]+66\" calculational value!"); } var testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//td[@kendogridlogicalcell and @role='gridcell' and text()='110']")); if (testCell == null) { Assert.Fail("There is no cell with \"110\" numeric value!"); } }
public void ApplicationDeleteTest() { Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Selenium Test Name')]/button[contains(text(), 'Delete')]")).Click(); Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[@role='dialog']//button[contains(text(), 'Delete')]")).Click(); _driver.Navigate().Refresh(); var newApplicationButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create New Application')]")); if (newApplicationButton == null) { Assert.Fail("Could not load the 'Create New Application' button in under 5 seconds!"); } var applicationEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Selenium Test Name EDITED')]")); if (applicationEntry != null) { Assert.Fail("Could not edit (or display on the list) an Application!"); } }
public void IsBooleanWorking() { _addNewRowButton.Click(); var createButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create')]")); if (createButton == null) { Assert.Fail("Could not load the 'Create' button in under 5 seconds!"); } var typeInput = _driver.FindElement(By.XPath("//input[@ng-reflect-name='rowTypeCheckbox']")); typeInput.Click(); var textInput = _driver.FindElement(By.XPath("//kendo-switch[@ng-reflect-name='Boolean']")); textInput.Click(); createButton.Click(); _driver.Navigate().Refresh(); _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, after the text value had been set!"); } _activeRow = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//tr[@kendogridlogicalrow and @role='row' and @data-kendo-grid-item-index='0' ]")); if (_activeRow == null) { Assert.Fail("Failed to create a row using \"true\" boolean value!"); } var testCell = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//td[@kendogridlogicalcell and @role='gridcell' and text()='true']")); if (testCell == null) { Assert.Fail("There is no cell with \"true\" boolean value!"); } }
public void ApplicationCreateTest() { _driver.FindElement(By.XPath("//button[contains(text(), 'Create New Application')]")).Click(); var newApplicationNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@data-sid = 'applicationNameInput']")); if (newApplicationNameInput == null) { Assert.Fail("Could not load the 'Name' input in under 5 seconds!"); } newApplicationNameInput.SendKeys("Selenium Test Name"); var functionalityToDragAndDrop = _driver.FindElement(By.XPath("//span[contains(text(),' SeleniumTestDataTypeGrid ')]")); var whereToDrop = _driver.FindElement(By.XPath("//span[contains(text(),' [Place new item] ')]")); Actions actions = new Actions(_driver); actions.DragAndDrop(functionalityToDragAndDrop, whereToDrop).Build().Perform(); _driver.FindElement(By.XPath("//button[contains(text(),'Create') and not(contains(text(),'Application'))]")).Click(); var newApplicationButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create New Application')]")); if (newApplicationButton == null) { Assert.Fail("Could not load the 'Create New Application' button in under 5 seconds!"); } var applicationEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Selenium Test Name')]")); if (applicationEntry == null) { Assert.Fail("Could not create (or display on the list) an Application!"); } }
public void GridsDeleteTest() { var gridEntry = _driver.FindElement(By.XPath("//div[contains(text(), 'seleniumTestGridNameEDITED')]")); var dataSid = int.Parse(gridEntry.GetAttribute("data-sid").Replace("element", "")); var gridDeleteButton = _driver.FindElement(By.XPath($"//a[@data-sid='deleteButton{dataSid}']")); gridDeleteButton.Click(); var nextButton = Helpers.Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[text()='Delete']")); if (nextButton == null) { Assert.Fail("The 'Delete element' dialog did not appear!"); } nextButton.Click(); _driver.Navigate().Refresh(); var newGridButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'New Grid')]")); if (newGridButton == null) { Assert.Fail("Could not load the 'New Grid' button in under 5 seconds!"); } gridEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'seleniumTestGridNameEDITED')]")); if (gridEntry != null) { Assert.Fail("Could not delete a Grid!"); } Console.WriteLine("Grid deleted successfully!"); Assert.Pass("Grid deleted successfully!"); }
public void GridsEditTest() { var gridEntry = _driver.FindElement(By.XPath("//div[contains(text(), 'seleniumTestGridName')]")); var dataSid = int.Parse(gridEntry.GetAttribute("data-sid").Replace("element", "")); var gridEditButton = _driver.FindElement(By.XPath($"//a[@data-sid='editButton{dataSid}']")); gridEditButton.Click(); var gridNameInput = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='modalAppName']")); if (gridNameInput == null) { Assert.Fail("Could not load the 'Grid Name' input in under 5 seconds!"); } gridNameInput.SendKeys("EDITED"); var gridDescriptionTextArea = _driver.FindElement(By.XPath("//textarea[@id='modalAppDescription']")); gridDescriptionTextArea.SendKeys("EDITED"); var textFieldNameInput = Helpers.Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='fieldName-0']")); if (textFieldNameInput == null) { Assert.Fail("Could not load the Field 'Name' in under 5 seconds!"); } textFieldNameInput.SendKeys("EDITED"); var numberFieldNameInput = Helpers.Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='fieldName-1']")); if (textFieldNameInput == null) { Assert.Fail("Could not load the Field 'Name' in under 5 seconds!"); } numberFieldNameInput.SendKeys("EDITED"); var createButton = _driver.FindElement(By.XPath("//button[contains(text(), 'Update')]")); createButton.Click(); var editedGridEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'seleniumTestGridNameEDITED')]")); if (gridEntry == null) { Assert.Fail("Could not edit (or display on the list) a Grid!"); } //TODO check if column names are also edited within View. Console.WriteLine("Grid edited successfully!"); Assert.Pass("Grid edited successfully!"); }
public void ApplicationEditTest() { _avatarButton.Click(); var applicationsButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//div/a[contains(text(),'Application')]/..")); if (applicationsButton == null) { Assert.Fail("Could not load the 'Applications' button in under 5 seconds!"); } applicationsButton.Click(); var newApplicationButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create New Application')]")); if (newApplicationButton == null) { Assert.Fail("Could not load the 'Create New Application' button in under 5 seconds!"); } Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Selenium Test Name')]/button[contains(text(), 'Edit')]")).Click(); var newApplicationNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@data-sid = 'applicationNameInput']")); if (newApplicationNameInput == null) { Assert.Fail("Could not load the 'Name' input in under 5 seconds!"); } newApplicationNameInput.SendKeys(" EDITED"); var functionalityToDragAndDrop = _driver.FindElement(By.XPath("//span[contains(text(),' Selenium App Test Template ')]")); var whereToDrop = _driver.FindElement(By.XPath("//div[@class='col']/kendo-textbox-container/../kendo-treeview")); Actions actions = new Actions(_driver); actions.DragAndDrop(functionalityToDragAndDrop, whereToDrop).Build().Perform(); _driver.FindElement(By.XPath("//button[contains(text(),'Update')]")).Click(); newApplicationButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'Create New Application')]")); if (newApplicationButton == null) { Assert.Fail("Could not load the 'Create New Application' button in under 5 seconds!"); } var applicationEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//li[contains(text(), 'Selenium Test Name EDITED')]")); if (applicationEntry == null) { Assert.Fail("Could not edit (or display on the list) an Application!"); } _driver.Navigate().Refresh(); var dropdownRoot = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//a[contains(text(),' SeleniumTestDataTypeGrid ')]")); actions = new Actions(_driver); actions.MoveToElement(dropdownRoot).Build().Perform(); var textTemplateFromDropdown = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//a[contains(text(),'Selenium App Test Template')]")); textTemplateFromDropdown.Click(); var paragraph = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//p[text()='Selenium Content']")); if (paragraph == null) { Assert.Fail("Could not load the content of the Text Template in under 5 seconds (or the content is incorrect)!"); } _driver.Navigate().Back(); }
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(); 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.CssSelector("div[contenteditable = 'true']")); textArea.Click(); textArea.SendKeys("\nSelenium Test Content Edited"); _driver.SwitchTo().DefaultContent(); _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!"); }
public void GridsCreateTest() { var newGridButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'New Grid')]")); if (newGridButton == null) { Assert.Fail("Could not load the 'New Grid' button in under 5 seconds!"); } newGridButton.Click(); var gridNameInput = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='modalAppName']")); if (gridNameInput == null) { Assert.Fail("Could not load the 'Grid Name' input in under 5 seconds!"); } gridNameInput.SendKeys("seleniumTestGridName"); var gridDescriptionTextArea = _driver.FindElement(By.XPath("//textarea[@id='modalAppDescription']")); gridDescriptionTextArea.SendKeys("seleniumTestGridDescription"); var newFieldButton = _driver.FindElement(By.XPath("//button[contains(text(), 'New Field')]")); newFieldButton.Click(); var textFieldNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='fieldName-0']")); if (textFieldNameInput == null) { Assert.Fail("Could not load the Field 'Name' in under 5 seconds!"); } textFieldNameInput.SendKeys("seleniumTestTextField"); newFieldButton.Click(); var numberFieldNameInput = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@id='fieldName-1']")); if (textFieldNameInput == null) { Assert.Fail("Could not load the Field 'Name' in under 5 seconds!"); } numberFieldNameInput.SendKeys("seleniumTestNumberField"); var numberFieldDataTypeSelect = _driver.FindElement(By.XPath("//select[@id='fieldDataType-1']")); numberFieldDataTypeSelect.Click(); var numericOption = Helpers.Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//select[@id='fieldDataType-1']/option[contains(text(), 'Numeric')]")); if (numericOption == null) { Assert.Fail("Could not load the Field DataType options in under 5 seconds!"); } numericOption.Click(); var createButton = _driver.FindElement(By.XPath("//button[contains(text(), 'Create')]")); createButton.Click(); var gridEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'seleniumTestGridName')]")); if (gridEntry == null) { Assert.Fail("Could not create (or display on the list) a Grid!"); } Console.WriteLine("Grid created successfully!"); Assert.Pass("Grid created successfully!"); }
public void OtSetup() { ChromeOptions options = new ChromeOptions(); options.AddArgument("--disable-notifications"); //If you want to run the tests without opening the browser, uncomment this //If you want to run the tests with a browser gui, comment this options.AddArgument("headless"); _driver = new ChromeDriver(options); _avatarButton = Helpers.LogIn.LogInWithLocalAdminSecret(_driver); if (_avatarButton == null) { _stopTests = true; Assume.That(_stopTests, Is.False, "Stopped testing because login has failed!"); return; } _avatarButton.Click(); var designButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Design']")); if (designButton == null) { Assert.Fail("Could not load the 'Design' button in under 5 seconds!"); } designButton.Click(); var gridsButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.CssSelector("kendo-panelbar-item[ng-reflect-title = 'Grids']")); if (gridsButton == null) { Assert.Fail("Could not load the 'Grids' button in under 5 seconds!"); } gridsButton.Click(); var newGridButton = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//button[contains(text(), 'New Grid')]")); if (newGridButton == null) { Assert.Fail("Could not load the 'New Grid' button in under 5 seconds!"); } var gridEntry = Waits.WaitUntilElementLoads(_driver, TimeSpan.FromSeconds(5), By.XPath("//div[contains(text(), 'SeleniumTestDataTypeGrid')]")); if (gridEntry == null) { _gridFound = false; Assert.Fail("Could not find the 'SeleniumTestDataTypeGrid' grid in under 5 seconds!"); } _gridFound = true; var dataSid = int.Parse(gridEntry.GetAttribute("data-sid").Replace("element", "")); var gridViewButton = _driver.FindElement(By.XPath($"//a[@data-sid='viewButton{dataSid}']")); gridViewButton.Click(); var gridViewRadioButton = Waits.WaitUntilElementVisible(_driver, TimeSpan.FromSeconds(5), By.XPath("//input[@type='radio']")); if (gridViewRadioButton == null) { Assert.Fail("Could not load the 'SeleniumTestDataTypeGrid DefaultView' radio button in under 5 seconds!"); } gridViewRadioButton.Click(); var gridViewSelectButton = _driver.FindElement(By.XPath("//button[text()='Select']")); gridViewSelectButton.Click(); _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!"); } }