diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Bindings.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Bindings.java index 6e8d4a453e..9ef1b83e45 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Bindings.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Bindings.java @@ -7,7 +7,7 @@ import org.openqa.selenium.support.ui.Select; /** * Created by mhajas on 8/21/15. */ -public class Bindings extends Authentication{ +public class Bindings extends Authentication { @Override public String getUriFragment() { @@ -17,48 +17,48 @@ public class Bindings extends Authentication{ @FindBy(id = "browser") private Select BrowserFlowSelect; + @FindBy(id = "registration") + private Select RegistrationFlowSelect; + + @FindBy(id = "grant") + private Select DirectGrantFlowSelect; + + @FindBy(id = "resetCredentials") + private Select ResetCredentialsSelect; + + @FindBy(id = "clientAuthentication") + private Select ClientAuthenticationSelect; + + @FindBy(xpath = "//button[text()='Save']") + private WebElement saveButton; + + @FindBy(xpath = "//button[text()='Cancel']") + private WebElement cancelButton; + public void changeBrowserFlowSelect(BrowserFlowSelectValues value) { BrowserFlowSelect.selectByVisibleText(value.getName()); } - @FindBy(id = "registration") - private Select RegistrationFlowSelect; - public void changeRegistrationFlowSelect(RegistrationFlowSelectValues value) { RegistrationFlowSelect.selectByVisibleText(value.getName()); } - @FindBy(id = "grant") - private Select DirectGrantFlowSelect; - public void changeDirectGrantFlowSelect(DirectGrantFlowSelectValues value) { DirectGrantFlowSelect.selectByVisibleText(value.getName()); } - @FindBy(id = "resetCredentials") - private Select ResetCredentialsSelect; - public void changeResetCredentialsSelect(ResetCredentialsSelectValues value) { ResetCredentialsSelect.selectByVisibleText(value.getName()); } - @FindBy(id = "clientAuthentication") - private Select ClientAuthenticationSelect; - public void changeClientAuthenticationSelect(ClientAuthenticationSelectValues value) { ClientAuthenticationSelect.selectByVisibleText(value.getName()); } - @FindBy(xpath = "//button[text()='Save']") - private WebElement saveButton; - public void clickSave() { saveButton.click(); } - @FindBy(xpath = "//button[text()='Cancel']") - private WebElement cancelButton; - public void clickCancel() { cancelButton.click(); } @@ -143,5 +143,4 @@ public class Bindings extends Authentication{ } - } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Flows.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Flows.java index 199406440c..5aaa807adb 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Flows.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Flows.java @@ -19,9 +19,14 @@ public class Flows extends Authentication { @FindBy(tagName = "select") private Select flowSelect; - public void changeFlowSelect(FlowSelectValues value) { - flowSelect.selectByVisibleText(value.getName()); - } + @FindBy(linkText = "New") + private WebElement newButton; + + @FindBy(linkText = "Copy") + private WebElement copyButton; + + @FindBy(tagName = "table") + private WebElement flowsTable; public enum FlowSelectValues { @@ -37,13 +42,12 @@ public class Flows extends Authentication { public String getName() { return name; } + } - @FindBy(linkText = "New") - private WebElement newButton; - - @FindBy(linkText = "Copy") - private WebElement copyButton; + public void changeFlowSelect(FlowSelectValues value) { + flowSelect.selectByVisibleText(value.getName()); + } public void clickNew() { newButton.click(); @@ -53,160 +57,156 @@ public class Flows extends Authentication { copyButton.click(); } + private void clickRadioButton(String row, int column) { + flowsTable.findElement(By.xpath("//td[text()[contains(.,'" + row + "')]]/../td[" + String.valueOf(column) + "]//input[@type='radio']")).click(); + } + // Direct grant public void setPasswordRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Password')]]/../td[2]//input[@type='radio']")).click(); + clickRadioButton("Password", 2); } public void setPasswordDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Password')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Password", 3); } public void setOTPRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'O T P')]]/../td[2]//input[@type='radio']")).click(); + clickRadioButton("O T P", 2); } public void setOTPOptional() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'O T P')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("O T P", 3); } public void setOTPDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'O T P')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("O T P", 4); } // Registration public void setRegistrationFormRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Registration form')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Registration form", 3); } public void setRegistrationFormDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Registration form')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Registration form", 4); } public void setRegistrationUserCreationRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Registration User Creation')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Registration User Creation", 3); } public void setRegistrationUserCreationDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Registration User Creation')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Registration User Creation", 4); } public void setProfileValidationRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Profile Validation')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Profile Validation", 3); } public void setProfileValidationDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Profile Validation')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Profile Validation", 4); } public void setPasswordValidationRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Password Validation')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Password Validation", 3); } public void setPasswordValidationDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Password Validation')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Password Validation", 4); } public void setRecaptchaRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Recaptcha')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Recaptcha", 3); } public void setRecaptchaDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Recaptcha')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Recaptcha", 4); } // Browser public void setCookieAlternative() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Cookie')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Cookie", 3); } public void setCookieDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Cookie')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Cookie", 4); } public void setKerberosAlternative() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Kerberos')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Kerberos", 3); } public void setKerberosRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Kerberos')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Kerberos", 4); } public void setKerberosDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Kerberos')]]/../td[5]//input[@type='radio']")).click(); + clickRadioButton("Kerberos", 5); } public void setFormsAlternative() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Forms')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Forms", 3); } public void setFormsRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Forms')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Forms", 4); } public void setFormsDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Forms')]]/../td[5]//input[@type='radio']")).click(); + clickRadioButton("Forms", 5); } public void setOTPFormRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' O T P Form')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton(" O T P Form", 3); } public void setOTPFormOptional() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' O T P Form')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton(" O T P Form", 4); } public void setOTPFormDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' O T P Form')]]/../td[5]//input[@type='radio']")).click(); + clickRadioButton(" O T P Form", 5); } // Reset credentials public void setResetPasswordRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset Password')]]/../td[2]//input[@type='radio']")).click(); + clickRadioButton("Reset Password", 2); } public void setResetPasswordOptional() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset Password')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Reset Password", 3); } public void setResetPasswordDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset Password')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Reset Password", 4); } public void setResetOTPRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset O T P')]]/../td[2]//input[@type='radio']")).click(); + clickRadioButton("Reset O T P", 2); } public void setResetOTPOptional() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset O T P')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Reset O T P", 3); } public void setResetOTPDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Reset O T P')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton("Reset O T P", 4); } // Clients - public void setClientIdAndSecretRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Client Id and Secret')]]/../td[2]//input[@type='radio']")).click(); - } - public void setClientIdAndSecretAlternative() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Client Id and Secret')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton("Client Id and Secret", 2); } public void setClientIdAndSecretDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Client Id and Secret')]]/../td[4]//input[@type='radio']")).click(); - } - - public void setSignedJwtRequired() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' Signed Jwt')]]/../td[2]//input[@type='radio']")).click(); + clickRadioButton("Client Id and Secret", 3); } public void setSignedJwtAlternative() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' Signed Jwt')]]/../td[3]//input[@type='radio']")).click(); + clickRadioButton(" Signed Jwt", 2); } public void setSignedJwtDisabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' Signed Jwt')]]/../td[4]//input[@type='radio']")).click(); + clickRadioButton(" Signed Jwt", 3); } } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/OTPPolicy.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/OTPPolicy.java index 34e8a098d9..2a2bfdb57e 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/OTPPolicy.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/OTPPolicy.java @@ -19,20 +19,20 @@ public class OTPPolicy extends Authentication { @FindBy(linkText = "Cancel") private WebElement cancelButton; + @FindBy(id = "lookAhead") + private WebElement lookAheadInput; + + @FindBy(id = "counter") + private WebElement initialCounterInput; + public void clickCancel() { cancelButton.click(); } - @FindBy(id = "lookAhead") - private WebElement lookAheadInput; - public void setLookAheadInputValue(String value) { Form.setInputValue(lookAheadInput, value); } - @FindBy(id = "counter") - private WebElement initialCounterInput; - public void setInitialcounterInputValue(String value) { Form.setInputValue(initialCounterInput, value); } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java index b2b08b5493..3df1e679d6 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java @@ -1,14 +1,15 @@ package org.keycloak.testsuite.console.page.authentication; -import java.util.List; - import org.jboss.arquillian.graphene.findby.ByJQuery; -import static org.keycloak.testsuite.util.WaitUtils.waitGuiForElement; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.ui.Select; +import java.util.List; + +import static org.keycloak.testsuite.util.WaitUtils.waitGuiForElement; + /** * @author Petr Mensik * @author tkyjovsk @@ -23,7 +24,7 @@ public class PasswordPolicy extends Authentication { @FindBy(tagName = "select") private Select addPolicySelect; - + @FindBy(tagName = "select") private WebElement addPolicySelectElement; 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 5da1cdaaed..0ea6af2b51 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 @@ -1,6 +1,8 @@ package org.keycloak.testsuite.console.page.authentication; import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; /** * @author tkyjovsk @@ -8,48 +10,62 @@ import org.openqa.selenium.By; */ public class RequiredActions extends Authentication { + public final static String ENABLED = "enabled"; + public final static String DEFAULT_ACTION = "defaultAction"; + + @FindBy(tagName = "table") + private WebElement requiredActionTable; + @Override public String getUriFragment() { return super.getUriFragment() + "/required-actions"; } - public void clickTermsAndConditionEnabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Terms and Conditions']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); + private void setRequiredActionValue(String row, String column, boolean value) { + WebElement checkbox = requiredActionTable.findElement(By.xpath("//td[text()='" + row + "']/..//input[@ng-model='requiredAction." + column + "']")); + + if (checkbox.isSelected() != value) { + checkbox.click(); + } } - public void clickTermsAndConditionDefaultAction() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Terms and Conditions']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); + public void setTermsAndConditionEnabled(boolean value) { + setRequiredActionValue("Terms and Conditions", ENABLED, value); } - public void clickVerifyEmailEnabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Verify Email']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); + public void setTermsAndConditionDefaultAction(boolean value) { + setRequiredActionValue("Terms and Conditions", DEFAULT_ACTION, value); } - public void clickVerifyEmailDefaultAction() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Verify Email']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); + public void setVerifyEmailEnabled(boolean value) { + setRequiredActionValue("Verify Email", ENABLED, value); } - public void clickUpdatePasswordEnabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Password']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); + public void setVerifyEmailDefaultAction(boolean value) { + setRequiredActionValue("Verify Email", DEFAULT_ACTION, value); } - public void clickUpdatePasswordDefaultAction() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Password']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); + public void setUpdatePasswordEnabled(boolean value) { + setRequiredActionValue("Update Password", ENABLED, value); } - public void clickConfigureTotpEnabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Configure Totp']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); + public void setUpdatePasswordDefaultAction(boolean value) { + setRequiredActionValue("Update Password", DEFAULT_ACTION, value); } - public void clickConfigureTotpDefaultAction() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Configure Totp']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); + public void setConfigureTotpEnabled(boolean value) { + setRequiredActionValue("Configure Totp", ENABLED, value); } - public void clickUpdateProfileEnabled() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Profile']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); + public void setConfigureTotpDefaultAction(boolean value) { + setRequiredActionValue("Configure Totp", DEFAULT_ACTION, value); } - public void clickUpdateProfileDefaultAction() { - driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Profile']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); + public void setUpdateProfileEnabled(boolean value) { + setRequiredActionValue("Update Profile", ENABLED, value); + } + + public void setUpdateProfileDefaultAction(boolean value) { + setRequiredActionValue("Update Profile", DEFAULT_ACTION, value); } } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/AdminEvents.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/AdminEvents.java index 08e0e0006f..8cf2afc534 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/AdminEvents.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/AdminEvents.java @@ -7,7 +7,6 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; /** - * * @author tkyjovsk * @author mhajas */ @@ -27,6 +26,12 @@ public class AdminEvents extends Events { public class AdminEventsTable extends DataTable { + @FindBy(xpath = "//button[text()[contains(.,'Filter')]]") + private WebElement filterButton; + + @FindBy(tagName = "form") + private AdminEventsTableFilterForm filterForm; + public void update() { waitAjaxForBody(); clickHeaderButton("Update"); @@ -37,63 +42,63 @@ public class AdminEvents extends Events { clickHeaderButton("Reset"); } - @FindBy(xpath = "//button[text()[contains(.,'Filter')]]") - private WebElement filterButton; - public void filter() { waitAjaxForBody(); filterButton.click(); } - @FindBy(tagName = "form") - private AdminEventsTableFilterForm filterForm; - public AdminEventsTableFilterForm filterForm() { return filterForm; } public class AdminEventsTableFilterForm extends Form { + @FindBy(id = "resource") + private WebElement resourcePathInput; + + @FindBy(id = "realm") + private WebElement realmInput; + + @FindBy(id = "client") + private WebElement clientInput; + + @FindBy(id = "user") + private WebElement userInput; + + @FindBy(id = "ipAddress") + private WebElement ipAddressInput; + + @FindBy(xpath = "//div[@id='s2id_adminEnabledEventOperations']/ul") + private WebElement operationTypesInput; + + @FindBy(xpath = "//div[@id='select2-drop']") + private WebElement operationTypesValues; + public void addOperationType(String type) { - driver.findElement(By.xpath("//div[@id='s2id_adminEnabledEventOperations']/ul")).click(); - driver.findElement(By.xpath("//div[@id='select2-drop']//div[text()[contains(.,'" + type + "')]]/..")).click(); + operationTypesInput.click(); + operationTypesValues.findElement(By.xpath("//div[text() = '" + type + "']")).click(); } public void removeOperationType(String type) { - driver.findElement(By.xpath("//div[@id='s2id_adminEnabledEventOperations']//div[text()='" + type + "']/../a")).click(); + operationTypesInput.findElement(By.xpath("//div[text()='" + type + "']/../a")).click(); } - @FindBy(id = "resource") - private WebElement resourcePathInput; - public void setResourcePathInput(String value) { setInputValue(resourcePathInput, value); } - @FindBy(id = "realm") - private WebElement realmInput; - public void setRealmInput(String value) { setInputValue(realmInput, value); } - @FindBy(id = "client") - private WebElement clientInput; - public void setClientInput(String value) { setInputValue(clientInput, value); } - @FindBy(id = "user") - private WebElement userInput; - public void setUserInput(String value) { setInputValue(userInput, value); } - @FindBy(id = "ipAddress") - private WebElement ipAddressInput; - public void setIpAddressInput(String value) { setInputValue(ipAddressInput, value); } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java index 686e902b19..be84772e0f 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/Config.java @@ -32,6 +32,33 @@ public class Config extends Events { @FindBy(xpath = "//div[@id='s2id_autogen1']/..//select") private Select eventListenersSelect; + @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='enabled']]") + private OnOffSwitch SaveEvents; + + @FindBy(xpath = "//div[@id='s2id_enabledEventTypes']//input") + private WebElement savedTypesInput; + + @FindBy(xpath = "//div[@id='select2-drop']/ul") + private WebElement savedTypesOptions; + + @FindBy(id = "expiration") + private WebElement expirationInput; + + @FindBy(name = "expirationUnit") + private Select expirationUnitSelect; + + @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsEnabled']]") + private OnOffSwitch saveAdminEvents; + + @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsDetailsEnabled']]") + private OnOffSwitch includeRepresentation; + + @FindBy(xpath = "//button[@data-ng-click='clearEvents()']") + private WebElement clearLoginEventsButton; + + @FindBy(xpath = "//button[@data-ng-click='clearAdminEvents()']") + private WebElement clearAdminEventsButton; + public void addEventListener(String listener) { eventListenersInput.click(); eventListenersSelect.selectByVisibleText(listener); @@ -41,19 +68,10 @@ public class Config extends Events { eventListenersInput.findElement(By.xpath("//div[text()='" + listener + "']/../a")).click(); } - @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='enabled']]") - private OnOffSwitch SaveEvents; - public void setSaveEvents(boolean value) { SaveEvents.setOn(value); } - @FindBy(xpath = "//div[@id='s2id_enabledEventTypes']//input") - private WebElement savedTypesInput; - - @FindBy(xpath = "//div[@id='select2-drop']/ul") - private WebElement savedTypesOptions; - public void addSaveType(String type) { savedTypesInput.click(); savedTypesOptions.findElement(By.xpath("//div[text()='" + type + "']")).click(); @@ -64,36 +82,24 @@ public class Config extends Events { } public void clearLoginEvents() { - driver.findElement(By.xpath("//button[@data-ng-click='clearEvents()']")).click(); + clearLoginEventsButton.click(); } - @FindBy(id = "expiration") - private WebElement expirationInput; - - @FindBy(name = "expirationUnit") - private Select expirationUnitSelect; - public void setExpiration(String value, String unit) { expirationUnitSelect.selectByVisibleText(unit); Form.setInputValue(expirationInput, value); } - @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsEnabled']]") - private OnOffSwitch saveAdminEvents; - public void setSaveAdminEvents(boolean value) { saveAdminEvents.setOn(value); } - @FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsDetailsEnabled']]") - private OnOffSwitch includeRepresentation; - public void setIncludeRepresentation(boolean value) { includeRepresentation.setOn(value); } public void clearAdminEvents() { - driver.findElement(By.xpath("//button[@data-ng-click='clearAdminEvents()']")).click(); + clearAdminEventsButton.click(); } } } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/LoginEvents.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/LoginEvents.java index 6752951139..136e455a8e 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/LoginEvents.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/events/LoginEvents.java @@ -26,6 +26,12 @@ public class LoginEvents extends Events { public class LoginEventsTable extends DataTable { + @FindBy(xpath = "//button[text()[contains(.,'Filter')]]") + private WebElement filterButton; + + @FindBy(tagName = "form") + private LoginEventsTableFilterForm filterForm; + public void update() { waitAjaxForBody(); clickHeaderButton("Update"); @@ -36,42 +42,42 @@ public class LoginEvents extends Events { clickHeaderButton("Reset"); } - @FindBy(xpath = "//button[text()[contains(.,'Filter')]]") - private WebElement filterButton; - public void filter() { waitAjaxForBody(); filterButton.click(); } - @FindBy(tagName = "form") - private LoginEventsTableFilterForm filterForm; - public LoginEventsTableFilterForm filterForm() { return filterForm; } public class LoginEventsTableFilterForm extends Form { + @FindBy(id = "client") + private WebElement clientInput; + + @FindBy(id = "user") + private WebElement userInput; + + @FindBy(xpath = "//div[@id='s2id_eventTypes']/ul") + private WebElement eventTypeInput; + + @FindBy(xpath = "//div[@id='select2-drop']") + private WebElement eventTypeValues; + public void addEventType(String type) { - driver.findElement(By.xpath("//div[@id='s2id_eventTypes']/ul")).click(); - driver.findElement(By.xpath("//div[@id='select2-drop']//div[text()='" + type + "']/..")).click(); + eventTypeInput.click(); + eventTypeValues.findElement(By.xpath("//div[text()='" + type + "']")).click(); } public void removeOperationType(String type) { - driver.findElement(By.xpath("//div[@id='s2id_eventTypes']//div[text()='" + type + "']/../a")).click(); + eventTypeInput.findElement(By.xpath("//div[text()='" + type + "']/../a]")).click(); } - @FindBy(id = "client") - private WebElement clientInput; - public void setClientInput(String value) { setInputValue(clientInput, value); } - @FindBy(id = "user") - private WebElement userInput; - public void setUserInput(String value) { setInputValue(userInput, value); } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/BruteForceDetection.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/BruteForceDetection.java new file mode 100644 index 0000000000..75e54b2087 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/BruteForceDetection.java @@ -0,0 +1,123 @@ +package org.keycloak.testsuite.console.page.realm; + +import org.jboss.arquillian.graphene.findby.FindByJQuery; +import org.jboss.arquillian.graphene.page.Page; +import org.keycloak.testsuite.console.page.fragment.OnOffSwitch; +import org.keycloak.testsuite.page.Form; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.ui.Select; + +/** + * @author mhajas + */ +public class BruteForceDetection extends SecurityDefenses { + + @Override + public String getUriFragment() { + return super.getUriFragment() + "/brute-force"; + } + + @Page + private BruteForceDetectionForm form; + + public BruteForceDetectionForm form() { + return form; + } + + public class BruteForceDetectionForm extends Form { + + @FindByJQuery("div[class='onoffswitch']") + private OnOffSwitch protectionEnabled; + + @FindBy(id = "failureFactor") + private WebElement maxLoginFailures; + + @FindBy(id = "waitIncrement") + private WebElement waitIncrementInput; + + @FindBy(name = "waitIncrementUnit") + private Select waitIncrementSelect; + + @FindBy(id = "quickLoginCheckMilliSeconds") + private WebElement quickLoginCheckInput; + + @FindBy(id = "minimumQuickLoginWait") + private WebElement minQuickLoginWaitInput; + + @FindBy(name = "minimumQuickLoginWaitUnit") + private Select minQuickLoginWaitSelect; + + @FindBy(id = "maxFailureWait") + private WebElement maxWaitInput; + + @FindBy(name = "maxFailureWaitUnit") + private Select maxWaitSelect; + + @FindBy(id = "maxDeltaTime") + private WebElement failureResetTimeInput; + + @FindBy(name = "maxDeltaTimeUnit") + private Select failureResetTimeSelect; + + public void setProtectionEnabled(boolean protectionEnabled) { + this.protectionEnabled.setOn(protectionEnabled); + } + + public void setMaxLoginFailures(String value) { + setInputValue(maxLoginFailures, value); + } + + public void setWaitIncrementInput(String value) { + setInputValue(waitIncrementInput, value); + } + + public void setWaitIncrementSelect(TimeSelectValues value) { + waitIncrementSelect.selectByVisibleText(value.getName()); + } + + public void setQuickLoginCheckInput(String value) { + setInputValue(quickLoginCheckInput, value); + } + + public void setMinQuickLoginWaitInput(String value) { + setInputValue(minQuickLoginWaitInput, value); + } + + public void setMinQuickLoginWaitSelect(TimeSelectValues value) { + minQuickLoginWaitSelect.selectByVisibleText(value.getName()); + } + + public void setMaxWaitInput(String value) { + setInputValue(maxWaitInput, value); + } + + public void setMaxWaitSelect(TimeSelectValues value) { + maxWaitSelect.selectByVisibleText(value.getName()); + } + + public void setFailureResetTimeInput(String value) { + setInputValue(failureResetTimeInput, value); + } + + public void setFailureResetTimeSelect(TimeSelectValues value) { + failureResetTimeSelect.selectByVisibleText(value.getName()); + } + } + + public enum TimeSelectValues { + + SECONDS("Seconds"), MINUTES("Minutes"), HOURS("Hours"), DAYS("Days"); + + private String name; + + private TimeSelectValues(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } + +} \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/EmailSettings.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/EmailSettings.java index f75117b54a..130174ef09 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/EmailSettings.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/EmailSettings.java @@ -11,7 +11,7 @@ import org.openqa.selenium.support.FindBy; * Created by mhajas on 8/25/15. */ public class EmailSettings extends RealmSettings { - + @Override public String getUriFragment() { return super.getUriFragment() + "/smtp-settings"; diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/Headers.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/Headers.java new file mode 100644 index 0000000000..d8c161bc4f --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/Headers.java @@ -0,0 +1,41 @@ +package org.keycloak.testsuite.console.page.realm; + +import org.jboss.arquillian.graphene.page.Page; +import org.keycloak.testsuite.page.Form; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.FindBy; + +/** + * @author mhajas + */ +public class Headers extends SecurityDefenses { + + @Override + public String getUriFragment() { + return super.getUriFragment() + "/headers"; + } + + @Page + private HeadersForm form; + + public HeadersForm form() { + return form; + } + + public class HeadersForm extends Form { + + @FindBy(id = "xFrameOptions") + private WebElement xFrameOptions; + + @FindBy(id = "contentSecurityPolicy") + private WebElement contentSecurityPolicy; + + public void setXFrameOptions(String value) { + setInputValue(xFrameOptions, value); + } + + public void setContentSecurityPolicy(String value) { + setInputValue(contentSecurityPolicy, value); + } + } +} diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/SecurityDefenses.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/SecurityDefenses.java index 00bd0b8414..24120af32d 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/SecurityDefenses.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/realm/SecurityDefenses.java @@ -18,13 +18,7 @@ package org.keycloak.testsuite.console.page.realm; import org.jboss.arquillian.graphene.findby.FindByJQuery; -import org.jboss.arquillian.graphene.page.Page; -import org.keycloak.testsuite.console.page.fragment.OnOffSwitch; -import org.keycloak.testsuite.page.Form; -import static org.keycloak.testsuite.page.Form.setInputValue; import org.openqa.selenium.WebElement; -import org.openqa.selenium.support.FindBy; -import org.openqa.selenium.support.ui.Select; /** * @author Filip Kiss @@ -37,160 +31,16 @@ public class SecurityDefenses extends RealmSettings { return super.getUriFragment() + "/defense"; // NOTE: page doesn't exist, only subpages } - public class Headers extends SecurityDefenses { - - @Override - public String getUriFragment() { - return super.getUriFragment() + "/headers"; - } - - @Page - private HeadersForm form; - - public HeadersForm form() { - return form; - } - - public class HeadersForm extends Form { - - @FindBy(id = "xFrameOptions") - private WebElement xFrameOptions; - - public void setXFrameOptions(String value) { - setInputValue(xFrameOptions, value); - } - - @FindBy(id = "contentSecurityPolicy") - private WebElement contentSecurityPolicy; - - public void setContentSecurityPolicy(String value) { - setInputValue(contentSecurityPolicy, value); - } - } - } - - public enum TimeSelectValues { - - SECONDS("Seconds"), MINUTES("Minutes"), HOURS("Hours"), DAYS("Days"); - - private String name; - - private TimeSelectValues(String name) { - this.name = name; - } - - public String getName() { - return name; - } - } - - public class BruteForceDetection extends SecurityDefenses { - - @Override - public String getUriFragment() { - return super.getUriFragment() + "/brute-force"; - } - - @Page - private BruteForceDetectionForm form; - - public BruteForceDetectionForm form() { - return form; - } - - public class BruteForceDetectionForm extends Form { - - @FindByJQuery("div[class='onoffswitch']") - private OnOffSwitch protectionEnabled; - - public void setProtectionEnabled(boolean protectionEnabled) { - this.protectionEnabled.setOn(protectionEnabled); - } - - @FindBy(id = "failureFactor") - private WebElement maxLoginFailures; - - public void setMaxLoginFailures(String value) { - setInputValue(maxLoginFailures, value); - } - - @FindBy(id = "waitIncrement") - private WebElement waitIncrementInput; - - @FindBy(name = "waitIncrementUnit") - private Select waitIncrementSelect; - - public void setWaitIncrementInput(String value) { - setInputValue(waitIncrementInput, value); - } - - public void setWaitIncrementSelect(TimeSelectValues value) { - waitIncrementSelect.selectByVisibleText(value.getName()); - } - - @FindBy(id = "quickLoginCheckMilliSeconds") - private WebElement quickLoginCheckInput; - - public void setQuickLoginCheckInput(String value) { - setInputValue(quickLoginCheckInput, value); - } - - @FindBy(id = "minimumQuickLoginWait") - private WebElement minQuickLoginWaitInput; - - @FindBy(name = "minimumQuickLoginWaitUnit") - private Select minQuickLoginWaitSelect; - - public void setMinQuickLoginWaitInput(String value) { - setInputValue(minQuickLoginWaitInput, value); - } - - public void setMinQuickLoginWaitSelect(TimeSelectValues value) { - minQuickLoginWaitSelect.selectByVisibleText(value.getName()); - } - - @FindBy(id = "maxFailureWait") - private WebElement maxWaitInput; - - @FindBy(name = "maxFailureWaitUnit") - private Select maxWaitSelect; - - public void setMaxWaitInput(String value) { - setInputValue(maxWaitInput, value); - } - - public void setMaxWaitSelect(TimeSelectValues value) { - maxWaitSelect.selectByVisibleText(value.getName()); - } - - @FindBy(id = "maxDeltaTime") - private WebElement failureResetTimeInput; - - @FindBy(name = "maxDeltaTimeUnit") - private Select failureResetTimeSelect; - - public void setFailureResetTimeInput(String value) { - setInputValue(failureResetTimeInput, value); - } - - public void setFailureResetTimeSelect(TimeSelectValues value) { - failureResetTimeSelect.selectByVisibleText(value.getName()); - } - - } - - } - @FindByJQuery("a:contains('Brute Force Detection')") private WebElement bruteForceDetectionTab; + @FindByJQuery("a:contains('Headers')") + private WebElement headersTab; + public void goToBruteForceDetection() { bruteForceDetectionTab.click(); } - @FindByJQuery("a:contains('Headers')") - private WebElement headersTab; - public void goToHeaders() { headersTab.click(); } diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java index 75cf70f9e2..77e9a4e5fa 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java @@ -22,9 +22,9 @@ import org.junit.Before; import org.junit.Test; import org.keycloak.testsuite.console.AbstractConsoleTest; import org.keycloak.testsuite.console.page.authentication.PasswordPolicy; +import org.keycloak.testsuite.console.page.users.UserCredentials; import static org.keycloak.testsuite.console.page.authentication.PasswordPolicy.Type.*; -import org.keycloak.testsuite.console.page.users.UserCredentials; /** * @author Petr Mensik diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java index 9c818d140e..c45b792660 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java @@ -19,7 +19,6 @@ package org.keycloak.testsuite.console.authentication; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.testsuite.auth.page.login.Registration; @@ -51,49 +50,17 @@ public class RequiredActionsTest extends AbstractConsoleTest { super.setDefaultPageUriParameters(); testRealmRegistrationPage.setAuthRealm("test"); } - + @Before public void beforeRequiredActionsTest() { requiredActionsPage.navigateTo(); } - @Test - public void requiredActionsTest() { - requiredActionsPage.clickTermsAndConditionEnabled(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickTermsAndConditionDefaultAction(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickVerifyEmailEnabled(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickVerifyEmailDefaultAction(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickUpdatePasswordEnabled(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickUpdatePasswordDefaultAction(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickConfigureTotpEnabled(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickConfigureTotpDefaultAction(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickUpdateProfileEnabled(); - assertFlashMessageSuccess(); - - requiredActionsPage.clickUpdateProfileDefaultAction(); - assertFlashMessageSuccess(); - } - @Test public void termsAndConditionsDefaultActionTest() { - requiredActionsPage.clickTermsAndConditionEnabled(); - requiredActionsPage.clickTermsAndConditionDefaultAction(); + requiredActionsPage.setTermsAndConditionEnabled(true); + requiredActionsPage.setTermsAndConditionDefaultAction(true); + assertFlashMessageSuccess(); allowTestRealmUserRegistration(); @@ -106,7 +73,8 @@ public class RequiredActionsTest extends AbstractConsoleTest { @Test public void configureTotpDefaultActionTest() { - requiredActionsPage.clickConfigureTotpDefaultAction(); + requiredActionsPage.setConfigureTotpDefaultAction(true); + assertFlashMessageSuccess(); allowTestRealmUserRegistration(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/realm/SecurityDefensesTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/realm/SecurityDefensesTest.java index 84a9930245..0263513d57 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/realm/SecurityDefensesTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/realm/SecurityDefensesTest.java @@ -21,7 +21,7 @@ import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; import org.junit.Test; import org.keycloak.testsuite.auth.page.account.Account; -import org.keycloak.testsuite.console.page.realm.SecurityDefenses; +import org.keycloak.testsuite.console.page.realm.BruteForceDetection; import org.keycloak.testsuite.console.page.users.UserAttributes; import org.keycloak.testsuite.console.page.users.Users; import org.openqa.selenium.By; @@ -41,7 +41,7 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; public class SecurityDefensesTest extends AbstractRealmTest { @Page - private SecurityDefenses.BruteForceDetection bruteForceDetectionPage; + private BruteForceDetection bruteForceDetectionPage; @Page private Account testRealmAccountPage; @@ -69,7 +69,7 @@ public class SecurityDefensesTest extends AbstractRealmTest { bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setMaxLoginFailures("1"); - bruteForceDetectionPage.form().setWaitIncrementSelect(SecurityDefenses.TimeSelectValues.SECONDS); + bruteForceDetectionPage.form().setWaitIncrementSelect(BruteForceDetection.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setWaitIncrementInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().save(); assertFlashMessageSuccess(); @@ -110,7 +110,7 @@ public class SecurityDefensesTest extends AbstractRealmTest { bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setMaxLoginFailures("100"); bruteForceDetectionPage.form().setQuickLoginCheckInput("1500"); - bruteForceDetectionPage.form().setMinQuickLoginWaitSelect(SecurityDefenses.TimeSelectValues.SECONDS); + bruteForceDetectionPage.form().setMinQuickLoginWaitSelect(BruteForceDetection.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setMinQuickLoginWaitInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().save(); assertFlashMessageSuccess(); @@ -150,7 +150,7 @@ public class SecurityDefensesTest extends AbstractRealmTest { bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setMaxLoginFailures("1"); - bruteForceDetectionPage.form().setMaxWaitSelect(SecurityDefenses.TimeSelectValues.SECONDS); + bruteForceDetectionPage.form().setMaxWaitSelect(BruteForceDetection.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setMaxWaitInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().save(); @@ -190,7 +190,7 @@ public class SecurityDefensesTest extends AbstractRealmTest { bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setMaxLoginFailures("2"); - bruteForceDetectionPage.form().setFailureResetTimeSelect(SecurityDefenses.TimeSelectValues.SECONDS); + bruteForceDetectionPage.form().setFailureResetTimeSelect(BruteForceDetection.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setFailureResetTimeInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().save(); assertFlashMessageSuccess(); @@ -223,7 +223,7 @@ public class SecurityDefensesTest extends AbstractRealmTest { public void userUnlockTest() { bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setMaxLoginFailures("1"); - bruteForceDetectionPage.form().setWaitIncrementSelect(SecurityDefenses.TimeSelectValues.MINUTES); + bruteForceDetectionPage.form().setWaitIncrementSelect(BruteForceDetection.TimeSelectValues.MINUTES); bruteForceDetectionPage.form().setWaitIncrementInput("10"); bruteForceDetectionPage.form().save(); assertFlashMessageSuccess(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/users/RequiredUserActionsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/users/RequiredUserActionsTest.java index 9151698d89..d532ae6363 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/users/RequiredUserActionsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/users/RequiredUserActionsTest.java @@ -1,28 +1,24 @@ package org.keycloak.testsuite.console.users; -import static org.jboss.arquillian.graphene.Graphene.waitGui; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; import org.junit.Test; -import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD; -import static org.keycloak.testsuite.auth.page.AuthRealm.TEST; import org.keycloak.testsuite.auth.page.account.Account; import org.keycloak.testsuite.auth.page.login.UpdateAccount; import org.keycloak.testsuite.auth.page.login.UpdatePassword; import org.keycloak.testsuite.console.page.authentication.RequiredActions; import org.keycloak.testsuite.console.page.users.UserAttributes; - -import static org.keycloak.testsuite.model.RequiredUserAction.TERMS_AND_CONDITIONS; -import static org.keycloak.testsuite.model.RequiredUserAction.UPDATE_PASSWORD; -import static org.keycloak.testsuite.model.RequiredUserAction.UPDATE_PROFILE; -import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; - import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import static org.jboss.arquillian.graphene.Graphene.waitGui; +import static org.keycloak.representations.idm.CredentialRepresentation.PASSWORD; +import static org.keycloak.testsuite.auth.page.AuthRealm.TEST; +import static org.keycloak.testsuite.model.RequiredUserAction.*; +import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith; + /** - * * @author tkyjovsk * @author mhajas */ @@ -124,7 +120,7 @@ public class RequiredUserActionsTest extends AbstractUserTest { @Test public void termsAndConditions() { requiredActionsPage.navigateTo(); - requiredActionsPage.clickTermsAndConditionEnabled(); + requiredActionsPage.setTermsAndConditionEnabled(true); manage().users(); usersPage.table().viewAllUsers(); @@ -142,6 +138,4 @@ public class RequiredUserActionsTest extends AbstractUserTest { } - - }