Exemplo n.º 1
0
        public void ClickOverlayedButton()
        {
            // Arrange
            string path = AppContext.BaseDirectory;
            string pathToTestTheFile = Path.GetFullPath(Path.Combine(path, "../../../../../src-for-testing/OverlayTest.html"));

            webDriver.Navigate().GoToUrl(pathToTestTheFile);

            // Act
            webDriver.FindElement(By.Id("open-overlay")).Click();

            string script1 = "document.getElementById('test-button').click()";
            IJavaScriptExecutor javaScriptExecutor = (IJavaScriptExecutor)webDriver;

            javaScriptExecutor.ExecuteScript(script1);
            DemoHelper.Pause();

            javaScriptExecutor.ExecuteScript(script1);
            DemoHelper.Pause();

            javaScriptExecutor.ExecuteScript(script1);
            DemoHelper.Pause();

            // Assert
            webDriver.FindElement(By.Id("pText")).Text.Should().Be("You can find the original code here https://jsfiddle.net/agib/jratazn7/. AAA AAA AAA");

            string script2       = "return document.getElementById('pText').innerHTML;";
            string paragraphText = (string)javaScriptExecutor.ExecuteScript(script2);

            paragraphText.Should().Be("You can find the original code here https://jsfiddle.net/agib/jratazn7/. AAA  AAA  AAA ");
        }
Exemplo n.º 2
0
        public void LoginAsAUser(string userEmail, int dropdownMenuItemsCount, params string[] dropdownMenuItemsText)
        {
            // Arrange
            var loginPage = new LoginPage(webDriver);

            loginPage.NavigateTo();

            // Act
            loginPage.EnterEmail(userEmail);
            loginPage.EnterPassword(ValidPassword);
            var homePage = loginPage.SubmitLoginForm();

            // Assert
            homePage.DisplayDropdownMenuItems();
            homePage.GetIdentityName().Should().Be(userEmail);
            DemoHelper.Pause();

            var dropdownMenuItemTexts = homePage.DropdownMenuItemTexts;

            dropdownMenuItemTexts.Should().HaveCount(dropdownMenuItemsCount);
            foreach (var dropdownMenuItemText in dropdownMenuItemTexts)
            {
                dropdownMenuItemsText.Should().Contain(dropdownMenuItemText);
            }
        }
Exemplo n.º 3
0
        public void CheckStrictlyNeccessaryCookiesTab()
        {
            LoginPage loginPage = new LoginPage(driver);

            loginPage.NavigateToLoginPage();
            loginPage.LoadComplete(10);
            loginPage.OpenCookiePanel();
            CookieSettingsPanel cookie_settings = new CookieSettingsPanel(driver);

            DemoHelper.Pause();
            cookie_settings.AccessStrictlyNecessaryCokkies();
            Assert.IsTrue(cookie_settings.GetCookiePresentationTitle(StrictlyNeccessaryCookiTitle));
        }
Exemplo n.º 4
0
        public void CookiesManipulationTest()
        {
            // Assert
            webDriver.FindElement(By.Id("js-gdpr-consent-banner")).Text.Should().Be("By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.");
            webDriver.Manage().Cookies.AllCookies.Should().HaveCount(5);
            DemoHelper.Pause(2);

            webDriver.FindElement(By.CssSelector("body.home-page.unified-theme:nth-child(2) div.p8.ff-sans.ps-fixed.b0.l0.r0.z-banner:nth-child(4) div.wmx8.mx-auto.grid.grid__center div.grid--cell:nth-child(2) > a.s-btn.s-btn__muted.s-btn__icon.js-notice-close")).Click();
            webDriver.Manage().Cookies.AllCookies.Should().HaveCount(6);
            DemoHelper.Pause(2);

            webDriver.Manage().Cookies.DeleteAllCookies();
            webDriver.Manage().Cookies.AllCookies.Should().HaveCount(0);
        }
Exemplo n.º 5
0
        public void ToggleOnAndAcceptFunctionalCookies()
        {
            LoginPage loginPage = new LoginPage(driver);

            loginPage.NavigateToLoginPage();
            loginPage.LoadComplete(10);
            loginPage.OpenCookiePanel();
            CookieSettingsPanel cookie_settings = new CookieSettingsPanel(driver);

            cookie_settings.AccessFunctionalCookies();
            Assert.AreEqual("true", cookie_settings.ToggleOnFunctionalCookies());
            cookie_settings.SaveCookieOption();
            DemoHelper.Pause();
            Assert.IsFalse(loginPage.CheckCookieSettingsBtnIsDisplayed());
        }
Exemplo n.º 6
0
        public void NavigateToTheNextPageThenPreviousInTheCatalog_AddedQueryParameterWithPageIdZero()
        {
            // Act
            IWebElement nextLink = webDriver.FindElement(By.Name("Next"));

            nextLink.Click();

            IWebElement previousLink = webDriver.FindElement(By.Id("Previous"));

            previousLink.Click();
            DemoHelper.Pause(3);

            webDriver.Url.Should().Be($"{HomeUrl}?pageId=0");
            webDriver.Title.Should().Be(HomeTitle);
        }
            public void GetOverlayedLinkText()
            {
                using (IWebDriver driver = new ChromeDriver())
                {
                    driver.Navigate().GoToUrl("http://localhost:5258/jsoverlay.html");

                    DemoHelper.Pause();

                    string script = "return document.getElementById('HiddenLink').innerHTML;";

                    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                    string linkText        = (string)js.ExecuteScript(script);

                    Assert.Equal("Go to Pluralsight", linkText);
                }
            }
Exemplo n.º 8
0
        public void FilterCookies()
        {
            LoginPage loginPage = new LoginPage(driver);

            loginPage.NavigateToLoginPage();
            loginPage.LoadComplete(10);
            loginPage.OpenCookiePanel();
            CookieSettingsPanel cookie_settings = new CookieSettingsPanel(driver);

            cookie_settings.AccessStrictlyNecessaryCokkies();
            cookie_settings.NavigateToCookieDetailPanel();
            cookie_settings.OpenCookiesFilterPane();
            cookie_settings.ClicktrictlyNecessaryCookiesFilterOption();
            cookie_settings.ClickFunctionalCookiesFilterOption();
            cookie_settings.ApplyCookieFilters();
            cookie_settings.AccessCookieListForEachCategory("First Party Cookies View Cookies");
            Assert.IsTrue(cookie_settings.CheckCorrectCookiesListIsDisplayed(functionalCookies_FirstParty_cookies));
            DemoHelper.Pause(5000);
        }
            public void ClickOverlayedLink()
            {
                using (IWebDriver driver = new ChromeDriver())
                {
                    driver.Navigate().GoToUrl("http://localhost:5258/jsoverlay.html");

                    DemoHelper.Pause();

                    string script          = "document.getElementById('HiddenLink').click();";
                    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                    js.ExecuteScript(script);

                    //driver.FindElement(By.Id("HiddenLink")).Click();

                    DemoHelper.Pause();

                    Assert.Equal("https://www.pluralsight.com/", driver.Url);
                }
            }
        public void DeleteBooking()
        {
            int existingBookings;
            var homePage = new HomePage(_driverFixture.Driver);

            homePage.NavigateTo();
            existingBookings = homePage.GetTotalLatestBookings();
            DemoHelper.Pause(5000);
            homePage.ClickDeleteButon();
            DemoHelper.Pause(6000);
            if (existingBookings == 0)
            {
                TestContext.WriteLine("There were no bookings to Delete");
            }
            else
            {
                Assert.Less(homePage.GetTotalLatestBookings(), existingBookings);
            }
        }
        public void CreateBooking()
        {
            int existingBookings = 0;
            var homePage         = new HomePage(_driverFixture.Driver);

            homePage.NavigateTo();
            existingBookings = homePage.GetTotalLatestBookings();
            DemoHelper.Pause();
            homePage.EnterfristName("Scott");
            DemoHelper.Pause();
            homePage.EnterLastName("Andrew");
            DemoHelper.Pause();
            homePage.EnterPrice("150");
            DemoHelper.Pause();
            homePage.ChooseDeposit(false);
            DemoHelper.Pause();
            homePage.EnterCheckInDate(DateTime.Now);
            DemoHelper.Pause();
            homePage.EnterCheckOutDate(DateTime.Now.AddDays(2));
            DemoHelper.Pause();
            homePage.ClickSave(existingBookings);
            DemoHelper.Pause(10000);
            Assert.AreEqual(homePage.GetTotalLatestBookings() - 1, existingBookings);
        }