e2e-testing-patterns
/e2e-testing-patterns
Use when writing or reviewing Playwright E2E tests - locator strategies, Page Object Model, auto-waiting, network interception, and WordPress/WooCommerce test helpers.
- Author
- vladolaru ↗
- Repository
- claude-code-plugins ↗
- Licence
- MIT
- Last repository change
- 12.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 12.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use when writing or reviewing Playwright E2E tests - locator strategies, Page Object Model, auto-waiting, network interception, and WordPress/WooCommerce test helpers.
Original author description
Use when writing or reviewing Playwright E2E tests - locator strategies, Page Object Model, auto-waiting, network interception, and WordPress/WooCommerce test helpers.
How it works
- Skill Directory
- Reference Routing
- Locator Priority (Best to Worst)
- E2E Quick Reference
- E2E Red Flags
- Page Object Model Pattern
SKILL.md preview
---
name: e2e-testing-patterns
description: Use when writing or reviewing Playwright E2E tests - locator strategies, Page Object Model, auto-waiting, network interception, and WordPress/WooCommerce test helpers.
---
## Skill Directory
Resolve `SKILL_DIR` to the absolute directory containing this `SKILL.md`, as
shown by the current host, before using any bundled path below.
Before a shell command uses `$SKILL_DIR`, assign it in that command or replace
it with the resolved path. It is not a host-exported environment variable.
# E2E Testing Patterns
Playwright end-to-end testing patterns. For shared test quality principles (philosophy, smells, mocking decisions), see `testing-patterns`.
## Reference Routing
| Need | Reference File | Sections to Read |
|------|---------------|-----------------|
| Playwright + E2E patterns | `$SKILL_DIR/../testing-patterns/references/playwright-patterns.md` | Full file (~461L, manageable) |
| Behavior vs implementation | `$SKILL_DIR/../testing-patterns/references/test-philosophy.md` | `## The Fundamental Shift` + `## Four Core Principles` |
| Flaky/brittle tests | `$SKILL_DIR/../testing-patterns/references/test-smells.md` | `## The Six Major Test Smells` (relevant subsection) |
| Mock usage decisions | `$SKILL_DIR/../testing-patterns/references/mocking-strategies.md` | `## The Mocking Decision Framework` |
| Test layer strategy | `$SKILL_DIR/../testing-patterns/references/test-layers.md` | `## The Three Layers` + `## Choosing the Right Layer` |
**How to read sections:** Grep for heading to find line number, Read with offset+limit.
## Locator Priority (Best to Worst)
1. `page.getByRole('button', { name: 'Submit' })` — accessible, resilient
2. `page.getByLabel('Email')` — form elements
3. `page.getByText('Welcome')` — visible content
4. `page.getByTestId('checkout-form')` — explicit test hooks
5. `page.locator('.class')` / `#id` — last resort, fragile
## E2E Quick Reference
| Use | Instead Of | Why |
|-----|-----------|-----|
| `await expect(locator).toBeVisible()` | `page.waitForTimeout(2000)` | Auto-waits, deterministic |
| `page.getByRole()` | `page.locator('.btn')` | Resilient to CSS changes |
| Page Object Model | Inline selectors | Reusable, single source of truth |
| `page.route()` for external APIs | Real HTTP calls | Fast, deterministic, no rate limits |
| Config-based URLs | `http://localhost:8080` | Works across environments |
| `toHaveScreenshot({ maxDiffPixelRatio: 0.01 })` | `toMatchSnapshot()` | Tolerates rendering differences |
| `test.describe()` grouping | Flat test structure | Logical organization |
| `await` before all assertions | Missing `await` | Playwright assertions are async |
## E2E Red Flags
| Pattern | Why Harmful | Fix |
|---------|------------|-----|
| CSS selectors as primary locators | Break on styling changes | Use role/label/text locators |
| `page.waitForTimeout()` | Arbitrary delay, flaky | Use `expect(locator).toBeVisible()` |
| Missing test isolation | Tests depend on prior state | `beforeEach` setup, clean state |
| Hardcoded URLs | Breaks across environments | Use config/env variables |
| No Page Object Model | Duplicated selectors | Extract to page object classes |
| Screenshot without tolerance | Pixel-perfect failures | Set `maxDiffPixelRatio` |
| Missing `await` before assertions | Silent assertion skip | Always await Playwright expects |
| `page.evaluate()` for assertions | Bypasses auto-waiting | Use Playwright locator assertions |
| No network interception | Flaky external calls | `page.route()` for third-party APIs |
## Page Object Model Pattern
- One class per page/component with locators as properties
- Methods return `this` or the next page object for chaining
- Locators defined once, referenced by all tests
- Actions (click, fill) encapsulated in methods
- Assertions stay in test files, not page objects
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · vladolaru/claude-code-plugins | 90 | MIT |
| wshobson/agents | 100 | MIT |
| EricGrill/agents-skills-plugins | 100 | MIT |
| aAAaqwq/AGI-Super-Team | 95 | MIT |
| HermeticOrmus/LibreUIUX-Claude-Code | 95 | MIT |
| rootcastleco/rei-skills | 90 | MIT |
| rmyndharis/antigravity-skills | 90 | MIT |
Database snapshot: 13.11.2026 · package version d4aa9da70ad5 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100e2e-testing
Playwright E2E testing patterns, Page Object Model, configuration, CI/CD integration, artifact management, and flaky test strategies. Use when writing Playwright tests, structuring page objects, or fixing flaky E2E runs in CI. - 100wp-test-strategy
WordPress testing strategy and review guidance. Use when planning or reviewing PHPUnit coverage, integration tests, block tests, e2e tests, Playwright flows, WooCommerce test coverage, fixture design, or when user mentions "test strategy", "WordPress tests", "PHPUnit",… - 100e2e-testing
Playwright E2E testing patterns, Page Object Model, configuration, CI/CD integration, artifact management, and flaky test strategies. Use when writing Playwright tests, structuring page objects, or fixing flaky E2E runs in CI. - 100e2e-testing
Playwright E2E testing patterns, Page Object Model, configuration, CI/CD integration, artifact management, and flaky test strategies. Use when writing Playwright tests, structuring page objects, or fixing flaky E2E runs in CI. - 95playwright-page-object-model
Use when creating page objects or refactoring Playwright tests for better maintainability with Page Object Model patterns. - 100woo-testing
Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.