KEYCLOAK-6450 Stabilize WelcomePageTest
This commit is contained in:
parent
3873ab811a
commit
340afb2a50
5 changed files with 92 additions and 30 deletions
|
@ -273,20 +273,17 @@ mvn -f testsuite/integration-arquillian/tests/other/console/pom.xml \
|
|||
```
|
||||
|
||||
## Welcome Page tests
|
||||
The Welcome Page tests need to be run on WildFly/EAP and with `-Dskip.add.user.json` switch. So that they are disabled by default and are meant to be run separately.
|
||||
The Welcome Page tests need to be run on WildFly/EAP. So that they are disabled by default and are meant to be run separately.
|
||||
|
||||
|
||||
# Prepare servers
|
||||
mvn -f testsuite/integration-arquillian/servers/pom.xml \
|
||||
clean install \
|
||||
-Pauth-server-wildfly \
|
||||
-Papp-server-wildfly
|
||||
-Pauth-server-wildfly
|
||||
|
||||
# Run tests
|
||||
mvn -f testsuite/integration-arquillian/tests/base/pom.xml \
|
||||
mvn -f testsuite/integration-arquillian/tests/other/welcome-page/pom.xml \
|
||||
clean test \
|
||||
-Dtest=WelcomePageTest \
|
||||
-Dskip.add.user.json \
|
||||
-Pauth-server-wildfly
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ import org.openqa.selenium.By;
|
|||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.FindBy;
|
||||
|
||||
import static org.keycloak.testsuite.page.Form.setInputValue;
|
||||
import static org.keycloak.testsuite.util.UIUtils.clickLink;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
|
||||
*/
|
||||
|
@ -44,16 +47,11 @@ public class WelcomePage extends AuthServer {
|
|||
}
|
||||
|
||||
public void setPassword(String username, String password) {
|
||||
usernameInput.clear();
|
||||
usernameInput.sendKeys(username);
|
||||
setInputValue(usernameInput, username);
|
||||
setInputValue(passwordInput, password);
|
||||
setInputValue(passwordConfirmationInput, password);
|
||||
|
||||
passwordInput.clear();
|
||||
passwordInput.sendKeys(password);
|
||||
|
||||
passwordConfirmationInput.clear();
|
||||
passwordConfirmationInput.sendKeys(password);
|
||||
|
||||
createButton.click();
|
||||
clickLink(createButton);
|
||||
|
||||
if (!driver.getPageSource().contains("User created")) {
|
||||
throw new RuntimeException("Failed to updated password");
|
||||
|
@ -61,7 +59,7 @@ public class WelcomePage extends AuthServer {
|
|||
}
|
||||
|
||||
public void navigateToAdminConsole() {
|
||||
driver.findElement(By.linkText("Administration Console")).click();
|
||||
clickLink(driver.findElement(By.linkText("Administration Console")));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -161,6 +161,12 @@
|
|||
<module>server-config-migration</module>
|
||||
</modules>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>welcome-page</id>
|
||||
<modules>
|
||||
<module>welcome-page</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 2018 Red Hat, Inc. and/or its affiliates
|
||||
~ and other contributors as indicated by the @author tags.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>integration-arquillian-tests-other</artifactId>
|
||||
<groupId>org.keycloak.testsuite</groupId>
|
||||
<version>4.0.0.CR1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>integration-arquillian-tests-welcome-page</artifactId>
|
||||
|
||||
<name>Welcome Page tests</name>
|
||||
|
||||
<properties>
|
||||
<browser>phantomjs</browser>
|
||||
<skip.add.user.json>true</skip.add.user.json>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<pageload.timeout>60000</pageload.timeout> <!-- accessing through external IP could be slow -->
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>enforce</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<rules>
|
||||
<requireProperty>
|
||||
<property>auth.server</property>
|
||||
<regex>(wildfly)|(eap)</regex>
|
||||
<regexMessage>Tests require activation of profile "auth-server-wildfly" or "auth-server-eap".</regexMessage>
|
||||
</requireProperty>
|
||||
</rules>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -38,6 +38,8 @@ import java.util.Collections;
|
|||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
import static org.keycloak.testsuite.util.URLUtils.navigateToUri;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -50,18 +52,6 @@ public class WelcomePageTest extends AbstractKeycloakTest {
|
|||
@Page
|
||||
protected OIDCLogin loginPage;
|
||||
|
||||
/*
|
||||
* Assume adding user is skipped.
|
||||
*
|
||||
* Assume we are not testing migration. In migration scenario there is admin user
|
||||
* migrated from previous version.
|
||||
*/
|
||||
@BeforeClass
|
||||
public static void beforeWelcomePageTest() {
|
||||
Assume.assumeTrue(Boolean.parseBoolean(System.getProperty("skip.add.user.json")));
|
||||
Assume.assumeFalse(Boolean.parseBoolean(System.getProperty("skip.welcome.page.test")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTestRealms(List<RealmRepresentation> testRealms) {
|
||||
// no operation
|
||||
|
@ -119,7 +109,7 @@ public class WelcomePageTest extends AbstractKeycloakTest {
|
|||
|
||||
@Test
|
||||
public void test_2_RemoteAccessNoAdmin() throws Exception {
|
||||
driver.navigate().to(getPublicServerUrl());
|
||||
navigateToUri(getPublicServerUrl().toString(), true);
|
||||
Assert.assertFalse("Welcome page did not ask to create a new admin user.", welcomePage.isPasswordSet());
|
||||
}
|
||||
|
||||
|
@ -135,7 +125,7 @@ public class WelcomePageTest extends AbstractKeycloakTest {
|
|||
|
||||
@Test
|
||||
public void test_4_RemoteAccessWithAdmin() throws Exception {
|
||||
driver.navigate().to(getPublicServerUrl());
|
||||
navigateToUri(getPublicServerUrl().toString(), true);
|
||||
Assert.assertTrue("Welcome page asked to set admin password.", welcomePage.isPasswordSet());
|
||||
}
|
||||
|
Loading…
Reference in a new issue