KEYCLOAK-4650 Add cancel warning test
This commit is contained in:
parent
bbed1ffca7
commit
618a8e7f90
2 changed files with 22 additions and 0 deletions
|
@ -48,6 +48,9 @@ public class ModalDialog {
|
||||||
@FindBy(id = "name")
|
@FindBy(id = "name")
|
||||||
private WebElement nameInput;
|
private WebElement nameInput;
|
||||||
|
|
||||||
|
@FindBy(className = "modal-body")
|
||||||
|
private WebElement message;
|
||||||
|
|
||||||
public void ok() {
|
public void ok() {
|
||||||
waitForModalFadeIn(driver);
|
waitForModalFadeIn(driver);
|
||||||
okButton.click();
|
okButton.click();
|
||||||
|
@ -70,4 +73,8 @@ public class ModalDialog {
|
||||||
nameInput.clear();
|
nameInput.clear();
|
||||||
nameInput.sendKeys(name);
|
nameInput.sendKeys(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebElement getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -17,6 +17,8 @@
|
||||||
package org.keycloak.testsuite.console.authorization;
|
package org.keycloak.testsuite.console.authorization;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -25,10 +27,13 @@ import org.junit.Test;
|
||||||
*/
|
*/
|
||||||
public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSettingsTest {
|
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
|
@Test
|
||||||
public void testDisableAuthorization() throws InterruptedException {
|
public void testDisableAuthorization() throws InterruptedException {
|
||||||
clientSettingsPage.navigateTo();
|
clientSettingsPage.navigateTo();
|
||||||
clientSettingsPage.form().setAuthorizationSettingsEnabled(false);
|
clientSettingsPage.form().setAuthorizationSettingsEnabled(false);
|
||||||
|
waitUntilElement(modalDialog.getMessage()).text().contains(WARNING_MESSAGE);
|
||||||
clientSettingsPage.form().confirmDisableAuthorizationSettings();
|
clientSettingsPage.form().confirmDisableAuthorizationSettings();
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
clientSettingsPage.form().save();
|
clientSettingsPage.form().save();
|
||||||
|
@ -37,4 +42,14 @@ public class DisableAuthorizationSettingsTest extends AbstractAuthorizationSetti
|
||||||
clientSettingsPage.navigateTo();
|
clientSettingsPage.navigateTo();
|
||||||
assertFalse(clientSettingsPage.form().isAuthorizationSettingsEnabled());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue