KEYCLOAK-4650 Add cancel warning test

This commit is contained in:
mhajas 2017-04-28 12:14:57 +02:00
parent bbed1ffca7
commit 618a8e7f90
2 changed files with 22 additions and 0 deletions

View file

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

View file

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