Skip to content
OwnlyPlans

CLAUDE.md (testing rules)

Add these rules to your existing CLAUDE.md or AGENTS.md.

Part of End-to-End Tests for Any Web App (Playwright MCP) by Admin

Download Open the item

CLAUDE.md — End-to-end tests with Playwright

Goal

Reliable end-to-end tests for this app's most important user flows.

Rules

  • Use the Playwright MCP to open the running app and explore a flow before writing its test.
  • Tests live in tests/. One file per flow, e.g. tests/sign-up.spec.ts.
  • Locators: getByRole, getByLabel, getByText first. data-testid only when nothing else is stable.
  • Never use fixed waits (waitForTimeout). Rely on auto-waiting and expect(...).toBeVisible().
  • Each test sets up its own data and does not depend on another test.
  • Run npx playwright test after writing each file; fix failures before moving on.
  • Never put real passwords or keys in tests. Use env vars (TEST_USER_EMAIL, TEST_USER_PASSWORD).
Source, 13 lines
# CLAUDE.md — End-to-end tests with Playwright

## Goal
Reliable end-to-end tests for this app's most important user flows.

## Rules
- Use the Playwright MCP to open the running app and explore a flow before writing its test.
- Tests live in `tests/`. One file per flow, e.g. `tests/sign-up.spec.ts`.
- Locators: `getByRole`, `getByLabel`, `getByText` first. `data-testid` only when nothing else is stable.
- Never use fixed waits (`waitForTimeout`). Rely on auto-waiting and `expect(...).toBeVisible()`.
- Each test sets up its own data and does not depend on another test.
- Run `npx playwright test` after writing each file; fix failures before moving on.
- Never put real passwords or keys in tests. Use env vars (`TEST_USER_EMAIL`, `TEST_USER_PASSWORD`).

Your AI tool
Starter prompt

		

Download the plan