How do you run the same test suite across multiple browsers and operating systems efficiently in CI?
- Same test suite, run against different browser engines (Chromium, Firefox, WebKit) and different operating systems (Windows, macOS, Linux).
- Done via a GitHub Actions matrix strategy — one job defined once, with lists of browsers/OS as variables, runs every combination in parallel.
- Playwright ships all three browser engines built in — no separate install needed.
The long answer
Cross-browser testing runs the identical test suite against multiple browser engines to catch rendering or behavior differences: Chromium (Chrome, Edge), Firefox (Gecko), and WebKit (Safari). Cross-platform testing runs that same suite across operating systems — Windows, macOS, Linux — since fonts, rendering, and file-path handling can differ subtly. A third related dimension is cross-device/responsive testing — different viewports and mobile screen sizes, which Playwright can emulate directly (devices['iPhone 13']) without real hardware.
The mechanism for running all these combinations efficiently is a matrix strategy in GitHub Actions. Instead of duplicating a job per browser/OS combination, you define the job once and list the variables:
strategy:
matrix:
browser: [chromium, firefox, webkit]
os: [ubuntu-latest, windows-latest]
This spins up six parallel runners automatically — one per browser × OS combination — each with ${{ matrix.browser }} and ${{ matrix.os }} injected as variables into the same test command. It’s a loop, but parallel rather than sequential, so six configurations finish in roughly the time of one.
Because the full matrix (browsers × OS × viewports) explodes combinatorially, teams pick a prioritized subset rather than testing everything — e.g., Chrome+Windows, Safari+Mac, one mobile viewport — rather than every possible pairing.
Saying "we test on all browsers and all OS combinations" without naming the matrix strategy — that's the mechanism that makes it feasible in CI; without it, the answer sounds like manual repetition.