AI QA agent: plan, write and self-heal end-to-end tests
Get real end-to-end test coverage for your web app without writing every test by hand: an agent explores the app, writes a test plan, turns it into Playwright tests and repairs tests that break when the UI changes.
Starter prompt
Use the Playwright planner agent with tests/seed.spec.ts as the seed. Explore http://localhost:3000 and write a test plan for <flow, e.g. signup then checkout> to specs/<flow>.md: the happy path, three edge cases and one error case. Stop and show me the plan. After I approve it, use the generator agent to turn it into tests under tests/, run them, and use the healer agent on any failures. Don't change app code. If a test fails because the app itself is broken, skip that test and tell me why instead of weakening the assertion.
Config
terminal
# 1. Add Playwright Test to your project (skip if you already have it)
npm init playwright@latest
# 2. Generate the planner, generator and healer agents for your tool
npx playwright init-agents --loop=claude # Claude Code
# npx playwright init-agents --loop=codex # Codex
# npx playwright init-agents --loop=vscode # VS Code (v1.105+)
# npx playwright init-agents --loop=opencode
# 3. Run the suite (no AI needed here, so it works in CI)
npx playwright test
# Re-run step 2 after every Playwright upgradeSetup steps
- Install Playwright Test in your repo (npm init playwright@latest) and make sure your app runs locally.
- Run npx playwright init-agents with the loop for your tool (claude, codex, vscode or opencode). It adds the planner, generator and healer agent definitions.
- Write tests/seed.spec.ts: the minimum setup to reach a ready page (fixtures, a test user, the base URL). Every generated test starts from it.
- Ask the planner for one flow at a time and review the Markdown plan in specs/ before generating anything.
- Generate the tests, run npx playwright test, and let the healer fix broken locators or waits.
- Commit specs/ and tests/ together, run the suite in CI on every PR, and re-run init-agents whenever you upgrade Playwright.
Why this works
The job is split into three narrow agents with files you can read in between: a human-readable plan in specs/, plain Playwright tests in tests/, and a healer that only touches failing tests. You review a short plan instead of hundreds of generated lines, and the result is ordinary Playwright code that runs in CI without any AI.
Watch out
An agent that can edit tests can also "fix" a test by weakening it. Review healer diffs like any PR, and make sure a real bug ends up as a skipped test with a note, not a deleted assertion. Point it at a local or staging app with test accounts, never production.
Quick answers
How much does this setup cost per month?
$20/mo. Playwright and its test agents are free and open source. The cost is your agent plan: Claude Pro $20 for Claude Code or ChatGPT Plus $20 for Codex. Running the finished tests in CI only uses CI minutes, not AI.
Which tools does it use?
Claude Code, OpenAI Codex, Playwright MCP. Model: Your agent's default (Claude Sonnet 5.5 in Claude Code; GPT-6.1 Sol or the cheaper GPT-6.1 Terra in Codex).
What should I watch out for?
An agent that can edit tests can also "fix" a test by weakening it. Review healer diffs like any PR, and make sure a real bug ends up as a skipped test with a note, not a deleted assertion. Point it at a local or staging app with test accounts, never production.
Related loadouts
Compare the gear: AI coding agents tier list · AI code review tier list · Browser automation for agents tier list