all notes

· Playwright · GitHub Actions · CI

Smoke on every PR, three browsers every night

How I split a Playwright suite into a fast PR gate and a full cross-browser regression, without hammering a public demo site.

My Playwright suite for automationexercise.com has 24 tests across 10 spec files. Running all of them on three browsers for every pull request is slow, and the site is a shared public demo: it throttles busy clients and sometimes answers with a "heavy load" page. So I split the work in two.

Smoke: the pull request gate

Seven tests carry a @smoke tag: home, the login page and an invalid login, the product list and search, add to cart, and the main navigation. Every pull request runs only those, on Chromium.

test('should load home page successfully', { tag: '@smoke' }, async ({ page }) => {
  // ...
});

// smoke.yml
npx playwright test --grep @smoke --project=chromium

Regression: everything, everywhere, one at a time

The full suite runs on Chromium, Firefox, and WebKit as a matrix on every push to main and nightly at 02:17 UTC. The nightly run matters because the site changes without any commit of mine.

strategy:
  fail-fast: false   # one red browser must not hide the others
  max-parallel: 1    # one browser's traffic on the public site at a time
  matrix:
    browser: [chromium, firefox, webkit]

Making failures cheap to read

  • One worker and two retries on CI, to stay under the site's load limits.
  • A screenshot and a video on failure, and a trace on the first retry.
  • The HTML report and test-results/ uploaded as an artifact even when tests fail.
  • A BasePage that blocks ad networks and reloads the "heavy load" page up to three times, so a test fails on the app, not on an ad covering a button.

A required Smoke check on main finishes the setup: a pull request cannot merge until the smoke tests pass.