Merge pull request #3156 from vmuzikar/KEYCLOAK-3448

KEYCLOAK-3448 Stabilize Internationalization UI Test
This commit is contained in:
Stian Thorgersen 2016-08-23 12:55:53 +02:00 committed by GitHub
commit 014c8e068f
14 changed files with 85 additions and 12 deletions

View file

@ -36,6 +36,26 @@
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${testsuite.constants}</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
@ -48,10 +68,11 @@
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${auth.server.home}/themes</outputDirectory>
<outputDirectory>${keycloak.theme.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/themes</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>

View file

@ -0,0 +1,5 @@
#encoding: utf-8
doSave=Uložit
doCancel=Zrušit
editAccountHtmlTitle=Upravit účet
locale_cs=Čeština

View file

@ -0,0 +1,2 @@
parent=${theme-default-name}
locales=en,cs

View file

@ -0,0 +1,7 @@
#encoding: utf-8
enabled=Povolit
save=Uložit
cancel=Zrušit
onText=ZAP
offText=VYP
realm-settings=Nastavení Realmu

View file

@ -0,0 +1,2 @@
#encoding: utf-8
invalidPasswordMinLengthMessage=Neplatné heslo: musí mít alespoň {0} znaků.

View file

@ -0,0 +1,2 @@
parent=${theme-default-name}
locales=en,cs

View file

@ -0,0 +1,2 @@
parent=${theme-default-name}
locales=en,cs

View file

@ -0,0 +1,11 @@
#encoding: utf-8
doLogIn=Přihlásit
doRegister=Registrovat se
doCancel=Zrušit
doSubmit=Odeslat
doForgotPassword=Zapomněli jste heslo?
locale_cs=Čeština
username=Uživatelské jméno
usernameOrEmail=Uživatelské jméno nebo email
email=Email
password=Heslo

View file

@ -0,0 +1,2 @@
parent=${theme-default-name}
locales=en,cs

View file

@ -4,6 +4,7 @@ import org.jboss.arquillian.graphene.page.Page;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.auth.page.AuthRealm;
import org.keycloak.testsuite.console.page.fragment.Dropdown;
import org.keycloak.testsuite.console.page.realm.ThemeSettings;
@ -17,6 +18,13 @@ import static org.keycloak.testsuite.util.URLAssert.*;
* @author Vaclav Muzikar <vmuzikar@redhat.com>
*/
public class InternationalizationTest extends AbstractRealmTest {
private static final String THEME_NAME = "internat-test";
private static final String LOCALE_CS_NAME = "Čeština";
private static final String LABEL_CS_PASSWORD = "Heslo";
private static final String LABEL_CS_REALM_SETTINGS = "Nastavení Realmu";
private static final String LABEL_CS_EDIT_ACCOUNT = "Upravit účet";
@Page
private ThemeSettings themeSettingsPage;
@ -25,6 +33,13 @@ public class InternationalizationTest extends AbstractRealmTest {
@Before
public void beforeInternationalizationTest() {
RealmRepresentation realmRepresentation = testRealmResource().toRepresentation();
realmRepresentation.setAccountTheme(THEME_NAME);
realmRepresentation.setAdminTheme(THEME_NAME);
realmRepresentation.setEmailTheme(THEME_NAME);
realmRepresentation.setLoginTheme(THEME_NAME);
testRealmResource().update(realmRepresentation);
realmSettingsPage.navigateTo();
tabs().themes();
themeSettingsPage.setInternatEnabled(true);
@ -47,14 +62,14 @@ public class InternationalizationTest extends AbstractRealmTest {
public void loginInternationalization() {
testRealmAdminConsolePage.navigateTo();
localeDropdown.selectByText("Español");
assertLocale(".//label[@for='password']", "Contraseña"); // Password
localeDropdown.selectByText(LOCALE_CS_NAME);
assertLocale(".//label[@for='password']", LABEL_CS_PASSWORD);
loginToTestRealmConsoleAs(testUser);
assertConsoleLocale("Temas");
assertConsoleLocale(LABEL_CS_REALM_SETTINGS);
testRealmAccountPage.navigateTo();
assertAccountLocale("Cuenta");
assertAccountLocale(LABEL_CS_EDIT_ACCOUNT);
}
/**
@ -65,24 +80,24 @@ public class InternationalizationTest extends AbstractRealmTest {
testRealmAccountPage.navigateTo();
loginPage.form().login(testUser);
localeDropdown.selectByText("Français");
localeDropdown.selectByText(LOCALE_CS_NAME);
testRealmAccountPage.navigateTo();
assertAccountLocale("Compte");
assertAccountLocale(LABEL_CS_EDIT_ACCOUNT);
deleteAllCookiesForTestRealm();
loginToTestRealmConsoleAs(testUser);
assertConsoleLocale("Thèmes");
assertConsoleLocale(LABEL_CS_REALM_SETTINGS);
}
private void assertConsoleLocale(String expected) {
assertCurrentUrlEquals(realmSettingsPage);
assertLocale(".//a[contains(@href,'/theme-settings')]", expected); // Themes
assertLocale(".//div[@class='nav-category'][1]/ul/li[1]//a", expected); // Realm Settings
}
private void assertAccountLocale(String expected) {
assertCurrentUrlEquals(testRealmAccountPage);
assertLocale(".//div[contains(@class,'bs-sidebar')]/ul/li", expected); // Account
assertLocale(".//div[contains(@class,'content-area')]/div[@class='row']/div/h2", expected); // Edit Account
}
private void assertLocale(String xpathSelector, String expected) {

View file

@ -59,7 +59,7 @@
<artifactId>integration-arquillian-tests-base</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<includes>arquillian.xml,keycloak-add-user.json,kerberos/*</includes>
<includes>arquillian.xml,keycloak-add-user.json,test-constants.properties,kerberos/*</includes>
</artifactItem>
</artifactItems>
</configuration>

View file

@ -74,7 +74,7 @@
<frontend.console.output>true</frontend.console.output>
<backends.console.output>true</backends.console.output>
<testsuite.constants>test-constants.properties</testsuite.constants>
<testsuite.constants>${project.build.directory}/dependency/test-constants.properties</testsuite.constants>
</properties>