agentleFS
idavidov13idavidov13/agentic-playwright/.agents/skills/test-standards/SKILL.md

test-standards

Skill268 starsChanged 11 days agoMITView on GitHub

Use when creating or editing a spec file under tests/**, choosing a test type or tag, writing a data-driven loop, or wiring cleanup for a state-mutating test. Not for API coverage matrices (see `api-testing`) or factories and static data (see `data-strategy`).

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

5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Import test and expect from fixtures/pom/test-options.ts, never from @playwright/test.

    line 10
  2. Very specific:

    Never commit explore-only or debug specs (console.log(await page.content()), probes).

    line 32
  3. Very specific:

    After adding or modifying a spec, run npx playwright test <file> and confirm zero failures before reporting done.

    line 33
  4. Very specific:

    If the test mutates state, add the cleanup hook per references/destructive-tests.md.

    line 42
  5. Very specific:

    Run npx playwright test <file> and npm run lint.

    line 43

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Test Standards

Critical

  • Import test and expect from fixtures/pom/test-options.ts, never from @playwright/test.
  • Each test has exactly one tag from @smoke, @sanity, @regression, @e2e, @api, @destructive. Never @functional, never a tag array, never a tag on test.describe().

    // CORRECT
    test('should login', { tag: '@smoke' }, async ({ appPage }) => {});
    // WRONG
    test('should login', { tag: ['@smoke', '@e2e'] }, async () => {});
  • @destructive is the heaviest tag and always wins, but only for shared/global state (locale, permissions, roles, guest access, feature flags, global settings, shared seed data). A test that creates and removes only its own data keeps its importance tag.
  • Every state-mutating test has a test.afterEach() or test.afterAll() hook that reverts what it wrote, and the hook succeeds after a failed test.
  • Web-first assertions only: await expect(locator).toBeVisible(), .toHaveText(), .toHaveCount(). Never page.waitForTimeout().

    // CORRECT
    await expect(appPage.username).toBeVisible();
    // WRONG
    await page.waitForTimeout(1000);
  • Tests must be independent: no ordering, no shared mutable state. Setup goes in test.beforeEach() or a fixture.
  • Never commit explore-only or debug specs (console.log(await page.content()), probes).
  • After adding or modifying a spec, run npx playwright test <file> and confirm zero failures before reporting done.

Procedure

  1. Classify: functional (tests/{area}/functional/), API (tests/{area}/api/), E2E (tests/{area}/e2e/) or setup (tests/{area}/*.setup.ts). Run ls tests/ to resolve {area}.
  2. Open the nearest spec of the same type and copy its import, describe and beforeEach shape; a spec that must start signed out (login, anonymous forms) calls resetStorageState() in beforeEach; everything else starts signed in. Skeletons: references/spec-patterns.md.
  3. Tag the test; when unsure which importance tag applies, read references/tags.md.
  4. Split the body into test.step() blocks named GIVEN / WHEN / THEN. An API test with more than one call follows api-testing.
  5. Take values from a factory or a static .ts file per data-strategy; a data-driven for...of loop sits inside describe, outside test().
  6. If the test mutates state, add the cleanup hook per references/destructive-tests.md; API setup or teardown shared by several specs goes through api-testing.
  7. Run npx playwright test <file> and npm run lint; on red, load debugging.

References

  • references/spec-patterns.md: skeletons for a functional, data-driven, E2E and setup spec.
  • references/tags.md: what each tag covers, how each suite runs, the three tagging mistakes.
  • references/destructive-tests.md: the shared-state definition, the cleanup pattern, the destructive suite, suite-only failures.

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.