Skip to content

Commit

Permalink
Testsuite PoC - Add support for browsers with and without headless (k…
Browse files Browse the repository at this point in the history
…eycloak#31611)

Signed-off-by: stianst <stianst@gmail.com>
  • Loading branch information
stianst authored Jul 25, 2024
1 parent c92c642 commit 140e953
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ public String getAlias() {
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);
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public String getAlias() {
public WebDriver getWebDriver() {
FirefoxOptions options = new FirefoxOptions();
setGlobalOptions(options);
options.addArguments("-headless");
return new FirefoxDriver(options);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 140e953

Please sign in to comment.