Skip to content

Commit

Permalink
feat: add scroll to bottom on ebsr
Browse files Browse the repository at this point in the history
  • Loading branch information
sr4850 authored and 1dson committed Jan 10, 2025
1 parent 7b11353 commit 471dccf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,12 @@ public static String getSelectedTextFromDropDown(@NotNull String selector, @NotN
return option.getFirstSelectedOption().getText();
}

public static void scrollToBottom() {
JavascriptExecutor js = (JavascriptExecutor) getDriver();
js.executeScript("window.scrollTo(0, document.body.scrollHeight)");
public void scrollToBottom() {
WebElement footer = getDriver().findElement(By.tagName("govuk-footer"));
int deltaY = footer.getRect().y;
new Actions(getDriver())
.scrollByAmount(0, deltaY)
.perform();
}

public boolean pageContains(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void documentsAreGenerated() throws IllegalBrowserException, IOException

} while ((long) findElements("//*[@class='field file-upload']", SelectorType.XPATH).size() < 2 && System.currentTimeMillis() < kickOutTime);
try {
scrollToBottom();
assertTrue(findElements("//*[@class='field file-upload']", SelectorType.XPATH).stream().anyMatch(
webElement -> webElement.getText().contains("Route Track Map PDF (Auto Scale)")));
} catch (Exception e) {
Expand Down

0 comments on commit 471dccf

Please sign in to comment.