Prompt
parallel browser tests in ci
Latest observation
Oct 21, 2026
OpenAI APIWeb search: off
Here are practical ways to run parallel browser tests in CI, depending on your setup.
1) Split tests across CI workers
Most test runners support sharding or splitting files.
Examples
- Playwright: built-in sharding
npx playwright test --shard=1/4 npx playwright test --shard=2/4 - Cypress: use CI provider or Cypress Cloud for load balancing
- Jest + browser automation: use
--runInBandoff, or split test files across jobs - WebdriverIO / Selenium: run multiple matrix jobs with different spec subsets
2) Use a CI matrix
Define multiple jobs that run in parallel.
GitHub Actions example
name: browser-tests
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
shard: [1, 2, 3, 4]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx playwright test --shard=${{ matrix.shard }}/4
3) Parallelize by browser
If you run the same suite on Chromium, Firefox, and WebKit, you can split by browser and run each in a separate job.
Example
strategy:
matrix:
browser: [chromium, firefox, webkit]
steps:
- run: npx playwright test --project=${{ matrix.browser }}
4) Use test splitting by timing
For uneven test durations, split based on historical timings to keep jobs balanced.
Tools:
- CircleCI:
circleci tests split - GitHub Actions: custom scripts, or third-party splitters
- Jest: external test splitting tools
Example:
circleci tests glob "tests/**/*.spec.js" | circleci tests split | xargs npm test --
5) Make CI safe for parallel runs
Watch out for shared state:
- unique temp dirs
- isolated DB schemas
- separate user accounts
- port allocation per worker
- avoid writing to the same files
- cleanup after each test
6) Common best practices
- Keep tests deterministic
- Prefer isolated test data
- Retry only flaky tests sparingly
- Cache browser binaries and dependencies
- Collect artifacts per shard
- Merge reports after all jobs finish
7) If you want the simplest setup
For Playwright on GitHub Actions, the easiest win is:
- use a matrix of 4 shards
- run each shard with
--shard=X/4 - make sure each shard uses isolated test data
If you tell me:
- your test framework,
- CI provider,
- and whether you want parallel by shard, browser, or test file,
I can give you a ready-to-paste config.