From ea2c1d3bc95d9ad2834cbcc857ed4b936a660100 Mon Sep 17 00:00:00 2001 From: Duane May Date: Thu, 30 Jan 2025 17:51:16 -0500 Subject: [PATCH] Refactor and extend timeout durations --- .../uaa/integration/pageObjects/Page.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/Page.java b/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/Page.java index 04fba53b2ad..ee2b0c07a7c 100644 --- a/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/Page.java +++ b/uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/pageObjects/Page.java @@ -16,15 +16,24 @@ * as well as performing common page actions like logging out and clearing cookies. */ public class Page { + + // This is the global setting that selenium waits during operations. + // It should be small, as changing this value will increase the time tests take to run. + protected static final Duration IMPLICIT_WAIT_SECONDS = Duration.ofSeconds(5); + + // This is used to control the max time that awaitility will check to see if + // an assertion passes, before failing the test. + protected static final Duration AWAIT_AT_MOST_SECONDS = Duration.ofSeconds(30); + protected WebDriver driver; public Page(WebDriver driver) { this.driver = driver; - driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5)); + driver.manage().timeouts().implicitlyWait(IMPLICIT_WAIT_SECONDS); } public static AbstractStringAssert assertThatUrlEventuallySatisfies(WebDriver driver, Consumer> assertUrl) { - await().atMost(Duration.ofSeconds(5)) + await().atMost(AWAIT_AT_MOST_SECONDS) .untilAsserted(() -> assertUrl.accept(assertThatUrl(driver))); return assertThatUrl(driver); } @@ -34,7 +43,7 @@ private static AbstractStringAssert assertThatUrl(WebDriver driver) { } public AbstractStringAssert assertThatUrlEventuallySatisfies(Consumer> assertUrl) { - await().atMost(Duration.ofSeconds(5)) + await().atMost(AWAIT_AT_MOST_SECONDS) .untilAsserted(() -> assertUrl.accept(assertThatUrl(driver))); return assertThatUrl(); }