E2E Testing with Playwright
Run browser tests against real user flows. Keep scripts temporary unless the user asks to add permanent tests.
Workflow
- Ask what to run if the user did not specify: existing tests, generate a new check, record a session, or verify a feature.
- Read existing test context:
playwright.config.*package.jsonscripts**/*.spec.ts,**/*.test.ts,**/e2e/**- fixture, seed, and database reset docs
- Detect or start the dev server from project docs/scripts.
- Use deterministic fixtures. No production data, random order, wall-clock dependence, or leftover state.
- Generate temporary scripts under
/tmpwhen needed. - Prefer semantic locators: role, label, text, test id, CSS last.
- Run the test, read the full output, fix failures, and rerun.
Playwright Helper Skill
If the bundled playwright-skill helper is installed alongside this skill,
find its directory from the loaded skill path and run helper scripts from
there:
cd <playwright-skill-dir> && node scripts/run.js /tmp/e2e-check.js
If the helper is unavailable, use project-local Playwright commands instead:
npx playwright test --reporter=list
npx playwright test /tmp/e2e-check.spec.ts --reporter=list
Generated Test Rules
- Write temporary tests to
/tmp/e2e-<name>.spec.tsor/tmp/e2e-<name>.js. - Never use fixed
waitForTimeoutdelays. - Use
waitForSelector,waitForURL, or assertions on visible UI state. - Capture screenshots, traces, or HTML reports when failures need evidence.
- Do not declare success while tests fail.
Failure handling
- No dev server running: read project docs and
package.jsonscripts for a start command; ask the user if none found. - Test still failing after two fix attempts: capture a screenshot/trace, report the exact failure line, and stop — do not loop blindly.
- No
playwright.config.*found: generate a minimal temporary config under/tmp; do not write into the project without asking.
Output Contract
## E2E Result
### Target
<app/flow tested>
### Commands
- `<command>`
### Result
pass | fail | blocked
### Evidence
- screenshot/trace/output path or key failure line
### Next Fix
- <if failing>