All guides
E2E authoring · 10 minutes · Intermediate

Self-healing E2E tests with Claude MCP

Most "self-healing" tools rerun the AI agent on every test execution — that's slow, expensive, and probabilistic. There's a better split: use Claude to design the suite once, replay deterministically from snapshots, and bring the LLM back only when a selector actually breaks.

What "self-healing" actually means

The term gets stretched. In practice there are three flavours:

  • Agent-driven replay — the LLM drives the browser visually on every run. Brilliant at reasoning, but pays an LLM token tax on every step. Examples: Claude Computer Use, raw playwright-mcp.
  • Static selector fallbacks — the framework tries multiple selectors per element. Cheap, but breaks the moment all fallbacks miss.
  • Conditional self-heal — replay is deterministic; the LLM is invoked only when a selector misses. This is what E2Easy + Claude MCP does.

Conditional self-heal gives you the maintenance benefit without the per-replay LLM bill.

The architecture

Three components, each with a clear job:

  1. Claude — designs the test once from a chat prompt, using inspect_page against the live DOM.
  2. E2Easy MCP server — stores the recording as a Playwright-grade test with stable selectors, ARIA, xpath and locators.
  3. Playwright runner — replays the recording deterministically. On selector miss, it pings the MCP server to trigger Claude self-heal on that step only.

Cost model

For a typical 100-step E2E test replayed 100× in a year:

Authoring (Claude, once)         ~$0.04
Self-heal (Claude, ~5 events/yr) ~$0.05
Replays (Playwright, 100×)        $0   in LLM tokens
                                  ----
Total LLM cost / year            ~$0.09

Compared to agent-driven approach:
100 replays × $3.20 per replay  ~$320

That's the 100× factor you see in the headline number on the main page.

Important: the 100× ratio assumes mostly stable selectors. If your team ships a redesign every sprint, self-heal events fire more often — but they still only patch the broken step, not the whole flow.

What Claude won't fix

Self-heal handles selector drift. It does not handle:

  • Backend schema changes that alter the response shape — that's a real bug, the test should fail.
  • Multi-step business-logic changes (e.g. checkout flow now requires 2FA).
  • Feature-flag-gated UI variants — solve via test parameters, not heal.

This is intentional. Self-heal is a maintenance tool, not a way to mask product bugs.

Set up self-healing in 5 minutes

Free during early access · OAuth 2.1 + PKCE · Cancel anytime