From 9bde0af0f13cfcd65016dfe3e48d9a0ee32df5ac Mon Sep 17 00:00:00 2001 From: Vaclav Muzikar Date: Mon, 15 Feb 2016 17:02:38 +0100 Subject: [PATCH] Fix InternationalizationTest (cherry picked from commit d58a575) --- .../testsuite/console/page/fragment/Dropdown.java | 11 ++++++++--- .../testsuite/console/page/realm/RealmSettings.java | 10 ++++++++++ .../console/realm/InternationalizationTest.java | 1 + 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/Dropdown.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/Dropdown.java index 8661a04051..070e6c7c36 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/Dropdown.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/Dropdown.java @@ -6,6 +6,8 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; +import static org.keycloak.testsuite.util.WaitUtils.*; + /** * @author Vaclav Muzikar */ @@ -17,11 +19,14 @@ public class Dropdown { private WebDriver driver; public String getSelected() { - return dropDownRoot.findElement(By.xpath("./a")).getText(); + waitUntilElement(dropDownRoot).is().present(); + WebElement element = dropDownRoot.findElement(By.xpath("./a")); + return element.getText(); } public void selectByText(String text) { - String href = dropDownRoot.findElement(By.xpath("./ul/li/a[text()='" + text + "']")).getAttribute("href"); - driver.navigate().to(href); + waitUntilElement(dropDownRoot).is().present(); + WebElement element = dropDownRoot.findElement(By.xpath("./ul/li/a[text()='" + text + "']")); + driver.navigate().to(element.getAttribute("href")); } } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/realm/RealmSettings.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/realm/RealmSettings.java index 347108dd6f..208096227c 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/realm/RealmSettings.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/realm/RealmSettings.java @@ -4,6 +4,8 @@ import org.keycloak.testsuite.console.page.AdminConsoleRealm; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import static org.keycloak.testsuite.util.WaitUtils.*; + /** * * @author tkyjovsk @@ -37,34 +39,42 @@ public class RealmSettings extends AdminConsoleRealm { private WebElement defenseTab; public void general() { + waitUntilElement(generalSettingsTab).is().present(); generalSettingsTab.click(); } public void login() { + waitUntilElement(loginSettingsTab).is().present(); loginSettingsTab.click(); } public void keys() { + waitUntilElement(keysSettingsTab).is().present(); keysSettingsTab.click(); } public void email() { + waitUntilElement(emailSettingsTab).is().present(); emailSettingsTab.click(); } public void themes() { + waitUntilElement(themeSettingsTab).is().present(); themeSettingsTab.click(); } public void cache() { + waitUntilElement(cacheSettingsTab).is().present(); cacheSettingsTab.click(); } public void tokens() { + waitUntilElement(tokenSettingsTab).is().present(); tokenSettingsTab.click(); } public void securityDefenses() { + waitUntilElement(defenseTab).is().present(); defenseTab.click(); } diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/InternationalizationTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/InternationalizationTest.java index 7cb21a6a8d..623f936ad5 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/InternationalizationTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/InternationalizationTest.java @@ -29,6 +29,7 @@ public class InternationalizationTest extends AbstractRealmTest { tabs().themes(); themeSettingsPage.setInternatEnabled(true); themeSettingsPage.saveTheme(); + assertAlertSuccess(); realmSettingsPage.setAdminRealm(AuthRealm.TEST); accountPage.setAuthRealm(testRealmPage); deleteAllCookiesForTestRealm();