コード例 #1
0
        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!");
            }
        }
コード例 #2
0
        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!");
        }
コード例 #3
0
        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!");
        }
コード例 #4
0
        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!");
            }
        }
コード例 #5
0
        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!");
        }
コード例 #6
0
        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!");
        }
コード例 #7
0
        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!");
            }
        }
コード例 #8
0
        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();
        }