e2e-testing-patterns

Implement end-to-end test suites with Playwright using page objects, fixtures, and network mocking.

1|Updated Dec 30, 2025
One-click install
npx skills add https://github.com/Fidasek009/agents --skill e2e-testing-patterns-fidasek009
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: e2e-testing-patterns
Source: https://github.com/Fidasek009/agents/tree/main/.agents/skills/e2e-testing-patterns
Command: npx skills add https://github.com/Fidasek009/agents --skill e2e-testing-patterns-fidasek009

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @playwright/test, @axe-core/playwright, and includes references (resource) components.

What problem does it solve? End-to-end tests are often flaky, slow, and brittle, causing teams to lose trust in their test suites and slowing down deployment. This Skill provides proven Playwright patterns for building deterministic, maintainable E2E tests that catch regressions before users do. ## Core Features & Use Cases - Playwright Configuration & Setup: Multi-browser projects, retries, trace capture, and CI-ready reporter configuration. - Page Object Model & Fixtures: Encapsulate page logic and manage test data lifecycle with setup/teardown fixtures. - Waiting, Mocking & Debugging: Auto-waiting assertions, API interception and mocking, visual regression screenshots, and accessibility checks with axe-core. - Use Case: When a checkout flow test fails intermittently in CI, apply the waiting strategies and trace viewer patterns to diagnose the race condition and replace fixed timeouts with condition-based waits. ## Quick Start Ask the AI to write a Playwright end-to-end test for your login flow using the page object model and stable selectors.

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?▼

Write Playwright tests by navigating to pages, interacting via role-based locators like getByRole and getByLabel, and asserting visible outcomes with expect. Organize page logic into Page Object classes and use fixtures to manage test data setup and cleanup.

How to fix flaky Playwright tests in CI?▼

Fix flaky tests by replacing fixed timeouts like waitForTimeout with condition-based waits such as waitForURL, waitForResponse, and auto-waiting assertions. Enable trace capture on first retry and use the trace viewer, screenshots, and videos to diagnose failures.

What selectors should I use in Playwright tests?▼

Use user-facing selectors: getByRole, getByLabel, and getByTestId with data-testid attributes. Avoid CSS classes, nth-child, and deep DOM paths, since they break when implementation details change.

Can Playwright mock API responses in tests?▼

Yes, Playwright mocks API responses using page.route to intercept requests and fulfill them with custom status codes and JSON bodies. You can also modify outgoing requests before continuing them, which is useful for testing error states and third-party services.

Does Playwright support accessibility testing?▼

Yes, Playwright supports accessibility testing through the @axe-core/playwright integration. Run AxeBuilder against a page or scoped element and assert that the violations array is empty to catch accessibility regressions.

When should I not use E2E tests?▼

Avoid E2E tests for unit-level logic, API contract validation, and exhaustive edge cases, 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.