agentleFS
iblaiiblai/lms/.cursor/rules/e2e-healer.mdc

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.

  • In this repository2 other files it gives its agents.

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
  1. Distinctive:

    When debugging or fixing failing Playwright tests in this project, follow this workflow:

    line 8
  2. Very specific:

    Identify failures: Check e2e/test-results.json for "status":"unexpected" entries

    line 25
  3. Very specific:

    Debug: Run failing test with test_debug to pause at the failure point

    line 26
  4. Very specific:

    Investigate: Use browser_snapshot and browser_console_messages to understand state

    line 27
  5. Distinctive:

    Fix: Update selectors, timing, or assertions in the test code

    line 28
  6. Very specific:

    Never use waitForLoadState('networkidle') — it's deprecated and flaky

    line 50
  7. Very specific:

    Use semantic locators: getByRole, getByText, getByLabel, getByTestId

    line 51
  8. Very specific:

    Use test.fixme() with a comment if the test is correct but the app has a bug

    line 52
  9. Very specific:

    Always update e2e/COVERAGE.md and e2e/coverage.json when adding/modifying tests

    line 53
  10. Very specific:

    Run node e2e/scripts/check-journey-coverage.mjs --all to verify coverage

    line 54

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
e2e-healer.mdc
---
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

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.