GitHub Actions
Run your Selenium Boot tests on every push and pull request. The workflow below installs Chrome, runs the suite, and uploads the HTML report as a downloadable artifact.
Basic workflow
name: Selenium Tests
on:
push:
branches: [main, master]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Install Chrome
uses: browser-actions/setup-chrome@v1
- name: Run tests
run: mvn test -B
- name: Upload HTML report
if: always()
uses: actions/upload-artifact@v4
with:
name: selenium-boot-report
path: target/selenium-boot-report.html
What Selenium Boot configures on CI
When it detects a CI environment (GitHub Actions, Jenkins, CircleCI and others), Selenium Boot adjusts itself — no YAML changes needed:
browser.headlessis forced totrue.execution.threadCountis derived from the available CPU cores, capped atexecution.maxActiveSessions— only when you left it at the default of1andparallelis notnone.- Inside Docker or Kubernetes, Chrome and Firefox get the container flags they need (for Chrome:
--no-sandbox,--disable-dev-shm-usage,--disable-gpu,--window-size=1920,1080). - JUnit XML is written to
target/surefire-reports/TEST-SeleniumBoot.xmlon every run. - When running in GitHub Actions and
tracing.enabled: trueis on, failed tests are summarized in a Markdown table (test name, error, and path totarget/traces/...) appended to$GITHUB_STEP_SUMMARYso failures are visible without opening artifacts.
Each override is printed to the console as [Selenium Boot] CI override: ….
Job summary with trace links
When tracing.enabled: true is enabled in selenium-boot.yml and tests fail, Selenium Boot automatically appends a Markdown table to $GITHUB_STEP_SUMMARY:
| Test | Error | Trace |
|---|---|---|
com.example.LoginTest#testInvalidLogin | Expected [Dashboard] but found [401 Unauthorized] | target/traces/LoginTest/testInvalidLogin-trace.html |
This lists every failing test, its error message, and the path to its trace file directly in the GitHub Actions run summary page. If no tests fail or outside GitHub Actions, nothing is written.
Publish JUnit XML test results
- name: Publish test results
uses: dorny/test-reporter@v1
if: always()
with:
name: Test Results
path: '**/surefire-reports/TEST-*.xml'
reporter: java-junit
fail-on-empty: false
This renders pass/fail counts directly in the GitHub Actions summary and PR checks.
Matrix — multiple browsers
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
browser: [chrome, firefox]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Install Chrome
if: matrix.browser == 'chrome'
uses: browser-actions/setup-chrome@v1
- name: Install Firefox
if: matrix.browser == 'firefox'
uses: browser-actions/setup-firefox@v1
- name: Run tests
run: mvn test -B -Dbrowser.type=${{ matrix.browser }}
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
with:
name: report-${{ matrix.browser }}
path: target/selenium-boot-report.html
Caching Maven dependencies
The cache: maven option in setup-java caches ~/.m2/repository automatically. This significantly reduces build time on subsequent runs.
Full example with parallel tests
- name: Run tests
run: mvn test -B -Dparallel=methods -DthreadCount=4
Or define parallel settings in selenium-boot.yml and commit it — the CI runner picks them up automatically.