KEYCLOAK-8347 Welcome page test migration clean up

This commit is contained in:
Peter Skopek 2019-03-22 15:26:02 +01:00 committed by Marek Posolda
parent 3a105cf9e9
commit 92567d5a77
4 changed files with 0 additions and 230 deletions

View file

@ -384,21 +384,6 @@ mvn -f testsuite/integration-arquillian/tests/other/base-ui/pom.xml \
-Dappium.avd=Nexus_5X_API_27 -Dappium.avd=Nexus_5X_API_27
``` ```
## Welcome Page tests
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
# Run tests
mvn -f testsuite/integration-arquillian/tests/other/welcome-page/pom.xml \
clean test \
-Pauth-server-wildfly
## Social Login ## Social Login
The social login tests require setup of all social networks including an example social user. These details can't be The social login tests require setup of all social networks including an example social user. These details can't be
shared as it would result in the clients and users eventually being blocked. By default these tests are skipped. shared as it would result in the clients and users eventually being blocked. By default these tests are skipped.

View file

@ -156,12 +156,6 @@
<module>server-config-migration</module> <module>server-config-migration</module>
</modules> </modules>
</profile> </profile>
<profile>
<id>welcome-page</id>
<modules>
<module>welcome-page</module>
</modules>
</profile>
<profile> <profile>
<id>base-ui</id> <id>base-ui</id>
<modules> <modules>

View file

@ -1,71 +0,0 @@
<?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>6.0.0-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>

View file

@ -1,138 +0,0 @@
/*
* Copyright 2017 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.
*/
package org.keycloak.testsuite.welcomepage;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.keycloak.representations.idm.RealmRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.auth.page.WelcomePage;
import org.keycloak.testsuite.auth.page.login.OIDCLogin;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import static org.keycloak.testsuite.util.URLUtils.navigateToUri;
/**
*
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class WelcomePageTest extends AbstractKeycloakTest {
@Page
private WelcomePage welcomePage;
@Page
protected OIDCLogin loginPage;
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
// no operation
}
/*
* Leave out client initialization and creation of a user account. We
* don't need those.
*/
@Before
@Override
public void beforeAbstractKeycloakTest() {
setDefaultPageUriParameters();
}
@After
@Override
public void afterAbstractKeycloakTest() {
// no need for this either
}
/**
* Attempt to resolve the floating IP address. This is where EAP/WildFly
* will be accessible. See "-Djboss.bind.address=0.0.0.0".
*
* @return
* @throws Exception
*/
private String getFloatingIpAddress() throws Exception {
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
for (NetworkInterface ni : Collections.list(netInterfaces)) {
Enumeration<InetAddress> inetAddresses = ni.getInetAddresses();
for (InetAddress a : Collections.list(inetAddresses)) {
if (!a.isLoopbackAddress() && a.isSiteLocalAddress()) {
return a.getHostAddress();
}
}
}
return null;
}
private URL getPublicServerUrl() throws Exception {
String floatingIp = getFloatingIpAddress();
if (floatingIp == null) {
throw new RuntimeException("Could not determine floating IP address.");
}
return new URL("http", floatingIp, welcomePage.getInjectedUrl().getPort(), "");
}
@Test
public void test_1_LocalAccessNoAdmin() throws Exception {
welcomePage.navigateTo();
Assert.assertFalse("Welcome page did not ask to create a new admin user.", welcomePage.isPasswordSet());
}
@Test
public void test_2_RemoteAccessNoAdmin() throws Exception {
navigateToUri(getPublicServerUrl().toString());
Assert.assertFalse("Welcome page did not ask to create a new admin user.", welcomePage.isPasswordSet());
}
@Test
public void test_3_LocalAccessWithAdmin() throws Exception {
welcomePage.navigateTo();
welcomePage.setPassword("admin", "admin");
Assert.assertTrue(driver.getPageSource().contains("User created"));
welcomePage.navigateTo();
Assert.assertTrue("Welcome page asked to set admin password.", welcomePage.isPasswordSet());
}
@Test
public void test_4_RemoteAccessWithAdmin() throws Exception {
navigateToUri(getPublicServerUrl().toString());
Assert.assertTrue("Welcome page asked to set admin password.", welcomePage.isPasswordSet());
}
@Test
public void test_5_AccessCreatedAdminAccount() throws Exception {
welcomePage.navigateToAdminConsole();
loginPage.form().login("admin", "admin");
Assert.assertFalse("Login with 'admin:admin' failed",
driver.getPageSource().contains("Invalid username or password."));
}
}