self-heal

Repairs drifted Playwright locators in page object models after triage confirms test issues.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/tetianna/ai-assisted-qa-automation-2 --skill self-heal-tetianna
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: self-heal
Source: https://github.com/tetianna/ai-assisted-qa-automation-2/tree/main/.cursor/skills/self-heal
Command: npx skills add https://github.com/tetianna/ai-assisted-qa-automation-2 --skill self-heal-tetianna

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? UI changes break Playwright tests when accessible names or roles drift, and fixing them manually requires tracing failures, rediscovering elements, and patching locators without accidentally weakening assertions or masking real app bugs. ## Core Features & Use Cases - Gated drift repair: Only proceeds when ci-failure-triage has classified the failure as a test issue (drift); routes app bugs to jira-bug-reporter instead. - Accessibility-tree rediscovery: Uses Agent-Browser (Playwright MCP) to read the a11y tree and find the element's current role and accessible name. - Minimal POM patching: Edits only the page object model with role-based locators, keeping spec assertions byte-identical, then re-runs the test and opens a PR with a before/after locator table. - Use Case: A CI run fails because a button label changed from "Cancel1" to "Cancel". After triage confirms drift, this Skill rediscovers the button via the a11y tree, patches the POM locator, verifies the test passes with unchanged assertions, and opens a review PR. ## Quick Start Ask the agent to heal the drifted locator in the failing Playwright spec after triage has classified the red build as a test issue.

Frequently Asked Questions about self-heal

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a broken Playwright locator after a UI change?▼

First confirm via failure triage that the issue is locator drift, not an app bug. Then rediscover the element's current role and accessible name using the browser's accessibility tree, patch only the page object model with a getByRole locator, and re-run the test to verify it passes.

How to self-heal Playwright tests without weakening assertions?▼

Patch only the locator in the page object model and keep spec assertion lines byte-identical. If the test can only pass by changing an expect statement, treat it as a potential app bug and escalate rather than merging the change.

When should I not use locator self-healing for a failing test?▼

Do not heal when triage classifies the failure as an app bug or is inconclusive, when no triage exists yet, or when fixing requires weakening assertions. In those cases route to bug reporting or ask a human to confirm before proceeding.

Why does my Playwright test fail after a UI update?▼

Tests fail when accessible names, labels, or roles change, breaking role-based locators like getByRole with a specific name. Inspect the Playwright trace to find the failing selector, then compare it against the current accessibility tree to identify the drift.

Can self-healing fix multiple broken locators in one run?▼

No, the workflow enforces one repair per run: one failing locator chain leads to one POM patch and one pull request. If the test remains red after a single locator fix, stop and report findings for human follow-up.