diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/RequiredActions.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/RequiredActions.java index 0ea6af2b51..ca3d0bbc88 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/RequiredActions.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/RequiredActions.java @@ -7,11 +7,16 @@ import org.openqa.selenium.support.FindBy; /** * @author tkyjovsk * @author mhajas + * @author Vaclav Muzikar */ public class RequiredActions extends Authentication { - public final static String ENABLED = "enabled"; - public final static String DEFAULT_ACTION = "defaultAction"; + public final static String DEFAULT = "_default"; + public final static String CONFIGURE_TOTP = "CONFIGURE_TOTP"; + public final static String UPDATE_PROFILE = "UPDATE_PROFILE"; + public final static String TERMS_AND_CONDITIONS = "terms_and_conditions"; + public final static String UPDATE_PASSWORD = "UPDATE_PASSWORD"; + public final static String VERIFY_EMAIL = "VERIFY_EMAIL"; @FindBy(tagName = "table") private WebElement requiredActionTable; @@ -21,51 +26,55 @@ public class RequiredActions extends Authentication { return super.getUriFragment() + "/required-actions"; } - private void setRequiredActionValue(String row, String column, boolean value) { - WebElement checkbox = requiredActionTable.findElement(By.xpath("//td[text()='" + row + "']/..//input[@ng-model='requiredAction." + column + "']")); + private void setRequiredActionValue(String id, boolean value) { + WebElement checkbox = requiredActionTable.findElement(By.id(id)); if (checkbox.isSelected() != value) { checkbox.click(); } } + private void setRequiredActionDefaultValue(String id, boolean value) { + setRequiredActionValue(id + DEFAULT, value); + } + public void setTermsAndConditionEnabled(boolean value) { - setRequiredActionValue("Terms and Conditions", ENABLED, value); + setRequiredActionValue(TERMS_AND_CONDITIONS, value); } public void setTermsAndConditionDefaultAction(boolean value) { - setRequiredActionValue("Terms and Conditions", DEFAULT_ACTION, value); + setRequiredActionDefaultValue(TERMS_AND_CONDITIONS, value); } public void setVerifyEmailEnabled(boolean value) { - setRequiredActionValue("Verify Email", ENABLED, value); + setRequiredActionValue(VERIFY_EMAIL, value); } public void setVerifyEmailDefaultAction(boolean value) { - setRequiredActionValue("Verify Email", DEFAULT_ACTION, value); + setRequiredActionDefaultValue(VERIFY_EMAIL, value); } public void setUpdatePasswordEnabled(boolean value) { - setRequiredActionValue("Update Password", ENABLED, value); + setRequiredActionValue(UPDATE_PASSWORD, value); } public void setUpdatePasswordDefaultAction(boolean value) { - setRequiredActionValue("Update Password", DEFAULT_ACTION, value); + setRequiredActionDefaultValue(UPDATE_PASSWORD, value); } public void setConfigureTotpEnabled(boolean value) { - setRequiredActionValue("Configure Totp", ENABLED, value); + setRequiredActionValue(CONFIGURE_TOTP, value); } public void setConfigureTotpDefaultAction(boolean value) { - setRequiredActionValue("Configure Totp", DEFAULT_ACTION, value); + setRequiredActionDefaultValue(CONFIGURE_TOTP, value); } public void setUpdateProfileEnabled(boolean value) { - setRequiredActionValue("Update Profile", ENABLED, value); + setRequiredActionValue(UPDATE_PROFILE, value); } public void setUpdateProfileDefaultAction(boolean value) { - setRequiredActionValue("Update Profile", DEFAULT_ACTION, value); + setRequiredActionDefaultValue(UPDATE_PROFILE, value); } }