e2e-testing-patterns

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

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill e2e-testing-patterns-sanketadlak
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: e2e-testing-patterns
Source: https://github.com/SanketAdlak/PDMProjectDesign/tree/main/.agents/skills/e2e-testing-patterns
Command: npx skills add https://github.com/SanketAdlak/PDMProjectDesign --skill e2e-testing-patterns-sanketadlak

SYSTEM DOCUMENTATION & REQUIREMENTS

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 bugs to production. This Skill provides proven patterns for building deterministic, fast E2E tests that catch regressions on critical user journeys. ## Core Features & Use Cases - Playwright Patterns: Page Object Model, custom fixtures for test data, proper waiting strategies, network mocking and interception, visual regression testing, and parallel sharding. - Cypress Patterns: Custom commands, cy.intercept for API mocking, and configuration best practices. - Quality & Debugging: Accessibility testing with axe-core, trace viewer debugging, test.step reporting, and guidance on avoiding flaky selectors and fixed timeouts. - Use Case: When setting up CI/CD test pipelines, use this Skill to configure Playwright with retries, sharding across workers, and failure screenshots so your team gets reliable signal on every pull request. ## Quick Start Write a Playwright end-to-end test for the login flow using the Page Object Model pattern with proper waiting strategies.

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 async page interactions like goto, fill, and click. Organize them with the Page Object Model to encapsulate locators and actions per page, keeping tests readable and maintainable.

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

Playwright offers native cross-browser support including WebKit, built-in parallel sharding, and auto-waiting assertions. Cypress provides a rich interactive runner and custom commands via cy.intercept for API mocking. Both support TypeScript and network interception.

How do I fix flaky Playwright tests?

Replace fixed timeouts like waitForTimeout with condition-based waits such as waitForURL, waitForResponse, or auto-waiting assertions like toBeVisible. Use stable data-testid selectors instead of CSS classes, and keep tests independent with proper data cleanup.

How do I mock API responses in Playwright tests?

Use page.route with a URL pattern to intercept requests and call route.fulfill with a custom status, content type, and JSON body. You can also modify outgoing requests with route.continue or mock third-party services like Stripe.

What should not be tested with end-to-end tests?

Avoid testing unit-level logic, API contracts, and exhaustive edge cases with E2E tests since they are slow and expensive. Follow the testing pyramid: many unit tests, fewer integration tests, and a small set of E2E tests covering critical user journeys.

How do I run Playwright tests in parallel in CI?

Configure fullyParallel in playwright.config.ts and use sharding with the shard option to split tests across CI workers, for example npx playwright test --shard=1/4. Set retries and a single worker in CI for stability.