Appearance
Playwright Test Agents – Local Setup
The repository now ships with the Playwright Test Agents configuration generated via npx playwright init-agents --loop=opencode. The agent bundle lives under .opencode/ plus opencode.json, so Cursor/VS Code subagents can use the planner, generator, and healer loops.
Environment assumptions
playwright.config.tsruns both legacy specs ine2e/and the new agent-authored specs that live intests/**/*.pw.spec.ts.- The config exports a
webServercommand that setsTEST_MODE=1andE2E_FAKE_DB=1, so you do not need a Postgres server when generating or running tests. - The new seed test is
tests/seed.pw.spec.ts. Agents (and humans) can run this seed to ensure/app/bulk/newis ready before building further plans.
Day-to-day workflow
- Planner: ask for a plan while referencing
tests/seed.pw.spec.tsplus any Markdown spec inspecs/. - Generator: once the plan exists, run the generator agent to emit
.pw.spec.tsfiles undertests/. - Healer: when a
.pw.spec.tstest fails, invoke the healer agent to suggest locator/wait fixes. Review the patch before committing.
All generated tests should stick to the .pw.spec.ts suffix so they remain scoped to Playwright and avoid clashing with Vitest unit tests under tests/.
Using agents locally
- Start the Remix dev server with
npm run dev(or rely on the Playwright web server) so/app/bulk/newis reachable. - When prompting the planner, mention the seed (
tests/seed.pw.spec.ts) and the spec file you want to target (e.g.,specs/bulk-variants.md). - Use the generator to translate that spec into
.pw.spec.tsfiles. Generated files live undertests/– keep their suffix as.pw.spec.ts. - Use the healer on a failing spec (
tests/bulk-tasks/basic-actions.pw.spec.ts, etc.). Re-runnpm run test:e2e -- <spec>locally before accepting the fix.
Manual commands
bash
# Install browsers after upgrading Playwright
npx playwright install
# Run the full suite (legacy + agent tests)
npm run test:e2e
# Run only the new agent tests
npx playwright test tests/**/*.pw.spec.tsTip: when recording or debugging, add
--headed --uito the commands above to watch the flows in Chromium.
CI integration
.github/workflows/ci.ymlrunsnpm run test:e2eon every push/PR so the agent-authored suites (intests/**/*.pw.spec.ts) stay green alongside the legacy specs..github/workflows/playwright-healer.ymlcan be triggered manually (Run workflow) to re-run the last failing specs or a specific file. It uploadsplaywright-report/andtest-results/artifacts for offline debugging.