コード例 #1
0
ファイル: PageBarTests.cs プロジェクト: alekparol/WebScraper
        public void FirstPage()
        {
            /* Test initialization */

            IWebDriver driver = new ChromeDriver();

            driver.Navigate().GoToUrl("https://www.olx.pl/warszawa/q-lodowka/");

            List <IWebElement> pageChangeBar = new List <IWebElement>(driver.FindElements(By.XPath("//*[@id=\"body-container\"]/div[3]/div/div[8]")));
            PageBar            pageBar       = new PageBar(driver);

            /* Testing */

            pageBar = pageBar.GoToNextPage(driver);

            Assert.That(pageBar.PageList.FirstPageNumber, Is.EqualTo(1));
            pageBar = pageBar.GoToFirstPage(driver);

            Assert.That(driver.Url, Is.EqualTo("https://www.olx.pl/warszawa/q-lodowka/"));

            Assert.That(pageBar.PageList.NumberOfPages, Is.EqualTo(14));
            Assert.That(pageBar.PageList.FirstPageNumber, Is.EqualTo(1));

            Assert.That(pageBar.NextPrev.IsNext(), Is.True);
            Assert.That(pageBar.NextPrev.IsPrevious(), Is.False);

            /* Teard down */

            driver.Quit();
        }
コード例 #2
0
        public void PageBar_GoToPreviousPage_Test_4()
        {
            using (var driver = new ChromeDriver())
            {
                /* Initialization */
                var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));

                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl("https://tms.lionbridge.com/");

                string       projectTitle = "Qlik";
                ProjectsPage testPage     = new ProjectsPage(driver, projectTitle);

                testPage.ClickChosenProject();
                ParticularProjectPage testProjectPage = new ParticularProjectPage(driver);

                testProjectPage.ProfileClick(driver);
                testProjectPage.ChangeItemsPerPageMin(driver);

                testProjectPage.StatusClick(driver);
                StatusPage testStatusPage = new StatusPage(driver);

                PageBar testPageBar = new PageBar(driver);
                testPageBar.GoToLastPage(driver);

                testPageBar = new PageBar(driver);
                /* Set of assertions */

                Assert.AreEqual(testPageBar.GetLastPageNumber, testPageBar.GetCurrentPageNumber);
                Assert.AreEqual(0, testPageBar.PreviousPageIsNull);
                Assert.AreEqual(1, testPageBar.NextPageIsNull);

                testPageBar.GoToFirstPage(driver);
                testPageBar = new PageBar(driver);

                Assert.AreEqual(0, testPageBar.CurrentPageIsNull);
                Assert.AreEqual(1, testPageBar.CurrentPageIsFirst);
                Assert.AreEqual(0, testPageBar.CurrentPageIsLast);

                Assert.AreEqual(1, testPageBar.GetCurrentPageNumber);
                Assert.AreEqual(1, testPageBar.PreviousPageIsNull);
                Assert.AreEqual(0, testPageBar.NextPageIsNull);

                testPageBar.GoToPreviousPage(driver);
                testPageBar = new PageBar(driver);

                Assert.AreEqual(0, testPageBar.CurrentPageIsNull);
                Assert.AreEqual(1, testPageBar.CurrentPageIsFirst);
                Assert.AreEqual(0, testPageBar.CurrentPageIsLast);

                Assert.AreEqual(1, testPageBar.GetCurrentPageNumber);
                Assert.AreEqual(1, testPageBar.PreviousPageIsNull);
                Assert.AreEqual(0, testPageBar.NextPageIsNull);
            }
        }
コード例 #3
0
        public void PageBar_GoToFirstPage_Test_3()
        {
            using (var driver = new ChromeDriver())
            {
                /* Initialization */
                var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60));

                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl("https://lionbridge.com/");

                PageBar testPageBar = new PageBar(driver);
                testPageBar.GoToFirstPage(driver);
                /* Set of assertions */

                Assert.AreEqual(-1, testPageBar.CurrentPageIsNull);
                Assert.AreEqual(-1, testPageBar.CurrentPageIsFirst);
                Assert.AreEqual(-1, testPageBar.CurrentPageIsLast);

                Assert.AreEqual(-1, testPageBar.GetCurrentPageNumber);
                Assert.AreEqual(-1, testPageBar.PreviousPageIsNull);
                Assert.AreEqual(-1, testPageBar.NextPageIsNull);
            }
        }