Skip to content

Commit

Permalink
Merge pull request keycloak#4860 from pdrozd/KEYCLOAK-6047
Browse files Browse the repository at this point in the history
KEYCLOAK-6047 Added ide time window to mellon test
  • Loading branch information
pdrozd authored Dec 15, 2017
2 parents 6bfdc94 + a7c6eb4 commit 4097a81
Showing 1 changed file with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.AbstractAuthTest;
import org.keycloak.testsuite.util.URLAssert;
import org.keycloak.models.utils.SessionTimeoutHelper;

import java.util.List;

Expand Down Expand Up @@ -42,24 +43,29 @@ public void setDefaultPageUriParameters() {

@Test
public void singleLoginAndLogoutTest() {
modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
assertTrue(driver.getPageSource().contains("Protected resource"));
try {
modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
assertTrue(driver.getPageSource().contains("Protected resource"));

modAuthMellonProtectedResourcePage2.navigateTo();
assertTrue(driver.getPageSource().contains("Protected resource 2"));
modAuthMellonProtectedResourcePage2.navigateTo();
assertTrue(driver.getPageSource().contains("Protected resource 2"));

modAuthMellonProtectedResourcePage2.logout();
assertTrue(driver.getPageSource().contains("Unprotected resource 2"));
modAuthMellonProtectedResourcePage2.logout();
assertTrue(driver.getPageSource().contains("Unprotected resource 2"));

modAuthMellonProtectedResourcePage2.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
modAuthMellonProtectedResourcePage2.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);

pause(5000); //session length
setTimeOffset(SessionTimeoutHelper.IDLE_TIMEOUT_WINDOW_SECONDS * 1000);
pause(5000); //session length

modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
} finally {
resetTimeOffset();
}
}

@Test
Expand All @@ -76,13 +82,17 @@ public void unauthorizedSSO() {

@Test
public void sessionExpiration() {
modAuthMellonProtectedResourcePage.navigateTo();
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
assertTrue(driver.getPageSource().contains("Protected resource"));

pause(5000); //session length

modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
try {
modAuthMellonProtectedResourcePage.navigateTo();
testRealmSAMLRedirectLoginPage.form().login(bburkeUser);
assertTrue(driver.getPageSource().contains("Protected resource"));
setTimeOffset(SessionTimeoutHelper.IDLE_TIMEOUT_WINDOW_SECONDS * 1000);
pause(5000); //session length

modAuthMellonProtectedResourcePage.navigateTo();
URLAssert.assertCurrentUrlStartsWith(testRealmSAMLRedirectLoginPage);
} finally {
resetTimeOffset();
}
}
}

0 comments on commit 4097a81

Please sign in to comment.