e2e-testing-patterns

Provide end-to-end testing patterns for Playwright and Cypress.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Build reliable, fast, and maintainable end-to-end test suites that catch regressions and empower fast shipping.

Core Features & Use Cases

  • Playwright patterns: Page Object Model, fixtures, waiting strategies.
  • Cypress patterns: custom commands and intercepts.
  • Advanced topics: visual regression, accessibility, and parallel testing patterns.

Quick Start

Start by organizing tests under e2e/, configuring Playwright or Cypress, and writing representative end-to-end tests.

Frequently Asked Questions about e2e-testing-patterns

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

FAQPage Schema
How do I reduce flaky tests in my Playwright and Cypress test suites?

Flaky tests in Playwright and Cypress stem from unreliable waiting strategies and race conditions. Use robust waiting patterns—explicit waits for elements and network responses—instead of fixed delays. Playwright's auto-waiting and Cypress's built-in retry logic, combined with proper fixture setup and Page Object Model organization, eliminate most flakiness across CI/CD pipelines.

What's the best way to organize end-to-end tests for multiple browsers and responsive designs?

Organize tests under an e2e/ directory with Page Object Model patterns to separate test logic from UI selectors. Playwright and Cypress both support configuring multiple browsers and viewports declaratively. Structure fixtures and custom commands to run the same test suite across browsers and screen sizes, reducing duplication and maintenance overhead.

Can I use Page Object Model with both Playwright and Cypress?

Page Object Model works with both frameworks and is the recommended pattern for maintainable E2E tests. Encapsulate page interactions and selectors in reusable classes or objects, then reference them in test files. This approach keeps tests readable, reduces selector brittleness, and scales across large test suites.

How do I test accessibility requirements in my end-to-end test suite?

Both Playwright and Cypress support accessibility testing through assertions on ARIA attributes, semantic HTML, and keyboard navigation. Integrate accessibility checks into your E2E tests by validating focus management, screen reader compatibility, and color contrast within your existing test patterns.

What patterns help run E2E tests in parallel across CI/CD pipelines?

Parallel testing in Playwright and Cypress requires stateless test isolation—each test runs independently with its own fixtures and data. Configure sharding at the CI level, use database fixtures that reset between runs, and avoid shared state. This unlocks fast feedback in CI/CD without race conditions or test interference.

Does Cypress support visual regression testing like Playwright does?

Visual regression testing captures and compares screenshots across test runs to detect unintended UI changes. Both Playwright and Cypress support this through plugins and integrations. Configure baseline screenshots in your test suite, then assert visual diffs in CI to prevent regressions before shipping.