selector-drift-recovery
显著减少 UI 重构对回归测试维护的人工成本,适合频繁迭代的前端团队。
需访问测试构建和运行浏览器环境,可能依赖敏感测试凭证。
在 UI 重构后批量重生成并验证失效的测试选择器并提交修复 PR。
UI 重构后批量修复失效的测试选择器:用 aria-snapshot 做旧 DOM 与新 DOM 的差异比对,按 role-first + 区域定位重生成定位器,验证新构建并把改动汇总成一个带截图和置信度的 PR。适合重构导致大量测试同时失败的情况,需配合 Playwright >= 1.50 使用,不针对单个偶发性测试的修复。
▸ 展开 SKILL.md 英文原文
Bulk-regenerate broken test selectors after a UI refactor or redesign. Detects drift between old and new DOM with an aria-snapshot diff, maps old locators to new equivalents using role-first + region scoping, validates against the new build, and produces a single PR with grouped per-file selector updates and per-change evidence. Assumes Playwright >= 1.50 (trace viewer DOM-snapshot panel, getByRole filtering, ariaSnapshot). Use when: "UI refactor broke tests," "redesign broke tests," "bulk update selectors," "regenerate selectors after refactor," "selector drift," "fix N broken tests after redesign." Not for: healing one flaky test at runtime — use test-reliability. Not for: writing a new test suite from scratch — use playwright-automation. Not for: re-recording tests after a framework switch (Selenium to Playwright) — use test-migration. Related: test-reliability, playwright-automation, test-migration, ci-cd-integration, visual-testing.
帮我安装这个 skill:https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/selector-drift-recovery/SKILL.mdcurl -fsSL "https://raw.githubusercontent.com/petrkindlmann/qa-skills/main/skills/selector-drift-recovery/SKILL.md"<objective> A redesign shipped and 23 tests now fail with `TimeoutError: locator.* exceeded` — the DOM moved, not the product. This skill closes that maintenance loop: it diffs the old DOM against the new one, regenerates the broken selectors role-first against the new build, validates the whole suite, and ships the diff as one reviewable PR with a confidence score and screenshot per change. The trigger is an event (a refactor merged), not a flake. The output is a PR a human signs off on — not a silent runtime auto-heal. This is the bulk, offline, batch counterpart to `test-reliability`. They share the multi-attribute locator + confidence scoring primitives but run in opposite directions: `