Skip to content

Commit

Permalink
additional conditional wait for javascript to run and set the title
Browse files Browse the repository at this point in the history
  • Loading branch information
mstevetodd committed May 1, 2020
1 parent b802715 commit 0218202
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ public WebServerAcceptanceSteps(jmri.InstanceManager instance) {
assertThat(webDriver.getTitle()).isEqualTo(pageTitle);
});

Then("^either (.*) or (.*) is returned as the title$", (String pageTitle, String formatedPageTitle) -> {
waitLoad();
assertThat(webDriver.getTitle()).isIn(newLinkedHashSet(pageTitle, formatedPageTitle));
Then("^either (.*) or (.*) is returned as the title$", (String pageTitle, String formattedPageTitle) -> {
waitLoad(); //wait for page to load
//additional conditional wait for javascript to run and set the title
WebDriverWait wait = new WebDriverWait(webDriver, 15);
wait.until(ExpectedConditions.or(
ExpectedConditions.titleIs(pageTitle), ExpectedConditions.titleIs(formattedPageTitle)));
assertThat(webDriver.getTitle()).isIn(newLinkedHashSet(pageTitle, formattedPageTitle));
});


Expand Down

0 comments on commit 0218202

Please sign in to comment.