openspec-playwright 0.2.8 → 0.2.9
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.
|
@@ -5,7 +5,7 @@ license: MIT
|
|
|
5
5
|
compatibility: Requires openspec CLI, Playwright (with browsers installed), and @playwright/mcp (globally installed via `claude mcp add playwright npx @playwright/mcp@latest`).
|
|
6
6
|
metadata:
|
|
7
7
|
author: openspec-playwright
|
|
8
|
-
version: "2.
|
|
8
|
+
version: "2.22"
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
## Input
|
|
@@ -349,7 +349,7 @@ After writing `app-exploration.md`, extract **project-level shared knowledge** a
|
|
|
349
349
|
| Common Selector Patterns | New patterns discovered that apply across routes |
|
|
350
350
|
| SPA Routing | SPA framework, routing behavior |
|
|
351
351
|
| Project Conventions | BASE_URL, auth method, multi-user roles |
|
|
352
|
-
| Selector Fixes | Healed selectors (see Step 9) — route, old
|
|
352
|
+
| Selector Fixes | Healed selectors (see Step 9) — route, old → new selector, reason, date |
|
|
353
353
|
|
|
354
354
|
Append only new/changed items — preserve existing content.
|
|
355
355
|
|
|
@@ -660,6 +660,10 @@ If tests fail → use Playwright MCP tools to inspect UI, fix selectors, re-run.
|
|
|
660
660
|
| `browser_take_screenshot` | Visually compare before/after fixes |
|
|
661
661
|
| `browser_run_code` | Execute custom fix logic (optional) |
|
|
662
662
|
|
|
663
|
+
**Before Phase 1 — check accumulated knowledge:**
|
|
664
|
+
|
|
665
|
+
Read `tests/playwright/app-knowledge.md` → **Selector Fixes** table. If the failing test's selector or route matches a known fix, use it directly (skip Phase 2). If partial match → use as the top candidate in Phase 2 Step 5a. If file does not exist → skip.
|
|
666
|
+
|
|
663
667
|
**Healer — Phase 1: Triage**
|
|
664
668
|
|
|
665
669
|
When a test fails, classify before attempting repair.
|
|
@@ -761,9 +765,29 @@ After Triage classifies failure as "Test Bug" or "Ambiguous":
|
|
|
761
765
|
- Data values differ (e.g., expected "¥1000" but got "¥999" → **Phase 3**, could be rounding, discount, or calculation bug)
|
|
762
766
|
- Missing elements after interaction (e.g., "after creating order, success message should appear" → no message → **Phase 3**)
|
|
763
767
|
|
|
764
|
-
5. If selector issue →
|
|
768
|
+
5. If selector issue → generate candidate list, then select:
|
|
769
|
+
|
|
770
|
+
**5a. Extract candidates** — identify the target element from the failing test's assertion, then from the snapshot list all selectors for that element:
|
|
771
|
+
|
|
772
|
+
First check `app-knowledge.md` → **Common Selector Patterns** for project-specific conventions (e.g., if project uses Tailwind and `.btn-primary` is listed as preferred → treat it as Fair or higher, not Fragile).
|
|
773
|
+
|
|
774
|
+
```
|
|
775
|
+
Target: <element from failing assertion, e.g. "button with text 'Submit'">
|
|
776
|
+
Candidates (stable → fragile):
|
|
777
|
+
- getByRole(button, { name: 'Submit' }) ← Stable (semantic)
|
|
778
|
+
- getByText('Submit') ← Fair (unique text)
|
|
779
|
+
- getByLabel('Email') ← Fair (form fields)
|
|
780
|
+
- locator('#submit') ← Fair (id attribute)
|
|
781
|
+
- locator('.btn-primary') ← Fragile (style class) — upgrade if listed in Common Selector Patterns
|
|
782
|
+
- locator('button:nth-child(3)') ← Fragile (DOM order)
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
Stability: `getByRole` > `getByText`/`getByLabel` > `locator('#id')` > `locator('.class')` > `locator('nth-child')`. Upgrade stability if `app-knowledge.md` → **Common Selector Patterns** explicitly lists the selector as preferred for this project.
|
|
786
|
+
|
|
787
|
+
**5b. Select top candidate** — pick the highest-stability candidate that matches the target. Output: `SELECTED: <selector> — reason: <why this one>`.
|
|
788
|
+
|
|
765
789
|
6. Apply fix → re-run **only that test** (attempt 1/3)
|
|
766
|
-
7. If healed → append to `app-knowledge.md` → **Selector Fixes** table (route, old → new selector, reason)
|
|
790
|
+
7. If healed → append to `app-knowledge.md` → **Selector Fixes** table (route, old → new selector, reason, date)
|
|
767
791
|
|
|
768
792
|
**Element Missing handling (when browser_snapshot shows element not found):**
|
|
769
793
|
|