KEYCLOAK-12606 Add test
This commit is contained in:
parent
1ca417c2c0
commit
df11a8a864
2 changed files with 35 additions and 6 deletions
|
@ -8,11 +8,17 @@ import static org.keycloak.testsuite.broker.BrokerTestConstants.IDP_OIDC_PROVIDE
|
|||
import static org.keycloak.testsuite.broker.BrokerTestConstants.USER_EMAIL;
|
||||
import static org.keycloak.testsuite.broker.BrokerTestTools.createIdentityProvider;
|
||||
import static org.keycloak.testsuite.broker.BrokerTestTools.waitForPage;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.keycloak.admin.client.resource.UserResource;
|
||||
import org.keycloak.admin.client.resource.UsersResource;
|
||||
import org.keycloak.representations.idm.IdentityProviderRepresentation;
|
||||
import org.keycloak.representations.idm.UserRepresentation;
|
||||
import org.keycloak.testsuite.Assert;
|
||||
import org.keycloak.testsuite.arquillian.SuiteContext;
|
||||
import org.keycloak.testsuite.updaters.Creator;
|
||||
import org.keycloak.testsuite.util.UserBuilder;
|
||||
|
||||
public class KcOidcBrokerLoginHintTest extends AbstractBrokerTest {
|
||||
|
||||
|
@ -21,11 +27,6 @@ public class KcOidcBrokerLoginHintTest extends AbstractBrokerTest {
|
|||
return new KcOidcBrokerConfigurationWithLoginHint();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getAccountUrl(String realmName) {
|
||||
return BrokerTestTools.getAuthRoot(suiteContext) + "/auth/realms/" + realmName + "/account";
|
||||
}
|
||||
|
||||
private class KcOidcBrokerConfigurationWithLoginHint extends KcOidcBrokerConfiguration {
|
||||
|
||||
@Override
|
||||
|
@ -86,4 +87,32 @@ public class KcOidcBrokerLoginHintTest extends AbstractBrokerTest {
|
|||
Assert.assertTrue("There must be user " + bc.getUserLogin() + " in realm " + bc.consumerRealmName(),
|
||||
isUserFound);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loginHintWithExistingUser() {
|
||||
try (Creator<UserResource> c = Creator.create(adminClient.realm(bc.consumerRealmName()),
|
||||
UserBuilder.create()
|
||||
.username(bc.getUserLogin())
|
||||
.password(bc.getUserPassword())
|
||||
.email(bc.getUserEmail())
|
||||
.enabled(true)
|
||||
.build()
|
||||
)) {
|
||||
driver.navigate().to(getAccountUrl(bc.consumerRealmName()));
|
||||
waitForPageToLoad();
|
||||
driver.navigate().to(driver.getCurrentUrl() + "&login_hint=" + USER_EMAIL + "&kc_idp_hint=" + IDP_OIDC_ALIAS);
|
||||
waitForPageToLoad();
|
||||
|
||||
loginPage.login(bc.getUserPassword());
|
||||
|
||||
updateAccountInformationPage.assertCurrent();
|
||||
updateAccountInformationPage.updateAccountInformation(bc.getUserLogin(), bc.getUserEmail(), "Firstname", "Lastname");
|
||||
|
||||
idpConfirmLinkPage.assertCurrent();
|
||||
idpConfirmLinkPage.clickLinkAccount();
|
||||
|
||||
loginPage.login(bc.getUserPassword());
|
||||
accountPage.isCurrent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.keycloak.representations.idm.UserRepresentation;
|
|||
import org.keycloak.testsuite.Assert;
|
||||
import org.keycloak.testsuite.arquillian.SuiteContext;
|
||||
|
||||
public class KcOidcBrokerNoLoginHintTest extends KcOidcBrokerLoginHintTest {
|
||||
public class KcOidcBrokerNoLoginHintTest extends AbstractBrokerTest {
|
||||
|
||||
@Override
|
||||
protected BrokerConfiguration getBrokerConfiguration() {
|
||||
|
|
Loading…
Reference in a new issue