E2E Testing Patterns
Use when creating or repairing browser end-to-end tests for critical user journeys, cross-browser behavior, accessibility, or release confidence; keep tests deterministic, independent, user-facing, and safe for CI.
Install
npx skills add sandbaseai/workbuddy-skill --skill e2e-testing-patternsgit clone --depth 1 https://github.com/sandbaseai/workbuddy-skill.git /tmp/workbuddy-skill
mkdir -p ~/.claude/skills
cp -r /tmp/workbuddy-skill/skills/e2e-testing-patterns ~/.claude/skills/e2e-testing-patternsPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# 端到端测试模式 端到端测试验证用户通过真实浏览器可观察到的关键行为和系统集成。它们数量应少而有价值:用单元测试覆盖逻辑,用契约/集成测试覆盖 API 和依赖,用 E2E 覆盖跨页面、认证、关键业务流程和真实交互。 ## 环境与安全门禁 开始前记录应用 revision、环境 URL、浏览器/运行器版本、测试账号来源、数据清理方式、允许的外部依赖、并发限制和报告读者。 - 默认只使用专用测试环境、合成数据和最小权限账号;禁止将生产 cookie、令牌、客户数据或秘密写入测试代码、日志、trace、截图或视频。 - 对会产生邮件、付款、删除、消息或第三方写操作的流程使用 sandbox、拦截器或明确的 dry-run;不得通过 E2E 直接验证生产副作用。 - 测试超出授权环境、关键账号不可用、数据清理失败或副作用边界不明时返回 `BLOCKED`。 - 浏览器测试失败只说明当前环境/路径的证据,不自动批准发布、修改代码或重试高风险操作。 ## 测试范围 ### 适合 E2E - 登录、注册、结账、关键表单、权限边界和多步骤用户旅程; - 浏览器渲染、导航、键盘交互、可见错误恢复和跨页面状态; - 真实 API 集成、关键浏览器兼容性和发布 smoke path; - 影响用户的可访问性要求,如语义角色、键盘路径、焦点和错误提示。 ### 不适合 E2E - 每个分支、算法边界、纯函数和异常组合:使用单元测试; - 所有 API schema 和错误组合:使用契约/集成测试; - 内部状态、私有函数、CSS 层级或实现细节; - 可由更快、更精确的低层测试覆盖的重复案例。 每条 E2E 都要写出用户风险、成功标准和为什么不能由低层测试替代。 ## 设计原则 1. **以用户行为断言**:通过角色、标签、可见文本、URL 和可访问状态判断结果,不读取私有状态。 2. **稳定定位**:优先 `getByRole`、`getByLabel`、`getByText` 等语义定位器;必要时使用有意设计的 `data-testid`/`data-cy`。避免 CSS 类、XPath、`nth-child` 和深层 DOM 结构。 3. **显式同步**:等待具体条件、网络响应或 UI 状态,不使用任意固定 sleep;为外部依赖设置有意义的超时。 4. **测试独立**:每个测试准备自己的数据和会话,可任意顺序、并行或单独运行;不要依赖前一个测试留下的购物车、登录态或数据库行。 5. **最小路径**:一个测试覆盖一个清晰旅程;公共准备逻辑抽成 fixture/页面对象,但不要把所有断言藏在黑盒 helper 中。 6. **可重复与可诊断**:固定必要的时区、locale、随机种子和时钟;失败时保留安全的 trace、截图、控制台和网络摘要。 ## 分阶段流程 ### 1. 建立测试契约 ```markdown Journey: <用户目标> Risk: <失败会影响什么> Preconditions: <测试账号、种子数据、feature flag> Steps: <用户可见步骤> Assertions: <用户可观察结果和关键后置状态> Isolation: <创建/清理/命名空间> Environment: <浏览器、URL、依赖和副作用> Evidence: <报告、trace、截图、日志的安全保留方式> ``` 先确认需求和验收标准,再确定最短可验证路径。缺少稳定的用户结果或数据清理方式时不要开始堆叠步骤。
Details
- Skill name
e2e-testing-patterns- Repository
- sandbaseai/workbuddy-skill
- Path
skills/e2e-testing-patterns/SKILL.md- License
- MIT
- Repo updated
- 8 September 2026
FAQ
What does the E2E Testing Patterns skill do?
Use when creating or repairing browser end-to-end tests for critical user journeys, cross-browser behavior, accessibility, or release confidence; keep tests deterministic, independent, user-facing, and safe for CI.
How do I install the E2E Testing Patterns skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add sandbaseai/workbuddy-skill --skill e2e-testing-patterns. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is E2E Testing Patterns popular?
It lives in sandbaseai/workbuddy-skill, which has 9 GitHub stars and 3 forks.
Related skills
Access Control Security Best Practices
9sandbaseai/workbuddy-skill
Design, review, implement, and verify least-privilege access controls across users, services, tenants, resources, and administrative workflows.
Accessibility Review
9sandbaseai/workbuddy-skill
Use when reviewing a web interface or interaction for semantic, keyboard, focus, screen-reader, ARIA, and contrast accessibility risks.
Acquire Codebase Knowledge
9sandbaseai/workbuddy-skill
Use when the user asks to map, document, or onboard into an existing codebase and needs evidence-backed architecture, structure, conventions, integrations, testing, and concerns documentation.
Idea Refine
9sandbaseai/workbuddy-skill
Use when a product, feature, content, or workflow idea is vague and needs structured divergent exploration, assumption testing, and convergence into an actionable one-page brief.
Design Test Strategy
9sandbaseai/workbuddy-skill
Design a risk-based mix of unit, integration, contract, end-to-end, performance, and manual tests.
Javascript Testing Patterns
9sandbaseai/workbuddy-skill
Use when building or repairing JavaScript/TypeScript tests with Jest, Vitest, Testing Library, async services, or CI; select the right test layer, keep mocks contract-aware, and assert public behavior.
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.