Testsuite PoC - Add support for browsers with and without headless (#31611)

Signed-off-by: stianst <stianst@gmail.com>
This commit is contained in:
Stian Thorgersen 2024-07-25 13:41:50 +02:00 committed by GitHub
parent c92c642fec
commit 140e953d3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 53 additions and 11 deletions

View file

@ -956,9 +956,9 @@ jobs:
uses: ./.github/actions/integration-test-setup
- name: Run tests
run: |
cd test-poc
mvn clean install
env:
KC_TEST_BROWSER: chrome-headless
run: mvn clean install -f test-poc
check:
name: Status Check - Keycloak CI

View file

@ -0,0 +1,27 @@
package org.keycloak.test.framework.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class ChromeHeadlessWebDriverSupplier extends AbstractWebDriverSupplier {
@Override
public String getAlias() {
return "chrome-headless";
}
@Override
public WebDriver getWebDriver() {
ChromeOptions options = new ChromeOptions();
setGlobalOptions(options);
options.addArguments(
"--headless",
"--disable-gpu",
"--window-size=1920,1200",
"--ignore-certificate-errors",
"--disable-dev-shm-usage"
);
return new ChromeDriver(options);
}
}

View file

@ -15,13 +15,6 @@ public class ChromeWebDriverSupplier extends AbstractWebDriverSupplier {
public WebDriver getWebDriver() {
ChromeOptions options = new ChromeOptions();
setGlobalOptions(options);
options.addArguments(
"--headless",
"--disable-gpu",
"--window-size=1920,1200",
"--ignore-certificate-errors",
"--disable-dev-shm-usage"
);
return new ChromeDriver(options);
}
}

View file

@ -0,0 +1,21 @@
package org.keycloak.test.framework.webdriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
public class FirefoxHeadlessWebDriverSupplier extends AbstractWebDriverSupplier {
@Override
public String getAlias() {
return "firefox-headless";
}
@Override
public WebDriver getWebDriver() {
FirefoxOptions options = new FirefoxOptions();
setGlobalOptions(options);
options.addArguments("-headless");
return new FirefoxDriver(options);
}
}

View file

@ -15,7 +15,6 @@ public class FirefoxWebDriverSupplier extends AbstractWebDriverSupplier {
public WebDriver getWebDriver() {
FirefoxOptions options = new FirefoxOptions();
setGlobalOptions(options);
options.addArguments("-headless");
return new FirefoxDriver(options);
}
}

View file

@ -5,7 +5,9 @@ org.keycloak.test.framework.realm.UserSupplier
org.keycloak.test.framework.server.EmbeddedKeycloakTestServerSupplier
org.keycloak.test.framework.server.DistributionKeycloakTestServerSupplier
org.keycloak.test.framework.server.RemoteKeycloakTestServerSupplier
org.keycloak.test.framework.webdriver.ChromeHeadlessWebDriverSupplier
org.keycloak.test.framework.webdriver.ChromeWebDriverSupplier
org.keycloak.test.framework.webdriver.FirefoxHeadlessWebDriverSupplier
org.keycloak.test.framework.webdriver.FirefoxWebDriverSupplier
org.keycloak.test.framework.database.DevMemDatabaseSupplier
org.keycloak.test.framework.database.DevFileDatabaseSupplier