Fix LoginSettingsTest
(cherry picked from commit bf70927)
This commit is contained in:
parent
0197c69ac3
commit
0e6e3d10d8
3 changed files with 32 additions and 8 deletions
|
@ -81,6 +81,10 @@ public class LoginSettings extends RealmSettings {
|
||||||
emailAsUsernameOnOffSwitch.setOn(emailAsUsername);
|
emailAsUsernameOnOffSwitch.setOn(emailAsUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmailAsUsername() {
|
||||||
|
return emailAsUsernameOnOffSwitch.isOn();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isEditUsernameAllowed() {
|
public boolean isEditUsernameAllowed() {
|
||||||
return editUsernameAllowed.isOn();
|
return editUsernameAllowed.isOn();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@ public class Form {
|
||||||
|
|
||||||
public static final String ACTIVE_DIV_XPATH = ".//div[not(contains(@class,'ng-hide'))]";
|
public static final String ACTIVE_DIV_XPATH = ".//div[not(contains(@class,'ng-hide'))]";
|
||||||
|
|
||||||
@FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Save']")
|
@FindBy(xpath = ACTIVE_DIV_XPATH + "/button[@kc-save or @data-kc-save]")
|
||||||
private WebElement save;
|
private WebElement save;
|
||||||
@FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Cancel']")
|
@FindBy(xpath = ACTIVE_DIV_XPATH + "/button[@kc-reset or @data-kc-reset]")
|
||||||
private WebElement cancel;
|
private WebElement cancel;
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
|
|
|
@ -41,13 +41,14 @@ import org.keycloak.testsuite.console.page.realm.LoginSettings.RequireSSLOption;
|
||||||
import org.keycloak.testsuite.util.MailServer;
|
import org.keycloak.testsuite.util.MailServer;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
|
||||||
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
|
||||||
|
|
||||||
|
import org.keycloak.testsuite.util.WaitUtils;
|
||||||
import org.openqa.selenium.Cookie;
|
import org.openqa.selenium.Cookie;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author tkyjovsk
|
* @author tkyjovsk
|
||||||
*/
|
*/
|
||||||
@Ignore
|
|
||||||
public class LoginSettingsTest extends AbstractRealmTest {
|
public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
|
|
||||||
private static final String NEW_USERNAME = "newUsername";
|
private static final String NEW_USERNAME = "newUsername";
|
||||||
|
@ -84,7 +85,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
|
|
||||||
log.info("enabling registration");
|
log.info("enabling registration");
|
||||||
loginSettingsPage.form().setRegistrationAllowed(true);
|
loginSettingsPage.form().setRegistrationAllowed(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isRegistrationAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
testRealmAdminConsolePage.navigateTo();
|
testRealmAdminConsolePage.navigateTo();
|
||||||
|
@ -98,7 +101,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("enabling email as username");
|
log.info("enabling email as username");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setEmailAsUsername(true);
|
loginSettingsPage.form().setEmailAsUsername(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isEmailAsUsername());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
testRealmAdminConsolePage.navigateTo();
|
testRealmAdminConsolePage.navigateTo();
|
||||||
|
@ -112,8 +117,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("disabling registration");
|
log.info("disabling registration");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setRegistrationAllowed(false);
|
loginSettingsPage.form().setRegistrationAllowed(false);
|
||||||
loginSettingsPage.form().save();
|
|
||||||
assertFalse(loginSettingsPage.form().isRegistrationAllowed());
|
assertFalse(loginSettingsPage.form().isRegistrationAllowed());
|
||||||
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("disabled");
|
log.debug("disabled");
|
||||||
|
|
||||||
testRealmAdminConsolePage.navigateTo();
|
testRealmAdminConsolePage.navigateTo();
|
||||||
|
@ -125,7 +131,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
public void editUsername() {
|
public void editUsername() {
|
||||||
log.info("enabling edit username");
|
log.info("enabling edit username");
|
||||||
loginSettingsPage.form().setEditUsernameAllowed(true);
|
loginSettingsPage.form().setEditUsernameAllowed(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isEditUsernameAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
log.info("edit username");
|
log.info("edit username");
|
||||||
|
@ -145,7 +153,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("disabling edit username");
|
log.info("disabling edit username");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setEditUsernameAllowed(false);
|
loginSettingsPage.form().setEditUsernameAllowed(false);
|
||||||
|
assertFalse(loginSettingsPage.form().isEditUsernameAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("disabled");
|
log.debug("disabled");
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +166,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
|
|
||||||
log.info("enabling reset password");
|
log.info("enabling reset password");
|
||||||
loginSettingsPage.form().setResetPasswordAllowed(true);
|
loginSettingsPage.form().setResetPasswordAllowed(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isResetPasswordAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
testRealmAdminConsolePage.navigateTo();
|
testRealmAdminConsolePage.navigateTo();
|
||||||
|
@ -169,8 +181,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("disabling reset password");
|
log.info("disabling reset password");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setResetPasswordAllowed(false);
|
loginSettingsPage.form().setResetPasswordAllowed(false);
|
||||||
loginSettingsPage.form().save();
|
|
||||||
assertFalse(loginSettingsPage.form().isResetPasswordAllowed());
|
assertFalse(loginSettingsPage.form().isResetPasswordAllowed());
|
||||||
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("disabled");
|
log.debug("disabled");
|
||||||
|
|
||||||
testRealmAdminConsolePage.navigateTo();
|
testRealmAdminConsolePage.navigateTo();
|
||||||
|
@ -183,7 +196,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
|
|
||||||
log.info("enabling remember me");
|
log.info("enabling remember me");
|
||||||
loginSettingsPage.form().setRememberMeAllowed(true);
|
loginSettingsPage.form().setRememberMeAllowed(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isRememberMeAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
log.info("login with remember me checked");
|
log.info("login with remember me checked");
|
||||||
|
@ -198,8 +213,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("disabling remember me");
|
log.info("disabling remember me");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setRememberMeAllowed(false);
|
loginSettingsPage.form().setRememberMeAllowed(false);
|
||||||
loginSettingsPage.form().save();
|
|
||||||
assertFalse(loginSettingsPage.form().isRememberMeAllowed());
|
assertFalse(loginSettingsPage.form().isRememberMeAllowed());
|
||||||
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("disabled");
|
log.debug("disabled");
|
||||||
|
|
||||||
testAccountPage.navigateTo();
|
testAccountPage.navigateTo();
|
||||||
|
@ -218,10 +234,12 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
|
|
||||||
log.info("enabling verify email in login settings");
|
log.info("enabling verify email in login settings");
|
||||||
loginSettingsPage.form().setVerifyEmailAllowed(true);
|
loginSettingsPage.form().setVerifyEmailAllowed(true);
|
||||||
|
assertTrue(loginSettingsPage.form().isVerifyEmailAllowed());
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("enabled");
|
log.debug("enabled");
|
||||||
|
|
||||||
log.info("configure smpt server in test realm");
|
log.info("configure smtp server in test realm");
|
||||||
RealmRepresentation testRealmRep = testRealmResource().toRepresentation();
|
RealmRepresentation testRealmRep = testRealmResource().toRepresentation();
|
||||||
testRealmRep.setSmtpServer(suiteContext.getSmtpServer());
|
testRealmRep.setSmtpServer(suiteContext.getSmtpServer());
|
||||||
testRealmResource().update(testRealmRep);
|
testRealmResource().update(testRealmRep);
|
||||||
|
@ -236,8 +254,9 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("disabling verify email");
|
log.info("disabling verify email");
|
||||||
loginSettingsPage.navigateTo();
|
loginSettingsPage.navigateTo();
|
||||||
loginSettingsPage.form().setVerifyEmailAllowed(false);
|
loginSettingsPage.form().setVerifyEmailAllowed(false);
|
||||||
loginSettingsPage.form().save();
|
|
||||||
assertFalse(loginSettingsPage.form().isVerifyEmailAllowed());
|
assertFalse(loginSettingsPage.form().isVerifyEmailAllowed());
|
||||||
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("disabled");
|
log.debug("disabled");
|
||||||
|
|
||||||
log.debug("create new test user");
|
log.debug("create new test user");
|
||||||
|
@ -261,6 +280,7 @@ public class LoginSettingsTest extends AbstractRealmTest {
|
||||||
log.info("set require ssl for all requests");
|
log.info("set require ssl for all requests");
|
||||||
loginSettingsPage.form().selectRequireSSL(RequireSSLOption.all);
|
loginSettingsPage.form().selectRequireSSL(RequireSSLOption.all);
|
||||||
loginSettingsPage.form().save();
|
loginSettingsPage.form().save();
|
||||||
|
assertFlashMessageSuccess();
|
||||||
log.debug("set");
|
log.debug("set");
|
||||||
|
|
||||||
log.info("check HTTPS required");
|
log.info("check HTTPS required");
|
||||||
|
|
Loading…
Reference in a new issue