/mattpocock-skills:e2e-testingfrom mattpocock-skills
Author, maintain, run, and debug resilient end-to-end browser tests (Playwright, Cypress) for critical user journeys. Use when writing automated E2E tests, codifying acceptance criteria into browser suites, or diagnosing flaky browser tests.
Ships in mattpocock-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Automated end-to-end (E2E) browser tests verify that integrated application subsystems (frontend, backend, database, external APIs) deliver the intended user experience in real browsers.
This skill is the reference for writing, maintaining, running, and diagnosing resilient browser tests with modern frameworks (Playwright, Cypress) without flakiness or maintenance nightmares.
Every automated browser test must uphold these five invariants:
Do not invert the testing pyramid into an ice-cream cone. Edge cases, input boundary validations, and detailed matrix variations belong to unit and integration tests at the code seam (see the tdd skill). E2E browser tests verify only high-value, multi-step critical user journeys:
Never use implementation-coupled CSS selectors (div > button.btn-primary.css-1a2b), class names, or XPaths. Always use user-facing locators matching how assistive technologies and users see the page:
page.getByRole('button', { name: /submit order/i })page.getByLabel('Work Email')page.getByText('Invoice #1042')page.getByTestId('tenant-selector') (used only when semantic roles do not exist)Never introduce arbitrary sleep calls (page.waitForTimeout(3000) or sleep(3)). Hard waits cause test flakiness and slow down CI suites:
await expect(locator).toBeVisible().await page.waitForResponse(resp => resp.url().includes('/api/exports') && resp.status() === 200).Do not navigate through login pages before every individual test:
storageState.json.Each test run must be independent and repeatable:
test-org-${Date.now()}).Extract the user journey from the spec or recent /qa-session defect/acceptance notes. Outline the journey as sequential user actions and observable milestones.
Place E2E tests in the repo's designated test directory (e.g. e2e/, tests/e2e/, or playwright/). Use descriptive test titles:
import { test, expect } from "@playwright/test";
test.describe("Organization Data Export", () => {
test.use({ storageState: "playwright/.auth/admin.json" });
test("billing admin triggers async export and downloads verified CSV", async ({ page }) => {
// 1. Navigate directly to target surface
await page.goto("/settings/billing/export");
// 2. Interact using accessible roles
await page.getByRole("button", { name: /request export/i }).click();
const dialog = page.getByRole("dialog", { name: /confirm export/i });
await expect(dialog).toBeVisible();
await dialog.getByRole("combobox", { name: /format/i }).selectOption("csv");
await dialog.getByRole("button", { name: /start export/i }).click();
// 3. Verify optimistic transition and status polling
await expect(page.getByText(/export requested/i)).toBeVisible();
// 4. Await asynchronous job completion and download event
const downloadPromise = page.waitForEvent("download");
const downloadButton = page.getByRole("button", { name: /download ready file/i });
await expect(downloadButton).toBeEnabled({ timeout: 30000 });
await downloadButton.click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toMatch(/^export-.*\.csv$/);
});
});
Run the suite with headless and UI modes:
npx playwright test e2e/export.spec.ts --project=chromium
Verify that the test passes consistently across multiple local runs without intermittent failures:
npx playwright test e2e/export.spec.ts --repeat-each=3
When an E2E test fails locally or on CI:
npx playwright show-trace test-results/trace.zip
expect(locator).toBeVisible() or explicit waitForResponse./diagnosing-bugs.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub op3616windows/skills --plugin mattpocock-skills48 skills in this plugin
/ask-mattAsk which skill or flow fits your situation. A router over the skills in this repo./chief-of-staffPursue a long-running goal in a single session by co-ordinating subagents./claude-handoffHand the current conversation off to a fresh background agent that picks up the work immediately./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary./code-reviewReview the changes since a fixed point (commit, branch, tag, or merge-base) along three axes: Standards (does the code follow this repo's documented coding standards?), Spec (does the code match what the originating issue/spec asked for?), and Security (does the code introduce AppSec or privacy vulnerabilities?). Runs all three reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X"./diagnosing-bugsDiagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.