diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java index 2796fc41d9..9639749394 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/ModalDialog.java @@ -48,6 +48,9 @@ public class ModalDialog { @FindBy(id = "name") private WebElement nameInput; + @FindBy(className = "modal-body") + private WebElement message; + public void ok() { waitForModalFadeIn(driver); okButton.click(); @@ -70,4 +73,8 @@ public class ModalDialog { nameInput.clear(); nameInput.sendKeys(name); } + + public WebElement getMessage() { + return message; + } } \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/DisableAuthorizationSettingsTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/DisableAuthorizationSettingsTest.java index 3e3359e6db..0c60f0f170 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/DisableAuthorizationSettingsTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/DisableAuthorizationSettingsTest.java @@ -17,6 +17,8 @@ package org.keycloak.testsuite.console.authorization; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement; import org.junit.Test; @@ -25,10 +27,13 @@ import org.junit.Test; */ public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSettingsTest { + public static final String WARNING_MESSAGE = "Are you sure you want to disable authorization ? Once you save your changes, all authorization settings associated with this client will be removed. This operation can not be reverted."; + @Test public void testDisableAuthorization() throws InterruptedException { clientSettingsPage.navigateTo(); clientSettingsPage.form().setAuthorizationSettingsEnabled(false); + waitUntilElement(modalDialog.getMessage()).text().contains(WARNING_MESSAGE); clientSettingsPage.form().confirmDisableAuthorizationSettings(); Thread.sleep(1000); clientSettingsPage.form().save(); @@ -37,4 +42,14 @@ public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSetti clientSettingsPage.navigateTo(); assertFalse(clientSettingsPage.form().isAuthorizationSettingsEnabled()); } + + @Test + public void testCancelDisablingAuthorization() throws InterruptedException { + clientSettingsPage.navigateTo(); + clientSettingsPage.form().setAuthorizationSettingsEnabled(false); + waitUntilElement(modalDialog.getMessage()).text().contains(WARNING_MESSAGE); + modalDialog.cancel(); + Thread.sleep(1000); + assertTrue(clientSettingsPage.form().isAuthorizationSettingsEnabled()); + } }