e2e-spec-rules
/e2e-spec-rules
The rules every Playwright E2E spec in this skill set follows, covering self-contained tests, user-facing locators, exact web-first assertions, and the patterns that disqualify a spec. Use when writing, fixing or reviewing a Playwright E2E spec, and whenever e2e-plan or e2e-repro says to follow the spec rules.
- Author
- smooth-deploy ↗
- Repository
- playwright-skills ↗
- Licence
- MIT
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.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
The rules every Playwright E2E spec in this skill set follows, covering self-contained tests, user-facing locators, exact web-first assertions, and the patterns that disqualify a spec. Use when writing, fixing or reviewing a Playwright E2E spec, and whenever e2e-plan or e2e-repro says to follow the spec rules.
Original author description
The rules every Playwright E2E spec in this skill set follows, covering self-contained tests, user-facing locators, exact web-first assertions, and the patterns that disqualify a spec. Use when writing, fixing or reviewing a Playwright E2E spec, and whenever e2e-plan or e2e-repro says to follow the spec rules.
How it works
SKILL.md has no level-two headings · 19 lines, 720 words
SKILL.md preview
---
name: e2e-spec-rules
description: The rules every Playwright E2E spec in this skill set follows, covering self-contained tests, user-facing locators, exact web-first assertions, and the patterns that disqualify a spec. Use when writing, fixing or reviewing a Playwright E2E spec, and whenever e2e-plan or e2e-repro says to follow the spec rules.
license: MIT
---
# e2e-spec-rules
Rules for a spec that fails when the feature breaks and for no other reason. ENV is the environment file `.e2e/e2e-env.md`.
- **Self-contained.** Every test reads top to bottom as the user's journey: reset (per ENV), `goto` the first page, log in through the UI where the scenario has an account, then reach every later page the way the user does: click the header link, the record's name, the "Proceed to checkout" link. `goto` only for the first page of a test; a second `goto` skips the navigation the user would have done and tests a route the app never shows. Wait on each page's ready signal (per ENV), then the steps. All of it inline, in every test, as plain Playwright steps. No `beforeEach`, no helper functions, no custom fixtures, no `request` fixture: `async ({ page })` is the only signature. Repetition between tests is correct here; a reader of one test needs nothing else.
- **Locators.** `getByRole`, `getByLabel`, `getByText`; `getByTestId` only when nothing user-facing is unique. Scope with `.filter({ has })` or chain from a row or dialog. No CSS, no `.locator(...)`. A chain through generic text (the "1" inside the Cart link) is a guess, and a chain through `getByRole("paragraph")` or `getByRole("strong")` is DOM structure, not something the user names; there the testid from ENV is the locator. A dropdown is `getByRole("combobox", { name })` by its label text, set with `selectOption({ label })` by the option text the user reads, never by value.
- **Ambiguity.** A locator that matches 0 or 2+ elements is fixed from a fresh live snapshot: scoped (`dialog.getByRole("alert")`) or named (`getByRole("status", { name: ... })`). A label that matches two fields (login and register forms on one page) means the testid from ENV. Never `.first()`, never a try/catch.
- **Ready signal.** Asserted like anything else: `await expect(page.getByTestId("cart-page")).toHaveAttribute("data-state", "ready")`.
- **Rows.** Found by the name the user sees (`getByRole("row", { name: "CI pipeline" })`), never by a seed id. A record's own page is reached the way the user reaches it, by clicking its name, never by `goto` with a seed id in the path (`goto("/products/prod-001")`). The id for a `page.request` URL comes from a GET of the list, found by the same name (`keys.find(k => k.name === "CI pipeline").id`), never typed from seed data.
- **Assertions.** Web-first only (`await expect(locator).toBeVisible()`, `toHaveCount(0)`, `toHaveURL`), on the exact element with the exact value: `toHaveText("paid")`, since `toContainText("paid")` also holds for "unpaid", and a `toHaveCount(1)` on generic text proves nothing. `toContainText` is allowed only for a message with a variable part, never for a plan name, a status, a date or an amount. A URL is asserted as the exact string, `toHaveURL("/account")`, never a regex.
- **Transient text** (toast, spinner, "Saving…"). Assert it only when the ticket claims it. To wait for an action, use the durable state it produces (the cart count, the new row).
- **Absence.** `await expect(row.getByRole("button", { name: "Remove" })).toHaveCount(0)` scoped to the row, never an unscoped `getByText`. A hidden element keeps its text, and `toHaveText` passes on text the user cannot see; what the ticket calls hidden, gone or empty is asserted with `toBeHidden()` or `toHaveCount(0)` on that element, never with its leftover text (a badge reading "0" under `hidden` is hidden, not "0").
- **State that must persist or stay unchanged.** A committed state change the ticket says persists (an item added, a member removed, a plan switched): assert the new state as the page shows it, `reload`, wait for ready, assert it again. The first proves the UI reacted, the second proves the server kept it. Unchanged state after an error gets the same pair. One reload per committed change, on the page that shows it; never on a page with a form in progress, and never after a sign-in or a navigation, which changed nothing the ticket claims.
- **Passwords.** `process.env.E2E_PASSWORD_<NAME>`, the variable ENV names. Never the literal value.
- **URLs.** Relative everywhere, `goto("/settings")` and `page.request.delete("/api/...")` alike. The base URL lives in the Playwright config, never in the spec.
Disqualified, each one on its own: `waitForTimeout`, `if (await x.isVisible())`, `.catch(() => ...)` on a locator, regex locators guessing the UI (`/log ?in|sign ?in/`), `page.on("dialog")` for a dialog never seen live, `.first()`/`.last()`/`.nth()` to silence ambiguity, `.or()` to hedge between two guesses (`.and()` and `.filter()` narrow and are fine).
Versions
The database has no other skills named e2e-spec-rules.
Database snapshot: 13.11.2026 · package version 655e2a11ba56 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 2 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100playwright-testing
Playwright E2E testing patterns — web-first assertions, user-visible locators, network interception, fixtures, authentication, and parallel execution. Use when building or reviewing E2E tests with Playwright, when setting up browser testing for a web app, or when migrating from Cypress or Selenium. - 100playwright
Playwright E2E testing framework. Covers browser automation, assertions, and test generation. Use for end-to-end testing. USE WHEN: user mentions "playwright", "e2e test", "browser test", "end-to-end", asks about "page.goto", "page.click", "locators", "cross-browser testing",… - 100playwright-e2e-testing
Write, fix, or review Playwright end-to-end tests, especially for Next.js apps - locators, auth via storageState, flaky waits, server-side fetch mocking, CI against a production build. Use for *.spec.ts / e2e/ / playwright.config changes or flaky browser tests. For unit and… - 100playwright-testing
Expert guidance for writing end-to-end tests with Playwright Test framework. Use this skill when writing browser automation tests, creating test suites, working with locators and assertions, mocking network requests, handling authentication, or configuring the Playwright test… - 100writing-playwright-e2e-tests
TSH's standard for Playwright end-to-end tests: mapping acceptance criteria to scenarios, Page Object structure, user-visible locators, auto-waiting instead of manual timeouts, unique test data for parallel runs, mocking only external boundaries, and a bounded debug loop with… - 95qa-e2e-playwright
Use this skill when the user says 'playwright', 'playwright test', 'playwright config', 'locators', 'storageState', 'trace viewer', 'playwright codegen', 'playwright sharding', 'playwright fixtures'. It writes and structures Playwright Test suites in TypeScript: config,…