Skip to content

Commit

Permalink
wait until text visible
Browse files Browse the repository at this point in the history
  • Loading branch information
VladPiatachenko committed Oct 18, 2024
1 parent 832be3c commit 55643d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/java/com/fluffy/universe/e2e/Profilee2eTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.io.File;
import java.io.IOException;
import java.time.Duration;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
Expand Down Expand Up @@ -69,7 +72,9 @@ void SuccessfulViewProfileTest(){
assertEquals(driver.findElement(By.xpath("/html/body/main/div/form/div[1]/h1")).getText(),"Account");
assertNotEquals(driver.findElement(By.id("account__first-name")).getAttribute("value"),"");
assertNotEquals(driver.findElement(By.id("account__last-name")).getAttribute("value"),"");
System.out.println("~~~~~~~~~~~~url!~~~~~~~~~~~");
System.out.println(driver.getCurrentUrl());
System.out.println("~~~~~~~~~~~~email!~~~~~~~~~~~");
System.out.println(driver.findElement(By.id("account__email")).getAttribute("value"));
assertNotEquals(driver.findElement(By.id("account__email")).getAttribute("value"),"");//negative test on account_address
driver.close();
Expand Down Expand Up @@ -99,6 +104,9 @@ void SuccessfulEditProfileTest() throws IOException {
driver.findElement(By.id("account__address")).sendKeys("E-605");
driver.findElement(By.id("account__website")).sendKeys("https://example.com");
driver.findElement(By.xpath("/html/body/main/div/form/div[8]/button")).click();
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html/body/div[2]/div/div[1]/h2")));
System.out.println("~~~~~~~~~~~~alert!~~~~~~~~~~~");
System.out.println(driver.findElement(By.xpath("/html/body/div[2]/div/div[1]/h2")).getText());
assertEquals(driver.findElement(By.xpath("/html/body/div[2]/div/div[1]/h2")).getText(),"Congratulations!");
assertEquals(driver.findElement(By.xpath("/html/body/div[2]/div/div[2]")).getText(),"User account data updated successfully.");
Expand Down

0 comments on commit 55643d4

Please sign in to comment.