playwright-testing
Skill0 starsChanged 39 days agoMITView on GitHub
Writes and reviews end-to-end Playwright tests that survive UI refactors and never fail on timing - resilient locators, web-first assertions, isolated state, and a flake policy with quarantine rules. Use when someone asks "write a Playwright test for this flow", "why is this e2e test flaky", "how do I wait for this element", "what selector should I use", or is setting up a Playwright suite and CI config. Do NOT use for consumer/provider contract tests of API boundaries - use contract-test-writer instead; for turning product requirements into an e2e scenario inventory before any code - use e2e-scenario-author instead; for systematically diagnosing an already-flaky suite - use flaky-test-detangler instead; for designing reusable test fixtures and factories - use test-data-builder instead.
18 other projects use a version of this.
Adopted by
Most recently taken up by
- kazemcodes/skill-treetheir own version, first seen Nov 8, 2026
- n-n-code/n-n-code-skillstheir own version, first seen Nov 1, 2026
- suryas91/claude-skillstheir own version, first seen Oct 11, 2026
- TangleML/tangle-uitheir own version, first seen Oct 8, 2026
- PrairieLearn/PrairieLearntheir own version, first seen Oct 8, 2026
- fossasia/visdomtheir own version, first seen Oct 8, 2026
Used with
Projects with it also use security, ponytail and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
0xSeroSkillsecurity
Also in 3 projects that use this
GoogleSkillponytail
Forces the laziest solution that actually works, simplest, shortest, most minimal. Channels a senior dev who has seen everything: question whether the task needs to exist at all (YAGNI), reach for the standard library before custom code, native platform features before dependencies, one line before fifty. Supports intensity levels: lite, full (default), ultra. Use on ANY coding task: writing, adding, refactoring, fixing, reviewing, or designing code, and choosing libraries or dependencies. Also use whenever the user says "ponytail", "be lazy", "lazy mode", "simplest solution", "minimal solution", "yagni", "do less", or "shortest path", or complains about over-engineering, bloat, boilerplate, or unnecessary dependencies. Do NOT use for non-coding requests (general knowledge, prose, translation, summaries, recipes).
Also in 3 projects that use this
GoogleSkillgrill-me
A relentless interview to sharpen a plan or design.
Also in 3 projects that use this
Other versions18 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 18
- fossasia/visdom★ 10ksame name
- podman-desktop/podman-desktop★ 8.1ksame name
- silvertakana/worldwideview★ 1.9ksame name
- marmelab/atomic-crm★ 1.4ksame name
- alinaqi/maggy★ 711same name
- alinaqi/claude-bootstrap★ 708same name
- PrairieLearn/PrairieLearn★ 530same name
- Community-Access/accessibility-agents★ 409same name
- chongdashu/vibejam-starter-pack★ 147same name
- TangleML/tangle-ui★ 104same name
8 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- contract-test-writerSkill
- coverage-gap-finderSkill
- e2e-scenario-authorSkill
- flaky-test-detanglerSkill
- mock-stub-designerSkill
- mutation-test-runnerSkill
- tdd-expertSkill
- test-data-builderSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 6 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before writing a test, collect (label guesses as guesses):
- Very specific: line 52
Never waitForTimeout with a magic number - zero tolerance, it is the single largest flake source.
- Very specific: line 54
Wait for the condition you care about: page.waitForResponse for a request, expect(page).toHaveURL for navigation, a locator state for …
- Distinctive: line 55
Keep the default expect timeout at 5 s and test timeout at 30 s.
- Distinctive: line 61
Use fixtures for shared setup (auth via storage state, base URL) instead of repeating login flows - a UI login in every test adds seconds …
- Very specific: line 68
Run new or modified tests 10 times before merging (--repeat-each=10).
- Very specific: line 82
Do not use waitForTimeout - it is either wasted seconds or a flake, never correct.
- Very specific: line 83
Do not chain assertions on .count() or other non-retrying snapshots.
- Distinctive: line 84
Do not share mutable state between tests or depend on run order - parallelism will eventually expose it at the worst time.
- Distinctive: line 85
Do not name tests after implementation ("clicks #submit-btn") - name the user intent so failures read as broken behavior.
- Distinctive: line 86
Do not treat CI retries as the fix for flakiness.
- Very specific: line 90
Every locator is role/label/text-based or a justified data-testid.
“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Playwright Testing
A test should fail only when the app is broken - never because of timing, test order, or a CSS refactor. The costly failure mode this skill prevents is the suite the team stops trusting: once engineers rerun red builds by reflex, the suite catches nothing and its entire cost is waste.
Operating procedure
Step 1: gather inputs
Before writing a test, collect (label guesses as guesses):
- The user behavior under test, phrased as intent ("user can reset password"), not implementation.
- What is in scope: the backend too, or frontend only (decides whether to mock the network).
- How test state is created and destroyed (API seeding, DB reset, per-test user).
- Whether the app renders accessible roles/labels (decides locator strategy).
Step 2: choose locators in strict priority order
getByRolewith accessible name - survives any markup refactor that keeps the UI accessible.getByLabel/getByPlaceholderfor form fields.getByTextfor non-interactive content.data-testidonly when semantics genuinely cannot identify the element - and then add the attribute to the app rather than falling through to CSS.- CSS/XPath tied to structure: never in new code.
Bad:
await page.locator('div.form-wrap > div:nth-child(3) button.btn-primary').click();
await page.waitForTimeout(3000);
expect(await page.locator('.msg').count()).toBe(1);Breaks on any layout change, sleeps a fixed 3 s (too slow when the app is fast, flaky when it is slow), and asserts a non-retrying snapshot.
Good:
await page.getByRole('button', { name: 'Reset password' }).click();
await expect(page.getByRole('alert')).toHaveText(/check your email/i);Locators encode user-visible semantics; the web-first assertion auto-retries until the alert renders or the timeout hits.
Step 3: eliminate timing from the test
- Never
waitForTimeoutwith a magic number - zero tolerance, it is the single largest flake source. - Rely on auto-waiting actions and web-first assertions (
await expect(locator).toBeVisible()), which retry until true. - Wait for the condition you care about:
page.waitForResponsefor a request,expect(page).toHaveURLfor navigation, a locator state for rendering. - Keep the default expect timeout at 5 s and test timeout at 30 s. A test that needs more than 30 s is doing too much - split it.
Step 4: isolate state
- One behavior per test, arrange-act-assert.
- Seed and reset data so no test depends on execution order; each test must pass alone and under
--fully-parallel. - Use fixtures for shared setup (auth via storage state, base URL) instead of repeating login flows - a UI login in every test adds seconds and a flake surface per test.
- Mock the network where the backend is out of scope; hit the real backend only in tests whose purpose is integration.
Step 5: configure CI for evidence, not retries-as-a-cure
retries: 2in CI,0locally;trace: 'on-first-retry'so every flake produces a trace.- Headed locally to debug, headless in CI.
- Run new or modified tests 10 times before merging (
--repeat-each=10); all 10 must pass.
Flake policy (red lines)
- A test that fails then passes on retry with no code change is flaky by definition - file it, do not shrug.
- Quarantine any test that flakes more than twice in 30 CI runs (>~1% flake rate); a quarantined test is skipped from merge-blocking runs and gets an owner and a deadline. Hand systematic diagnosis to flaky-test-detangler.
- Suite-level red line: if more than 2% of CI runs need a retry to go green, stop adding tests and fix stability first - trust erodes faster than coverage accrues.
Deliverable
Produce the test file(s) plus the config deltas: role-based locators throughout, zero fixed sleeps, fixtures for auth/setup, CI retry and trace settings, and a one-line intent-named title per test.
Do NOT
- Do not use
waitForTimeout- it is either wasted seconds or a flake, never correct. - Do not chain assertions on
.count()or other non-retrying snapshots; use web-firstexpectmatchers. - Do not share mutable state between tests or depend on run order - parallelism will eventually expose it at the worst time.
- Do not name tests after implementation ("clicks #submit-btn") - name the user intent so failures read as broken behavior.
- Do not treat CI retries as the fix for flakiness; they are instrumentation for capturing traces, not a cure.
Quality bar
- Every locator is role/label/text-based or a justified
data-testid; zero structural CSS/XPath. - Zero fixed sleeps anywhere in the diff.
- Each test passes in isolation and repeated 10 times.
- Failure output alone (title + assertion + trace) tells a reader what user behavior broke.
- CI config captures a trace on first retry.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

