Fix TokensTest
(cherry picked from commit 32e6bb0)
This commit is contained in:
parent
02851989b3
commit
c34aa5763d
1 changed files with 11 additions and 5 deletions
|
@ -36,8 +36,8 @@ public class TokensTest extends AbstractRealmTest {
|
||||||
@Page
|
@Page
|
||||||
private TokenSettings tokenSettingsPage;
|
private TokenSettings tokenSettingsPage;
|
||||||
|
|
||||||
private static final int TIMEOUT = 4;
|
private static final int TIMEOUT = 1;
|
||||||
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
|
private static final TimeUnit TIME_UNIT = TimeUnit.MINUTES;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void beforeTokensTest() {
|
public void beforeTokensTest() {
|
||||||
|
@ -52,7 +52,7 @@ public class TokensTest extends AbstractRealmTest {
|
||||||
tokenSettingsPage.form().save();
|
tokenSettingsPage.form().save();
|
||||||
|
|
||||||
loginToTestRealmConsoleAs(testUser);
|
loginToTestRealmConsoleAs(testUser);
|
||||||
TIME_UNIT.sleep(TIMEOUT + 2);
|
waitForTimeout(TIMEOUT + 2);
|
||||||
|
|
||||||
driver.navigate().refresh();
|
driver.navigate().refresh();
|
||||||
|
|
||||||
|
@ -66,16 +66,22 @@ public class TokensTest extends AbstractRealmTest {
|
||||||
tokenSettingsPage.form().save();
|
tokenSettingsPage.form().save();
|
||||||
|
|
||||||
loginToTestRealmConsoleAs(testUser);
|
loginToTestRealmConsoleAs(testUser);
|
||||||
TIME_UNIT.sleep(TIMEOUT / 2);
|
waitForTimeout(TIMEOUT / 2);
|
||||||
|
|
||||||
driver.navigate().refresh();
|
driver.navigate().refresh();
|
||||||
assertCurrentUrlStartsWith(testRealmAdminConsolePage); // assert still logged in (within lifespan)
|
assertCurrentUrlStartsWith(testRealmAdminConsolePage); // assert still logged in (within lifespan)
|
||||||
|
|
||||||
TIME_UNIT.sleep(TIMEOUT / 2 + 2);
|
waitForTimeout(TIMEOUT / 2 + 2);
|
||||||
driver.navigate().refresh();
|
driver.navigate().refresh();
|
||||||
|
|
||||||
log.debug(driver.getCurrentUrl());
|
log.debug(driver.getCurrentUrl());
|
||||||
assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); // assert logged out (lifespan exceeded)
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue