diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index e5713f39f7..54be4e0499 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -384,21 +384,6 @@ mvn -f testsuite/integration-arquillian/tests/other/base-ui/pom.xml \ -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 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. diff --git a/testsuite/integration-arquillian/tests/other/pom.xml b/testsuite/integration-arquillian/tests/other/pom.xml index 64075ff891..51bf55587b 100644 --- a/testsuite/integration-arquillian/tests/other/pom.xml +++ b/testsuite/integration-arquillian/tests/other/pom.xml @@ -156,12 +156,6 @@ server-config-migration - - welcome-page - - welcome-page - - base-ui diff --git a/testsuite/integration-arquillian/tests/other/welcome-page/pom.xml b/testsuite/integration-arquillian/tests/other/welcome-page/pom.xml deleted file mode 100644 index 44f08c386c..0000000000 --- a/testsuite/integration-arquillian/tests/other/welcome-page/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - integration-arquillian-tests-other - org.keycloak.testsuite - 6.0.0-SNAPSHOT - - 4.0.0 - - integration-arquillian-tests-welcome-page - - Welcome Page tests - - - phantomjs - true - - - - - - maven-surefire-plugin - - - 60000 - - - - - maven-enforcer-plugin - - - - enforce - - - - - auth.server - (wildfly)|(eap) - Tests require activation of profile "auth-server-wildfly" or "auth-server-eap". - - - true - - - - - - - - \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/other/welcome-page/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java b/testsuite/integration-arquillian/tests/other/welcome-page/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java deleted file mode 100644 index de0d611f72..0000000000 --- a/testsuite/integration-arquillian/tests/other/welcome-page/src/test/java/org/keycloak/testsuite/welcomepage/WelcomePageTest.java +++ /dev/null @@ -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 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 netInterfaces = NetworkInterface.getNetworkInterfaces(); - for (NetworkInterface ni : Collections.list(netInterfaces)) { - Enumeration 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.")); - } - -}