diff --git a/misc/keycloak-test-helper/pom.xml b/misc/keycloak-test-helper/pom.xml index a9a92fb019..48a9cff2c4 100644 --- a/misc/keycloak-test-helper/pom.xml +++ b/misc/keycloak-test-helper/pom.xml @@ -35,7 +35,8 @@ org.seleniumhq.selenium selenium-java - provided + 2.35.0 + pom org.keycloak diff --git a/pom.xml b/pom.xml index 078973c3c8..bff7d4ff9b 100644 --- a/pom.xml +++ b/pom.xml @@ -178,7 +178,6 @@ 2.10 4.13.2 2.7.0.Final - 2.35.0 3.0.0-M7 1.4.01 @@ -678,20 +677,6 @@ api-ldap-codec-standalone ${apacheds.codec.version} - - - - org.seleniumhq.selenium - selenium-java - ${selenium.version} - test - - - org.seleniumhq.selenium - selenium-chrome-driver - ${selenium.version} - test - org.apache.jmeter ApacheJMeter_java diff --git a/test-poc/framework/pom.xml b/test-poc/framework/pom.xml index e661a9a9ad..cd032b36be 100755 --- a/test-poc/framework/pom.xml +++ b/test-poc/framework/pom.xml @@ -31,6 +31,10 @@ jar PoC JUnit 5 testing framework for Keycloak + + 4.21.0 + + org.keycloak @@ -47,13 +51,19 @@ org.seleniumhq.selenium selenium-java - 4.21.0 + ${selenium.version} pom org.seleniumhq.selenium selenium-firefox-driver - 4.21.0 + ${selenium.version} + pom + + + org.seleniumhq.selenium + selenium-chrome-driver + ${selenium.version} pom diff --git a/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java b/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java new file mode 100644 index 0000000000..90758d5f95 --- /dev/null +++ b/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/ChromeWebDriverSupplier.java @@ -0,0 +1,42 @@ +package org.keycloak.test.framework.webdriver; + +import org.keycloak.test.framework.injection.InstanceWrapper; +import org.keycloak.test.framework.injection.LifeCycle; +import org.keycloak.test.framework.injection.Registry; +import org.keycloak.test.framework.injection.Supplier; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.chrome.ChromeDriver; + +public class ChromeWebDriverSupplier implements Supplier { + + @Override + public Class getAnnotationClass() { + return TestWebDriver.class; + } + + @Override + public Class getValueType() { + return WebDriver.class; + } + + @Override + public InstanceWrapper getValue(Registry registry, TestWebDriver annotation) { + final var driver = new ChromeDriver(); + return new InstanceWrapper<>(this, annotation, driver); + } + + @Override + public LifeCycle getLifeCycle() { + return LifeCycle.GLOBAL; + } + + @Override + public boolean compatible(InstanceWrapper a, InstanceWrapper b) { + return true; + } + + @Override + public void close(WebDriver instance) { + instance.quit(); + } +} diff --git a/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java b/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java index eeb5a9bf62..7badd2c429 100644 --- a/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java +++ b/test-poc/framework/src/main/java/org/keycloak/test/framework/webdriver/FirefoxWebDriverSupplier.java @@ -37,7 +37,7 @@ public class FirefoxWebDriverSupplier implements Supplier