openspec-playwright 0.1.52 → 0.1.54
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.
|
@@ -76,24 +76,33 @@ This validates: app server reachable, auth fixtures initialized, Playwright work
|
|
|
76
76
|
|
|
77
77
|
### 4. Explore application
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
Explore to collect real DOM data before writing test plan. This eliminates blind selector guessing.
|
|
80
80
|
|
|
81
81
|
**Prerequisites**: seed test pass. If auth is required, ensure `auth.setup.ts` has been run (Step 7). BASE_URL must be verified reachable (see 4.1).
|
|
82
82
|
|
|
83
83
|
#### 4.1. Verify BASE_URL + Read app-knowledge.md + Extract routes
|
|
84
84
|
|
|
85
|
-
1. **Verify BASE_URL
|
|
85
|
+
1. **Verify BASE_URL**: `browser_navigate(BASE_URL)` → check HTTP status. If unreachable or HTTP 5xx → **STOP: app has a bug. Tell user to fix the server first.**
|
|
86
86
|
2. **Read app-knowledge.md**: understand known risks (SPA, dynamic content) and project conventions
|
|
87
87
|
3. **Read specs**: extract all URLs/paths, group by Guest vs Protected
|
|
88
88
|
|
|
89
89
|
#### 4.2. Explore each route via Playwright MCP
|
|
90
90
|
|
|
91
|
-
For each route
|
|
91
|
+
For each route:
|
|
92
92
|
|
|
93
93
|
```
|
|
94
|
-
browser_navigate → browser_snapshot → browser_take_screenshot
|
|
94
|
+
browser_navigate → browser_console_messages → browser_snapshot → browser_take_screenshot
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
**After navigating, check for app-level errors**:
|
|
98
|
+
|
|
99
|
+
| Signal | Meaning | Action |
|
|
100
|
+
|--------|---------|--------|
|
|
101
|
+
| HTTP 5xx or unreachable | Backend/server error | **STOP** — tell user: "App has a backend error (HTTP <code>). Fix it, then re-run /opsx:e2e." |
|
|
102
|
+
| JS error in console | App runtime error | **STOP** — tell user: "Page has JS errors. Fix them, then re-run /opsx:e2e." |
|
|
103
|
+
| HTTP 404 | Route not in app (metadata issue) | Continue — mark `⚠️ route not found` in app-exploration.md |
|
|
104
|
+
| Auth required, no credentials | Missing auth setup | Continue — skip protected routes, explore login page |
|
|
105
|
+
|
|
97
106
|
**For guest routes** (no auth):
|
|
98
107
|
```javascript
|
|
99
108
|
// Navigate directly
|
|
@@ -102,27 +111,20 @@ await browser_navigate(`${BASE_URL}/<route>`)
|
|
|
102
111
|
|
|
103
112
|
**For protected routes** (auth required):
|
|
104
113
|
```javascript
|
|
105
|
-
// Option A: use existing storageState (recommended
|
|
114
|
+
// Option A: use existing storageState (recommended)
|
|
106
115
|
// Option B: navigate to /login first, fill form, then navigate to target
|
|
107
116
|
// Option C: use browser_run_code to set auth cookies directly
|
|
108
117
|
```
|
|
109
118
|
|
|
110
119
|
**If credentials are not yet available**:
|
|
111
|
-
1.
|
|
112
|
-
2.
|
|
113
|
-
3.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
4. Run `npx playwright test --project=setup`
|
|
120
|
-
5. Re-run exploration for protected routes
|
|
121
|
-
|
|
122
|
-
Wait for page stability after navigation:
|
|
123
|
-
- Prefer waiting for a specific element: `browser_wait_for` with text or selector
|
|
124
|
-
- Avoid `networkidle` / `load` — they are too slow or unreliable
|
|
125
|
-
- Use a "page ready" signal: look for a heading, a loading spinner disappearing, or a URL change
|
|
120
|
+
1. Skip protected routes — mark `⚠️ auth needed — explore after auth.setup.ts`
|
|
121
|
+
2. Explore the login page itself (guest route) — extract form selectors
|
|
122
|
+
3. After auth.setup.ts runs, re-run exploration for protected routes
|
|
123
|
+
|
|
124
|
+
Wait for page stability:
|
|
125
|
+
- Prefer `browser_wait_for` with text or selector
|
|
126
|
+
- Avoid `networkidle` / `load` — too slow or unreliable
|
|
127
|
+
- Ready signal: heading, spinner disappears, or URL change
|
|
126
128
|
|
|
127
129
|
#### 4.3. Parse the snapshot
|
|
128
130
|
|
|
@@ -152,16 +154,13 @@ Key fields per route:
|
|
|
152
154
|
|
|
153
155
|
After exploration, add route-level notes (redirects, dynamic content → see 4.5).
|
|
154
156
|
|
|
155
|
-
#### 4.5.
|
|
157
|
+
#### 4.5. Exploration behavior notes
|
|
156
158
|
|
|
157
|
-
| Situation |
|
|
158
|
-
|
|
159
|
-
| Route 404 | Mark as "⚠️ route not found — verify URL in specs" |
|
|
160
|
-
| Network error | Mark as "⚠️ unreachable — check if server is running" |
|
|
161
|
-
| Auth required, no credentials | Skip routes + explore login page → document selectors → set up auth first | See 4.2 "If credentials are not yet available" |
|
|
159
|
+
| Situation | Action |
|
|
160
|
+
|-----------|--------|
|
|
162
161
|
| SPA routing (URL changes but page doesn't reload) | Explore via navigation clicks from known routes, not direct URLs |
|
|
163
|
-
| Page loads but no interactive elements |
|
|
164
|
-
| Dynamic content (user-specific) | Record structure
|
|
162
|
+
| Page loads but no interactive elements | Wait longer for SPA hydration |
|
|
163
|
+
| Dynamic content (user-specific) | Record structure — use `toContainText`, not `toHaveText` |
|
|
165
164
|
|
|
166
165
|
**Idempotency**: If `app-exploration.md` already exists → read it, verify routes still match specs, update only new routes or changed pages.
|
|
167
166
|
|
|
@@ -171,6 +170,7 @@ After writing `app-exploration.md`, extract **project-level shared knowledge** a
|
|
|
171
170
|
|
|
172
171
|
| Section | What to extract |
|
|
173
172
|
|---------|----------------|
|
|
173
|
+
| Architecture | Monolith or separated? Backend port? Restart command? |
|
|
174
174
|
| Credential Format | Login endpoint, username format (email vs username) |
|
|
175
175
|
| Common Selector Patterns | New patterns discovered that apply across routes |
|
|
176
176
|
| SPA Routing | SPA framework, routing behavior |
|
|
@@ -429,6 +429,7 @@ Reference: `openspec/schemas/playwright-e2e/templates/report.md`
|
|
|
429
429
|
|----------|----------|
|
|
430
430
|
| No specs | Stop — E2E requires specs |
|
|
431
431
|
| Seed test fails | Stop — fix environment |
|
|
432
|
+
| App has JS errors or HTTP 5xx during exploration | **STOP** — see app-knowledge.md → Architecture section for restart instructions |
|
|
432
433
|
| No auth required | Skip auth setup |
|
|
433
434
|
| app-exploration.md exists | Read and use (never regenerate) |
|
|
434
435
|
| app-knowledge.md exists | Read and use (append new patterns only) |
|
|
Binary file
|
package/package.json
CHANGED
package/release-notes.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
## What's Changed
|
|
2
2
|
|
|
3
|
-
-
|
|
3
|
+
- feat: add Architecture section to app-knowledge.md and SKILL.md
|
|
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.54
|
|
@@ -40,6 +40,14 @@ Priority: `[data-testid]` > `getByRole` > `getByLabel` > `getByText` > CSS
|
|
|
40
40
|
| success msg | `[data-testid="success-msg"]` | |
|
|
41
41
|
| loading spinner | `[data-testid="loading"]` | |
|
|
42
42
|
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
| Aspect | Value | Notes |
|
|
46
|
+
|--------|-------|-------|
|
|
47
|
+
| Architecture | monolith / separated | Frontend + backend in one repo or separate? |
|
|
48
|
+
| Backend server | `<port>` or `embedded` | e.g. `3001` or `embedded in frontend` |
|
|
49
|
+
| How to restart backend | `<command>` | e.g. `cd backend && npm run dev` |
|
|
50
|
+
|
|
43
51
|
## SPA Routing
|
|
44
52
|
|
|
45
53
|
- Framework: <e.g. React Router / Vue Router / Next.js>
|
|
Binary file
|