# 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.

- Category: Coding agents · Difficulty: Intermediate
- Estimated monthly cost: $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.
- 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)
- MCP servers: Playwright's browser tools, wired into the agents by npx playwright init-agents
- Last checked: 2026-10-27 · Hands-on tested: no (built from official docs)
- Canonical: https://getagentloadout.com/loadouts/qa-test-agents/ · JSON: https://getagentloadout.com/data/loadouts/qa-test-agents.json

## Tools
- [Claude Code](https://claude.com/product/claude-code): Anthropic's agentic coding tool for the terminal and IDEs. Included in paid Claude plans. Pricing: Pro $20/mo ($17/mo billed yearly; 5-hour and weekly usage limits); Max 5x $100/mo (5x Pro usage per session); Max 20x $200/mo (20x Pro usage per session). Source: https://claude.com/pricing
- [OpenAI Codex](https://openai.com/codex): OpenAI's coding agent for web, CLI, IDE and cloud tasks, bundled with ChatGPT plans. Pricing: Free $0/mo (Lightweight tasks, GPT-6 Luna); Go $8/mo (Lightweight tasks); Plus $20/mo (GPT-6.1 Sol, GPT-6.1 Terra and GPT-6 Luna); Pro $100/mo (Pro 100 / Pro 200 / Pro 500 ($500 adds Ultrafast); billed monthly only). Source: https://learn.chatgpt.com/docs/pricing
- [Playwright MCP](https://github.com/microsoft/playwright-mcp): Microsoft's MCP server that lets agents drive a real browser via accessibility snapshots. Pricing: Open source $0/mo (Runs locally with npx). Source: https://playwright.dev/docs/getting-started-mcp

## 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)

```bash
# 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 upgrade
```

## Setup steps
1. Install Playwright Test in your repo (npm init playwright@latest) and make sure your app runs locally.
2. 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.
3. 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.
4. Ask the planner for one flow at a time and review the Markdown plan in specs/ before generating anything.
5. Generate the tests, run npx playwright test, and let the healer fix broken locators or waits.
6. 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.

## Unverified
- We haven't measured how many plan, generate and heal rounds fit in a $20 plan's usage limits.
- Not hands-on tested yet; built from Playwright's Test Agents docs (playwright.dev/docs/test-agents).

## Related loadouts
- [The $20/month coding agent: pick one subscription](https://getagentloadout.com/loadouts/twenty-dollar-coding-agent/)
- [Delegate tasks to a background agent](https://getagentloadout.com/loadouts/async-cloud-agent/)
- [Agent-driven data notebook](https://getagentloadout.com/loadouts/data-analysis-notebook/)

Some links may be affiliate links; it never affects rankings. Rankings are never for sale.
