CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
100/100
Scores the file, not the repository.Length
939 words
17 headings · 4 code blocksRepository
94k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1### Monorepo Packages23| Package | npm name | Purpose |4|---------|----------|---------|5| `playwright-core` | `playwright-core` | Browser automation engine: client, server, dispatchers, protocol |6| `playwright` | `playwright` | Test runner + browser automation (public package) |7| `playwright-test` | `@playwright/test` | Test runner entry point |8| `playwright-client` | `@playwright/client` | Standalone client package |9| `protocol` | *(internal)* | RPC protocol definitions (`protocol.yml` → generated `channels.d.ts`) |1011### Browser Packages1213`playwright-chromium`, `playwright-firefox`, `playwright-webkit` — per-browser distributions.14`playwright-browser-chromium`, `playwright-browser-firefox`, `playwright-browser-webkit` — binary packages.1516### Tooling Packages1718| Package | Purpose |19|---------|---------|20| `html-reporter` | HTML test report viewer |21| `trace-viewer` | Trace viewer UI |22| `recorder` | Test recorder |23| `web` | Shared web UI components |24| `injected` | Scripts injected into browser pages |2526### Component Testing2728`playwright-ct-core`, `playwright-ct-react`, `playwright-ct-vue`2930### Key Directories3132| Directory | Purpose |33|-----------|---------|34| `tests/` | All test suites (page, library, playwright-test, mcp, components, etc.) |35| `docs/src/` | API documentation — **source of truth** for public TypeScript types |36| `docs/src/api/` | Per-class API reference (`class-page.md`, `class-locator.md`, etc.) |37| `utils/` | Build scripts, code generation, linting, doc tools |38| `browser_patches/` | Browser engine patches |3940## Build4142```bash43npm run build # Full build44npm run watch # Watch mode (recommended during development)45```4647Assume watch is running and code is up to date. Generated files (types, channels, validators) are produced by watch automatically.4849## Lint and type check5051```bash52npm run flint53```5455Runs all lint checks in parallel: eslint, tsc, doclint, check-deps, generate_channels, generate_types, lint-tests, test-types, lint-packages, code-snippet linting.5657**Always run `flint` before committing.** Do not use `tsc --noEmit` or individual lint commands separately.5859## Test Commands6061| Command | Scope |62|---------|-------|63| `npm run ctest <filter>` | Chromium only library tests — **use during development** |64| `npm run test <filter> -- --project=<chromium,firefix,webkit>` | All library / per project |65| `npm run ttest <filter>` | Test runner (`tests/playwright-test/`) |66| `npm run ctest-mcp <filter>` | Chromium only MCP tools (`tests/mcp/`) |67| `npm run test-mcp <filter> -- --project=<chromium,firefox,webkit>` | MCP tools (`tests/mcp/`) |686970### Filtering7172```bash73npm run ctest tests/page/locator-click.spec.ts # Specific file74npm run ctest tests/page/locator-click.spec.ts:12 # Specific location75npm run ctest -- --grep "should click" # By test name76npm run ctest-mcp snapshot # By file name part77```7879### Test Directories and Fixtures8081| Directory | Import | Key Fixtures | What to Test |82|-----------|--------|--------------|--------------|83| `tests/page/` | `import { test, expect } from './pageTest'` | `page`, `server`, `browserName` | User interactions: click, fill, navigate, locators, assertions |84| `tests/library/` | `import { browserTest, expect } from '../config/browserTest'` | `browser`, `context`, `browserType` | Browser/context lifecycle, cookies, permissions, browser-specific features |85| `tests/playwright-test/` | `import { test, expect } from './playwright-test-fixtures'` | test runner fixtures | Test runner: reporters, config, annotations, retries |86| `tests/mcp/` | `import { test, expect } from './fixtures'` | `client`, `server` | MCP tools via `client.callTool()` |8788**Decision rule**: Does the test need `browser`/`browserType`/`context` → `tests/library/`. Just needs `page` + `server` → `tests/page/`.8990## DEPS System9192Import boundaries are enforced via `DEPS.list` files (52+ across the repo), checked by `npm run flint`.9394**Key rule**: Client code NEVER imports server code. Server code NEVER imports client code. Communication is only through the protocol.95When creating or moving files, update the relevant `DEPS.list` to declare allowed imports. Files marked `"strict"` can only import what is explicitly listed.9697## Coding Convention9899For exported classes:100- `private _method()` — only used within the class itself101- `_method()` (no `private`) — used by other code in the same file, but not outside the file102- `method()` (public) — used in other files103104Non-exported classes have no naming convention; they are internal implementation details.105106## Commit Convention107108Before committing, run `npm run flint` and fix errors.109110Semantic commit messages: `label(scope): description`111112Labels: `fix`, `feat`, `chore`, `docs`, `test`, `devops`113114```bash115git checkout -b fix-39562116# ... make changes ...117git add <changed-files>118git commit -m "$(cat <<'EOF'119fix(proxy): handle SOCKS proxy authentication120121Fixes: https://github.com/microsoft/playwright/issues/39562122EOF123)"124# **Never `git push` without an explicit instruction to push.**125git push origin fix-39562126gh pr create --repo microsoft/playwright --head username:fix-39562 \127 --title "fix(proxy): handle SOCKS proxy authentication" \128 --body "$(cat <<'EOF'129## Summary130- <describe the change very! briefly>131132Fixes https://github.com/microsoft/playwright/issues/39562133EOF134)"135```136137Never add Co-Authored-By agents in commit message.138Never add "Generated with" in commit message.139Never add test plan to PR description. Keep PR description short — a few bullet points at most.140Branch naming for issue fixes: `fix-<issue-number>`141142**Never amend commits.** Always create a new commit for follow-up changes, even when iterating on an open PR. Amending rewrites history and forces a force-push, losing the incremental review trail. Only amend if the user explicitly says so.143144**Never `git push` without an explicit instruction to push.** Applies even when a PR is already open for the branch — additional commits are immediately visible to reviewers. Commit locally, report what was committed, and wait. Only push when the user's message contains "push", "upload", "create PR", "ship it", or equivalent.145146## Development Guides147148Detailed guides for common development tasks:149150- **[Architecture: Client, Server, and Dispatchers](.claude/skills/playwright-dev/library.md)** — package layout, protocol layer, ChannelOwner/SdkObject/Dispatcher base classes, DEPS rules, end-to-end RPC flow, object lifecycle151- **[Adding and Modifying APIs](.claude/skills/playwright-dev/api.md)** — 6-step process: define docs → implement client → define protocol → implement dispatcher → implement server → write tests152- **[MCP Tools and CLI Commands](.claude/skills/playwright-dev/tools.md)** — `defineTool()`/`defineTabTool()`, tool capabilities, CLI `declareCommand()`, config options, testing with MCP fixtures153- **[Vendoring Dependencies](.claude/skills/playwright-dev/vendor.md)** — bundle architecture, esbuild setup, typed wrappers, adding deps to existing bundles154
Also in microsoft/playwright
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| microsoft/playwright.github/copilot-instructions.md · 94k | Copilot instructions | git | 16/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotCMS/corecore-web/CLAUDE.md · 950 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| livewire/livewireCLAUDE.md · 24k | CLAUDE.md | setupbuildteststyle+4 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 950 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | 3 days ago | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago |
