openspec-playwright 0.1.48 → 0.1.49
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.
- package/README.md +40 -11
- package/README.zh-CN.md +61 -9
- package/openspec-playwright-0.1.49.tgz +0 -0
- package/package.json +1 -1
- package/release-notes.md +2 -2
- package/openspec-playwright-0.1.48.tgz +0 -0
package/README.md
CHANGED
|
@@ -59,18 +59,35 @@ openspec-pw doctor # Check prerequisites
|
|
|
59
59
|
## How It Works
|
|
60
60
|
|
|
61
61
|
```
|
|
62
|
-
/
|
|
62
|
+
/opsx:e2e <change-name>
|
|
63
63
|
│
|
|
64
|
-
├── 1.
|
|
64
|
+
├── 1. Select change → read openspec/changes/<name>/specs/
|
|
65
65
|
│
|
|
66
|
-
├── 2.
|
|
66
|
+
├── 2. Detect auth → check specs for login/auth markers
|
|
67
67
|
│
|
|
68
|
-
├── 3.
|
|
68
|
+
├── 3. Validate env → run seed.spec.ts
|
|
69
69
|
│
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
├── 4. Explore app → Playwright MCP explores real DOM
|
|
71
|
+
│ ├─ Read app-knowledge.md (project-level knowledge)
|
|
72
|
+
│ ├─ Extract routes from specs
|
|
73
|
+
│ ├─ Navigate each route → snapshot → screenshot
|
|
74
|
+
│ └─ Write app-exploration.md (change-level findings)
|
|
75
|
+
│ └─ Extract patterns → update app-knowledge.md
|
|
76
|
+
│
|
|
77
|
+
├── 5. Planner → generates test-plan.md
|
|
78
|
+
│
|
|
79
|
+
├── 6. Generator → creates tests/playwright/<name>.spec.ts
|
|
80
|
+
│ └─ Verifies selectors in real browser before writing
|
|
81
|
+
│
|
|
82
|
+
├── 7. Configure auth → auth.setup.ts (if required)
|
|
83
|
+
│
|
|
84
|
+
├── 8. Configure playwright → playwright.config.ts
|
|
85
|
+
│
|
|
86
|
+
├── 9. Execute tests → openspec-pw run <name>
|
|
87
|
+
│
|
|
88
|
+
├── 10. Healer (if needed) → auto-heals failures via MCP
|
|
89
|
+
│
|
|
90
|
+
└── 11. Report → openspec/reports/playwright-e2e-<name>.md
|
|
74
91
|
|
|
75
92
|
### Two Verification Layers
|
|
76
93
|
|
|
@@ -92,7 +109,7 @@ openspec-pw doctor # Check prerequisites
|
|
|
92
109
|
2. Installs E2E command/workflow files for each detected editor
|
|
93
110
|
3. Installs `/openspec-e2e` skill for Claude Code
|
|
94
111
|
4. Installs Playwright MCP globally for Claude Code (via `claude mcp add`)
|
|
95
|
-
5. Generates `tests/playwright/seed.spec.ts`, `auth.setup.ts`, `credentials.yaml`
|
|
112
|
+
5. Generates `tests/playwright/seed.spec.ts`, `auth.setup.ts`, `credentials.yaml`, `app-knowledge.md`
|
|
96
113
|
|
|
97
114
|
> **Note**: After running `openspec-pw init`, manually install Playwright browsers: `npx playwright install --with-deps`
|
|
98
115
|
|
|
@@ -141,20 +158,32 @@ Playwright MCP is installed globally via `claude mcp add` and enables the Healer
|
|
|
141
158
|
|
|
142
159
|
```
|
|
143
160
|
Schema (openspec/schemas/playwright-e2e/)
|
|
144
|
-
└── Templates: test-plan.md, report.md, playwright.config.ts
|
|
161
|
+
└── Templates: test-plan.md, report.md, playwright.config.ts, app-knowledge.md
|
|
145
162
|
|
|
146
163
|
CLI (openspec-pw)
|
|
147
164
|
├── init → Installs commands for detected editors
|
|
148
165
|
├── update → Syncs commands + schema from npm
|
|
166
|
+
├── run → Executes E2E tests with server lifecycle
|
|
167
|
+
├── verify → Checks implementation against artifacts
|
|
149
168
|
└── doctor → Checks prerequisites
|
|
150
169
|
|
|
151
170
|
Skill/Commands (per editor)
|
|
152
|
-
├── Claude Code → /
|
|
171
|
+
├── Claude Code → /opsx:e2e (skill) + /opsx:e2e (command) + MCP
|
|
153
172
|
├── Cursor → /opsx-e2e (command)
|
|
154
173
|
├── Windsurf → /opsx-e2e (workflow)
|
|
155
174
|
├── Cline → /opsx-e2e (workflow)
|
|
156
175
|
└── Continue → /opsx-e2e (prompt)
|
|
157
176
|
|
|
177
|
+
Test Assets (tests/playwright/)
|
|
178
|
+
├── seed.spec.ts → Env validation
|
|
179
|
+
├── auth.setup.ts → Session recording
|
|
180
|
+
├── credentials.yaml → Test users
|
|
181
|
+
└── app-knowledge.md → Project-level selector patterns (cross-change)
|
|
182
|
+
|
|
183
|
+
Exploration (openspec/changes/<name>/specs/playwright/)
|
|
184
|
+
├── app-exploration.md → This change's routes + verified selectors
|
|
185
|
+
└── test-plan.md → This change's test cases
|
|
186
|
+
|
|
158
187
|
Healer Agent (Claude Code + MCP only)
|
|
159
188
|
└── browser_snapshot, browser_navigate, browser_run_code, etc.
|
|
160
189
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -61,15 +61,33 @@ openspec-pw doctor # 检查前置条件
|
|
|
61
61
|
```
|
|
62
62
|
/opsx:e2e <change-name>
|
|
63
63
|
│
|
|
64
|
-
├── 1.
|
|
64
|
+
├── 1. 选择 change → 读取 openspec/changes/<name>/specs/
|
|
65
65
|
│
|
|
66
|
-
├── 2.
|
|
66
|
+
├── 2. 检测 auth → 从 specs 识别登录/认证标记
|
|
67
67
|
│
|
|
68
|
-
├── 3.
|
|
68
|
+
├── 3. 验证环境 → 运行 seed.spec.ts
|
|
69
69
|
│
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
├── 4. 探索应用 → Playwright MCP 探索真实 DOM
|
|
71
|
+
│ ├─ 读取 app-knowledge.md(项目级知识)
|
|
72
|
+
│ ├─ 从 specs 提取路由
|
|
73
|
+
│ ├─ 遍历每个路由 → snapshot → screenshot
|
|
74
|
+
│ └─ 写入 app-exploration.md(change 级发现)
|
|
75
|
+
│ └─ 提取模式 → 更新 app-knowledge.md
|
|
76
|
+
│
|
|
77
|
+
├── 5. Planner → 生成 test-plan.md
|
|
78
|
+
│
|
|
79
|
+
├── 6. Generator → 创建 tests/playwright/<name>.spec.ts
|
|
80
|
+
│ └─ 写测试前先在真实浏览器验证选择器
|
|
81
|
+
│
|
|
82
|
+
├── 7. 配置 auth → auth.setup.ts(如需要)
|
|
83
|
+
│
|
|
84
|
+
├── 8. 配置 playwright → playwright.config.ts
|
|
85
|
+
│
|
|
86
|
+
├── 9. 执行测试 → openspec-pw run <name>
|
|
87
|
+
│
|
|
88
|
+
├── 10. Healer(如需要)→ 通过 MCP 自动修复失败
|
|
89
|
+
│
|
|
90
|
+
└── 11. 报告 → openspec/reports/playwright-e2e-<name>.md
|
|
73
91
|
```
|
|
74
92
|
|
|
75
93
|
### 两层验证
|
|
@@ -83,16 +101,16 @@ openspec-pw doctor # 检查前置条件
|
|
|
83
101
|
|
|
84
102
|
1. **Node.js >= 20**
|
|
85
103
|
2. **OpenSpec** 已初始化: `npm install -g @fission-ai/openspec && openspec init`
|
|
86
|
-
3.
|
|
104
|
+
3. **任一 24 编辑器**: Claude Code、Cursor、Windsurf、Cline、Continue 等(自动检测)
|
|
87
105
|
4. **仅 Claude Code**: Playwright MCP — `claude mcp add playwright npx @playwright/mcp@latest`
|
|
88
106
|
|
|
89
107
|
## `openspec-pw init` 做了什么
|
|
90
108
|
|
|
91
|
-
1. 检测已安装的 AI
|
|
109
|
+
1. 检测已安装的 AI 编码助手(支持全部 24 个编辑器)
|
|
92
110
|
2. 为每个检测到的编辑器安装 E2E 命令/工作流文件
|
|
93
111
|
3. 为 Claude Code 安装 `/openspec-e2e` skill
|
|
94
112
|
4. 为 Claude Code 全局安装 Playwright MCP(通过 `claude mcp add`)
|
|
95
|
-
5. 生成 `tests/playwright/seed.spec.ts`、`auth.setup.ts`、`credentials.yaml`
|
|
113
|
+
5. 生成 `tests/playwright/seed.spec.ts`、`auth.setup.ts`、`credentials.yaml`、`app-knowledge.md`
|
|
96
114
|
|
|
97
115
|
> **注意**:运行 `openspec-pw init` 后,手动安装 Playwright 浏览器:`npx playwright install --with-deps`
|
|
98
116
|
|
|
@@ -137,6 +155,40 @@ npx playwright test --project=setup
|
|
|
137
155
|
|
|
138
156
|
Playwright MCP 通过 `claude mcp add` 全局安装,启用 Healer Agent(通过 UI 检查自动修复测试失败)。设置后需重启 Claude Code 生效。
|
|
139
157
|
|
|
158
|
+
## 架构
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Schema (openspec/schemas/playwright-e2e/)
|
|
162
|
+
└── 模板: test-plan.md, report.md, playwright.config.ts, app-knowledge.md
|
|
163
|
+
|
|
164
|
+
CLI (openspec-pw)
|
|
165
|
+
├── init → 为检测到的编辑器安装命令
|
|
166
|
+
├── update → 从 npm 同步命令和 schema
|
|
167
|
+
├── run → 执行 E2E 测试并管理服务器生命周期
|
|
168
|
+
├── verify → 检查实现是否符合 artifacts
|
|
169
|
+
└── doctor → 检查前置条件
|
|
170
|
+
|
|
171
|
+
Skill/命令(按编辑器)
|
|
172
|
+
├── Claude Code → /opsx:e2e (skill) + /opsx:e2e (command) + MCP
|
|
173
|
+
├── Cursor → /opsx-e2e (command)
|
|
174
|
+
├── Windsurf → /opsx-e2e (workflow)
|
|
175
|
+
├── Cline → /opsx-e2e (workflow)
|
|
176
|
+
└── Continue → /opsx-e2e (prompt)
|
|
177
|
+
|
|
178
|
+
测试资产 (tests/playwright/)
|
|
179
|
+
├── seed.spec.ts → 环境验证
|
|
180
|
+
├── auth.setup.ts → 会话录制
|
|
181
|
+
├── credentials.yaml → 测试用户
|
|
182
|
+
└── app-knowledge.md → 项目级选择器模式(跨 change 复用)
|
|
183
|
+
|
|
184
|
+
探索结果 (openspec/changes/<name>/specs/playwright/)
|
|
185
|
+
├── app-exploration.md → 本次 change 的路由 + 已验证选择器
|
|
186
|
+
└── test-plan.md → 本次 change 的测试用例
|
|
187
|
+
|
|
188
|
+
Healer Agent(仅 Claude Code + MCP)
|
|
189
|
+
└── browser_snapshot, browser_navigate, browser_run_code 等
|
|
190
|
+
```
|
|
191
|
+
|
|
140
192
|
## 许可
|
|
141
193
|
|
|
142
194
|
MIT
|
|
Binary file
|
package/package.json
CHANGED
package/release-notes.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
## What's Changed
|
|
2
2
|
|
|
3
|
-
-
|
|
3
|
+
- docs: update README and Chinese README with app-knowledge and new pipeline
|
|
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.49
|
|
Binary file
|