Merge pull request #2962 from stianst/master

Add retry to testPostEncryptedLoginLogout
This commit is contained in:
Stian Thorgersen 2016-06-23 15:48:43 +02:00 committed by GitHub
commit ce17999d26
2 changed files with 13 additions and 3 deletions

View file

@ -22,7 +22,7 @@ package org.keycloak.testsuite;
*/
public class Retry {
public static void execute(Runnable runnable, int retry, long interval) throws InterruptedException {
public static void execute(Runnable runnable, int retry, long interval) {
while (true) {
try {
runnable.run();
@ -30,7 +30,11 @@ public class Retry {
} catch (RuntimeException e) {
retry--;
if (retry > 0) {
try {
Thread.sleep(interval);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
} else {
throw e;
}

View file

@ -44,6 +44,7 @@ import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
import org.keycloak.saml.processing.core.saml.v2.constants.X500SAMLProfileConstants;
import org.keycloak.services.managers.RealmManager;
import org.keycloak.testsuite.KeycloakServer;
import org.keycloak.testsuite.Retry;
import org.keycloak.testsuite.pages.LoginPage;
import org.keycloak.testsuite.rule.AbstractKeycloakRule;
import org.keycloak.testsuite.rule.ErrorServlet;
@ -503,7 +504,12 @@ public class SamlAdapterTestStrategy extends ExternalResource {
driver.navigate().to(APP_SERVER_BASE_URL + "/sales-post-enc/");
assertAtLoginPagePostBinding();
loginPage.login("bburke", "password");
Retry.execute(new Runnable() {
@Override
public void run() {
assertEquals(driver.getCurrentUrl(), APP_SERVER_BASE_URL + "/sales-post-enc/");
}
}, 10, 100);
Assert.assertTrue(driver.getPageSource().contains("bburke"));
driver.navigate().to(APP_SERVER_BASE_URL + "/sales-post-enc?GLO=true");
checkLoggedOut(APP_SERVER_BASE_URL + "/sales-post-enc/", true);