Merge pull request #3523 from vmuzikar/KEYCLOAK-3872-2
KEYCLOAK-3872 Stabilize PasswordPolicy UI test
This commit is contained in:
commit
9711ac2ecb
2 changed files with 8 additions and 6 deletions
|
@ -6,6 +6,7 @@ import org.openqa.selenium.WebElement;
|
|||
import org.openqa.selenium.support.FindBy;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
|
||||
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||
|
||||
/**
|
||||
|
@ -33,8 +34,9 @@ public class PasswordPolicy extends Authentication {
|
|||
public void addPolicy(Type policy, String value) {
|
||||
waitUntilElement(addPolicySelectElement).is().present();
|
||||
addPolicySelect.selectByVisibleText(policy.getName());
|
||||
setPolicyValue(policy, value);
|
||||
if (value != null) {setPolicyValue(policy, value);}
|
||||
primaryButton.click();
|
||||
waitForPageToLoad(driver);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,15 +45,13 @@ public class PasswordPolicy extends Authentication {
|
|||
}
|
||||
|
||||
public void addPolicy(Type policy) {
|
||||
addPolicySelect.selectByVisibleText(policy.getName());
|
||||
primaryButton.click();
|
||||
addPolicy(policy, null);
|
||||
}
|
||||
|
||||
public void removePolicy(Type policy) {
|
||||
getPolicyRow(policy).findElement(By.cssSelector("td.kc-action-cell")).click();
|
||||
if (!primaryButton.isDisplayed()) {
|
||||
primaryButton.click();
|
||||
}
|
||||
primaryButton.click();
|
||||
waitForPageToLoad(driver);
|
||||
}
|
||||
|
||||
public void editPolicy(Type policy, int value) {
|
||||
|
@ -61,6 +61,7 @@ public class PasswordPolicy extends Authentication {
|
|||
public void editPolicy(Type policy, String value) {
|
||||
setPolicyValue(policy, value);
|
||||
primaryButton.click();
|
||||
waitForPageToLoad(driver);
|
||||
}
|
||||
|
||||
private void setPolicyValue(Type policy, String value) {
|
||||
|
|
|
@ -49,6 +49,7 @@ public class PasswordPolicyTest extends AbstractConsoleTest {
|
|||
public void testAddAndRemovePolicy() {
|
||||
passwordPolicyPage.navigateTo();
|
||||
passwordPolicyPage.addPolicy(DIGITS, 5);
|
||||
assertAlertSuccess();
|
||||
passwordPolicyPage.removePolicy(DIGITS);
|
||||
assertAlertSuccess();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue