agentleFS
AndreiBanu1AndreiBanu1/playwright-suite-skills/skills/write-e2e-test/SKILL.md

write-e2e-test

Skill1 starsChanged 3 months agoMITView on GitHub

Use when adding a new browser-level Playwright spec — an end-to-end or journey test that drives a real page. Reads the repo's conventions from .claude/test-profile.md, mirrors the nearest existing spec, keeps interaction behind whatever model layer the repo uses, and verifies the spec actually runs before finishing. Not for API-only or component tests.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add one browser spec that a reviewer would not be able to tell from the specs already in the repo.

    line 8
  2. Distinctive:

    Search the model layer named in the profile for the screens this flow crosses.

    line 39
  3. Distinctive:

    Create a new model only when nothing covers the screen — and then via write-page-object, followed by register-fixture so the spec can …

    line 40
  4. Distinctive:

    No sleeps: Wait on the condition you actually care about — a state, a response, an element — never on a duration.

    line 65
  5. Very specific:

    Run the new spec alone, using the profile's run one command.

    line 77
  6. Distinctive:

    Never widen an assertion to make a run pass.

    line 91
  7. Distinctive:

    Never leave a generated or recorded spec in raw recorder output.

    line 93
  8. Distinctive:

    Do not introduce a helper, a wrapper, or a config field for a single call site.

    line 95
  9. Distinctive:

    If the flow needs an auth or seeding step the repo has no pattern for, stop and ask.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: write-e2e-test

Add one browser spec that a reviewer would not be able to tell from the specs already in the repo.

Matching the neighbours matters more than matching any external best practice. A spec that is individually elegant and structurally foreign is a maintenance tax on everyone who touches it next.

Preconditions

  1. .claude/test-profile.md exists. If it does not, run probe-conventions first — without it you would be inventing an import path, and a spec that cannot resolve test is worse than no spec.
  2. The profile lists a browser group. If it does not, this repo has no browser tests; ask before creating the first one, because it needs a fixture/context decision the user owns.
  3. You know which flow is under test and where it starts. If not, use clarify-scope.

Procedure

1. Read the neighbour before writing anything

Open the two specs closest to the feature you are adding. Note, concretely:

  • the exact import block, in order;
  • how the test is titled and whether titles carry tags;
  • whether the body is flat or divided into steps, and how those step descriptions are phrased;
  • how the test reaches its starting state — a navigation call, a stored session, a setup hook;
  • what it asserts on, and whether assertions live in the spec or behind a model method.

You are going to copy all six decisions. Deviating from one of them needs a reason you can say out loud.

2. Decide reuse before creating

Search the model layer named in the profile for the screens this flow crosses. Extend what exists. Create a new model only when nothing covers the screen — and then via write-page-object, followed by register-fixture so the spec can actually reach it.

Grep the existing specs for the same flow first. A duplicate journey test that nobody notices is the most expensive kind of test: it doubles the maintenance and finds nothing new.

3. Write the spec

Structure it as arrange → act → assert, in the repo's own idiom:

<the profile's verbatim browser import line>
<the repo's own data import, if it has one>

test('<what the user can do, phrased as an outcome>', async ({ <only the fixtures you use> }) => {
  // arrange — reach the state the behaviour starts from
  // act     — the one interaction under test
  // assert  — the observable consequence that proves it worked
});

Rules that hold regardless of repo style:

  • One behaviour per spec. A second act is a second test unless the steps genuinely cannot be reached independently.
  • No sleeps. Wait on the condition you actually care about — a state, a response, an element — never on a duration. A fixed wait is either flake or wasted seconds, and usually both.
  • Assert something a user could observe. Asserting on internal state proves the test ran, not that the feature works.
  • Independence by default. Shared-state ordering (serial mode, or whatever the repo uses) is a deliberate choice with a comment explaining what state is shared — not a default.
  • Data from wherever the profile says data lives. Values inline in a spec are fine only when the value is the test: a malformed input, a boundary, a deliberately absent record. Those are clearer inline than hidden in a fixture file.

4. Verify

Run the new spec alone, using the profile's run one command. Then run the lint and typecheck commands if the profile lists them.

A spec you have not executed is a draft. Say "draft" if you are handing it over unrun — do not report it as done.

5. Confirm it can fail

Once green, break the expectation deliberately — change the asserted value — and confirm it goes red, then restore it. A test that passes against both the correct and the incorrect value asserts nothing, and this ten-second check is the only way to notice.

Guardrails

  • Never widen an assertion to make a run pass. If the app disagrees with the test and the test is right, that is a product finding — report it rather than absorbing it.
  • Never leave a generated or recorded spec in raw recorder output. The adapted spec is the deliverable.
  • Do not introduce a helper, a wrapper, or a config field for a single call site.
  • If the flow needs an auth or seeding step the repo has no pattern for, stop and ask. Inventing a second auth mechanism is a structural decision, not a test detail.

Done when

The spec runs green in isolation, has been shown to fail when the expectation is wrong, reads like its neighbours, and you have reported the file path, the target it was verified against, and any new model or context wiring it required.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.