Skip to content

Commit

Permalink
stabilize flaky Selenium test
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Nov 15, 2023
1 parent 72b50b0 commit 36e0afb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/uitest/selenium_page_objects/HangmanPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;

import static java.time.Duration.ofSeconds;
import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable;
import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOfElementLocated;

public class HangmanPage {
Expand Down Expand Up @@ -45,11 +46,16 @@ public HangmanPage(WebDriver driver) {
}

public void guessLetter(char letter) {
new FluentWait<>(driver).until(elementToBeClickable(letterSelector(letter)));
letter(letter).click();
}

public WebElement letter(char letter) {
return driver.findElement(By.xpath("//*[@letter='" + letter + "']"));
return driver.findElement(letterSelector(letter));
}

private By letterSelector(char letter) {
return By.xpath("//*[@letter='" + letter + "']");
}

public HangmanPage selectLanguage(String language, String expectedTopicLabel) {
Expand Down

0 comments on commit 36e0afb

Please sign in to comment.