From c34aa5763df3a8ad1eaa7055c008a8a86f043dfe Mon Sep 17 00:00:00 2001 From: Vaclav Muzikar Date: Tue, 16 Feb 2016 13:33:30 +0100 Subject: [PATCH] Fix TokensTest (cherry picked from commit 32e6bb0) --- .../testsuite/console/realm/TokensTest.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/TokensTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/TokensTest.java index 975a6199a6..9121d92cdc 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/TokensTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/TokensTest.java @@ -36,8 +36,8 @@ public class TokensTest extends AbstractRealmTest { @Page private TokenSettings tokenSettingsPage; - private static final int TIMEOUT = 4; - private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS; + private static final int TIMEOUT = 1; + private static final TimeUnit TIME_UNIT = TimeUnit.MINUTES; @Before public void beforeTokensTest() { @@ -52,7 +52,7 @@ public class TokensTest extends AbstractRealmTest { tokenSettingsPage.form().save(); loginToTestRealmConsoleAs(testUser); - TIME_UNIT.sleep(TIMEOUT + 2); + waitForTimeout(TIMEOUT + 2); driver.navigate().refresh(); @@ -66,16 +66,22 @@ public class TokensTest extends AbstractRealmTest { tokenSettingsPage.form().save(); loginToTestRealmConsoleAs(testUser); - TIME_UNIT.sleep(TIMEOUT / 2); + waitForTimeout(TIMEOUT / 2); driver.navigate().refresh(); assertCurrentUrlStartsWith(testRealmAdminConsolePage); // assert still logged in (within lifespan) - TIME_UNIT.sleep(TIMEOUT / 2 + 2); + waitForTimeout(TIMEOUT / 2 + 2); driver.navigate().refresh(); log.debug(driver.getCurrentUrl()); assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); // assert logged out (lifespan exceeded) } + private void waitForTimeout (int timeout) throws InterruptedException { + log.info("Wait for timeout: " + timeout + " " + TIME_UNIT); + TIME_UNIT.sleep(timeout); + log.info("Timeout reached"); + } + }