From c1cced9f312578d123cc71e737738df76df57622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Barto=C5=A1?= Date: Fri, 21 Apr 2023 10:22:29 +0200 Subject: [PATCH] Fix CorsExampleAdapterTest --- Quarkus3 branch sync no. 14 (24.4.2023) Resolved conflicts: keycloak/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java - Modified --- .github/workflows/ci.yml | 3 +- .../util/ChromeJavascriptBrowser.java | 34 +++++++++++++++++++ .../example/cors/CorsExampleAdapterTest.java | 12 +++---- .../base/src/test/resources/arquillian.xml | 7 ++++ 4 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ChromeJavascriptBrowser.java diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16278a23e3..c92c10cc89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,11 +101,10 @@ jobs: uses: ./.github/actions/integration-test-setup - name: Run base tests - # Temporarily use app-server-wildfly instead of Undertow run: | TESTS=`testsuite/integration-arquillian/tests/base/testsuites/base-suite.sh ${{ matrix.group }}` echo "Tests: $TESTS" - ./mvnw test -Dsurefire.rerunFailingTestsCount=${{ env.SUREFIRE_RERUN_FAILING_COUNT }} -nsu -B -Pauth-server-quarkus,app-server-wildfly -Dtest=$TESTS -pl testsuite/integration-arquillian/tests/base | misc/log/trimmer.sh + ./mvnw test -Dsurefire.rerunFailingTestsCount=${{ env.SUREFIRE_RERUN_FAILING_COUNT }} -nsu -B -Pauth-server-quarkus "-Dwebdriver.chrome.driver=$CHROMEWEBDRIVER/chromedriver" -Dtest=$TESTS -pl testsuite/integration-arquillian/tests/base | misc/log/trimmer.sh - name: Upload JVM Heapdumps if: always() diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ChromeJavascriptBrowser.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ChromeJavascriptBrowser.java new file mode 100644 index 0000000000..51bab1e258 --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/util/ChromeJavascriptBrowser.java @@ -0,0 +1,34 @@ +/* + * Copyright 2023 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.util; + +import org.jboss.arquillian.drone.api.annotation.Qualifier; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author Martin Bartos + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD, ElementType.PARAMETER}) +@Qualifier +public @interface ChromeJavascriptBrowser { +} diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java index 764a2fd736..dab673aa87 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/adapter/example/cors/CorsExampleAdapterTest.java @@ -32,10 +32,10 @@ import org.keycloak.testsuite.adapter.AbstractExampleAdapterTest; import org.keycloak.testsuite.adapter.page.AngularCorsProductTestApp; import org.keycloak.testsuite.adapter.page.CorsDatabaseServiceTestApp; import org.keycloak.testsuite.arquillian.annotation.AppServerContainer; +import org.keycloak.testsuite.util.ChromeJavascriptBrowser; import org.keycloak.testsuite.utils.arquillian.ContainerConstants; import org.keycloak.testsuite.auth.page.account.Account; import org.keycloak.testsuite.auth.page.login.OIDCLogin; -import org.keycloak.testsuite.util.JavascriptBrowser; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -73,21 +73,21 @@ public class CorsExampleAdapterTest extends AbstractExampleAdapterTest { @ArquillianResource private Deployer deployer; - // Javascript browser needed KEYCLOAK-4703 + // Javascript browser needed, but not PhantomJS @Drone - @JavascriptBrowser + @ChromeJavascriptBrowser protected WebDriver jsDriver; @Page - @JavascriptBrowser + @ChromeJavascriptBrowser protected OIDCLogin jsDriverTestRealmLoginPage; @Page - @JavascriptBrowser + @ChromeJavascriptBrowser private AngularCorsProductTestApp jsDriverAngularCorsProductPage; @Page - @JavascriptBrowser + @ChromeJavascriptBrowser private Account jsDriverTestRealmAccount; @Deployment(name = AngularCorsProductTestApp.DEPLOYMENT_NAME, managed = false) diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml index 511c148524..29807ca676 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/arquillian.xml @@ -98,6 +98,13 @@ ${webdriverDownloadBinaries} + + chrome + ${chromeBinary} + ${js.chromeArguments} + ${chromeDriverVersion} + + ${browser} ${firefox_binary}