Skip to content
Latchkey

How to Run WebdriverIO Tests in CI on GitHub Actions

WebdriverIO needs the app running and Chrome in headless mode; start-server-and-test wires both together.

Add --headless to the browser capabilities and use start-server-and-test to boot the app, wait for its URL, then run wdio run.

Steps

  • Set headless args in the wdio capabilities.
  • Install and wrap the run with start-server-and-test.
  • Point wait-on at the app URL before the suite runs.
  • Upload the wdio report on completion.

Workflow

.github/workflows/ci.yml
jobs:
  wdio:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci
      - run: npx start-server-and-test start http://localhost:3000 'wdio run wdio.conf.js'

Headless capability

wdio.conf.js
export const config = {
  capabilities: [{
    browserName: 'chrome',
    'goog:chromeOptions': {
      args: ['--headless=new', '--no-sandbox', '--disable-dev-shm-usage'],
    },
  }],
}

Gotchas

  • --disable-dev-shm-usage avoids Chrome crashes on the small default shared memory.
  • start-server-and-test exits with the test command status, so a failing suite fails the job.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →