claude-everything-workflow 0.2.2 → 0.2.3

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.
Files changed (77) hide show
  1. package/AGENTS.md +6 -5
  2. package/CLAUDE.md +1 -5
  3. package/README.md +57 -27
  4. package/agents/e2e-runner.md +8 -141
  5. package/commands/code-review.md +9 -30
  6. package/commands/pr.md +1 -6
  7. package/commands/verify.md +7 -11
  8. package/harness/manifest.json +346 -0
  9. package/package.json +7 -2
  10. package/rules/01-base.md +9 -26
  11. package/rules/02-code-size.md +5 -9
  12. package/rules/03-architecture.md +8 -22
  13. package/rules/04-error-handling.md +4 -5
  14. package/rules/05-git-workflow.md +4 -3
  15. package/rules/06-comments.md +3 -9
  16. package/rules/07-forbidden.md +4 -3
  17. package/rules/common/agent-orchestration.md +1 -3
  18. package/rules/common/hooks.md +2 -0
  19. package/rules/common/pr-automation.md +1 -1
  20. package/rules/common/skills-learning.md +1 -1
  21. package/rules/common/testing.md +3 -2
  22. package/scripts/install-rules.js +100 -0
  23. package/scripts/install.ps1 +27 -3
  24. package/scripts/install.sh +24 -2
  25. package/scripts/legacy-common-rule-hashes.json +78 -0
  26. package/scripts/retired-skill-files.json +17 -0
  27. package/scripts/upstream-capability-map.json +14 -9
  28. package/scripts/verify/grilling-spec-gate-checks.js +11 -5
  29. package/scripts/verify/install-rules.test.js +156 -0
  30. package/scripts/verify/metadata-checks.js +26 -3
  31. package/scripts/verify/repository-checks.js +35 -61
  32. package/scripts/verify/skill-invocation.test.js +86 -0
  33. package/scripts/verify/skill-manifest-checks.js +197 -0
  34. package/scripts/verify/skill-manifest-checks.test.js +123 -0
  35. package/scripts/verify/workflow-checks.js +26 -82
  36. package/scripts/verify-harness.js +2 -0
  37. package/scripts/verify-upstream-capability-map.js +2 -1
  38. package/skills/README.md +9 -10
  39. package/skills/code-review/SKILL.md +54 -41
  40. package/skills/codebase-design/SKILL.md +1 -1
  41. package/skills/continuous-learning-v2/SKILL.md +1 -1
  42. package/skills/domain-modeling/SKILL.md +3 -2
  43. package/skills/e2e-testing/SKILL.md +20 -310
  44. package/skills/e2e-testing/references/playwright-patterns.md +324 -0
  45. package/skills/feature-acceptance/SKILL.md +1 -1
  46. package/skills/grilling/SKILL.md +1 -1
  47. package/skills/handoff/SKILL.md +3 -4
  48. package/skills/handoff/agents/openai.yaml +2 -0
  49. package/skills/implement/SKILL.md +32 -81
  50. package/skills/implement/references/ticket-delivery.md +43 -0
  51. package/skills/improve-codebase-architecture/SKILL.md +1 -2
  52. package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
  53. package/skills/iterative-retrieval/SKILL.md +1 -1
  54. package/skills/prototype/SKILL.md +1 -1
  55. package/skills/resolving-merge-conflicts/SKILL.md +1 -1
  56. package/skills/spec-gate/SKILL.md +1 -1
  57. package/skills/subagent-driven-development/SKILL.md +2 -2
  58. package/skills/systematic-debugging/SKILL.md +9 -3
  59. package/skills/test-driven-development/SKILL.md +6 -2
  60. package/skills/to-tickets/SKILL.md +5 -3
  61. package/skills/triage/SKILL.md +4 -4
  62. package/skills/triage/agents/openai.yaml +2 -0
  63. package/skills/using-git-worktrees/SKILL.md +8 -5
  64. package/skills/using-superpowers/SKILL.md +27 -94
  65. package/skills/using-superpowers/references/process-outcomes.md +41 -0
  66. package/skills/verification-before-completion/SKILL.md +5 -4
  67. package/skills/visual-companion/SKILL.md +1 -1
  68. package/agents/architect.md +0 -59
  69. package/agents/code-reviewer.md +0 -28
  70. package/agents/planner.md +0 -40
  71. package/agents/tdd-guide.md +0 -101
  72. package/skills/find-skills/SKILL.md +0 -142
  73. package/skills/project-context/SKILL.md +0 -94
  74. package/skills/project-context/agents/openai.yaml +0 -6
  75. package/skills/project-context/references/project-context-template.md +0 -61
  76. package/skills/research/SKILL.md +0 -48
  77. package/skills/wayfinder/SKILL.md +0 -57
@@ -1,326 +1,36 @@
1
1
  ---
2
2
  name: e2e-testing
3
- description: Playwright E2E testing patterns, Page Object Model, configuration, CI/CD integration, artifact management, and flaky test strategies.
3
+ description: Use for explicit Playwright or E2E work; keep tests repeatable and load detailed patterns on demand.
4
4
  origin: ECC
5
5
  ---
6
6
 
7
- # E2E Testing Patterns
7
+ # E2E Testing
8
8
 
9
- Comprehensive Playwright patterns for building stable, fast, and maintainable E2E test suites.
9
+ 只在用户明确要求 E2E、Playwright、端到端回归或测试不稳定性处理时加载。这里负责把需求落到项目已有的可重复测试入口;通用示例和配置细节见 `references/playwright-patterns.md`,命中具体问题时再读取。
10
10
 
11
- ## Test File Organization
11
+ ## 先发现项目现状
12
12
 
13
- ```
14
- tests/
15
- ├── e2e/
16
- │ ├── auth/
17
- │ │ ├── login.spec.ts
18
- │ │ ├── logout.spec.ts
19
- │ │ └── register.spec.ts
20
- │ ├── features/
21
- │ │ ├── browse.spec.ts
22
- │ │ ├── search.spec.ts
23
- │ │ └── create.spec.ts
24
- │ └── api/
25
- │ └── endpoints.spec.ts
26
- ├── fixtures/
27
- │ ├── auth.ts
28
- │ └── data.ts
29
- └── playwright.config.ts
30
- ```
13
+ 1. 读取 `package.json`、lockfile、CI 配置和现有测试目录,确认包管理器与脚本。
14
+ 2. 查找 `playwright.config.*`、`tests/e2e/`、`e2e/`、`BASE_URL`、启动命令和测试数据准备方式。
15
+ 3. 优先使用项目已有依赖和 `npx playwright test`;缺少浏览器时再处理安装。
16
+ 4. Agent Browser 或 MCP 只用于交互式探索和定位,不作为最终测试或报告来源。
31
17
 
32
- ## Page Object Model (POM)
18
+ ## 执行契约
33
19
 
34
- ```typescript
35
- import { Page, Locator } from '@playwright/test'
20
+ - 用 Page Object Model(POM)或项目已有等价抽象组织稳定定位器;优先 `getByRole`、`getByTestId` 和条件等待。
21
+ - 覆盖用户指定的关键旅程,并补正常、边界和错误路径;禁止用 `waitForTimeout` 掩盖竞态。
22
+ - 本地先运行与改动相关的最小集合;关键路径或新增测试重复运行以检查 flaky。
23
+ - 失败先读取 CLI 输出、trace、screenshot、video 和 HTML report,再判断是产品缺陷、测试缺陷还是环境问题。
24
+ - CI 失败保留 `playwright-report`、`test-results`、trace、screenshot 和 video;修复后至少复跑失败用例。
36
25
 
37
- export class ItemsPage {
38
- readonly page: Page
39
- readonly searchInput: Locator
40
- readonly itemCards: Locator
41
- readonly createButton: Locator
26
+ ## 最小配置要求
42
27
 
43
- constructor(page: Page) {
44
- this.page = page
45
- this.searchInput = page.locator('[data-testid="search-input"]')
46
- this.itemCards = page.locator('[data-testid="item-card"]')
47
- this.createButton = page.locator('[data-testid="create-btn"]')
48
- }
28
+ 项目没有现成 E2E 基础设施时,才新增最小 `playwright.config.*`、测试目录和脚本。配置应明确 `baseURL`、`webServer`、`trace: 'on-first-retry'`、`screenshot: 'only-on-failure'` 和失败制品保存策略。
49
29
 
50
- async goto() {
51
- await this.page.goto('/items')
52
- await this.page.waitForLoadState('networkidle')
53
- }
30
+ ## 输出
54
31
 
55
- async search(query: string) {
56
- await this.searchInput.fill(query)
57
- await this.page.waitForResponse(resp => resp.url().includes('/api/search'))
58
- await this.page.waitForLoadState('networkidle')
59
- }
32
+ 返回修改的测试或配置文件、实际运行命令、通过/失败结果、失败根因判断和可复查制品路径。未运行的检查说明原因,不把探索截图或受控 fixture 写成真实 E2E 通过。
60
33
 
61
- async getItemCount() {
62
- return await this.itemCards.count()
63
- }
64
- }
65
- ```
34
+ ## 参考
66
35
 
67
- ## Test Structure
68
-
69
- ```typescript
70
- import { test, expect } from '@playwright/test'
71
- import { ItemsPage } from '../../pages/ItemsPage'
72
-
73
- test.describe('Item Search', () => {
74
- let itemsPage: ItemsPage
75
-
76
- test.beforeEach(async ({ page }) => {
77
- itemsPage = new ItemsPage(page)
78
- await itemsPage.goto()
79
- })
80
-
81
- test('should search by keyword', async ({ page }) => {
82
- await itemsPage.search('test')
83
-
84
- const count = await itemsPage.getItemCount()
85
- expect(count).toBeGreaterThan(0)
86
-
87
- await expect(itemsPage.itemCards.first()).toContainText(/test/i)
88
- await page.screenshot({ path: 'artifacts/search-results.png' })
89
- })
90
-
91
- test('should handle no results', async ({ page }) => {
92
- await itemsPage.search('xyznonexistent123')
93
-
94
- await expect(page.locator('[data-testid="no-results"]')).toBeVisible()
95
- expect(await itemsPage.getItemCount()).toBe(0)
96
- })
97
- })
98
- ```
99
-
100
- ## Playwright Configuration
101
-
102
- ```typescript
103
- import { defineConfig, devices } from '@playwright/test'
104
-
105
- export default defineConfig({
106
- testDir: './tests/e2e',
107
- fullyParallel: true,
108
- forbidOnly: !!process.env.CI,
109
- retries: process.env.CI ? 2 : 0,
110
- workers: process.env.CI ? 1 : undefined,
111
- reporter: [
112
- ['html', { outputFolder: 'playwright-report' }],
113
- ['junit', { outputFile: 'playwright-results.xml' }],
114
- ['json', { outputFile: 'playwright-results.json' }]
115
- ],
116
- use: {
117
- baseURL: process.env.BASE_URL || 'http://localhost:3000',
118
- trace: 'on-first-retry',
119
- screenshot: 'only-on-failure',
120
- video: 'retain-on-failure',
121
- actionTimeout: 10000,
122
- navigationTimeout: 30000,
123
- },
124
- projects: [
125
- { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
126
- { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
127
- { name: 'webkit', use: { ...devices['Desktop Safari'] } },
128
- { name: 'mobile-chrome', use: { ...devices['Pixel 5'] } },
129
- ],
130
- webServer: {
131
- command: 'npm run dev',
132
- url: 'http://localhost:3000',
133
- reuseExistingServer: !process.env.CI,
134
- timeout: 120000,
135
- },
136
- })
137
- ```
138
-
139
- ## Flaky Test Patterns
140
-
141
- ### Quarantine
142
-
143
- ```typescript
144
- test('flaky: complex search', async ({ page }) => {
145
- test.fixme(true, 'Flaky - Issue #123')
146
- // test code...
147
- })
148
-
149
- test('conditional skip', async ({ page }) => {
150
- test.skip(process.env.CI, 'Flaky in CI - Issue #123')
151
- // test code...
152
- })
153
- ```
154
-
155
- ### Identify Flakiness
156
-
157
- ```bash
158
- npx playwright test tests/search.spec.ts --repeat-each=10
159
- npx playwright test tests/search.spec.ts --retries=3
160
- ```
161
-
162
- ### Common Causes & Fixes
163
-
164
- **Race conditions:**
165
- ```typescript
166
- // Bad: assumes element is ready
167
- await page.click('[data-testid="button"]')
168
-
169
- // Good: auto-wait locator
170
- await page.locator('[data-testid="button"]').click()
171
- ```
172
-
173
- **Network timing:**
174
- ```typescript
175
- // Bad: arbitrary timeout
176
- await page.waitForTimeout(5000)
177
-
178
- // Good: wait for specific condition
179
- await page.waitForResponse(resp => resp.url().includes('/api/data'))
180
- ```
181
-
182
- **Animation timing:**
183
- ```typescript
184
- // Bad: click during animation
185
- await page.click('[data-testid="menu-item"]')
186
-
187
- // Good: wait for stability
188
- await page.locator('[data-testid="menu-item"]').waitFor({ state: 'visible' })
189
- await page.waitForLoadState('networkidle')
190
- await page.locator('[data-testid="menu-item"]').click()
191
- ```
192
-
193
- ## Artifact Management
194
-
195
- ### Screenshots
196
-
197
- ```typescript
198
- await page.screenshot({ path: 'artifacts/after-login.png' })
199
- await page.screenshot({ path: 'artifacts/full-page.png', fullPage: true })
200
- await page.locator('[data-testid="chart"]').screenshot({ path: 'artifacts/chart.png' })
201
- ```
202
-
203
- ### Traces
204
-
205
- ```typescript
206
- await browser.startTracing(page, {
207
- path: 'artifacts/trace.json',
208
- screenshots: true,
209
- snapshots: true,
210
- })
211
- // ... test actions ...
212
- await browser.stopTracing()
213
- ```
214
-
215
- ### Video
216
-
217
- ```typescript
218
- // In playwright.config.ts
219
- use: {
220
- video: 'retain-on-failure',
221
- videosPath: 'artifacts/videos/'
222
- }
223
- ```
224
-
225
- ## CI/CD Integration
226
-
227
- ```yaml
228
- # .github/workflows/e2e.yml
229
- name: E2E Tests
230
- on: [push, pull_request]
231
-
232
- jobs:
233
- test:
234
- runs-on: ubuntu-latest
235
- steps:
236
- - uses: actions/checkout@v4
237
- - uses: actions/setup-node@v4
238
- with:
239
- node-version: 20
240
- - run: npm ci
241
- - run: npx playwright install --with-deps
242
- - run: npx playwright test
243
- env:
244
- BASE_URL: ${{ vars.STAGING_URL }}
245
- - uses: actions/upload-artifact@v4
246
- if: always()
247
- with:
248
- name: playwright-report
249
- path: playwright-report/
250
- retention-days: 30
251
- ```
252
-
253
- ## Test Report Template
254
-
255
- ```markdown
256
- # E2E Test Report
257
-
258
- **Date:** YYYY-MM-DD HH:MM
259
- **Duration:** Xm Ys
260
- **Status:** PASSING / FAILING
261
-
262
- ## Summary
263
- - Total: X | Passed: Y (Z%) | Failed: A | Flaky: B | Skipped: C
264
-
265
- ## Failed Tests
266
-
267
- ### test-name
268
- **File:** `tests/e2e/feature.spec.ts:45`
269
- **Error:** Expected element to be visible
270
- **Screenshot:** artifacts/failed.png
271
- **Recommended Fix:** [description]
272
-
273
- ## Artifacts
274
- - HTML Report: playwright-report/index.html
275
- - Screenshots: artifacts/*.png
276
- - Videos: artifacts/videos/*.webm
277
- - Traces: artifacts/*.zip
278
- ```
279
-
280
- ## Wallet / Web3 Testing
281
-
282
- ```typescript
283
- test('wallet connection', async ({ page, context }) => {
284
- // Mock wallet provider
285
- await context.addInitScript(() => {
286
- window.ethereum = {
287
- isMetaMask: true,
288
- request: async ({ method }) => {
289
- if (method === 'eth_requestAccounts')
290
- return ['0x1234567890123456789012345678901234567890']
291
- if (method === 'eth_chainId') return '0x1'
292
- }
293
- }
294
- })
295
-
296
- await page.goto('/')
297
- await page.locator('[data-testid="connect-wallet"]').click()
298
- await expect(page.locator('[data-testid="wallet-address"]')).toContainText('0x1234')
299
- })
300
- ```
301
-
302
- ## Financial / Critical Flow Testing
303
-
304
- ```typescript
305
- test('trade execution', async ({ page }) => {
306
- // Skip on production — real money
307
- test.skip(process.env.NODE_ENV === 'production', 'Skip on production')
308
-
309
- await page.goto('/markets/test-market')
310
- await page.locator('[data-testid="position-yes"]').click()
311
- await page.locator('[data-testid="trade-amount"]').fill('1.0')
312
-
313
- // Verify preview
314
- const preview = page.locator('[data-testid="trade-preview"]')
315
- await expect(preview).toContainText('1.0')
316
-
317
- // Confirm and wait for blockchain
318
- await page.locator('[data-testid="confirm-trade"]').click()
319
- await page.waitForResponse(
320
- resp => resp.url().includes('/api/trade') && resp.status() === 200,
321
- { timeout: 30000 }
322
- )
323
-
324
- await expect(page.locator('[data-testid="trade-success"]')).toBeVisible()
325
- })
326
- ```
36
+ 需要 POM、配置模板、flaky 隔离、重试和制品示例时,按需读取 `references/playwright-patterns.md`。
@@ -0,0 +1,324 @@
1
+ # Playwright Patterns
2
+
3
+ 按需参考的 POM、配置、flaky 和制品示例。
4
+
5
+ # E2E Testing Patterns
6
+
7
+ Comprehensive Playwright patterns for building stable, fast, and maintainable E2E test suites.
8
+
9
+ ## Test File Organization
10
+
11
+ ```
12
+ tests/
13
+ ├── e2e/
14
+ │ ├── auth/
15
+ │ │ ├── login.spec.ts
16
+ │ │ ├── logout.spec.ts
17
+ │ │ └── register.spec.ts
18
+ │ ├── features/
19
+ │ │ ├── browse.spec.ts
20
+ │ │ ├── search.spec.ts
21
+ │ │ └── create.spec.ts
22
+ │ └── api/
23
+ │ └── endpoints.spec.ts
24
+ ├── fixtures/
25
+ │ ├── auth.ts
26
+ │ └── data.ts
27
+ └── playwright.config.ts
28
+ ```
29
+
30
+ ## Page Object Model (POM)
31
+
32
+ ```typescript
33
+ import { Page, Locator } from '@playwright/test'
34
+
35
+ export class ItemsPage {
36
+ readonly page: Page
37
+ readonly searchInput: Locator
38
+ readonly itemCards: Locator
39
+ readonly createButton: Locator
40
+
41
+ constructor(page: Page) {
42
+ this.page = page
43
+ this.searchInput = page.locator('[data-testid="search-input"]')
44
+ this.itemCards = page.locator('[data-testid="item-card"]')
45
+ this.createButton = page.locator('[data-testid="create-btn"]')
46
+ }
47
+
48
+ async goto() {
49
+ await this.page.goto('/items')
50
+ await this.page.waitForLoadState('networkidle')
51
+ }
52
+
53
+ async search(query: string) {
54
+ await this.searchInput.fill(query)
55
+ await this.page.waitForResponse(resp => resp.url().includes('/api/search'))
56
+ await this.page.waitForLoadState('networkidle')
57
+ }
58
+
59
+ async getItemCount() {
60
+ return await this.itemCards.count()
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Test Structure
66
+
67
+ ```typescript
68
+ import { test, expect } from '@playwright/test'
69
+ import { ItemsPage } from '../../pages/ItemsPage'
70
+
71
+ test.describe('Item Search', () => {
72
+ let itemsPage: ItemsPage
73
+
74
+ test.beforeEach(async ({ page }) => {
75
+ itemsPage = new ItemsPage(page)
76
+ await itemsPage.goto()
77
+ })
78
+
79
+ test('should search by keyword', async ({ page }) => {
80
+ await itemsPage.search('test')
81
+
82
+ const count = await itemsPage.getItemCount()
83
+ expect(count).toBeGreaterThan(0)
84
+
85
+ await expect(itemsPage.itemCards.first()).toContainText(/test/i)
86
+ await page.screenshot({ path: 'artifacts/search-results.png' })
87
+ })
88
+
89
+ test('should handle no results', async ({ page }) => {
90
+ await itemsPage.search('xyznonexistent123')
91
+
92
+ await expect(page.locator('[data-testid="no-results"]')).toBeVisible()
93
+ expect(await itemsPage.getItemCount()).toBe(0)
94
+ })
95
+ })
96
+ ```
97
+
98
+ ## Playwright Configuration
99
+
100
+ ```typescript
101
+ import { defineConfig, devices } from '@playwright/test'
102
+
103
+ export default defineConfig({
104
+ testDir: './tests/e2e',
105
+ fullyParallel: true,
106
+ forbidOnly: !!process.env.CI,
107
+ retries: process.env.CI ? 2 : 0,
108
+ workers: process.env.CI ? 1 : undefined,
109
+ reporter: [
110
+ ['html', { outputFolder: 'playwright-report' }],
111
+ ['junit', { outputFile: 'playwright-results.xml' }],
112
+ ['json', { outputFile: 'playwright-results.json' }]
113
+ ],
114
+ use: {
115
+ baseURL: process.env.BASE_URL || 'http://localhost:3000',
116
+ trace: 'on-first-retry',
117
+ screenshot: 'only-on-failure',
118
+ video: 'retain-on-failure',
119
+ actionTimeout: 10000,
120
+ navigationTimeout: 30000,
121
+ },
122
+ projects: [
123
+ { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
124
+ { name: 'firefox', use: { ...devices['Desktop Firefox'] } },
125
+ { name: 'webkit', use: { ...devices['Desktop Safari'] } },
126
+ { name: 'mobile-chrome', use: { ...devices['Pixel 5'] } },
127
+ ],
128
+ webServer: {
129
+ command: 'npm run dev',
130
+ url: 'http://localhost:3000',
131
+ reuseExistingServer: !process.env.CI,
132
+ timeout: 120000,
133
+ },
134
+ })
135
+ ```
136
+
137
+ ## Flaky Test Patterns
138
+
139
+ ### Quarantine
140
+
141
+ ```typescript
142
+ test('flaky: complex search', async ({ page }) => {
143
+ test.fixme(true, 'Flaky - Issue #123')
144
+ // test code...
145
+ })
146
+
147
+ test('conditional skip', async ({ page }) => {
148
+ test.skip(process.env.CI, 'Flaky in CI - Issue #123')
149
+ // test code...
150
+ })
151
+ ```
152
+
153
+ ### Identify Flakiness
154
+
155
+ ```bash
156
+ npx playwright test tests/search.spec.ts --repeat-each=10
157
+ npx playwright test tests/search.spec.ts --retries=3
158
+ ```
159
+
160
+ ### Common Causes & Fixes
161
+
162
+ **Race conditions:**
163
+ ```typescript
164
+ // Bad: assumes element is ready
165
+ await page.click('[data-testid="button"]')
166
+
167
+ // Good: auto-wait locator
168
+ await page.locator('[data-testid="button"]').click()
169
+ ```
170
+
171
+ **Network timing:**
172
+ ```typescript
173
+ // Bad: arbitrary timeout
174
+ await page.waitForTimeout(5000)
175
+
176
+ // Good: wait for specific condition
177
+ await page.waitForResponse(resp => resp.url().includes('/api/data'))
178
+ ```
179
+
180
+ **Animation timing:**
181
+ ```typescript
182
+ // Bad: click during animation
183
+ await page.click('[data-testid="menu-item"]')
184
+
185
+ // Good: wait for stability
186
+ await page.locator('[data-testid="menu-item"]').waitFor({ state: 'visible' })
187
+ await page.waitForLoadState('networkidle')
188
+ await page.locator('[data-testid="menu-item"]').click()
189
+ ```
190
+
191
+ ## Artifact Management
192
+
193
+ ### Screenshots
194
+
195
+ ```typescript
196
+ await page.screenshot({ path: 'artifacts/after-login.png' })
197
+ await page.screenshot({ path: 'artifacts/full-page.png', fullPage: true })
198
+ await page.locator('[data-testid="chart"]').screenshot({ path: 'artifacts/chart.png' })
199
+ ```
200
+
201
+ ### Traces
202
+
203
+ ```typescript
204
+ await browser.startTracing(page, {
205
+ path: 'artifacts/trace.json',
206
+ screenshots: true,
207
+ snapshots: true,
208
+ })
209
+ // ... test actions ...
210
+ await browser.stopTracing()
211
+ ```
212
+
213
+ ### Video
214
+
215
+ ```typescript
216
+ // In playwright.config.ts
217
+ use: {
218
+ video: 'retain-on-failure',
219
+ videosPath: 'artifacts/videos/'
220
+ }
221
+ ```
222
+
223
+ ## CI/CD Integration
224
+
225
+ ```yaml
226
+ # .github/workflows/e2e.yml
227
+ name: E2E Tests
228
+ on: [push, pull_request]
229
+
230
+ jobs:
231
+ test:
232
+ runs-on: ubuntu-latest
233
+ steps:
234
+ - uses: actions/checkout@v4
235
+ - uses: actions/setup-node@v4
236
+ with:
237
+ node-version: 20
238
+ - run: npm ci
239
+ - run: npx playwright install --with-deps
240
+ - run: npx playwright test
241
+ env:
242
+ BASE_URL: ${{ vars.STAGING_URL }}
243
+ - uses: actions/upload-artifact@v4
244
+ if: always()
245
+ with:
246
+ name: playwright-report
247
+ path: playwright-report/
248
+ retention-days: 30
249
+ ```
250
+
251
+ ## Test Report Template
252
+
253
+ ```markdown
254
+ # E2E Test Report
255
+
256
+ **Date:** YYYY-MM-DD HH:MM
257
+ **Duration:** Xm Ys
258
+ **Status:** PASSING / FAILING
259
+
260
+ ## Summary
261
+ - Total: X | Passed: Y (Z%) | Failed: A | Flaky: B | Skipped: C
262
+
263
+ ## Failed Tests
264
+
265
+ ### test-name
266
+ **File:** `tests/e2e/feature.spec.ts:45`
267
+ **Error:** Expected element to be visible
268
+ **Screenshot:** artifacts/failed.png
269
+ **Recommended Fix:** [description]
270
+
271
+ ## Artifacts
272
+ - HTML Report: playwright-report/index.html
273
+ - Screenshots: artifacts/*.png
274
+ - Videos: artifacts/videos/*.webm
275
+ - Traces: artifacts/*.zip
276
+ ```
277
+
278
+ ## Wallet / Web3 Testing
279
+
280
+ ```typescript
281
+ test('wallet connection', async ({ page, context }) => {
282
+ // Mock wallet provider
283
+ await context.addInitScript(() => {
284
+ window.ethereum = {
285
+ isMetaMask: true,
286
+ request: async ({ method }) => {
287
+ if (method === 'eth_requestAccounts')
288
+ return ['0x1234567890123456789012345678901234567890']
289
+ if (method === 'eth_chainId') return '0x1'
290
+ }
291
+ }
292
+ })
293
+
294
+ await page.goto('/')
295
+ await page.locator('[data-testid="connect-wallet"]').click()
296
+ await expect(page.locator('[data-testid="wallet-address"]')).toContainText('0x1234')
297
+ })
298
+ ```
299
+
300
+ ## Financial / Critical Flow Testing
301
+
302
+ ```typescript
303
+ test('trade execution', async ({ page }) => {
304
+ // Skip on production — real money
305
+ test.skip(process.env.NODE_ENV === 'production', 'Skip on production')
306
+
307
+ await page.goto('/markets/test-market')
308
+ await page.locator('[data-testid="position-yes"]').click()
309
+ await page.locator('[data-testid="trade-amount"]').fill('1.0')
310
+
311
+ // Verify preview
312
+ const preview = page.locator('[data-testid="trade-preview"]')
313
+ await expect(preview).toContainText('1.0')
314
+
315
+ // Confirm and wait for blockchain
316
+ await page.locator('[data-testid="confirm-trade"]').click()
317
+ await page.waitForResponse(
318
+ resp => resp.url().includes('/api/trade') && resp.status() === 200,
319
+ { timeout: 30000 }
320
+ )
321
+
322
+ await expect(page.locator('[data-testid="trade-success"]')).toBeVisible()
323
+ })
324
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: feature-acceptance
3
- description: 用于功能验收、回归验证、确认修复是否生效,以及需要用真实界面、视频或日志证据判断用户流程是否正常的任务。适用于“验收一下”“测一下”“确认修复”“给我可复核证据”等请求。
3
+ description: "验收真实用户流程、界面和日志证据;用于确认修复或交付是否真正生效。"
4
4
  ---
5
5
 
6
6
  # 功能验收
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: grilling
3
- description: "Resolve consequential user-owned decisions through a one-question-at-a-time interview. Use when the user says grill me, asks for challenge or pressure-testing, or when the central router finds an unresolved decision that materially changes the outcome; do not trigger for discoverable facts, ordinary complexity, file count, or high risk by itself."
3
+ description: Resolve a consequential user-owned decision one question at a time; do not ask discoverable facts.
4
4
  ---
5
5
 
6
6
  # Grilling