
E2E Testing Patterns
FreeMaster end-to-end testing for reliable software delivery.
Free · Opens the source repo
What E2E Testing Patterns does
E2E Testing Patterns is designed to assist developers and QA engineers in creating robust end-to-end (E2E) test suites using popular frameworks like Playwright and Cypress. This skill provides a comprehensive guide to implementing E2E tests, ensuring that critical user workflows are validated before deployment. By focusing on user behavior rather than implementation details, it helps catch regressions early in the development cycle, ultimately improving software quality and deployment speed.
The skill emphasizes best practices such as using stable data attributes for selectors, keeping tests independent, and optimizing for speed. It outlines what to test, including critical user journeys and complex interactions, while also clarifying what should not be tested with E2E, like unit-level logic or edge cases. This guidance helps streamline testing efforts and maintain a clear testing strategy aligned with the Testing Pyramid philosophy.
Additionally, the skill includes detailed patterns and worked examples to illustrate effective testing strategies. Users can leverage these resources to set up CI/CD pipelines, debug flaky tests, and establish E2E testing standards tailored to their projects. The documentation also addresses common pitfalls in E2E testing, providing solutions to avoid flaky tests and slow execution.
Whether you are implementing E2E tests for the first time or looking to refine your existing testing processes, E2E Testing Patterns offers the insights and practices necessary for successful test automation.
When to use it
Use this skill when implementing automated end-to-end tests for critical user workflows or when debugging unreliable tests.
When not to use it
This skill is not suitable for unit testing or for scenarios where detailed edge case testing is required.
What you can build with it
Automating User Workflows
Implement automated tests for critical user journeys like login and checkout to ensure reliability.
Debugging Unreliable Tests
Use the skill's debugging strategies to identify and fix flaky tests that fail intermittently.
Setting Up CI/CD Pipelines
Integrate E2E tests into your CI/CD pipeline to validate changes before deployment.
How to install E2E Testing Patterns
View source1. Install with the skills CLI
npx skills add wshobson/agents/e2e-testing-patterns --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by wshobsonE2E 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
- Use Data Attributes:
data-testidordata-cyfor stable selectors - Avoid Brittle Selectors: Don't rely on CSS classes or DOM structure
- Test User Behavior: Click, type, see - not implementation details
- Keep Tests Independent: Each test should run in isolation
- Clean Up Test Data: Create and destroy test data in each test
- Use Page Objects: Encapsulate page logic
- Meaningful Assertions: Check actual user-visible behavior
- 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
cy.getByRole("button", { name: "Submit" }).click();
cy.getByLabel("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
await page.screenshot({ path: 'screenshot.png' });
await page.video()?.saveAs('video.webm');
// 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
Frequently asked questions about E2E Testing Patterns
Similar skills
Spring Boot Testing
Master testing techniques for Spring Boot 4 applications.
GitHub Issues
Manage GitHub issues efficiently with MCP tools.
Geofeed Tuner
Optimize your IP geolocation feeds in CSV format.
Batch Files
Master Windows batch scripting for automation and task management.
Adobe Illustrator Scripting
Automate your Illustrator workflows with ExtendScript.
Plugin Structure
Create and organize Claude Code plugins effectively.
