diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/otp-policy.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/otp-policy.html index bf06303969..1f8890e7d7 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/otp-policy.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/otp-policy.html @@ -54,7 +54,7 @@
- +
What should the initial counter value be?
diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Authentication.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Authentication.java index 05b00246d2..858de4093c 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Authentication.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/authentication/Authentication.java @@ -3,7 +3,7 @@ package org.keycloak.testsuite.console.page.authentication; import org.keycloak.testsuite.console.page.AdminConsoleRealm; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; -import static org.keycloak.testsuite.util.WaitUtils.waitAjaxForElement; +import static org.keycloak.testsuite.util.WaitUtils.*; /** * @author tkyjovsk @@ -20,6 +20,9 @@ public class Authentication extends AdminConsoleRealm { @FindBy(xpath = "//div[contains(@class, 'alert-success')]") private WebElement success; + @FindBy(xpath = "//button[@class='close']/span") + private WebElement close; + public String getSuccessMessage() { waitAjaxForElement(success); return success.getText(); @@ -30,6 +33,13 @@ public class Authentication extends AdminConsoleRealm { return error.getText(); } + public void closeNotification() { + if (close.isDisplayed()) { + close.click(); + } + waitAjaxForElementNotVisible(close); + } + public AuthenticationTabs tabs() { return authenticationTabs; } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/WaitUtils.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/WaitUtils.java index ac6ed22e4d..7b0fdb14b8 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/WaitUtils.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/WaitUtils.java @@ -41,6 +41,11 @@ public final class WaitUtils { .element(element).is().not().present(); } + public static void waitAjaxForElementNotVisible(WebElement element) { + waitAjax().until() + .element(element).is().not().visible(); + } + public static void waitGuiForElement(By element, String message) { waitGui().until(message) .element(element).is().present(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/OTPPolicyTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/OTPPolicyTest.java index 72455e216a..d9f8f89bd0 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/OTPPolicyTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/console/authentication/OTPPolicyTest.java @@ -24,6 +24,7 @@ package org.keycloak.testsuite.console.authentication; import org.jboss.arquillian.graphene.page.Page; import static org.junit.Assert.*; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.testsuite.console.AbstractConsoleTest; @@ -66,42 +67,58 @@ public class OTPPolicyTest extends AbstractConsoleTest { } @Test + @Ignore //KEYCLOAK-2051 when you close notification, it is not displayed again public void invalidValuesTest() { otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.EMPTY, "", "30"); assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); + otpPolicyPage.closeNotification(); + otpPolicyPage.navigateTo();// workaround: input.clear() doesn't work when