{"slug": "playwright-test-agents-planner-generator-and-healer-explained-and-where-they", "title": "Playwright Test Agents: Planner, Generator and Healer Explained (and Where They Fall Short)", "summary": "Playwright 1.56 ships three built-in AI test agents — a planner that explores a running app and writes a Markdown test plan, a generator that turns plans into Playwright test files, and a healer that replays failing tests and patches them — installed via `npx playwright init-agents` and run inside Claude Code, VS Code, Codex or OpenCode. Each agent pairs instructions with Playwright's MCP browser tools, using whatever model the client provides, and the guide notes the healer can produce a passing or skipped test, raising the question of whether it fixed the test or masked the bug.", "body_md": "You run one command, open Claude Code or VS Code, and type \"plan tests for guest checkout\". A few minutes later you have a Markdown test plan, a folder of Playwright tests and an agent that offers to fix whichever ones fail.\n\nThat's the promise of Playwright Test Agents. It's real, and it's useful. It also raises the question every QA lead asks next: if an AI agent fixes the failing tests, who checks that it fixed the test and not the bug?\n\n**Playwright Test Agents are three AI agent definitions that ship with Playwright: a planner that explores your app and writes a Markdown test plan, a generator that turns the plan into Playwright test files, and a healer that runs failing tests and patches them. You install them with `npx playwright init-agents` and run them in Claude Code, VS Code, Codex or OpenCode.**\n\nThis guide explains how each agent works, how to set them up, what the healer can and can't be trusted with, and when a team needs more than three agents in a repository.\n\nKey takeaways\n\n`npx playwright init-agents --loop=claude` (or `vscode`, `codex`, `opencode`).\nPlaywright Test Agents arrived in Playwright 1.56. The [Playwright docs](https://playwright.dev/docs/test-agents) describe them as three agents that \"can be used independently, sequentially, or as the chained calls in the agentic loop.\"\n\n| Agent | Input | What it does | Output | \n|---|---|---|---|\n| **Planner** | A request, a seed test, optionally a product spec | Explores the running app in a real browser | A Markdown test plan in `specs/` | \n| **Generator** | A Markdown plan from `specs/` | Writes tests and checks selectors and assertions live against the app | Playwright test files in `tests/` | \n| **Healer** | The name of a failing test | Replays the steps, inspects the current UI, patches the test and re-runs it | A passing test, or a skipped one | \n\nEach agent is a set of instructions plus Playwright's MCP browser tools. The AI model is whatever your client uses, so quality depends on the model as well as on Playwright.\n\nYou need an existing Playwright Test project. Then run the command for your client:\n\n```\nnpx playwright init-agents --loop=claude    # Claude Code\nnpx playwright init-agents --loop=vscode    # VS Code with Copilot\nnpx playwright init-agents --loop=codex     # OpenAI Codex\nnpx playwright init-agents --loop=opencode  # OpenCode\n```\n\nThe command writes the agent definitions into your project. For VS Code, the docs say you need VS Code v1.105 or later for the agentic experience to work properly.\n\nAfter a run, a typical project looks like this:\n\n```\n.github/                # agent definitions written by init-agents\nspecs/                  # Markdown test plans from the planner\ntests/\n  seed.spec.ts          # gets the app into a ready state\n  guest-checkout.spec.ts\nplaywright.config.ts\n```\n\nTwo rules save a lot of confusion:\n\n`specs/` with your tests.\nThe planner opens your app, explores the flow you ask about and writes a plan for one or many scenarios. Before it explores, it runs your **seed test**, which does all the setup a test needs: opening the right page, signing in, seeding data.\n\nA seed test can be very small. This one is illustrative:\n\n``` js\n// tests/seed.spec.ts\nimport { test, expect } from '@playwright/test';\n\ntest('seed', async ({ page }) => {\n  await page.goto('https://staging.example.com/login');\n  await page.getByLabel('Email').fill(process.env.TEST_USER_EMAIL!);\n  await page.getByLabel('Password').fill(process.env.TEST_USER_PASSWORD!);\n  await page.getByRole('button', { name: 'Sign in' }).click();\n  await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();\n});\n```\n\nThen ask for a plan in plain language, for example: *\"Use the planner agent to create a test plan for applying a discount code at checkout. Cover valid, expired and already-used codes.\"*\n\nThe planner saves a Markdown file in `specs/`. The docs call it \"human-readable but precise enough for test generation\". It lists scenarios, steps and expected results. Read it before you generate anything. A wrong plan produces confident, wrong tests.\n\n**What makes plans better:**\n\nThe generator reads the plan and writes Playwright tests. It doesn't just translate text into code. It runs the steps in a browser and checks that selectors and assertions work against the live app.\n\nGenerated files point back to their sources with comments, which makes review easier:\n\n``` js\n// spec: specs/discount-codes.md\n// seed: tests/seed.spec.ts\nimport { test, expect } from '@playwright/test';\n\ntest('expired discount code shows an error', async ({ page }) => {\n  await page.goto('https://staging.example.com/cart');\n  await page.getByLabel('Discount code').fill('SPRING2025');\n  await page.getByRole('button', { name: 'Apply' }).click();\n  await expect(page.getByText('This code has expired')).toBeVisible();\n  await expect(page.getByTestId('order-total')).toHaveText('$120.00');\n});\n```\n\n*(Illustrative output; your generator's code will differ.)*\n\nThe docs are upfront that generated tests \"may include initial errors\" that the healer can then fix. In practice, review three things in every generated test:\n\nWhen a test fails, you give the healer its name. According to the docs, it:\n\nThe result is \"a passing test, or a skipped test if the healer believes that functionality is broken.\"\n\nThat last line is the one to think hardest about.\n\nYes, if you let it merge changes nobody reviews. This is the biggest worry testers raise about AI healing, and it's fair. One reviewer on a QA forum described the risk as \"an easy always green model\".\n\nA test can fail for two very different reasons:\n\n| Failure | Example | Right fix | \n|---|---|---|\n| **The test is out of date** | The \"Apply\" button was renamed \"Redeem\" | Update the locator. Healing is exactly right. | \n| **The product is broken** | The discount no longer changes the total | Fail the build and file a bug. \"Healing\" this is hiding it. | \n\nA healer that changes an assertion from `$108.00` to `$120.00`, or skips a test \"because the feature looks broken\", turns the second case into a green build. The agent isn't being malicious. It was asked to make a test pass.\n\n**Guardrails that keep healing honest:**\n\n`expect` needs a human who knows the feature.`test.skip` or `test.fixme`, or removes assertions, until someone approves it:\n\n```\n# Fails if a pull request adds skipped tests or deletes assertions under tests/\nBASE=origin/main\nif git diff -U0 \"$BASE\"...HEAD -- tests | grep -qE '^\\+.*\\btest\\.(skip|fixme)\\('; then\n  echo \"New skipped or fixme tests found. Get a reviewer to approve them.\"\n  exit 1\nfi\nREMOVED=$(git diff -U0 \"$BASE\"...HEAD -- tests | grep -cE '^-\\s*(await\\s+)?expect\\(' || true)\nif [ \"$REMOVED\" -gt 0 ]; then\n  echo \"$REMOVED assertion(s) removed. Get a reviewer to approve them.\"\n  exit 1\nfi\n```\n\nFor a wider look at keeping AI agents' test results trustworthy, see [why confidence is the real bottleneck in agentic testing](https://robonito.com/blog/post/agentic-testing-confidence-bottleneck/?utm_source=devto&utm_medium=syndication&utm_campaign=playwright-test-agents).\n\nPlaywright has added agent features steadily since the test agents launched. From the [release notes](https://playwright.dev/docs/release-notes):\n\n`npx playwright test --debug=cli` and explore traces with `npx playwright trace`. Agents can also record \"agentic video receipts\" of what they did.`playwright-cli`, so `npx playwright mcp` and `npx playwright cli` work without separate installs.\nThe [Playwright CLI](https://playwright.dev/agent-cli/introduction) also installs \"skills\" for Claude Code, GitHub Copilot and Cursor, including one to plan, generate and heal tests. It's a lighter-weight route to the same workflow.\n\n|  | Test Agents | Playwright MCP | Playwright CLI with skills | \n|---|---|---|---|\n| What it is | Predefined planner, generator and healer agents | Browser tools for any MCP client | A command-line tool and skills for coding agents | \n| Best for | Building and repairing a Playwright suite in your repo | Exploring, debugging, one-off agent sessions | Coding agents that work in a terminal | \n| Output | Plans in `specs/` , tests in`tests/` | Actions, snapshots, optional generated code | Commands and generated tests | \n| Set up with | `npx playwright init-agents` | `npx @playwright/mcp@latest` (also bundled as`npx playwright mcp` since 1.62) | `npm install -g @playwright/cli@latest` | \n\nThey aren't rivals. The test agents use Playwright's MCP tools under the hood, and many teams use all three. Our [Playwright MCP guide](https://robonito.com/blog/post/playwright-mcp/?utm_source=devto&utm_medium=syndication&utm_campaign=playwright-test-agents) covers MCP setup in Claude Code, Cursor and VS Code in detail.\n\nThe honest picture from early users is mixed:\n\nNone of this is surprising for a tool that's only a year old. It does mean the agents speed up writing tests, while owning the suite is still a job for your team.\n\n**They're a strong fit when:**\n\n**They're a weaker fit when:**\n\nRobonito is an agentic QA platform. Its agents create, run and maintain end-to-end tests, and it covers the jobs that sit around the three Playwright agents rather than replacing Playwright.\n\n**Where Playwright Test Agents are the better choice:**  a developer-owned suite that should live entirely in your repository as Playwright code, with no platform and no extra cost beyond your model's tokens.\n\nFor a fuller comparison, see [Robonito vs Playwright](https://robonito.com/robonito-vs-playwright/?utm_source=devto&utm_medium=syndication&utm_campaign=playwright-test-agents). Or  on a flow you've already planned with the planner agent.\n\nYes. They ship with Playwright, which is open source. You pay for the AI model your client uses, such as Claude Code, Copilot or Codex.\n\nThey were introduced in Playwright 1.56. Use a current release and regenerate the agent definitions with `npx playwright init-agents` after each upgrade.\n\nYes. Run `npx playwright init-agents --loop=claude`. The docs also list VS Code, Codex and OpenCode loops.\n\nIt's a normal Playwright test that sets up everything other tests need, such as signing in. The planner runs it before exploring, and uses it as an example for the tests it plans.\n\nIt can fix tests that broke because the UI changed, such as a renamed button or a new layout. If it decides the feature itself is broken, it can mark the test as skipped. Review those changes: a skipped test may be hiding a real bug.\n\nPlaywright MCP gives any MCP-capable AI client tools to drive a browser. Test Agents are three predefined agents that use those tools to plan, generate and heal Playwright tests in your repository.\n\nNot native apps. They drive browsers, so they can test mobile web with a phone-sized viewport, but native Android and iOS apps need a different tool.\n\nLet the agents draft. Keep the suite trustworthy. Robonito runs your critical journeys on every release, with healing your team can review and evidence for every run. or .\n\n*Originally published on the [Robonito blog](https://robonito.com/blog/post/playwright-test-agents/?utm_source=devto&utm_medium=syndication&utm_campaign=playwright-test-agents). Robonito is an AI-native QA platform: AI agents that write, run and self-heal end-to-end tests for web, mobile, API and desktop apps.*", "url": "https://wpnews.pro/news/playwright-test-agents-planner-generator-and-healer-explained-and-where-they", "canonical_source": "https://dev.to/robonito/playwright-test-agents-planner-generator-and-healer-explained-and-where-they-fall-short-4f7a", "published_at": "2026-12-02 01:06:24+00:00", "updated_at": "2026-12-02 01:14:29.354055+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols"], "entities": ["Playwright", "Microsoft", "Claude Code", "VS Code", "OpenAI Codex", "OpenCode"], "also_reported_by": [], "takeaway": "Playwright 1.56's planner, generator and healer agents install with `npx playwright init-agents --loop=<claude|vscode|codex|opencode>`, chain through Markdown plans in `specs/` and tests in `tests/`, and depend on a seed test to put the app in a ready state.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/playwright-test-agents-planner-generator-and-healer-explained-and-where-they", "markdown": "https://wpnews.pro/news/playwright-test-agents-planner-generator-and-healer-explained-and-where-they.md", "text": "https://wpnews.pro/news/playwright-test-agents-planner-generator-and-healer-explained-and-where-they.txt", "jsonld": "https://wpnews.pro/news/playwright-test-agents-planner-generator-and-healer-explained-and-where-they.jsonld"}}