Builds reusable Playwright fixtures via `test.extend` - picks the right scope (test vs worker), wires the `use(value)` setup/teardown split, composes auth (storageState per worker), database (per-test snapshot/restore), and feature-flag fixtures into one custom `test` object the whole suite imports. Outputs the `fixtures.ts` file plus per-fixture review notes (scope rationale, teardown ordering, `workerInfo.workerIndex` for parallel isolation). Use when the suite has copy-pasted `beforeEach` boilerplate that should be a fixture, or when adding auth / db / flag setup that crosses many specs.
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
| Anti-pattern | Why it fails | Fix |
|---|---|---|
| Worker-scoped fixture for state that changes between tests | Tests on the same worker pollute each other; intermittent failures. | Move to test scope. Per pw-fix: test-scoped fixtures "are torn down immediately after". |
| Test-scoped fixture for immutable expensive state (e.g. logged-in user) | Per-test login = N × ~1s. CI time balloons. | Worker scope + workerInfo.workerIndex per pw-fix. |
beforeAll for shared state in a parallel suite | beforeAll runs once per spec file, not once per worker; doesn't compose. | Worker-scoped fixture with the right use() boundary. |
| Teardown that depends on a downstream fixture's setup | Reverse-order teardown means the dependency is gone when teardown runs. | Invert composition: dependent fixture extends the dependency. |
Manual await context.close() inside a test | Bypasses Playwright's cleanup; flake on the next test. | Let the page/context fixture handle close in its teardown. |
| Hard-coded port / DB name in fixtures | Two parallel workers fight over the same resource. | Derive from workerInfo.workerIndex per pw-fix. |
Storing playwright/.auth/*.json in git | Per pw-auth: "these files contain sensitive cookies and headers". | .gitignore the auth dir; reauthenticate in CI per worker. |
| One mega-fixture that bundles auth+db+flags | Tests can't opt out of pieces; one tweak breaks everyone. | Atomic fixtures composed via extend per Step 6. |
use() block produces a warning, not a failure. Wrap
critical teardown in a runtime check that fails the next test if
state is dirty.{ timeout: 60_000 }; the test's own timeout is
separate.