Merge pull request #3156 from vmuzikar/KEYCLOAK-3448
KEYCLOAK-3448 Stabilize Internationalization UI Test
This commit is contained in:
commit
014c8e068f
14 changed files with 85 additions and 12 deletions
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#encoding: utf-8
|
||||
doSave=Uložit
|
||||
doCancel=Zrušit
|
||||
editAccountHtmlTitle=Upravit účet
|
||||
locale_cs=Čeština
|
|
@ -0,0 +1,2 @@
|
|||
#encoding: utf-8
|
||||
locale_cs=Čeština
|
|
@ -0,0 +1,2 @@
|
|||
parent=${theme-default-name}
|
||||
locales=en,cs
|
|
@ -0,0 +1,7 @@
|
|||
#encoding: utf-8
|
||||
enabled=Povolit
|
||||
save=Uložit
|
||||
cancel=Zrušit
|
||||
onText=ZAP
|
||||
offText=VYP
|
||||
realm-settings=Nastavení Realmu
|
|
@ -0,0 +1,2 @@
|
|||
#encoding: utf-8
|
||||
invalidPasswordMinLengthMessage=Neplatné heslo: musí mít alespoň {0} znaků.
|
|
@ -0,0 +1,2 @@
|
|||
parent=${theme-default-name}
|
||||
locales=en,cs
|
|
@ -0,0 +1,2 @@
|
|||
parent=${theme-default-name}
|
||||
locales=en,cs
|
|
@ -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
|
|
@ -0,0 +1,2 @@
|
|||
#encoding: utf-8
|
||||
locale_cs=Čeština
|
|
@ -0,0 +1,2 @@
|
|||
parent=${theme-default-name}
|
||||
locales=en,cs
|
|
@ -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) {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue