add-regression-point
为已有 PageObject 增量添加回归测试点。触发:新增测试点、添加回归点、add test point、增加覆盖、扩展页面方法。
复核运行期自愈提案并写回 PageObject。触发:选择器失效、定位符漂移、自愈提案、proposals.jsonl、用例误报不通过。
$ npx -y skills add danielsuo117/velocitai --skill selector-self-heal --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/selector-self-healContext preview
The summary Claude sees to decide when to auto-load this skill.
复核运行期自愈提案并写回 PageObject。触发:选择器失效、定位符漂移、自愈提案、proposals.jsonl、用例误报不通过。
name: selector-self-heal description: 复核运行期自愈提案并写回 PageObject。触发:选择器失效、定位符漂移、自愈提案、proposals.jsonl、用例误报不通过。
**不适用**:首次编写定位符(用 locator-replacer);页面真的少了元素(那是真缺陷,不是漂移)。
---
运行期只做两件事:找出可用的替代定位符让用例继续,并把提案写进 `reports/self-heal/proposals.jsonl`。**运行期绝不改源码。** 写回是本 skill 的职责,且要经人确认与落库闸门。
这条分界不是洁癖。测试进程里自动改源码,意味着一次跑飞的回归可以静默重写 整个 PageObject 层,而改动淹没在测试输出里没人看见。
---
python3 -c "import json;[print(json.dumps(json.loads(l),ensure_ascii=False,indent=2)) for l in open('reports/self-heal/proposals.jsonl')]"每条提案含:`intent`(常量名、原选择器、注释说明、历史指纹)、 `candidates`(全部候选及置信度与理由)、`chosen`(运行期实际采用者,可能为 null)。
| 现象 | 结论 | |------|------| | `chosen` 为 null,且候选列表为空 | 元素真的不在了 → **真缺陷**,不要写回,去查功能 | | `chosen` 的 strategy 是 `testid` 或 `id` | 锚点稳定 → 可写回 | | `chosen` 的 strategy 是 `text` | 文案改动即失效 → 写回前先找有没有 testid 可用 | | `chosen` 的 strategy 是 `stable-class` | 样式重构即失效 → 优先向前端要 testid | | 同一常量反复出现在提案里 | 该定位符本身选得不好 → 重新设计,别反复打补丁 |
**触发**:`chosen` 非 null 但 `intent` 的指纹字段全为 null 时,必须人工确认—— 没有历史指纹意味着判定只依赖注释说明,证据比平时弱。
写回目标是 PageObject 类顶部的定位符常量,**只改选择器字符串,不动常量名**:
# 改前 LOGIN_BUTTON = "#login-btn" # P0: 登录按钮 # 改后 LOGIN_BUTTON = '[data-testid="login-submit"]' # P0: 登录按钮
常量名是全项目引用点,改名会波及所有用例;注释是下次自愈的意图来源, 删掉等于自断依据。
---
相关:[自愈边界规则](../../rules/playwright/self-healing-boundaries.md) · [locator-replacer](../locator-replacer/) · [落库闸门](../../rules/agent-behavior/evolution-gate.md)
Next-generation UI automation harness powered by Python & Playwright. Chat with AI Agents to seamlessly generate, architect, and execute enterprise-grade UI test code.
为已有 PageObject 增量添加回归测试点。触发:新增测试点、添加回归点、add test point、增加覆盖、扩展页面方法。
浏览器 viewport / headless / 超时分层配置。触发:viewport、浏览器配置、导航超时、headless、slow_mo、incognito。
共享 page 下用例离开起点后必须 UI 返回并断言。触发:往返闭合、case round trip、复位超时、scope 共享 page。
一键生成 PageObject + 配套测试。触发:新增页面、生成页面、gen page、create page、添加页面对象。