public void successfulRegisterAndDeleteTest() { page.register("*****@*****.**", "Test1!", "Test1!"); page.logout(); driver.FindElement(By.LinkText("Login")).Click(); loginPage = new LoginPage(driver); wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5)); //Navigate to the Login page and login as admin loginPage.login("*****@*****.**", "Admin1*"); wait.Until(wt => wt.FindElement(By.LinkText("*****@*****.**"))); driver.FindElement(By.LinkText("CLIENTS")).Click(); ClientsPage clientsPage = new ClientsPage(driver); wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5)); wait.Until(wt => wt.FindElement(By.Id("clientsTable"))); int numberRows = clientsPage.countRows(); clientsPage.deleteUserWithEmail("*****@*****.**"); IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); Thread.Sleep(1000); int newNumberRows = clientsPage.countRows(); Assert.AreEqual(numberRows - 1, newNumberRows); }
public void deleteCreatedUser() { wait.Until(wt => wt.FindElement(By.Id("clientsTable"))); int numberRows = page.countRows(); page.deleteUserWithEmail("*****@*****.**"); IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); Thread.Sleep(1000); int newNumberRows = page.countRows(); Assert.AreEqual(numberRows - 1, newNumberRows); }
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); }