Merge pull request #2500 from vmuzikar/master

KEYCLOAK-2745 More UI tests stabilization
This commit is contained in:
Stian Thorgersen 2016-04-05 11:19:01 +02:00
commit 373ded9761
5 changed files with 17 additions and 32 deletions

View file

@ -53,7 +53,7 @@ public class ModalDialog {
waitUntilElement(deleteButton).is().present(); waitUntilElement(deleteButton).is().present();
deleteButton.click(); deleteButton.click();
waitUntilElement(root).is().not().present(); waitUntilElement(root).is().not().present();
pause(100); pause(200);
} }
public void cancel() { public void cancel() {

View file

@ -45,6 +45,7 @@ public class Form {
public void save() { public void save() {
// guardAjax(save).click(); // guardAjax(save).click();
waitUntilElement(save).is().present();
save.click(); save.click();
} }

View file

@ -192,6 +192,7 @@ public class LdapUserProviderForm extends Form {
} }
public void selectVendor(int index) { public void selectVendor(int index) {
waitUntilElement(By.id("vendor")).is().present();
vendorSelect.selectByIndex(index); vendorSelect.selectByIndex(index);
} }
@ -233,20 +234,11 @@ public class LdapUserProviderForm extends Form {
} }
public void setAccountAfterPasswordUpdateEnabled(boolean enabled) { public void setAccountAfterPasswordUpdateEnabled(boolean enabled) {
if ((!enableAccountAfterPasswordUpdate.isOn() && enabled) enableAccountAfterPasswordUpdate.setOn(enabled);
|| !enabled && enableAccountAfterPasswordUpdate.isOn()) {
driver.findElement(By
.xpath("//div[contains(@class,'onoffswitch') and ./input[@id='userAccountControlsAfterPasswordUpdate']]"))
.findElements(By.tagName("span")).get(0).click();
}
} }
public void setAllowKerberosAuthEnabled(boolean enabled) { public void setAllowKerberosAuthEnabled(boolean enabled) {
if ((!allowKerberosAuth.isOn() && enabled) || !enabled && allowKerberosAuth.isOn()) { allowKerberosAuth.setOn(enabled);
driver.findElement(
By.xpath("//div[contains(@class,'onoffswitch') and ./input[@id='allowKerberosAuthentication']]"))
.findElements(By.tagName("span")).get(0).click();
}
} }
public void setDebugEnabled(boolean debugEnabled) { public void setDebugEnabled(boolean debugEnabled) {

View file

@ -52,7 +52,7 @@ public class OTPPolicyTest extends AbstractConsoleTest {
@Test @Test
public void otpPolicyTest() { public void otpPolicyTest() {
otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA256, Digits.EIGHT, "10", "50"); otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA256, Digits.EIGHT, "10", "50");
assertEquals("Success! Your changes have been saved to the realm.", otpPolicyPage.getSuccessMessage()); assertAlertSuccess();
RealmRepresentation realm = testRealmResource().toRepresentation(); RealmRepresentation realm = testRealmResource().toRepresentation();
assertEquals("hotp", realm.getOtpPolicyType()); assertEquals("hotp", realm.getOtpPolicyType());
@ -62,7 +62,7 @@ public class OTPPolicyTest extends AbstractConsoleTest {
assertEquals(Integer.valueOf(50), realm.getOtpPolicyInitialCounter()); assertEquals(Integer.valueOf(50), realm.getOtpPolicyInitialCounter());
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA512, Digits.EIGHT, "10", "40"); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA512, Digits.EIGHT, "10", "40");
assertEquals("Success! Your changes have been saved to the realm.", otpPolicyPage.getSuccessMessage()); assertAlertSuccess();
realm = testRealmResource().toRepresentation(); realm = testRealmResource().toRepresentation();
assertEquals(Integer.valueOf(40), realm.getOtpPolicyPeriod()); assertEquals(Integer.valueOf(40), realm.getOtpPolicyPeriod());
@ -71,54 +71,45 @@ public class OTPPolicyTest extends AbstractConsoleTest {
@Test @Test
public void invalidValuesTest() { public void invalidValuesTest() {
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "", "30"); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "", "30");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo();// workaround: input.clear() doesn't work when <input type="number" ... otpPolicyPage.navigateTo();// workaround: input.clear() doesn't work when <input type="number" ...
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, " ", "30"); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, " ", "30");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "no number", "30"); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "no number", "30");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
RealmRepresentation realm = testRealmResource().toRepresentation(); RealmRepresentation realm = testRealmResource().toRepresentation();
assertEquals(Integer.valueOf(1), realm.getOtpPolicyLookAheadWindow()); assertEquals(Integer.valueOf(1), realm.getOtpPolicyLookAheadWindow());
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", ""); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", " "); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", " ");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "no number"); otpPolicyPage.form().setValues(OTPType.TIME_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "no number");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
realm = testRealmResource().toRepresentation(); realm = testRealmResource().toRepresentation();
assertEquals(Integer.valueOf(30), realm.getOtpPolicyPeriod()); assertEquals(Integer.valueOf(30), realm.getOtpPolicyPeriod());
otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", ""); otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", " "); otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", " ");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "no number"); otpPolicyPage.form().setValues(OTPType.COUNTER_BASED, OTPHashAlg.SHA1, Digits.SIX, "1", "no number");
assertEquals("Error! Missing or invalid field(s). Please verify the fields in red.", otpPolicyPage.getErrorMessage()); assertAlertDanger();
otpPolicyPage.closeNotification();
otpPolicyPage.navigateTo(); otpPolicyPage.navigateTo();
realm = testRealmResource().toRepresentation(); realm = testRealmResource().toRepresentation();

View file

@ -26,6 +26,7 @@ public class InternationalizationTest extends AbstractRealmTest {
@Before @Before
public void beforeInternationalizationTest() { public void beforeInternationalizationTest() {
realmSettingsPage.navigateTo();
tabs().themes(); tabs().themes();
themeSettingsPage.setInternatEnabled(true); themeSettingsPage.setInternatEnabled(true);
themeSettingsPage.saveTheme(); themeSettingsPage.saveTheme();