Example #1
0
        public void newClientRatesAFilm()
        {
            //create new user that will rate a film
            driver.Navigate().GoToUrl("http://*****:*****@test.com", "Test1!", "Test1!");
            wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5));
            wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**")));

            driver.FindElement(By.LinkText("MOVIES")).Click();
            filmsPage = new FilmsPage(driver);
            filmsPage.clickOnMovieToAccessDetailsFromPosition(1);
            detailsPage = new DetailsPage(driver);
            float oldRating = detailsPage.getRating();

            detailsPage.rateFilm(10);
            Thread.Sleep(2000);
            Assert.AreEqual(detailsPage.getDoneMessage(), "Thank you for rating this movie!");
            detailsPage.rateFilm(6);
            Thread.Sleep(2000);
            Assert.AreEqual(detailsPage.getDoneMessage(), "You have already rated this movie!");
            float newRating = detailsPage.getRating();

            Assert.AreNotEqual(oldRating, newRating);
            detailsPage.clickLogOut();

            //admin deletes the new user
            string loginURL = "http://*****:*****@yahoo.com", "Admin2*");
            wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**")));
            driver.FindElement(By.LinkText("CLIENTS")).Click();
            clientsPage = new ClientsPage(driver);
            wait.Until(wt => wt.FindElement(By.Id("clientsTable")));
            int numberRows = clientsPage.countRows();

            clientsPage.deleteUserWithEmail("*****@*****.**");
            Thread.Sleep(1500);
            IAlert alert = driver.SwitchTo().Alert();

            alert.Accept();
            Thread.Sleep(1500);
            int newNumberRows = clientsPage.countRows();

            Assert.AreEqual(numberRows - 1, newNumberRows);
        }
Example #2
0
        public void getDetailsForFifthFilm()
        {
            string url = "http://*****:*****@yahoo.com", "User1*");
            wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**")));

            driver.FindElement(By.LinkText("MOVIES")).Click();
            FilmsPage filmsPage = new FilmsPage(driver);

            filmsPage.clickOnMovieToAccessDetailsFromPosition(5);
            detailsPage = new DetailsPage(driver);
            detailsPage.waitForName();
            string title = detailsPage.getName();

            Assert.AreEqual("Incredibles 2", title);
        }