You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: replace Playwright MCP workflow with Playwright Test Agents
Switch E2E testing to use Playwright Test Agents (planner, generator,
healer) instead of manual Playwright MCP workflow. Remove data-testid
requirements from coding standards — use semantic selectors instead.
Copy file name to clipboardExpand all lines: docs/testing.md
+37-34Lines changed: 37 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,18 +21,30 @@ pnpm --filter <package> test # Run tests for a specific package
21
21
pnpm --filter <package>test --watch # Watch mode
22
22
```
23
23
24
-
## E2E Tests — AI-Assisted Playwright Workflow
24
+
## E2E Tests — Playwright Test Agents
25
25
26
-
E2E tests follow a two-phase AI-assisted workflow using [Playwright MCP](https://github.com/microsoft/playwright-mcp).
26
+
E2E tests use [Playwright Test Agents](https://playwright.dev/docs/test-agents) for AI-assisted test creation, generation, and self-healing.
27
27
28
-
### Prerequisites
28
+
### Setup
29
29
30
-
- All interactive elements must have `data-testid` attributes (see `docs/coding-standards.md`)
31
-
- Playwright tests use `page.getByTestId()` for element selection — stable across UI refactors
30
+
Initialize Playwright Test Agents in the project:
32
31
33
-
### Phase 1: Write Test Specs as Natural Language
32
+
```bash
33
+
npx playwright init-agents --loop=claude
34
+
```
35
+
36
+
This sets up agent definitions under `.github/` with all necessary MCP tools and instructions — no separate skills installation required. Regenerate after Playwright updates to access new tools.
37
+
38
+
### Workflow
39
+
40
+
#### Step 1: Planner Agent — Create Test Specs
41
+
42
+
Based on user descriptions or PRD documents, use the **Planner Agent** to explore the running app and produce markdown test plans:
34
43
35
-
Create `.md` files describing user scenarios from the user's perspective:
44
+
- Input: user scenario description or PRD document
45
+
- Output: structured markdown spec file under `e2e/specs/`
46
+
47
+
The planner navigates the app, discovers page structure, and writes human-readable test plans with steps and expected results.
36
48
37
49
```markdown
38
50
<!-- e2e/specs/user-crud.md -->
@@ -49,50 +61,41 @@ Create `.md` files describing user scenarios from the user's perspective:
49
61
9. Verify the user is removed from the list
50
62
```
51
63
52
-
###Phase 2: Generate Playwright Tests via Playwright MCP
64
+
#### Step 2: Generator Agent — Create Test Files
53
65
54
-
1. AI reads the `.md` spec file
55
-
2. AI uses **Playwright MCP** to navigate the running app, following the spec steps:
56
-
- Navigate to pages, click elements, fill forms, observe results
57
-
- Discover `data-testid` attributes and page structure via Playwright's built-in selectors (`getByTestId`, `getByRole`, etc.)
58
-
3. AI generates a Playwright test file using the observed selectors:
66
+
Use the **Generator Agent** to transform markdown specs into executable Playwright test files:
59
67
60
-
```
61
-
e2e/specs/user-crud.md ← Human-written scenario
62
-
e2e/tests/user-crud.spec.ts ← AI-generated Playwright test
63
-
```
68
+
- Input: markdown spec from `e2e/specs/`
69
+
- Output: Playwright test file under `e2e/tests/`
70
+
- The generator verifies selectors and assertions live against the running app using semantic selectors (`getByRole`, `getByText`, `getByLabel`, `getByPlaceholder`)
0 commit comments