lms / rules
Cursor rule14 starsChanged 8 months agoMITView on GitHub
Heal failing Playwright E2E tests using the Playwright Test MCP server
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this e2e-healer.mdc into the rules it gives an agent
10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
When debugging or fixing failing Playwright tests in this project, follow this workflow:
- Very specific: line 25
Identify failures: Check e2e/test-results.json for "status":"unexpected" entries
- Very specific: line 26
Debug: Run failing test with test_debug to pause at the failure point
- Very specific: line 27
Investigate: Use browser_snapshot and browser_console_messages to understand state
- Distinctive: line 28
Fix: Update selectors, timing, or assertions in the test code
- Very specific: line 50
Never use waitForLoadState('networkidle') — it's deprecated and flaky
- Very specific: line 51
Use semantic locators: getByRole, getByText, getByLabel, getByTestId
- Very specific: line 52
Use test.fixme() with a comment if the test is correct but the app has a bug
- Very specific: line 53
Always update e2e/COVERAGE.md and e2e/coverage.json when adding/modifying tests
- Very specific: line 54
Run node e2e/scripts/check-journey-coverage.mjs --all to verify coverage
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.
Files
---
description: Heal failing Playwright E2E tests using the Playwright Test MCP server
globs: ["e2e/**/*.spec.ts", "e2e/**/*.ts"]
---
# E2E Test Healer
When debugging or fixing failing Playwright tests in this project, follow this workflow:
## Available MCP Tools
This project has a `playwright-test` MCP server configured. Use these tools:
- `test_run` — Run all tests or a specific test file
- `test_debug` — Debug a specific failing test
- `test_list` — List available tests
- `browser_snapshot` — Capture page state during debugging
- `browser_console_messages` — Check for console errors
- `browser_network_requests` — Inspect network activity
- `browser_evaluate` — Evaluate JavaScript on the page
- `browser_generate_locator` — Generate resilient locators
## Workflow
1. **Identify failures**: Check `e2e/test-results.json` for `"status":"unexpected"` entries
2. **Debug**: Run failing test with `test_debug` to pause at the failure point
3. **Investigate**: Use `browser_snapshot` and `browser_console_messages` to understand state
4. **Fix**: Update selectors, timing, or assertions in the test code
5. **Verify**: Re-run the test to confirm the fix
6. **Repeat**: Continue until all tests pass
## Running Tests
```bash
# Run all journey tests
pnpm exec playwright test --config=e2e/playwright.config.ts
# Run a specific journey
pnpm exec playwright test --config=e2e/playwright.config.ts e2e/journeys/01-authentication.spec.ts
# Run by test name
pnpm exec playwright test --config=e2e/playwright.config.ts -g "test title"
# List all tests
pnpm exec playwright test --config=e2e/playwright.config.ts --list
```
## Key Principles
- Never use `waitForLoadState('networkidle')` — it's deprecated and flaky
- Use semantic locators: `getByRole`, `getByText`, `getByLabel`, `getByTestId`
- Use `test.fixme()` with a comment if the test is correct but the app has a bug
- Always update `e2e/COVERAGE.md` and `e2e/coverage.json` when adding/modifying tests
- Run `node e2e/scripts/check-journey-coverage.mjs --all` to verify coverage
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.

