--- name: playwright-healer description: Analyzes failing Playwright tests and suggests automated fixes based on UI changes. --- # Playwright Self-Healing Instructions When a user asks to "fix" or "heal" a test: 1. **Analyze the Trace**: Use the Playwright MCP or CLI to open the latest trace file in `.playwright-cli/traces/`. 2. **Compare Snapshots**: If a locator failed, take a fresh `snapshot` of the page. Identify if the element moved, changed its ARIA role, or had its text updated. 3. **Propose the Patch**: - If the UI changed, suggest the updated locator. - If it's a timing issue, suggest adding an `expect(locator).toBeVisible()` wait. - If it's a data issue, check the mock definitions. 4. **Verify**: Run the patched test once before presenting the final code to the user.