E2E: per-worker DB isolation to re-enable parallel Playwright runs #67
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The Playwright e2e suite runs against a single shared dev stack (one
php+ onedatabasecontainer, via the Vite/apiproxy). When a second spec was added (#54's add-bucket e2e), enabling real parallelism (fullyParallel: true, 2 workers), the suite went flaky: concurrent register/login flows race on shared backend state — observed as an intermittent failure at the post-registertoHaveURL(/\/login$/)assertion inauth.spec.ts(passed on rerun; serial--workers=1was stable 3/3).Interim fix (already applied):
e2e/playwright.config.tsnow setsfullyParallel: false+workers: 1. Serial is cheap today (~3s/spec), so this is fine short-term — but it won't scale as the suite grows.Goal
Re-enable parallel e2e by giving each Playwright worker an isolated database, so concurrent specs can't race on shared state. Then flip
fullyParallel/workersback on in the config.The real problem (not just data collisions)
Note the observed race was in the auth flow (register→login), not scenario/bucket data — the emails are already unique per run and it still flaked. So "unique test data" alone is insufficient; the fix needs genuine backend-state isolation between workers.
Options to evaluate during scoping
process.env.TEST_WORKER_INDEX) to its own, point thephpservice at the right one per request. Most robust; most infra work (compose + app DB-selection seam, which doesn't exist today).workers: 1permanently if the suite stays small. Revisit only if e2e run time becomes a real bottleneck.Depends on / relates to
Out of scope
Testing
fullyParallel: true+ remove theworkers: 1cap, run the full e2e suite repeatedly (e.g. 5×) to confirm no flakes.