← ClaudeAtlas

playwright-pageobject-testinglisted

Coding standard for tests and page objects in this repository, locator priority, page object structure, fixtures, assertions, and the anti-patterns that get a change rejected. Use before writing or reviewing any test code.
ella79/agentic-playwright-suite · ★ 8 · Testing & QA · score 78
Install: claude install-skill ella79/agentic-playwright-suite
# Page Object Testing Skill ## Outcome Tests that read like the user's intent, break only when the product breaks, and can be changed by someone who has never opened this repo before. ## Before writing anything Confirm these, or ask. Guessing one of them is what produces a case that has to be rewritten: 1. The user flow and what counts as success 2. The entry point: which page object already reaches it, or whether a new one is needed 3. The data the case needs, and whether the `uniqueAccount` fixture covers it 4. Which assertion is the business-critical one, as opposed to a sync check 5. Whether this is coverage or a correction, because the suite is capped at twenty per suite Defaults, not worth asking about: Chromium at 1920x1080, base URL from `playwright.config.ts`, per-test account through the fixture. ## Working order Plan, then page object, then spec. A spec cannot be written against locators that do not exist yet, and a page object written after the spec ends up shaped by the spec instead of by the page. 1. **Read the plan.** The case ID, its scenario, its expectation. If there is no plan, there is no case to write. 2. **Decide the boundary.** One page object per URL-addressable page, one component object per modal. Shared chrome belongs in the base, not copied. 3. **Design the method, not the click.** Task-oriented names, awaiting the state transition the user would wait for. Return a value only when the spec asserts on it. 4. **Add the locator.** `r