Playwright's three test agents (planner, generator and healer) can draft end-to-end tests for your app from a plain request. Run them against a test environment, then review the plan, the test files and every test the healer changed or marked test.fixme() before you merge.
The agents do the typing. You decide whether the tests check the right things.
Based on Playwright, by Microsoft, Apache-2.0 licensed. We checked the Test Agents docs and v1.64.1, released 14 October 2026, and generated the Claude Code agent files ourselves with that version on 28 October 2026. Agent files change between releases, so regenerate and reread yours.
What the three agents do
From the docs:
- Planner "explores the app and produces a Markdown test plan", saved under
specs/. - Generator "transforms the Markdown plan into the Playwright Test files" under
tests/, checking selectors and assertions live as it goes. - Healer "executes the test suite and automatically repairs failing tests".
You can use them one at a time or chain them. The docs note that generated tests "may include initial errors", which is what the healer is for.
Step 1: Generate the agent definitions
In a project that already uses Playwright Test, run the command for your tool:
npx playwright init-agents --loop=claudeThe docs also list --loop=vscode, --loop=codex and --loop=opencode. For VS Code, they say version 1.105 or later is needed.
With v1.64.1 and --loop=claude, our run created:
.claude/agents/playwright-test-planner.md,playwright-test-generator.mdandplaywright-test-healer.md.mcp.json, which starts aplaywright-testMCP server withnpx playwright run-test-mcp-serverseed.spec.ts, an empty seed testspecs/README.md
The docs say these definitions "should be regenerated whenever Playwright is updated". Commit them so changes show up in review.
Step 2: Read what each agent is allowed to do
Each agent file lists its tools at the top. In our generated files:
- The planner can read files and drive the browser: open pages, click, type, upload files, take screenshots. Its list also includes a tool named
browser_run_code_unsafe. - The generator can drive the browser and write tests through the MCP server's
generator_write_testtool. - The healer can run and debug tests, and it has Claude Code's
Edit,MultiEditandWritetools, so it edits files in your repo directly.
The healer's instructions also say: "Do not ask user questions, you are not interactive tool, do the most reasonable thing possible to pass the test." That's fine for a test drafter, as long as a person reviews the result.
Step 3: Point the agents at a test environment
The planner and generator click through your real UI. Give them somewhere safe to do it:
- a local or staging build, not production
- test accounts with no real customer data or payment methods
- a seed test that logs in and sets up state the same way every time
The seed test matters. Per the docs, the planner runs it to do "all the initialization necessary for your test", including global setup and fixtures, and uses it as the example for every generated test.
Step 4: Plan, then read the plan
Ask the planner for one flow at a time, for example: "Generate a plan for guest checkout." You can add a product requirements document for context.
Read the Markdown plan in specs/ before generating anything. It lists steps and expected results in plain language, so it's the cheapest place to catch a wrong assumption. Edit it until the expected results match what your product should do.
Step 5: Generate, run, and heal
Give the generator the plan file. It writes tests under tests/, with comments that point back to the spec and seed. Run them yourself with npx playwright test.
When a test fails, the healer replays the failing steps, inspects the UI, suggests a patch such as a locator update or wait adjustment, and "re-runs the test until it passes or until guardrails stop the loop". Its output is "a passing test, or a skipped test if the healer believes that functionality is broken."
Step 6: Review before you merge
This is the human approval step, and it's where the real value is. Open the diff and check:
- Every
test.fixme(). The generated healer instructions say that if an error persists and it's confident the test is correct, it marks the testtest.fixme()so it's skipped, with a comment. A skipped test may be pointing at a real bug. Read the comment and decide. - Weakened assertions. A test can pass because an expectation was loosened. Compare each healed test to its spec.
- Locators. Prefer role- and label-based locators like
getByRole, which the docs' examples use. - Scope. Generated tests should map to the plan; the docs say they align "one-to-one with specs wherever feasible".
Merge only what you'd have been happy to write yourself.
The takeaway
Playwright's planner, generator and healer draft end-to-end tests quickly. Run them against a test environment with test accounts, read the plan before generating, and review every healed or fixme test before merging.
Next step
For browser automation outside tests, see our Playwright MCP kit. Read how we verify kits, or find an agent for the job.
Good setups, worth keeping. Request email updates on the home page, then confirm by email. No subscription starts until you confirm.
Part of: Which setup should I use to add human approval to an agent?
