KEYCLOAK-2745 More UI tests stabilization

This commit is contained in:
Vaclav Muzikar 2016-04-05 10:13:40 +02:00
parent 1f26765546
commit 3dbf5ee389
5 changed files with 17 additions and 32 deletions

View file

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

View file

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

View file

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

View file

@ -52,7 +52,7 @@ public class OTPPolicyTest extends AbstractConsoleTest {
@Test
public void otpPolicyTest() {
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();
assertEquals("hotp", realm.getOtpPolicyType());
@ -62,7 +62,7 @@ public class OTPPolicyTest extends AbstractConsoleTest {
assertEquals(Integer.valueOf(50), realm.getOtpPolicyInitialCounter());
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();
assertEquals(Integer.valueOf(40), realm.getOtpPolicyPeriod());
@ -71,54 +71,45 @@ public class OTPPolicyTest extends AbstractConsoleTest {
@Test
public void invalidValuesTest() {
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();// workaround: input.clear() doesn't work when <input type="number" ...
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
RealmRepresentation realm = testRealmResource().toRepresentation();
assertEquals(Integer.valueOf(1), realm.getOtpPolicyLookAheadWindow());
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
realm = testRealmResource().toRepresentation();
assertEquals(Integer.valueOf(30), realm.getOtpPolicyPeriod());
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
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());
otpPolicyPage.closeNotification();
assertAlertDanger();
otpPolicyPage.navigateTo();
realm = testRealmResource().toRepresentation();

View file

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