diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SessionServletAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SessionServletAdapterTest.java index 6e886a8ff3..fb97188d8c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SessionServletAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/servlet/SessionServletAdapterTest.java @@ -23,9 +23,7 @@ import org.jboss.arquillian.graphene.page.Page; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.After; import org.junit.Test; -import org.keycloak.OAuth2Constants; import org.keycloak.admin.client.resource.ClientResource; -import org.keycloak.common.Profile; import org.keycloak.protocol.oidc.OIDCLoginProtocolService; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.RealmRepresentation; @@ -33,12 +31,12 @@ import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.adapter.AbstractServletsAdapterTest; import org.keycloak.testsuite.adapter.page.SessionPortal; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.auth.page.account.Sessions; import org.keycloak.testsuite.auth.page.login.Login; import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; import org.keycloak.testsuite.pages.InfoPage; import org.keycloak.testsuite.pages.LogoutConfirmPage; +import org.keycloak.testsuite.util.AccountHelper; import org.keycloak.testsuite.utils.arquillian.ContainerConstants; import org.keycloak.testsuite.util.SecondBrowser; import org.openqa.selenium.By; @@ -210,12 +208,10 @@ public class SessionServletAdapterTest extends AbstractServletsAdapterTest { //KEYCLOAK-1216 @Test - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void testAccountManagementSessionsLogout() { // login as bburke loginAndCheckSession(testRealmLoginPage); - testRealmSessions.navigateTo(); - testRealmSessions.logoutAll(); + AccountHelper.logout(testRealmResource(), "bburke@redhat.com"); // Assert I need to login again (logout was propagated to the app) loginAndCheckSession(testRealmLoginPage); } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java index 72b834daec..f1f3cbec72 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java @@ -29,10 +29,9 @@ import org.keycloak.representations.idm.authorization.DecisionStrategy; import org.keycloak.services.resources.admin.permissions.AdminPermissionManagement; import org.keycloak.services.resources.admin.permissions.AdminPermissions; import org.keycloak.testsuite.AbstractKeycloakTest; -import org.keycloak.testsuite.ProfileAssume; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.arquillian.annotation.UncaughtServerErrorExpected; import org.keycloak.testsuite.auth.page.login.UpdateAccount; +import org.keycloak.testsuite.pages.AppPage; import org.keycloak.testsuite.pages.LoginPage; import org.keycloak.testsuite.pages.social.AbstractSocialLoginPage; import org.keycloak.testsuite.pages.social.BitbucketLoginPage; @@ -98,7 +97,6 @@ import com.google.common.collect.ImmutableMap; * @author Stian Thorgersen * @author Vaclav Muzikar */ -@DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public class SocialLoginTest extends AbstractKeycloakTest { public static final String SOCIAL_CONFIG = "social.config"; @@ -110,6 +108,9 @@ public class SocialLoginTest extends AbstractKeycloakTest { @Page private LoginPage loginPage; + @Page + private AppPage appPage; + @Page private UpdateAccount updateAccountPage; @@ -173,12 +174,13 @@ public class SocialLoginTest extends AbstractKeycloakTest { @Before public void beforeSocialLoginTest() { - accountPage.setAuthRealm(REALM); + oauth.realm(REALM); } @After public void afterSocialLoginTest() { currentTestProvider = null; + oauth.realm("test"); } private void removeUser() { @@ -246,7 +248,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(OPENSHIFT); performLogin(); assertUpdateProfile(false, false, true); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -256,7 +258,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(OPENSHIFT4); performLogin(); assertUpdateProfile(false, false, true); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -265,7 +267,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(OPENSHIFT4_KUBE_ADMIN); performLogin(); assertUpdateProfile(true, true, true); - assertAccount(); + appPage.assertCurrent(); } @Test @@ -275,7 +277,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { addAttributeMapper("ocp-groups", "groups"); performLogin(); assertUpdateProfile(false, false, true); - assertAccount(); + appPage.assertCurrent(); assertAttribute("ocp-groups", getConfig("groups")); } @@ -284,7 +286,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void googleLogin() throws InterruptedException { setTestProvider(GOOGLE); performLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -295,7 +297,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { navigateToLoginPage(); assertTrue(driver.getCurrentUrl().contains("hd=" + getConfig(GOOGLE_HOSTED_DOMAIN, "hostedDomain"))); doLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -320,7 +322,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void bitbucketLogin() throws InterruptedException { setTestProvider(BITBUCKET); performLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -329,7 +331,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void gitlabLogin() throws InterruptedException { setTestProvider(GITLAB); performLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -338,7 +340,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void facebookLogin() throws InterruptedException { setTestProvider(FACEBOOK); performLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -348,7 +350,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(FACEBOOK_INCLUDE_BIRTHDAY); addAttributeMapper("birthday", "birthday"); performLogin(); - assertAccount(); + appPage.assertCurrent(); assertAttribute("birthday", getConfig("profile.birthday")); testTokenExchange(); } @@ -358,7 +360,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(INSTAGRAM); performLogin(); assertUpdateProfile(true, true, true); - assertAccount(); + appPage.assertCurrent(); } @@ -367,7 +369,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void githubLogin() throws InterruptedException { setTestProvider(GITHUB); performLogin(); - assertAccount(); + appPage.assertCurrent(); testTokenExchange(); } @@ -375,21 +377,21 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void githubPrivateEmailLogin() throws InterruptedException { setTestProvider(GITHUB_PRIVATE_EMAIL); performLogin(); - assertAccount(); + appPage.assertCurrent(); } @Test public void twitterLogin() { setTestProvider(TWITTER); performLogin(); - assertAccount(); + appPage.assertCurrent(); } @Test public void linkedinLogin() { setTestProvider(LINKEDIN); performLogin(); - assertAccount(); + appPage.assertCurrent(); } @Test @@ -398,7 +400,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { addAttributeMapper("picture", "profilePicture.displayImage~.elements[0].identifiers[0].identifier"); performLogin(); - assertAccount(); + appPage.assertCurrent(); assertAttribute("picture", getConfig("profile.picture")); } @@ -406,14 +408,14 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void microsoftLogin() { setTestProvider(MICROSOFT); performLogin(); - assertAccount(); + appPage.assertCurrent(); } @Test public void paypalLogin() { setTestProvider(PAYPAL); performLogin(); - assertAccount(); + appPage.assertCurrent(); } @Test @@ -421,7 +423,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { setTestProvider(STACKOVERFLOW); performLogin(); assertUpdateProfile(false, false, true); - assertAccount(); + appPage.assertCurrent(); } public IdentityProviderRepresentation buildIdp(Provider provider) { @@ -495,7 +497,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { private void navigateToLoginPage() { currentSocialLoginPage.logout(); // try to logout first to be sure we're not logged in - accountPage.navigateTo(); + driver.navigate().to(oauth.getLoginFormUrl()); loginPage.clickSocial(currentTestProvider.id()); // Just to be sure there's no redirect in progress @@ -516,14 +518,6 @@ public class SocialLoginTest extends AbstractKeycloakTest { WaitUtils.waitForPageToLoad(); } - private void assertAccount() { - assertTrue(URLUtils.currentUrlStartsWith(accountPage.toString())); // Sometimes after login the URL ends with /# or similar - - assertEquals(getConfig("profile.firstName"), accountPage.getFirstName()); - assertEquals(getConfig("profile.lastName"), accountPage.getLastName()); - assertEquals(getConfig("profile.email"), accountPage.getEmail()); - } - private void assertAttribute(String attrName, String expectedValue) { List users = adminClient.realm(REALM).users().search(null, null, null); assertEquals(1, users.size()); @@ -533,7 +527,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { } private void assertUpdateProfile(boolean firstName, boolean lastName, boolean email) { - assertTrue(URLUtils.currentUrlDoesntStartWith(accountPage.toString())); + assertTrue(URLUtils.currentUrlDoesntStartWith(oauth.APP_AUTH_ROOT)); if (firstName) { assertTrue(updateAccountPage.fields().getFirstName().isEmpty()); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java index ea7294e336..3c929ae6e5 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/client/ClientRedirectTest.java @@ -21,7 +21,6 @@ import org.junit.Test; import org.junit.Rule; import org.keycloak.OAuth2Constants; import org.keycloak.OAuthErrorException; -import org.keycloak.common.Profile; import org.keycloak.common.util.KeycloakUriBuilder; import org.keycloak.constants.ServiceUrlConstants; import org.keycloak.protocol.oidc.OIDCLoginProtocol; @@ -30,7 +29,6 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest; import org.keycloak.testsuite.AssertEvents; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.util.AdminClientUtil; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.util.ClientBuilder; import org.keycloak.testsuite.util.RealmBuilder; @@ -68,7 +66,6 @@ public class ClientRedirectTest extends AbstractTestRealmKeycloakTest { * @throws Exception */ @Test - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void testClientRedirectEndpoint() throws Exception { oauth.doLogin("test-user@localhost", "password"); @@ -77,9 +74,6 @@ public class ClientRedirectTest extends AbstractTestRealmKeycloakTest { driver.get(getAuthServerRoot().toString() + "realms/test/clients/dummy-test/redirect"); assertEquals("http://example.org/dummy/base-path", driver.getCurrentUrl()); - - driver.get(getAuthServerRoot().toString() + "realms/test/clients/account/redirect"); - assertEquals(getAuthServerRoot().toString() + "realms/test/account/", driver.getCurrentUrl()); } @Test diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/BrowserFlowTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/BrowserFlowTest.java index 76e0055820..59dbe39550 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/BrowserFlowTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/BrowserFlowTest.java @@ -18,7 +18,6 @@ import org.keycloak.authentication.authenticators.conditional.ConditionalRoleAut import org.keycloak.authentication.authenticators.conditional.ConditionalUserAttributeValueFactory; import org.keycloak.authentication.authenticators.conditional.ConditionalUserConfiguredAuthenticatorFactory; import org.keycloak.authentication.requiredactions.WebAuthnRegisterFactory; -import org.keycloak.common.Profile; import org.keycloak.events.Details; import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationExecutionModel.Requirement; @@ -37,7 +36,6 @@ import org.keycloak.testsuite.ActionURIUtils; import org.keycloak.testsuite.AssertEvents; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.admin.authentication.AbstractAuthenticationTest; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.auth.page.login.OneTimeCode; import org.keycloak.testsuite.authentication.SetUserAttributeAuthenticatorFactory; import org.keycloak.testsuite.broker.SocialLoginTest; @@ -543,8 +541,6 @@ public class BrowserFlowTest extends AbstractTestRealmKeycloakTest { } @Test - - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void testAlternativeNonInteractiveExecutorInSubflow() { final String newFlowAlias = "browser - alternative non-interactive executor"; testingClient.server("test").run(session -> FlowUtil.inCurrentRealm(session).copyBrowserFlow(newFlowAlias)); @@ -568,7 +564,11 @@ public class BrowserFlowTest extends AbstractTestRealmKeycloakTest { // Check that Keycloak is redirecting us to the Keycloak account management page WebElement aHref = driver.findElement(By.tagName("a")); driver.get(aHref.getAttribute("href")); + // Waiting for account redirection from app page + driver.wait(1000); assertThat(driver.getTitle(), containsString("Account Management")); + } catch (Throwable t) { + t.printStackTrace(); } finally { revertFlows("browser - alternative non-interactive executor"); } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java index cf0316b019..fab5b47583 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/LoginTest.java @@ -20,11 +20,9 @@ import java.io.Closeable; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.UUID; import jakarta.ws.rs.client.Client; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.UriBuilder; - import org.apache.commons.lang3.RandomStringUtils; import org.jboss.arquillian.graphene.page.Page; import org.junit.Assert; @@ -910,7 +908,6 @@ public class LoginTest extends AbstractTestRealmKeycloakTest { } @Test - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void loginRememberMeExpiredIdle() throws Exception { try (Closeable c = new RealmAttributeUpdater(adminClient.realm("test")) .setSsoSessionIdleTimeoutRememberMe(1) @@ -933,13 +930,12 @@ public class LoginTest extends AbstractTestRealmKeycloakTest { setTimeOffset(2 + SessionTimeoutHelper.IDLE_TIMEOUT_WINDOW_SECONDS); // trying to open the account page with an expired idle timeout should redirect back to the login page. - appPage.openAccount(); + loginPage.open(); loginPage.assertCurrent(); } } @Test - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void loginRememberMeExpiredMaxLifespan() throws Exception { try (Closeable c = new RealmAttributeUpdater(adminClient.realm("test")) .setSsoSessionMaxLifespanRememberMe(1) @@ -962,7 +958,7 @@ public class LoginTest extends AbstractTestRealmKeycloakTest { setTimeOffset(2); // trying to open the account page with an expired lifespan should redirect back to the login page. - appPage.openAccount(); + loginPage.open(); loginPage.assertCurrent(); } } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java index 15c4814478..676f831db6 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/javascript/JavascriptAdapterTest.java @@ -7,11 +7,9 @@ import org.junit.Rule; import org.junit.Test; import org.keycloak.OAuth2Constants; import org.keycloak.admin.client.resource.ClientResource; -import org.keycloak.common.Profile; import org.keycloak.common.util.Retry; import org.keycloak.common.util.UriUtils; import org.keycloak.events.Details; -import org.keycloak.events.EventType; import org.keycloak.protocol.oidc.OIDCLoginProtocol; import org.keycloak.representations.ClaimsRepresentation; import org.keycloak.representations.IDToken; @@ -23,15 +21,15 @@ import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.AssertEvents; import org.keycloak.testsuite.admin.ApiUtil; import org.keycloak.testsuite.arquillian.SuiteContext; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.auth.page.account.Applications; import org.keycloak.testsuite.auth.page.login.OAuthGrant; import org.keycloak.testsuite.auth.page.login.UpdatePassword; import org.keycloak.testsuite.updaters.RealmAttributeUpdater; import org.keycloak.testsuite.util.JavascriptBrowser; -import org.keycloak.testsuite.util.OAuthClient; +import org.keycloak.testsuite.util.AccountHelper; import org.keycloak.testsuite.util.RealmBuilder; import org.keycloak.testsuite.util.UserBuilder; +import org.keycloak.testsuite.util.OAuthClient; import org.keycloak.testsuite.util.javascript.JSObjectBuilder; import org.keycloak.testsuite.util.javascript.JavascriptStateValidator; import org.keycloak.testsuite.util.javascript.JavascriptTestExecutor; @@ -145,7 +143,7 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest { public void testJSConsoleAuth() { testExecutor.init(defaultArguments(), this::assertInitNotAuth) .login(this::assertOnLoginPage) - .loginForm( UserBuilder.create().username("user").password("invalid-password").build(), + .loginForm(UserBuilder.create().username("user").password("invalid-password").build(), (driver1, output, events) -> assertCurrentUrlDoesntStartWith(testAppUrl, driver1)) .loginForm(UserBuilder.create().username("invalid-user").password("password").build(), (driver1, output, events) -> assertCurrentUrlDoesntStartWith(testAppUrl, driver1)) @@ -290,7 +288,6 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest { } @Test - @DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public void grantBrowserBasedApp() { Assume.assumeTrue("This test doesn't work with phantomjs", !"phantomjs".equals(System.getProperty("js.browser"))); @@ -321,11 +318,8 @@ public class JavascriptAdapterTest extends AbstractJavascriptTest { applicationsPage.navigateTo(); events.expectCodeToToken(codeId, loginEvent.getSessionId()).client(CLIENT_ID).assertEvent(); - applicationsPage.revokeGrantForApplication(CLIENT_ID); - events.expect(EventType.REVOKE_GRANT) - .client("account") - .detail(Details.REVOKED_CLIENT, CLIENT_ID) - .assertEvent(); + AccountHelper.revokeConsents(adminClient.realm(REALM_NAME), testUser.getUsername(),CLIENT_ID); + Assert.assertTrue(AccountHelper.getUserConsents(adminClient.realm(REALM_NAME), testUser.getUsername()).isEmpty()); jsDriver.navigate().to(testAppUrl); testExecutor.configure() // need to configure because we refreshed page diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/ssl/TrustStoreEmailTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/ssl/TrustStoreEmailTest.java index 9adb161013..6ae9f7e90e 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/ssl/TrustStoreEmailTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/ssl/TrustStoreEmailTest.java @@ -20,7 +20,6 @@ import org.jboss.arquillian.graphene.page.Page; import org.junit.After; import org.junit.Rule; import org.junit.Test; -import org.keycloak.common.Profile; import org.keycloak.events.Details; import org.keycloak.events.Errors; import org.keycloak.events.EventType; @@ -31,11 +30,10 @@ import org.keycloak.testsuite.AbstractTestRealmKeycloakTest; import org.keycloak.testsuite.Assert; import org.keycloak.testsuite.AssertEvents; import org.keycloak.testsuite.admin.ApiUtil; -import org.keycloak.testsuite.arquillian.annotation.DisableFeature; import org.keycloak.testsuite.auth.page.AuthRealm; -import org.keycloak.testsuite.auth.page.account.AccountManagement; import org.keycloak.testsuite.auth.page.login.OIDCLogin; import org.keycloak.testsuite.auth.page.login.VerifyEmail; +import org.keycloak.testsuite.util.AccountHelper; import org.keycloak.testsuite.util.MailServerConfiguration; import org.keycloak.testsuite.util.SslMailServer; @@ -47,7 +45,6 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; * * @author fkiss */ -@DisableFeature(value = Profile.Feature.ACCOUNT2, skipRestart = true) // TODO remove this (KEYCLOAK-16228) public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { @Page @@ -56,9 +53,6 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { @Page protected AuthRealm testRealmPage; - @Page - protected AccountManagement accountManagement; - @Page private VerifyEmail testRealmVerifyEmailPage; @@ -79,7 +73,6 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { super.setDefaultPageUriParameters(); testRealmPage.setAuthRealm("test"); testRealmVerifyEmailPage.setAuthRealm(testRealmPage); - accountManagement.setAuthRealm(testRealmPage); testRealmLoginPage.setAuthRealm(testRealmPage); } @@ -94,12 +87,12 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { UserRepresentation user = ApiUtil.findUserByUsername(testRealm(), "test-user@localhost"); SslMailServer.startWithSsl(this.getClass().getClassLoader().getResource(SslMailServer.PRIVATE_KEY).getFile()); - accountManagement.navigateTo(); + driver.navigate().to(oauth.getLoginFormUrl()); testRealmLoginPage.form().login(user.getUsername(), "password"); EventRepresentation sendEvent = events.expectRequiredAction(EventType.SEND_VERIFY_EMAIL) .user(user.getId()) - .client("account") + .client("test-app") .detail(Details.USERNAME, "test-user@localhost") .detail(Details.EMAIL, "test-user@localhost") .removeDetail(Details.REDIRECT_URI) @@ -118,7 +111,7 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { events.expectRequiredAction(EventType.VERIFY_EMAIL) .user(user.getId()) - .client("account") + .client("test-app") .detail(Details.USERNAME, "test-user@localhost") .detail(Details.EMAIL, "test-user@localhost") .detail(Details.CODE_ID, mailCodeId) @@ -126,17 +119,18 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { .assertEvent(); events.expectLogin() - .client("account") + .client("test-app") .user(user.getId()) .session(mailCodeId) .detail(Details.USERNAME, "test-user@localhost") .removeDetail(Details.REDIRECT_URI) .assertEvent(); - assertCurrentUrlStartsWith(accountManagement); - accountManagement.signOut(); + assertCurrentUrlStartsWith(oauth.APP_AUTH_ROOT); + AccountHelper.logout(testRealm(), user.getUsername()); + driver.navigate().to(oauth.getLoginFormUrl()); testRealmLoginPage.form().login(user.getUsername(), "password"); - assertCurrentUrlStartsWith(accountManagement); + assertCurrentUrlStartsWith(oauth.APP_AUTH_ROOT); } @Test @@ -144,13 +138,13 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { UserRepresentation user = ApiUtil.findUserByUsername(testRealm(), "test-user@localhost"); SslMailServer.startWithSsl(this.getClass().getClassLoader().getResource(SslMailServer.INVALID_KEY).getFile()); - accountManagement.navigateTo(); + driver.navigate().to(oauth.getLoginFormUrl()); loginPage.form().login(user.getUsername(), "password"); events.expectRequiredAction(EventType.SEND_VERIFY_EMAIL_ERROR) .error(Errors.EMAIL_SEND_FAILED) .user(user.getId()) - .client("account") + .client("test-app") .detail(Details.USERNAME, "test-user@localhost") .detail(Details.EMAIL, "test-user@localhost") .removeDetail(Details.REDIRECT_URI) @@ -174,13 +168,13 @@ public class TrustStoreEmailTest extends AbstractTestRealmKeycloakTest { try { SslMailServer.startWithSsl(this.getClass().getClassLoader().getResource(SslMailServer.PRIVATE_KEY).getFile()); - accountManagement.navigateTo(); + driver.navigate().to(oauth.getLoginFormUrl()); loginPage.form().login(user.getUsername(), "password"); events.expectRequiredAction(EventType.SEND_VERIFY_EMAIL_ERROR) .error(Errors.EMAIL_SEND_FAILED) .user(user.getId()) - .client("account") + .client("test-app") .detail(Details.USERNAME, "test-user@localhost") .detail(Details.EMAIL, "test-user@localhost") .removeDetail(Details.REDIRECT_URI)