Refactoring

This commit is contained in:
mhajas 2015-09-25 09:10:17 +02:00
parent 8ef6602f82
commit 8f1daf5d77
16 changed files with 387 additions and 378 deletions

View file

@ -17,48 +17,48 @@ public class Bindings extends Authentication{
@FindBy(id = "browser") @FindBy(id = "browser")
private Select BrowserFlowSelect; 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) { public void changeBrowserFlowSelect(BrowserFlowSelectValues value) {
BrowserFlowSelect.selectByVisibleText(value.getName()); BrowserFlowSelect.selectByVisibleText(value.getName());
} }
@FindBy(id = "registration")
private Select RegistrationFlowSelect;
public void changeRegistrationFlowSelect(RegistrationFlowSelectValues value) { public void changeRegistrationFlowSelect(RegistrationFlowSelectValues value) {
RegistrationFlowSelect.selectByVisibleText(value.getName()); RegistrationFlowSelect.selectByVisibleText(value.getName());
} }
@FindBy(id = "grant")
private Select DirectGrantFlowSelect;
public void changeDirectGrantFlowSelect(DirectGrantFlowSelectValues value) { public void changeDirectGrantFlowSelect(DirectGrantFlowSelectValues value) {
DirectGrantFlowSelect.selectByVisibleText(value.getName()); DirectGrantFlowSelect.selectByVisibleText(value.getName());
} }
@FindBy(id = "resetCredentials")
private Select ResetCredentialsSelect;
public void changeResetCredentialsSelect(ResetCredentialsSelectValues value) { public void changeResetCredentialsSelect(ResetCredentialsSelectValues value) {
ResetCredentialsSelect.selectByVisibleText(value.getName()); ResetCredentialsSelect.selectByVisibleText(value.getName());
} }
@FindBy(id = "clientAuthentication")
private Select ClientAuthenticationSelect;
public void changeClientAuthenticationSelect(ClientAuthenticationSelectValues value) { public void changeClientAuthenticationSelect(ClientAuthenticationSelectValues value) {
ClientAuthenticationSelect.selectByVisibleText(value.getName()); ClientAuthenticationSelect.selectByVisibleText(value.getName());
} }
@FindBy(xpath = "//button[text()='Save']")
private WebElement saveButton;
public void clickSave() { public void clickSave() {
saveButton.click(); saveButton.click();
} }
@FindBy(xpath = "//button[text()='Cancel']")
private WebElement cancelButton;
public void clickCancel() { public void clickCancel() {
cancelButton.click(); cancelButton.click();
} }
@ -143,5 +143,4 @@ public class Bindings extends Authentication{
} }
} }

View file

@ -19,9 +19,14 @@ public class Flows extends Authentication {
@FindBy(tagName = "select") @FindBy(tagName = "select")
private Select flowSelect; private Select flowSelect;
public void changeFlowSelect(FlowSelectValues value) { @FindBy(linkText = "New")
flowSelect.selectByVisibleText(value.getName()); private WebElement newButton;
}
@FindBy(linkText = "Copy")
private WebElement copyButton;
@FindBy(tagName = "table")
private WebElement flowsTable;
public enum FlowSelectValues { public enum FlowSelectValues {
@ -37,13 +42,12 @@ public class Flows extends Authentication {
public String getName() { public String getName() {
return name; return name;
} }
} }
@FindBy(linkText = "New") public void changeFlowSelect(FlowSelectValues value) {
private WebElement newButton; flowSelect.selectByVisibleText(value.getName());
}
@FindBy(linkText = "Copy")
private WebElement copyButton;
public void clickNew() { public void clickNew() {
newButton.click(); newButton.click();
@ -53,160 +57,156 @@ public class Flows extends Authentication {
copyButton.click(); 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 // Direct grant
public void setPasswordRequired() { 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() { 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() { 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() { 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() { 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 // Registration
public void setRegistrationFormRequired() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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 // Browser
public void setCookieAlternative() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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() { 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 // Reset credentials
public void setResetPasswordRequired() { 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() { 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() { 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() { 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() { 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() { 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 // 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() { 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() { public void setClientIdAndSecretDisabled() {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,'Client Id and Secret')]]/../td[4]//input[@type='radio']")).click(); clickRadioButton("Client Id and Secret", 3);
}
public void setSignedJwtRequired() {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()[contains(.,' Signed Jwt')]]/../td[2]//input[@type='radio']")).click();
} }
public void setSignedJwtAlternative() { 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() { 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);
} }
} }

View file

@ -19,20 +19,20 @@ public class OTPPolicy extends Authentication {
@FindBy(linkText = "Cancel") @FindBy(linkText = "Cancel")
private WebElement cancelButton; private WebElement cancelButton;
@FindBy(id = "lookAhead")
private WebElement lookAheadInput;
@FindBy(id = "counter")
private WebElement initialCounterInput;
public void clickCancel() { public void clickCancel() {
cancelButton.click(); cancelButton.click();
} }
@FindBy(id = "lookAhead")
private WebElement lookAheadInput;
public void setLookAheadInputValue(String value) { public void setLookAheadInputValue(String value) {
Form.setInputValue(lookAheadInput, value); Form.setInputValue(lookAheadInput, value);
} }
@FindBy(id = "counter")
private WebElement initialCounterInput;
public void setInitialcounterInputValue(String value) { public void setInitialcounterInputValue(String value) {
Form.setInputValue(initialCounterInput, value); Form.setInputValue(initialCounterInput, value);
} }

View file

@ -1,14 +1,15 @@
package org.keycloak.testsuite.console.page.authentication; package org.keycloak.testsuite.console.page.authentication;
import java.util.List;
import org.jboss.arquillian.graphene.findby.ByJQuery; import org.jboss.arquillian.graphene.findby.ByJQuery;
import static org.keycloak.testsuite.util.WaitUtils.waitGuiForElement;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.Select;
import java.util.List;
import static org.keycloak.testsuite.util.WaitUtils.waitGuiForElement;
/** /**
* @author Petr Mensik * @author Petr Mensik
* @author tkyjovsk * @author tkyjovsk

View file

@ -1,6 +1,8 @@
package org.keycloak.testsuite.console.page.authentication; package org.keycloak.testsuite.console.page.authentication;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
/** /**
* @author tkyjovsk * @author tkyjovsk
@ -8,48 +10,62 @@ import org.openqa.selenium.By;
*/ */
public class RequiredActions extends Authentication { 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 @Override
public String getUriFragment() { public String getUriFragment() {
return super.getUriFragment() + "/required-actions"; return super.getUriFragment() + "/required-actions";
} }
public void clickTermsAndConditionEnabled() { private void setRequiredActionValue(String row, String column, boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Terms and Conditions']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); WebElement checkbox = requiredActionTable.findElement(By.xpath("//td[text()='" + row + "']/..//input[@ng-model='requiredAction." + column + "']"));
if (checkbox.isSelected() != value) {
checkbox.click();
}
} }
public void clickTermsAndConditionDefaultAction() { public void setTermsAndConditionEnabled(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Terms and Conditions']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); setRequiredActionValue("Terms and Conditions", ENABLED, value);
} }
public void clickVerifyEmailEnabled() { public void setTermsAndConditionDefaultAction(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Verify Email']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); setRequiredActionValue("Terms and Conditions", DEFAULT_ACTION, value);
} }
public void clickVerifyEmailDefaultAction() { public void setVerifyEmailEnabled(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Verify Email']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); setRequiredActionValue("Verify Email", ENABLED, value);
} }
public void clickUpdatePasswordEnabled() { public void setVerifyEmailDefaultAction(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Password']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); setRequiredActionValue("Verify Email", DEFAULT_ACTION, value);
} }
public void clickUpdatePasswordDefaultAction() { public void setUpdatePasswordEnabled(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Password']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); setRequiredActionValue("Update Password", ENABLED, value);
} }
public void clickConfigureTotpEnabled() { public void setUpdatePasswordDefaultAction(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Configure Totp']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); setRequiredActionValue("Update Password", DEFAULT_ACTION, value);
} }
public void clickConfigureTotpDefaultAction() { public void setConfigureTotpEnabled(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Configure Totp']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); setRequiredActionValue("Configure Totp", ENABLED, value);
} }
public void clickUpdateProfileEnabled() { public void setConfigureTotpDefaultAction(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Profile']/..//input[@type='checkbox' and @ng-model='requiredAction.enabled']")).click(); setRequiredActionValue("Configure Totp", DEFAULT_ACTION, value);
} }
public void clickUpdateProfileDefaultAction() { public void setUpdateProfileEnabled(boolean value) {
driver.findElement(By.xpath("//td[@class='ng-binding' and text()='Update Profile']/..//input[@type='checkbox' and @ng-model='requiredAction.defaultAction']")).click(); setRequiredActionValue("Update Profile", ENABLED, value);
}
public void setUpdateProfileDefaultAction(boolean value) {
setRequiredActionValue("Update Profile", DEFAULT_ACTION, value);
} }
} }

View file

@ -7,7 +7,6 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
/** /**
*
* @author tkyjovsk * @author tkyjovsk
* @author mhajas * @author mhajas
*/ */
@ -27,6 +26,12 @@ public class AdminEvents extends Events {
public class AdminEventsTable extends DataTable { public class AdminEventsTable extends DataTable {
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;
@FindBy(tagName = "form")
private AdminEventsTableFilterForm filterForm;
public void update() { public void update() {
waitAjaxForBody(); waitAjaxForBody();
clickHeaderButton("Update"); clickHeaderButton("Update");
@ -37,63 +42,63 @@ public class AdminEvents extends Events {
clickHeaderButton("Reset"); clickHeaderButton("Reset");
} }
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;
public void filter() { public void filter() {
waitAjaxForBody(); waitAjaxForBody();
filterButton.click(); filterButton.click();
} }
@FindBy(tagName = "form")
private AdminEventsTableFilterForm filterForm;
public AdminEventsTableFilterForm filterForm() { public AdminEventsTableFilterForm filterForm() {
return filterForm; return filterForm;
} }
public class AdminEventsTableFilterForm extends Form { 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) { public void addOperationType(String type) {
driver.findElement(By.xpath("//div[@id='s2id_adminEnabledEventOperations']/ul")).click(); operationTypesInput.click();
driver.findElement(By.xpath("//div[@id='select2-drop']//div[text()[contains(.,'" + type + "')]]/..")).click(); operationTypesValues.findElement(By.xpath("//div[text() = '" + type + "']")).click();
} }
public void removeOperationType(String type) { 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) { public void setResourcePathInput(String value) {
setInputValue(resourcePathInput, value); setInputValue(resourcePathInput, value);
} }
@FindBy(id = "realm")
private WebElement realmInput;
public void setRealmInput(String value) { public void setRealmInput(String value) {
setInputValue(realmInput, value); setInputValue(realmInput, value);
} }
@FindBy(id = "client")
private WebElement clientInput;
public void setClientInput(String value) { public void setClientInput(String value) {
setInputValue(clientInput, value); setInputValue(clientInput, value);
} }
@FindBy(id = "user")
private WebElement userInput;
public void setUserInput(String value) { public void setUserInput(String value) {
setInputValue(userInput, value); setInputValue(userInput, value);
} }
@FindBy(id = "ipAddress")
private WebElement ipAddressInput;
public void setIpAddressInput(String value) { public void setIpAddressInput(String value) {
setInputValue(ipAddressInput, value); setInputValue(ipAddressInput, value);
} }

View file

@ -32,6 +32,33 @@ public class Config extends Events {
@FindBy(xpath = "//div[@id='s2id_autogen1']/..//select") @FindBy(xpath = "//div[@id='s2id_autogen1']/..//select")
private Select eventListenersSelect; 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) { public void addEventListener(String listener) {
eventListenersInput.click(); eventListenersInput.click();
eventListenersSelect.selectByVisibleText(listener); eventListenersSelect.selectByVisibleText(listener);
@ -41,19 +68,10 @@ public class Config extends Events {
eventListenersInput.findElement(By.xpath("//div[text()='" + listener + "']/../a")).click(); 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) { public void setSaveEvents(boolean value) {
SaveEvents.setOn(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) { public void addSaveType(String type) {
savedTypesInput.click(); savedTypesInput.click();
savedTypesOptions.findElement(By.xpath("//div[text()='" + type + "']")).click(); savedTypesOptions.findElement(By.xpath("//div[text()='" + type + "']")).click();
@ -64,36 +82,24 @@ public class Config extends Events {
} }
public void clearLoginEvents() { 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) { public void setExpiration(String value, String unit) {
expirationUnitSelect.selectByVisibleText(unit); expirationUnitSelect.selectByVisibleText(unit);
Form.setInputValue(expirationInput, value); Form.setInputValue(expirationInput, value);
} }
@FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsEnabled']]")
private OnOffSwitch saveAdminEvents;
public void setSaveAdminEvents(boolean value) { public void setSaveAdminEvents(boolean value) {
saveAdminEvents.setOn(value); saveAdminEvents.setOn(value);
} }
@FindBy(xpath = ".//div[@class='onoffswitch' and ./input[@id='adminEventsDetailsEnabled']]")
private OnOffSwitch includeRepresentation;
public void setIncludeRepresentation(boolean value) { public void setIncludeRepresentation(boolean value) {
includeRepresentation.setOn(value); includeRepresentation.setOn(value);
} }
public void clearAdminEvents() { public void clearAdminEvents() {
driver.findElement(By.xpath("//button[@data-ng-click='clearAdminEvents()']")).click(); clearAdminEventsButton.click();
} }
} }
} }

View file

@ -26,6 +26,12 @@ public class LoginEvents extends Events {
public class LoginEventsTable extends DataTable { public class LoginEventsTable extends DataTable {
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;
@FindBy(tagName = "form")
private LoginEventsTableFilterForm filterForm;
public void update() { public void update() {
waitAjaxForBody(); waitAjaxForBody();
clickHeaderButton("Update"); clickHeaderButton("Update");
@ -36,42 +42,42 @@ public class LoginEvents extends Events {
clickHeaderButton("Reset"); clickHeaderButton("Reset");
} }
@FindBy(xpath = "//button[text()[contains(.,'Filter')]]")
private WebElement filterButton;
public void filter() { public void filter() {
waitAjaxForBody(); waitAjaxForBody();
filterButton.click(); filterButton.click();
} }
@FindBy(tagName = "form")
private LoginEventsTableFilterForm filterForm;
public LoginEventsTableFilterForm filterForm() { public LoginEventsTableFilterForm filterForm() {
return filterForm; return filterForm;
} }
public class LoginEventsTableFilterForm extends Form { 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) { public void addEventType(String type) {
driver.findElement(By.xpath("//div[@id='s2id_eventTypes']/ul")).click(); eventTypeInput.click();
driver.findElement(By.xpath("//div[@id='select2-drop']//div[text()='" + type + "']/..")).click(); eventTypeValues.findElement(By.xpath("//div[text()='" + type + "']")).click();
} }
public void removeOperationType(String type) { 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) { public void setClientInput(String value) {
setInputValue(clientInput, value); setInputValue(clientInput, value);
} }
@FindBy(id = "user")
private WebElement userInput;
public void setUserInput(String value) { public void setUserInput(String value) {
setInputValue(userInput, value); setInputValue(userInput, value);
} }

View file

@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -18,13 +18,7 @@
package org.keycloak.testsuite.console.page.realm; package org.keycloak.testsuite.console.page.realm;
import org.jboss.arquillian.graphene.findby.FindByJQuery; 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.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
/** /**
* @author Filip Kiss * @author Filip Kiss
@ -37,160 +31,16 @@ public class SecurityDefenses extends RealmSettings {
return super.getUriFragment() + "/defense"; // NOTE: page doesn't exist, only subpages 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')") @FindByJQuery("a:contains('Brute Force Detection')")
private WebElement bruteForceDetectionTab; private WebElement bruteForceDetectionTab;
@FindByJQuery("a:contains('Headers')")
private WebElement headersTab;
public void goToBruteForceDetection() { public void goToBruteForceDetection() {
bruteForceDetectionTab.click(); bruteForceDetectionTab.click();
} }
@FindByJQuery("a:contains('Headers')")
private WebElement headersTab;
public void goToHeaders() { public void goToHeaders() {
headersTab.click(); headersTab.click();
} }

View file

@ -22,9 +22,9 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.keycloak.testsuite.console.AbstractConsoleTest; import org.keycloak.testsuite.console.AbstractConsoleTest;
import org.keycloak.testsuite.console.page.authentication.PasswordPolicy; 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 static org.keycloak.testsuite.console.page.authentication.PasswordPolicy.Type.*;
import org.keycloak.testsuite.console.page.users.UserCredentials;
/** /**
* @author Petr Mensik * @author Petr Mensik

View file

@ -19,7 +19,6 @@ package org.keycloak.testsuite.console.authentication;
import org.jboss.arquillian.graphene.page.Page; import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.auth.page.login.Registration; import org.keycloak.testsuite.auth.page.login.Registration;
@ -57,43 +56,11 @@ public class RequiredActionsTest extends AbstractConsoleTest {
requiredActionsPage.navigateTo(); 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 @Test
public void termsAndConditionsDefaultActionTest() { public void termsAndConditionsDefaultActionTest() {
requiredActionsPage.clickTermsAndConditionEnabled(); requiredActionsPage.setTermsAndConditionEnabled(true);
requiredActionsPage.clickTermsAndConditionDefaultAction(); requiredActionsPage.setTermsAndConditionDefaultAction(true);
assertFlashMessageSuccess();
allowTestRealmUserRegistration(); allowTestRealmUserRegistration();
@ -106,7 +73,8 @@ public class RequiredActionsTest extends AbstractConsoleTest {
@Test @Test
public void configureTotpDefaultActionTest() { public void configureTotpDefaultActionTest() {
requiredActionsPage.clickConfigureTotpDefaultAction(); requiredActionsPage.setConfigureTotpDefaultAction(true);
assertFlashMessageSuccess();
allowTestRealmUserRegistration(); allowTestRealmUserRegistration();

View file

@ -21,7 +21,7 @@ import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.keycloak.testsuite.auth.page.account.Account; 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.UserAttributes;
import org.keycloak.testsuite.console.page.users.Users; import org.keycloak.testsuite.console.page.users.Users;
import org.openqa.selenium.By; import org.openqa.selenium.By;
@ -41,7 +41,7 @@ import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
public class SecurityDefensesTest extends AbstractRealmTest { public class SecurityDefensesTest extends AbstractRealmTest {
@Page @Page
private SecurityDefenses.BruteForceDetection bruteForceDetectionPage; private BruteForceDetection bruteForceDetectionPage;
@Page @Page
private Account testRealmAccountPage; private Account testRealmAccountPage;
@ -69,7 +69,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setProtectionEnabled(true);
bruteForceDetectionPage.form().setMaxLoginFailures("1"); bruteForceDetectionPage.form().setMaxLoginFailures("1");
bruteForceDetectionPage.form().setWaitIncrementSelect(SecurityDefenses.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setWaitIncrementSelect(BruteForceDetection.TimeSelectValues.SECONDS);
bruteForceDetectionPage.form().setWaitIncrementInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().setWaitIncrementInput(String.valueOf(secondsToWait));
bruteForceDetectionPage.form().save(); bruteForceDetectionPage.form().save();
assertFlashMessageSuccess(); assertFlashMessageSuccess();
@ -110,7 +110,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setProtectionEnabled(true);
bruteForceDetectionPage.form().setMaxLoginFailures("100"); bruteForceDetectionPage.form().setMaxLoginFailures("100");
bruteForceDetectionPage.form().setQuickLoginCheckInput("1500"); bruteForceDetectionPage.form().setQuickLoginCheckInput("1500");
bruteForceDetectionPage.form().setMinQuickLoginWaitSelect(SecurityDefenses.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setMinQuickLoginWaitSelect(BruteForceDetection.TimeSelectValues.SECONDS);
bruteForceDetectionPage.form().setMinQuickLoginWaitInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().setMinQuickLoginWaitInput(String.valueOf(secondsToWait));
bruteForceDetectionPage.form().save(); bruteForceDetectionPage.form().save();
assertFlashMessageSuccess(); assertFlashMessageSuccess();
@ -150,7 +150,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setProtectionEnabled(true);
bruteForceDetectionPage.form().setMaxLoginFailures("1"); bruteForceDetectionPage.form().setMaxLoginFailures("1");
bruteForceDetectionPage.form().setMaxWaitSelect(SecurityDefenses.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setMaxWaitSelect(BruteForceDetection.TimeSelectValues.SECONDS);
bruteForceDetectionPage.form().setMaxWaitInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().setMaxWaitInput(String.valueOf(secondsToWait));
bruteForceDetectionPage.form().save(); bruteForceDetectionPage.form().save();
@ -190,7 +190,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setProtectionEnabled(true);
bruteForceDetectionPage.form().setMaxLoginFailures("2"); bruteForceDetectionPage.form().setMaxLoginFailures("2");
bruteForceDetectionPage.form().setFailureResetTimeSelect(SecurityDefenses.TimeSelectValues.SECONDS); bruteForceDetectionPage.form().setFailureResetTimeSelect(BruteForceDetection.TimeSelectValues.SECONDS);
bruteForceDetectionPage.form().setFailureResetTimeInput(String.valueOf(secondsToWait)); bruteForceDetectionPage.form().setFailureResetTimeInput(String.valueOf(secondsToWait));
bruteForceDetectionPage.form().save(); bruteForceDetectionPage.form().save();
assertFlashMessageSuccess(); assertFlashMessageSuccess();
@ -223,7 +223,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
public void userUnlockTest() { public void userUnlockTest() {
bruteForceDetectionPage.form().setProtectionEnabled(true); bruteForceDetectionPage.form().setProtectionEnabled(true);
bruteForceDetectionPage.form().setMaxLoginFailures("1"); bruteForceDetectionPage.form().setMaxLoginFailures("1");
bruteForceDetectionPage.form().setWaitIncrementSelect(SecurityDefenses.TimeSelectValues.MINUTES); bruteForceDetectionPage.form().setWaitIncrementSelect(BruteForceDetection.TimeSelectValues.MINUTES);
bruteForceDetectionPage.form().setWaitIncrementInput("10"); bruteForceDetectionPage.form().setWaitIncrementInput("10");
bruteForceDetectionPage.form().save(); bruteForceDetectionPage.form().save();
assertFlashMessageSuccess(); assertFlashMessageSuccess();

View file

@ -1,28 +1,24 @@
package org.keycloak.testsuite.console.users; package org.keycloak.testsuite.console.users;
import static org.jboss.arquillian.graphene.Graphene.waitGui;
import org.jboss.arquillian.graphene.page.Page; import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; 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.account.Account;
import org.keycloak.testsuite.auth.page.login.UpdateAccount; import org.keycloak.testsuite.auth.page.login.UpdateAccount;
import org.keycloak.testsuite.auth.page.login.UpdatePassword; import org.keycloak.testsuite.auth.page.login.UpdatePassword;
import org.keycloak.testsuite.console.page.authentication.RequiredActions; import org.keycloak.testsuite.console.page.authentication.RequiredActions;
import org.keycloak.testsuite.console.page.users.UserAttributes; 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.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; 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 tkyjovsk
* @author mhajas * @author mhajas
*/ */
@ -124,7 +120,7 @@ public class RequiredUserActionsTest extends AbstractUserTest {
@Test @Test
public void termsAndConditions() { public void termsAndConditions() {
requiredActionsPage.navigateTo(); requiredActionsPage.navigateTo();
requiredActionsPage.clickTermsAndConditionEnabled(); requiredActionsPage.setTermsAndConditionEnabled(true);
manage().users(); manage().users();
usersPage.table().viewAllUsers(); usersPage.table().viewAllUsers();
@ -142,6 +138,4 @@ public class RequiredUserActionsTest extends AbstractUserTest {
} }
} }