diff --git a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/AbstractWebAuthnVirtualTest.java b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/AbstractWebAuthnVirtualTest.java index 85bba644a7..d6faebd1d7 100644 --- a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/AbstractWebAuthnVirtualTest.java +++ b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/AbstractWebAuthnVirtualTest.java @@ -41,7 +41,9 @@ import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.arquillian.annotation.AuthServerContainerExclude; import org.keycloak.testsuite.arquillian.annotation.EnableFeature; import org.keycloak.testsuite.pages.AppPage; +import org.keycloak.testsuite.pages.InfoPage; import org.keycloak.testsuite.pages.LoginPage; +import org.keycloak.testsuite.pages.LogoutConfirmPage; import org.keycloak.testsuite.pages.RegisterPage; import org.keycloak.testsuite.util.WaitUtils; import org.keycloak.testsuite.webauthn.authenticators.DefaultVirtualAuthOptions; @@ -106,6 +108,12 @@ public abstract class AbstractWebAuthnVirtualTest extends AbstractTestRealmKeycl @Page protected AppPage appPage; + @Page + protected LogoutConfirmPage logoutConfirmPage; + + @Page + protected InfoPage infoPage; + protected static final String ALL_ZERO_AAGUID = "00000000-0000-0000-0000-000000000000"; protected static final String ALL_ONE_AAGUID = "11111111-1111-1111-1111-111111111111"; protected static final String USERNAME = "UserWebAuthn"; @@ -383,9 +391,11 @@ public abstract class AbstractWebAuthnVirtualTest extends AbstractTestRealmKeycl protected void logout() { try { waitForPageToLoad(); - appPage.open(); - appPage.assertCurrent(); - appPage.logout(); + String logoutUrl = oauth.getLogoutUrl().build(); + driver.navigate().to(logoutUrl); + logoutConfirmPage.assertCurrent(); + logoutConfirmPage.confirmLogout(); + infoPage.assertCurrent(); waitForPageToLoad(); } catch (Exception e) { throw new RuntimeException("Cannot logout user", e); diff --git a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnIdlessTest.java b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnIdlessTest.java index d1ff71c046..68a76b9be2 100644 --- a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnIdlessTest.java +++ b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnIdlessTest.java @@ -247,8 +247,9 @@ public class WebAuthnIdlessTest extends AbstractWebAuthnVirtualTest { .user(userId) .assertEvent().getSessionId(); events.clear(); - appPage.logout(); + logout(); events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); return credentialId; @@ -302,8 +303,9 @@ public class WebAuthnIdlessTest extends AbstractWebAuthnVirtualTest { .assertEvent().getSessionId(); events.clear(); - appPage.logout(); + logout(); events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); } @@ -331,8 +333,9 @@ public class WebAuthnIdlessTest extends AbstractWebAuthnVirtualTest { .assertEvent().getSessionId(); events.clear(); - appPage.logout(); + logout(); events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); } @@ -363,8 +366,9 @@ public class WebAuthnIdlessTest extends AbstractWebAuthnVirtualTest { .assertEvent().getSessionId(); events.clear(); - appPage.logout(); + logout(); events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); } diff --git a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnRegisterAndLoginTest.java b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnRegisterAndLoginTest.java index b8a8311585..b1c2b5ff35 100644 --- a/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnRegisterAndLoginTest.java +++ b/testsuite/integration-arquillian/tests/other/webauthn/src/test/java/org/keycloak/testsuite/webauthn/WebAuthnRegisterAndLoginTest.java @@ -145,9 +145,11 @@ public class WebAuthnRegisterAndLoginTest extends AbstractWebAuthnVirtualTest { events.clear(); // logout by user - appPage.logout(); + logout(); + // confirm logout event events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); @@ -176,9 +178,11 @@ public class WebAuthnRegisterAndLoginTest extends AbstractWebAuthnVirtualTest { events.clear(); // logout by user - appPage.logout(); + logout(); + // confirm logout event events.expectLogout(sessionId) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); } finally { @@ -248,9 +252,10 @@ public class WebAuthnRegisterAndLoginTest extends AbstractWebAuthnVirtualTest { events.clear(); - appPage.logout(); + logout(); events.expectLogout(sessionID) + .removeDetail(Details.REDIRECT_URI) .user(userId) .assertEvent(); @@ -271,7 +276,7 @@ public class WebAuthnRegisterAndLoginTest extends AbstractWebAuthnVirtualTest { webAuthnLoginPage.clickAuthenticate(); appPage.assertCurrent(); - appPage.logout(); + logout(); // Only passwordless login loginUsernamePage.open(); @@ -292,7 +297,7 @@ public class WebAuthnRegisterAndLoginTest extends AbstractWebAuthnVirtualTest { webAuthnLoginPage.clickAuthenticate(); appPage.assertCurrent(); - appPage.logout(); + logout(); } finally { removeFirstCredentialForUser(userId, WebAuthnCredentialModel.TYPE_TWOFACTOR, WEBAUTHN_LABEL); removeFirstCredentialForUser(userId, WebAuthnCredentialModel.TYPE_PASSWORDLESS, PASSWORDLESS_LABEL);