E2e Testing Patterns skill for Claude

Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment.

When Claude uses it

Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.

E2e Testing Patterns SKILL.md

The full skill file from wshobson/agents (MIT).

E2E Testing Patterns

Build reliable, fast, and maintainable end-to-end test suites that provide confidence to ship code quickly and catch regressions before users do.

When to Use This Skill

  • Implementing end-to-end test automation
  • Debugging flaky or unreliable tests
  • Testing critical user workflows
  • Setting up CI/CD test pipelines
  • Testing across multiple browsers
  • Validating accessibility requirements
  • Testing responsive designs
  • Establishing E2E testing standards

Core Concepts

1. E2E Testing Fundamentals

What to Test with E2E:

  • Critical user journeys (login, checkout, signup)
  • Complex interactions (drag-and-drop, multi-step forms)
  • Cross-browser compatibility
  • Real API integration
  • Authentication flows

What NOT to Test with E2E:

  • Unit-level logic (use unit tests)
  • API contracts (use integration tests)
  • Edge cases (too slow)
  • Internal implementation details

2. Test Philosophy

The Testing Pyramid:

        /\
       /E2E\         ← Few, focused on critical paths
      /─────\
     /Integr\        ← More, test component interactions
    /────────\
   /Unit Tests\      ← Many, fast, isolated
  /────────────\

Best Practices:

  • Test user behavior, not implementation
  • Keep tests independent
  • Make tests deterministic
  • Optimize for speed
  • Use data-testid, not CSS selectors

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Use Data Attributes: data-testid or data-cy for stable selectors
  2. Avoid Brittle Selectors: Don't rely on CSS classes or DOM structure
  3. Test User Behavior: Click, type, see - not implementation details
  4. Keep Tests Independent: Each test should run in isolation
  5. Clean Up Test Data: Create and destroy test data in each test
  6. Use Page Objects: Encapsulate page logic
  7. Meaningful Assertions: Check actual user-visible behavior
  8. Optimize for Speed: Mock when possible, parallel execution
// ❌ Bad selectors
cy.get(".btn.btn-primary.submit-button").click();
cy.get("div > form > div:nth-child(2) > input").type("text");

// ✅ Good selectors (findBy* commands come from @testing-library/cypress;
// add `import "@testing-library/cypress/add-commands";` to your Cypress support file)
cy.findByRole("button", { name: "Submit" }).click();
cy.findByLabelText("Email address").type("user@example.com");
cy.get('[data-testid="email-input"]').type("user@example.com");

Common Pitfalls

  • Flaky Tests: Use proper waits, not fixed timeouts
  • Slow Tests: Mock external APIs, use parallel execution
  • Over-Testing: Don't test every edge case with E2E
  • Coupled Tests: Tests should not depend on each other
  • Poor Selectors: Avoid CSS classes and nth-child
  • No Cleanup: Clean up test data after each test
  • Testing Implementation: Test user behavior, not internals

Debugging Failing Tests

// Playwright debugging
// 1. Run in headed mode
npx playwright test --headed

// 2. Run in debug mode
npx playwright test --debug

// 3. Use trace viewer (record with `use: { trace: 'on-first-retry' }` in the config)
npx playwright show-trace path/to/trace.zip
await page.screenshot({ path: 'screenshot.png' });

// 4. Add test.step for better reporting
test('checkout flow', async ({ page }) => {
    await test.step('Add item to cart', async () => {
        await page.goto('/products');
        await page.getByRole('button', { name: 'Add to Cart' }).click();
    });

    await test.step('Proceed to checkout', async () => {
        await page.goto('/cart');
        await page.getByRole('button', { name: 'Checkout' }).click();
    });
});

// 5. Inspect page state
await page.pause();  // Pauses execution, opens inspector

How to install E2e Testing Patterns

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit wshobson/agents/plugins/developer-essentials/skills/e2e-testing-patterns#main ~/.claude/skills/e2e-testing-patterns

Codex

npx degit wshobson/agents/plugins/developer-essentials/skills/e2e-testing-patterns#main ~/.codex/skills/e2e-testing-patterns

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the E2e Testing Patterns skill do?

Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment. Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.

+How do I install E2e Testing Patterns in Claude Code?

Copy the skill folder into ~/.claude/skills/e2e-testing-patterns, for example with "npx degit wshobson/agents/plugins/developer-essentials/skills/e2e-testing-patterns#main ~/.claude/skills/e2e-testing-patterns". Claude Code loads it automatically and uses it when a task matches.

+Does E2e Testing Patterns work with ChatGPT or Codex?

Yes. E2e Testing Patterns uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/e2e-testing-patterns. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is E2e Testing Patterns free?

E2e Testing Patterns is published on GitHub by wshobson under the MIT license, which allows free use.

Related testing & code review skills

  1. Agent Browser

    Official

    Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms,…

    vercel-labs/agent-browser★ 53k
  2. Playwright

    Official

    Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction,…

    openai/skills★ 29k
  3. Playwright Skill

    Complete browser automation with Playwright. Auto-detects dev servers, writes reusable test scripts, and supports screenshots, responsive…

    lackeyjb/playwright-skill★ 3.3k
  4. Javascript Testing Patterns

    Implement comprehensive testing strategies using Jest, Vitest, and Testing Library for unit tests, integration tests, and end-to-end…

    wshobson/agents★ 43k
  5. Multi Reviewer Patterns

    Coordinate parallel code reviews across multiple quality dimensions with finding deduplication, severity calibration, and consolidated…

    wshobson/agents★ 43k
  6. Python Testing Patterns

    Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development.

    wshobson/agents★ 43k
  7. Review Agent Setup

    Configure human-in-the-loop gating for AI agent review actions in Claude Code.

    wshobson/agents★ 43k
  8. Screen Reader Testing

    Test web applications with screen readers including VoiceOver, NVDA, and JAWS.

    wshobson/agents★ 43k
  9. Temporal Python Testing

    Test Temporal workflows with pytest, time-skipping, and mocking strategies.

    wshobson/agents★ 43k

See all testing & code review skills →

More skills from wshobson

  1. Embedding Strategies

    Select and optimize embedding models for semantic search and RAG applications.

    wshobson/agents★ 43k
  2. Employment Contract Templates

    Create employment contracts, offer letters, and HR policy documents following legal best practices.

    wshobson/agents★ 43k
  3. Error Handling Patterns

    Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build…

    wshobson/agents★ 43k

All skills by wshobson →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.