Fix InternationalizationTest

(cherry picked from commit d58a575)
This commit is contained in:
Vaclav Muzikar 2016-02-15 17:02:38 +01:00
parent 8006c64dba
commit 9bde0af0f1
3 changed files with 19 additions and 3 deletions

View file

@ -6,6 +6,8 @@ import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import static org.keycloak.testsuite.util.WaitUtils.*;
/** /**
* @author Vaclav Muzikar <vmuzikar@redhat.com> * @author Vaclav Muzikar <vmuzikar@redhat.com>
*/ */
@ -17,11 +19,14 @@ public class Dropdown {
private WebDriver driver; private WebDriver driver;
public String getSelected() { 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) { public void selectByText(String text) {
String href = dropDownRoot.findElement(By.xpath("./ul/li/a[text()='" + text + "']")).getAttribute("href"); waitUntilElement(dropDownRoot).is().present();
driver.navigate().to(href); WebElement element = dropDownRoot.findElement(By.xpath("./ul/li/a[text()='" + text + "']"));
driver.navigate().to(element.getAttribute("href"));
} }
} }

View file

@ -4,6 +4,8 @@ import org.keycloak.testsuite.console.page.AdminConsoleRealm;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
import static org.keycloak.testsuite.util.WaitUtils.*;
/** /**
* *
* @author tkyjovsk * @author tkyjovsk
@ -37,34 +39,42 @@ public class RealmSettings extends AdminConsoleRealm {
private WebElement defenseTab; private WebElement defenseTab;
public void general() { public void general() {
waitUntilElement(generalSettingsTab).is().present();
generalSettingsTab.click(); generalSettingsTab.click();
} }
public void login() { public void login() {
waitUntilElement(loginSettingsTab).is().present();
loginSettingsTab.click(); loginSettingsTab.click();
} }
public void keys() { public void keys() {
waitUntilElement(keysSettingsTab).is().present();
keysSettingsTab.click(); keysSettingsTab.click();
} }
public void email() { public void email() {
waitUntilElement(emailSettingsTab).is().present();
emailSettingsTab.click(); emailSettingsTab.click();
} }
public void themes() { public void themes() {
waitUntilElement(themeSettingsTab).is().present();
themeSettingsTab.click(); themeSettingsTab.click();
} }
public void cache() { public void cache() {
waitUntilElement(cacheSettingsTab).is().present();
cacheSettingsTab.click(); cacheSettingsTab.click();
} }
public void tokens() { public void tokens() {
waitUntilElement(tokenSettingsTab).is().present();
tokenSettingsTab.click(); tokenSettingsTab.click();
} }
public void securityDefenses() { public void securityDefenses() {
waitUntilElement(defenseTab).is().present();
defenseTab.click(); defenseTab.click();
} }

View file

@ -29,6 +29,7 @@ public class InternationalizationTest extends AbstractRealmTest {
tabs().themes(); tabs().themes();
themeSettingsPage.setInternatEnabled(true); themeSettingsPage.setInternatEnabled(true);
themeSettingsPage.saveTheme(); themeSettingsPage.saveTheme();
assertAlertSuccess();
realmSettingsPage.setAdminRealm(AuthRealm.TEST); realmSettingsPage.setAdminRealm(AuthRealm.TEST);
accountPage.setAuthRealm(testRealmPage); accountPage.setAuthRealm(testRealmPage);
deleteAllCookiesForTestRealm(); deleteAllCookiesForTestRealm();