openspec-playwright 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,15 +2,32 @@
|
|
|
2
2
|
name: openspec-e2e
|
|
3
3
|
description: Run Playwright E2E verification for an OpenSpec change. Use when the user wants to validate that the implementation works end-to-end by running Playwright tests generated from the specs.
|
|
4
4
|
license: MIT
|
|
5
|
-
compatibility: Requires openspec CLI, Playwright (with browsers installed), and @playwright/mcp (globally installed via claude mcp add).
|
|
5
|
+
compatibility: Requires openspec CLI, Playwright (with browsers installed), and @playwright/mcp (globally installed via `claude mcp add playwright npx @playwright/mcp@latest`).
|
|
6
|
+
|
|
7
|
+
**Architecture**: Uses CLI + SKILLs (not `init-agents`). This follows Playwright's recommended approach for coding agents — CLI is more token-efficient than loading MCP tool schemas into context. MCP is used only for Healer (UI inspection on failure).
|
|
6
8
|
metadata:
|
|
7
9
|
author: openspec-playwright
|
|
8
|
-
version: "2.
|
|
10
|
+
version: "2.3"
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
- **Change name**: `/opsx:e2e <name>` or auto-detected from context
|
|
16
|
+
- **Specs**: `openspec/changes/<name>/specs/*.md`
|
|
17
|
+
- **Credentials**: `E2E_USERNAME` + `E2E_PASSWORD` env vars
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
- **Test file**: `tests/playwright/<name>.spec.ts`
|
|
22
|
+
- **Auth setup**: `tests/playwright/auth.setup.ts` (if auth required)
|
|
23
|
+
- **Report**: `openspec/reports/playwright-e2e-<name>-<timestamp>.md`
|
|
24
|
+
- **Test plan**: `openspec/changes/<name>/specs/playwright/test-plan.md`
|
|
25
|
+
|
|
26
|
+
## Architecture
|
|
27
|
+
|
|
28
|
+
Uses CLI + SKILLs (not `init-agents`). This follows Playwright's recommended approach for coding agents — CLI is more token-efficient than loading MCP tool schemas into context. MCP is used only for Healer (UI inspection on failure).
|
|
12
29
|
|
|
13
|
-
**
|
|
30
|
+
**Schema owns templates. CLI handles execution. Skill handles cognitive work.**
|
|
14
31
|
|
|
15
32
|
## Steps
|
|
16
33
|
|
|
@@ -140,7 +157,27 @@ The CLI handles:
|
|
|
140
157
|
- Port mismatch detection
|
|
141
158
|
- Report generation at `openspec/reports/playwright-e2e-<name>-<timestamp>.md`
|
|
142
159
|
|
|
143
|
-
If tests fail → analyze failures, use Playwright MCP tools to inspect UI state, fix selectors in the test file, and re-run.
|
|
160
|
+
If tests fail → analyze failures, use **Playwright MCP tools** to inspect UI state, fix selectors in the test file, and re-run.
|
|
161
|
+
|
|
162
|
+
**Healer MCP tools** (in order of use):
|
|
163
|
+
|
|
164
|
+
| Tool | Purpose |
|
|
165
|
+
|------|---------|
|
|
166
|
+
| `Navigate to a URL` | Go to the failing test's page |
|
|
167
|
+
| `Page snapshot` | Get page structure to find equivalent selectors |
|
|
168
|
+
| `Get console messages` | Diagnose JS errors that may cause failures |
|
|
169
|
+
| `Take a screenshot` | Visually compare before/after fixes |
|
|
170
|
+
| `Run Playwright code` | Execute custom fix logic (optional) |
|
|
171
|
+
|
|
172
|
+
**Healer workflow**:
|
|
173
|
+
1. Read the failing test file — identify the broken selector or assertion
|
|
174
|
+
2. Navigate to the target page with `Navigate to a URL`
|
|
175
|
+
3. Take a `Page snapshot` — find an equivalent stable selector
|
|
176
|
+
4. Fix the selector in the test file using the Edit tool
|
|
177
|
+
5. Re-run: `openspec-pw run <name>`
|
|
178
|
+
6. Repeat until pass or 3 attempts reached
|
|
179
|
+
|
|
180
|
+
**Note**: For selector fixes, prefer `getByRole`, `getByLabel`, `getByText` over CSS paths. For structural issues (wrong page content), update the assertion in the test file.
|
|
144
181
|
|
|
145
182
|
**Cap auto-heal attempts at 3** to prevent infinite loops.
|
|
146
183
|
|
|
@@ -159,9 +196,54 @@ Read the report at `openspec/reports/playwright-e2e-<name>-<timestamp>.md`.
|
|
|
159
196
|
- Append a verification note: e.g. `✅ Verified via Playwright E2E (<timestamp>)`
|
|
160
197
|
- Write the updated content back using the Edit tool
|
|
161
198
|
|
|
162
|
-
|
|
199
|
+
## Output Format
|
|
163
200
|
|
|
164
|
-
|
|
201
|
+
### Report Structure (`openspec/reports/playwright-e2e-<name>-<timestamp>.md`)
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
# Playwright E2E Report — <name>
|
|
205
|
+
|
|
206
|
+
## Summary
|
|
207
|
+
| Tests | Passed | Failed | Duration | Status |
|
|
208
|
+
|-------|--------|--------|----------|--------|
|
|
209
|
+
| N | N | N | Xm Xs | ✅/❌ |
|
|
210
|
+
|
|
211
|
+
## Results
|
|
212
|
+
|
|
213
|
+
### Passed
|
|
214
|
+
| Test | Duration | Notes |
|
|
215
|
+
|------|----------|-------|
|
|
216
|
+
| ... | ... | ... |
|
|
217
|
+
|
|
218
|
+
### Failed
|
|
219
|
+
| Test | Error | Recommendation |
|
|
220
|
+
|------|-------|----------------|
|
|
221
|
+
| ... | ... | file:line — fix |
|
|
222
|
+
|
|
223
|
+
## Auto-Heal Log
|
|
224
|
+
- Attempt N: selector fix → result
|
|
225
|
+
|
|
226
|
+
## Coverage
|
|
227
|
+
- [x] Requirement 1
|
|
228
|
+
- [ ] Requirement 2 (unverified)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Updated tasks.md
|
|
232
|
+
```
|
|
233
|
+
- [x] Implement feature X ✅ Verified via Playwright E2E (2026-03-28)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Graceful Degradation
|
|
237
|
+
|
|
238
|
+
| Scenario | Behavior |
|
|
239
|
+
|----------|----------|
|
|
240
|
+
| No specs found | Stop with info message — E2E requires specs |
|
|
241
|
+
| No auth required | Skip auth setup entirely |
|
|
242
|
+
| test-plan.md exists | Read and use it — never regenerate |
|
|
243
|
+
| auth.setup.ts exists | Verify format — update only if stale |
|
|
244
|
+
| playwright.config.ts exists | Read and preserve all fields — add only missing |
|
|
245
|
+
| Test fails (selector) | Healer: snapshot → fix → re-run, cap at 3 attempts |
|
|
246
|
+
| Test fails (app bug) | Report as failed with recommendation |
|
|
165
247
|
|
|
166
248
|
## Verification Heuristics
|
|
167
249
|
|
|
Binary file
|
package/package.json
CHANGED
package/release-notes.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
## What's Changed
|
|
2
2
|
|
|
3
|
-
- feat(skill):
|
|
3
|
+
- feat(skill): align SKILL.md with OpenSpec format (v2.3)
|
|
4
4
|
|
|
5
|
-
**Full Changelog**: https://github.com/wxhou/openspec-playwright/releases/tag/v0.1.
|
|
5
|
+
**Full Changelog**: https://github.com/wxhou/openspec-playwright/releases/tag/v0.1.28
|
|
Binary file
|