e2e-testing-patterns

Implements end-to-end test suites with Playwright and Cypress patterns.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill e2e-testing-patterns-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: e2e-testing-patterns
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/e2e-testing-patterns
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill e2e-testing-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/test, cypress, @axe-core/playwright.

What problem does it solve? End-to-end tests are often flaky, slow, and hard to maintain, causing teams to lose trust in their test suites and ship regressions. This Skill provides proven patterns for building stable, fast E2E tests that catch bugs before users do. ## Core Features & Use Cases - Playwright Patterns: Page Object Model, test fixtures, network mocking, waiting strategies, visual regression, and accessibility testing with axe-core. - Cypress Patterns: Custom commands, cy.intercept for API mocking, and configuration best practices. - CI/CD Integration: Parallel execution, test sharding, retries, tracing, and artifact capture for reliable pipelines. - Use Case: When your checkout flow tests fail intermittently in CI, apply the waiting strategies and network mocking patterns to eliminate flakiness and get deterministic results. ## Quick Start Help me write a Playwright end-to-end test for the login flow using the Page Object Model pattern.

Frequently Asked Questions about e2e-testing-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write end-to-end tests with Playwright?

Playwright tests use the test and expect functions with auto-waiting locators like getByRole and getByLabel. Structure tests with the Page Object Model to encapsulate page logic, and configure retries, tracing, and screenshots in playwright.config.ts.

Playwright vs Cypress for E2E testing, which should I use?

Playwright offers native cross-browser support including WebKit, built-in parallelization, and network interception via page.route. Cypress provides an interactive test runner and custom commands via Cypress.Commands.add. Both support API mocking and TypeScript.

How do I fix flaky end-to-end tests?

Replace fixed timeouts like waitForTimeout with condition-based waits such as waitForURL, waitForResponse, and auto-waiting assertions. Use stable data-testid selectors, isolate test data per test, and enable retries with trace capture in CI.

How do I mock API responses in Playwright tests?

Use page.route to intercept requests matching a URL pattern and fulfill them with custom status codes and JSON bodies. In Cypress, use cy.intercept with req.reply to stub, modify, or delay API responses.

What should I not test with end-to-end tests?

Avoid testing unit-level logic, API contracts, exhaustive edge cases, and internal implementation details with E2E tests. Reserve E2E for critical user journeys like login, checkout, and signup, following the testing pyramid.

How do I run Playwright tests in parallel in CI?

Enable fullyParallel in the config and use test sharding with the --shard flag to split tests across CI workers. Set retries to 2 in CI, limit workers to 1 per machine, and capture traces and videos on failure.