diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java index 501583f79f..fc26648c56 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/authentication/PasswordPolicy.java @@ -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) { diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java index f20348a6da..97a4b212b6 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/PasswordPolicyTest.java @@ -49,6 +49,7 @@ public class PasswordPolicyTest extends AbstractConsoleTest { public void testAddAndRemovePolicy() { passwordPolicyPage.navigateTo(); passwordPolicyPage.addPolicy(DIGITS, 5); + assertAlertSuccess(); passwordPolicyPage.removePolicy(DIGITS); assertAlertSuccess(); }