Skip to content

Commit

Permalink
test: Make test more stable (#14578)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur- authored Sep 20, 2022
1 parent fdd98d5 commit 30f1492
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;

Expand Down Expand Up @@ -45,9 +46,18 @@ protected WebElement getServerCounterStartButton() {
}

public static int getServerCounter(TestBenchTestCase t) {
WebElement serverCounterElem = t
.findElement(By.id(ClientServerCounterUI.SERVER_COUNTER_ID));
return Integer.parseInt(serverCounterElem.getText());
WebDriverException lastException = null;
for (int i = 0; i < 10; i++) {
try {
WebElement serverCounterElem = t.findElement(
By.id(ClientServerCounterUI.SERVER_COUNTER_ID));
return Integer.parseInt(serverCounterElem.getText());
} catch (WebDriverException e) {
lastException = e;
}
}

throw lastException;
}

public static WebElement getServerCounterStartButton(TestBenchTestCase t) {
Expand Down

0 comments on commit 30f1492

Please sign in to comment.