npx skills add https://github.com/0xbigboss/claude-code --skill e2e这些原则适用于处理 e2e 测试、测试失败或测试不稳定性时:
每个 e2e 失败都属于以下情况之一:
A. 不稳定的(测试基础设施问题)
B. 过时的(测试不再匹配实现)
C. 缺陷(实现不匹配规范)
不稳定的修复:
waitForTimeoutgetByRole/getByLabel/getByTestId 替换脆弱的 CSS 选择器These apply whenever working with e2e tests, test failures, or test flakiness:
Every e2e failure is exactly one of:
A. Flaky (test infrastructure issue)
B. Outdated (test no longer matches implementation)
C. Bug (implementation doesn't match spec)
Flaky fixes:
waitForTimeout with auto-waiting locators广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
expect() 的 web-first 断言修复竞态条件过时的修复:
缺陷修复:
E2e 测试修复不得更改:
唯一的例外:缺陷修复,其中规范明确定义了正确行为,并且单元测试覆盖了该修复。
playwright.config.ts、vitest.config.ts 或项目特定的设置package.json 以找到规范的 e2e 命令*.spec.md、docs/*.spec.md - 用于缺陷决策的真相来源使用最简报告器运行以避免上下文溢出:
# Playwright
yarn playwright test --reporter=line
# 或项目特定的
yarn test:e2e
如果指定了过滤器,则应用它:
yarn playwright test --reporter=line -g "transfer"
yarn test:e2e -- --grep "transfer"
将失败解析为:
| 测试 | 文件 | 错误 | 类别 |
|---|---|---|---|
login flow | auth.spec.ts:42 | 等待选择器超时 | 待定 |
对于每个失败:
按照上述原则依次应用修复:
所有修复完成后,重新运行测试套件:
## E2E 结果
**运行**:`yarn test:e2e` 于 <日期>
**结果**:X/Y 通过
### 已修复
- 不稳定的:`auth.spec.ts:42` - 将 waitForTimeout 替换为 getByRole 等待
- 过时的:`profile.spec.ts:88` - 在标题重新设计后更新了选择器
- 缺陷:`transfer.spec.ts:120` - 根据 SPEC.md#transfers 修复了金额验证
### 剩余失败
- 未验证的:`settings.spec.ts:55` - 无规范,需要用户决定
### 添加的单元测试
- `src/transfer.test.ts` - 金额验证边界情况(覆盖缺陷修复)
每周安装量
45
仓库
GitHub 星标
36
首次出现
2026年2月13日
安全审计
安装于
codex38
opencode36
claude-code36
gemini-cli36
github-copilot35
cursor35
getByRolegetByLabelgetByTestIdexpect() web-first assertionsOutdated fixes:
Bug fixes:
E2e test fixes must not change:
The only exception: bug fixes where a spec explicitly defines the correct behavior and unit tests cover the fix.
playwright.config.ts, vitest.config.ts, or project-specific setuppackage.json for the canonical e2e command*.spec.md, docs/*.spec.md - source of truth for bug decisionsRun with minimal reporter to avoid context overflow:
# Playwright
yarn playwright test --reporter=line
# Or project-specific
yarn test:e2e
If a filter is specified, apply it:
yarn playwright test --reporter=line -g "transfer"
yarn test:e2e -- --grep "transfer"
Parse failures into:
| Test | File | Error | Category |
|---|---|---|---|
login flow | auth.spec.ts:42 | timeout waiting for selector | TBD |
For each failure:
Apply fixes following the Principles above, in order:
After all fixes, re-run the suite:
## E2E Results
**Run**: `yarn test:e2e` on <date>
**Result**: X/Y passed
### Fixed
- FLAKY: `auth.spec.ts:42` - replaced waitForTimeout with getByRole wait
- OUTDATED: `profile.spec.ts:88` - updated selector after header redesign
- BUG: `transfer.spec.ts:120` - fixed amount validation per SPEC.md#transfers
### Remaining Failures
- UNVERIFIED: `settings.spec.ts:55` - no spec, needs user decision
### Unit Tests Added
- `src/transfer.test.ts` - amount validation edge cases (covers BUG fix)
Weekly Installs
45
Repository
GitHub Stars
36
First Seen
Feb 13, 2026
Security Audits
Installed on
codex38
opencode36
claude-code36
gemini-cli36
github-copilot35
cursor35
AI新闻播客制作技能:实时新闻转对话式播客脚本与音频生成
1,200 周安装