BXUP Track progress & test yourself — free
QA & Testing · Playbook · Core · ~5 min read
QA & TESTING · PLAYBOOK · CORE

Run the Playwright Test Agents — Planner → Generator → Healer, with Human Gates

Playwright now ships first-party agents: a planner that explores your app into a Markdown test plan, a generator that turns the plan into verified specs, and a healer that repairs failures. The loop is powerful precisely because a human edits the artifact between every stage — skip a gate and you ship the agent's misunderstandings at scale.

Tier: Core · Workflow area: Agentic test stack & self-healing

This playbook runs the full three-agent loop on a real feature, with explicit review gates: you edit the plan before generation, review the specs before merge, and audit every heal before it lands.

USE IT WHEN

The loop earns its setup

  • Standing up coverage for a feature or app area that has none — the planner's exploration is the fastest path to a credible first plan.
  • Your team already knows Playwright; the agents accelerate people who can judge the output.
  • Regressions from UI churn eat your week — the healer plus an audit habit pays off fast.
SKIP IT WHEN

Gates would be theater

  • Nobody on the team can review a Playwright spec — you would be accumulating tests no one understands (the classic AI-suite failure).
  • The app needs complex authenticated, multi-role, or data-seeded states the planner cannot reach unaided — build fixtures first, then plan.
  • You need API or unit coverage; this loop is end-to-end UI only.

Prerequisites

  • Playwright 1.50+ project with a running app (local or test env URL).
  • VS Code with Copilot, or Claude Code — the agents run through an agentic assistant.
  • Agent definitions initialized: npx playwright init-agents --loop=vscode (or --loop=claude).
  • A git branch and PR workflow — every stage's output is a reviewable artifact.

The workflow

  1. Initialize and inspect the agent definitions. init-agents writes planner, generator, and healer instructions plus a seed.spec.ts into your repo. Read them — they are prompts, and you are allowed to edit them to encode team conventions (locator style, fixture use, forbidden patterns).

  2. Run the planner with a scoped charter. Point it at one feature, not the whole app:

    Use the planner agent. Explore the checkout flow of http://localhost:3000
    starting from a logged-in state (use the storageState in .auth/user.json).
    Produce specs/checkout.md covering: guest vs logged-in checkout, address
    validation, payment failure handling, and order confirmation.
    Do not plan admin, search, or catalog scenarios.
    

    The planner drives a real browser and emits a Markdown plan of scenarios with steps and expected outcomes.

  3. GATE 1 — edit the plan like a test design review. This is the highest-leverage 20 minutes in the loop. Expect both over-scoping (trivial permutations padding the count) and under-scoping (no negative payment path, no empty-cart edge). Delete, merge, add, and correct expected outcomes that the planner guessed from UI text. A sample plan row worth fixing:

    ### Scenario: Payment declined
    Steps: ... submit card 4000-0000-0000-0002
    Expected: user sees "Something went wrong"        <- wrong: spec says inline
                                                         "Card declined" + cart preserved
    

    Commit the edited plan. It is now a reviewed artifact with your name on it.

  4. Run the generator against the edited plan. The generator writes one spec per scenario, executing each step live to verify selectors and assertions as it goes — expect it to iterate until the test actually passes against the running app.

  5. GATE 2 — review the specs before merge. Verified-against-the-app is not verified-correct. Review for assertion strength (does the order-confirmation test assert the order number, or just the "Thank you" header?), locator quality, and fixture use. Then check the suite is deterministic:

    npx playwright test --repeat-each=3 --workers=4
    
  6. Break something, run the healer. When UI churn or a refactor breaks specs, the healer replays the failure, inspects the live app, and proposes patches:

    Use the healer agent on the 3 failures in the last run. For each, output the
    diff and a one-line justification. Do not commit.
    
  7. GATE 3 — audit every heal as a proposed change. The healer cannot distinguish "selector drifted" from "feature broke". For each patch ask: did the app's intended behavior change? If yes, the heal is masking a regression — reject it and file the bug. Land accepted heals as commits with the justification in the message (see the healed-test audit queue playbook for the full workflow).

Key Takeaway:

The loop's artifacts — plan, specs, heal diffs — are checkpoints designed for human judgment. An unedited plan generates confidently wrong tests; an unaudited heal converts a real bug into a green run. The agents do the assembly; the gates do the QA.

Variations

  • Claude Code loop (--loop=claude): same three agents driven from the terminal; strongest when you want the planner to also read requirement docs in the repo for expected outcomes instead of guessing from the UI.
  • Planner-only mode: use the plan as a charter for manual exploratory testing or as input to hand-written specs — valuable even if you never run the generator.
  • Generator against a hand-written plan: skip the planner entirely when you already have acceptance criteria; write specs/feature.md yourself in the same format.
  • Seeded-bug calibration: before trusting the healer, deliberately break one feature and one selector; a healer that "fixes" the feature-level failure fails your calibration.

Quality check

  • Plan diff exists: the committed plan shows human edits — deletions and corrections, not just a rubber stamp.
  • Assertion audit: every generated spec asserts an outcome a user cares about, not merely element visibility; no tautological asserts.
  • Determinism: 3× repeat-each run is 100% green before merge.
  • Heal ledger: every healer patch in history has an accept/reject decision and justification; at least one rejected heal on record proves the gate is real.
  • Comprehensibility: a teammate who did not run the loop can explain any generated spec in review.

Pitfalls

  • Skipping Gate 1 because the plan "looks thorough". Volume is the planner's failure mode — 40 shallow scenarios read as rigor while the one payment edge case that matters is missing.
  • Trusting generator "verified" status. It verifies the test passes, not that the assertion is worth passing. Weak asserts sail through.
  • Healer-as-autopilot. Auto-committing heals is how a broken checkout stays green for a month. Every heal is a proposed change, no exceptions.
  • Whole-app charters. Planner output degrades sharply with scope; one flow per run keeps quality reviewable.
  • Letting agent definitions drift from team conventions. Encode locator and fixture rules into the definition files, or you will re-correct the same style errors in every review.

Restricted-environment variant

The agents drive a real browser against your app and send page snapshots to the model. On client engagements, that means client UI, data, and URLs enter the assistant — get the tool approved first, run against a test environment with synthetic data only, and never point the planner at production. Where policy requires, use a locally-hosted model endpoint for the loop; the artifacts and gates are identical. Disclose agent-generated tests in deliverable documentation where the client's audit standards require it.

Success criteria

  • A feature area goes from zero to a reviewed, deterministic suite in under a day, with plan and specs as merged artifacts.
  • Every stage shows human fingerprints: edited plan, review comments on specs, per-heal decisions.
  • At least one wrong heal caught and rejected within the first month of healer use.
  • Suite maintenance time drops without the team losing the ability to explain any test it contains.
Pro Tip

Treat the planner's Markdown plan as the durable asset, not the specs. When the app changes significantly, re-edit the plan and regenerate — cheaper than healing twenty stale specs, and the plan review keeps you, not the agent, as the owner of coverage.

This is the free reading view. Open BXUP to track your progress, run the hands-on labs, and prove it with original, exam-pattern assessments.
© Anvi Innovate · BXUP — Be Exponentially Upskilled · BXUP is an independent learning platform, not affiliated with or endorsed by AWS, Microsoft, Google, NVIDIA, IBM, Salesforce, Databricks, Oracle or Anthropic. All trademarks belong to their respective owners. · bxup.in