@hustle-together/api-dev-tools 3.12.3 → 4.5.1
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/.claude/adr-requests/.gitkeep +10 -0
- package/.claude/agents/adr-researcher.md +109 -0
- package/.claude/agents/visual-analyzer.md +183 -0
- package/.claude/api-dev-state.json +7 -463
- package/.claude/documentation-audit.json +114 -0
- package/.claude/registry.json +289 -0
- package/.claude/settings.json +45 -1
- package/.claude/workflow-logs/None.json +49 -0
- package/.claude/workflow-logs/session-20251230-143727.json +106 -0
- package/.skills/adr-deep-research/SKILL.md +351 -0
- package/.skills/api-create/SKILL.md +116 -17
- package/.skills/api-research/SKILL.md +130 -0
- package/.skills/docs-sync/SKILL.md +260 -0
- package/.skills/docs-update/SKILL.md +205 -0
- package/.skills/hustle-brand/SKILL.md +368 -0
- package/.skills/hustle-build/SKILL.md +786 -0
- package/.skills/hustle-build-review/SKILL.md +518 -0
- package/.skills/parallel-spawn/SKILL.md +212 -0
- package/.skills/ralph-continue/SKILL.md +151 -0
- package/.skills/ralph-loop/SKILL.md +341 -0
- package/.skills/ralph-status/SKILL.md +87 -0
- package/.skills/refactor/SKILL.md +59 -0
- package/.skills/shadcn/SKILL.md +522 -0
- package/.skills/test-all/SKILL.md +210 -0
- package/.skills/test-builds/SKILL.md +208 -0
- package/.skills/test-debug/SKILL.md +212 -0
- package/.skills/test-e2e/SKILL.md +168 -0
- package/.skills/test-review/SKILL.md +707 -0
- package/.skills/test-unit/SKILL.md +143 -0
- package/.skills/test-visual/SKILL.md +301 -0
- package/.skills/token-report/SKILL.md +132 -0
- package/CHANGELOG.md +575 -0
- package/README.md +426 -56
- package/bin/cli.js +1538 -88
- package/commands/hustle-api-create.md +22 -0
- package/commands/hustle-build.md +259 -0
- package/commands/hustle-combine.md +81 -2
- package/commands/hustle-ui-create-page.md +84 -2
- package/commands/hustle-ui-create.md +82 -2
- package/hooks/__pycache__/api-workflow-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/auto-answer.cpython-314.pyc +0 -0
- package/hooks/__pycache__/cache-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-api-routes.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-playwright-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-storybook-setup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/check-update.cpython-314.pyc +0 -0
- package/hooks/__pycache__/completion-promise-detector.cpython-314.pyc +0 -0
- package/hooks/__pycache__/context-capacity-warning.cpython-314.pyc +0 -0
- package/hooks/__pycache__/detect-interruption.cpython-314.pyc +0 -0
- package/hooks/__pycache__/docs-update-check.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-a11y-audit.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-brand-guide.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-component-type-confirm.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-deep-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-documentation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-dry-run.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-environment.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-external-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-freshness.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-components.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-page-data-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-questions-sourced.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-refactor.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-research.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema-from-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-schema.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-scope.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-tdd-red.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-disambiguation.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-ui-interview.cpython-314.pyc +0 -0
- package/hooks/__pycache__/enforce-verify.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-adr-options.cpython-314.pyc +0 -0
- package/hooks/__pycache__/generate-manifest-entry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/hook_utils.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-input-needed.cpython-314.pyc +0 -0
- package/hooks/__pycache__/notify-phase-complete.cpython-314.pyc +0 -0
- package/hooks/__pycache__/ntfy-on-question.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-completion.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-handoff.cpython-314.pyc +0 -0
- package/hooks/__pycache__/orchestrator-session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/parallel-orchestrator.cpython-314.pyc +0 -0
- package/hooks/__pycache__/periodic-reground.cpython-314.pyc +0 -0
- package/hooks/__pycache__/project-document-prompt.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-proxy.cpython-314.pyc +0 -0
- package/hooks/__pycache__/remote-question-server.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-code-review.cpython-314.pyc +0 -0
- package/hooks/__pycache__/run-visual-qa.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-logger.cpython-314.pyc +0 -0
- package/hooks/__pycache__/session-startup.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-scope-coverage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-token-usage.cpython-314.pyc +0 -0
- package/hooks/__pycache__/track-tool-use.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-adr-decision.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-api-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-registry.cpython-314.pyc +0 -0
- package/hooks/__pycache__/update-ui-showcase.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-after-green.cpython-314.pyc +0 -0
- package/hooks/__pycache__/verify-implementation.cpython-314.pyc +0 -0
- package/hooks/api-workflow-check.py +34 -0
- package/hooks/auto-answer.py +305 -0
- package/hooks/check-update.py +132 -0
- package/hooks/completion-promise-detector.py +293 -0
- package/hooks/context-capacity-warning.py +171 -0
- package/hooks/docs-update-check.py +120 -0
- package/hooks/enforce-dry-run.py +134 -0
- package/hooks/enforce-external-research.py +25 -0
- package/hooks/enforce-interview.py +20 -0
- package/hooks/generate-adr-options.py +282 -0
- package/hooks/hook_utils.py +609 -0
- package/hooks/lib/__pycache__/__init__.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/greptile.cpython-314.pyc +0 -0
- package/hooks/lib/__pycache__/ntfy.cpython-314.pyc +0 -0
- package/hooks/ntfy-on-question.py +240 -0
- package/hooks/orchestrator-completion.py +313 -0
- package/hooks/orchestrator-handoff.py +267 -0
- package/hooks/orchestrator-session-startup.py +146 -0
- package/hooks/parallel-orchestrator.py +451 -0
- package/hooks/periodic-reground.py +270 -67
- package/hooks/project-document-prompt.py +302 -0
- package/hooks/remote-question-proxy.py +284 -0
- package/hooks/remote-question-server.py +1224 -0
- package/hooks/run-code-review.py +176 -29
- package/hooks/run-visual-qa.py +338 -0
- package/hooks/session-logger.py +27 -1
- package/hooks/session-startup.py +113 -0
- package/hooks/update-adr-decision.py +236 -0
- package/hooks/update-api-showcase.py +13 -1
- package/hooks/update-testing-checklist.py +195 -0
- package/hooks/update-ui-showcase.py +13 -1
- package/package.json +7 -3
- package/scripts/extract-schema-docs.cjs +322 -0
- package/templates/.skills/hustle-interview/SKILL.md +174 -0
- package/templates/CLAUDE-SECTION.md +89 -64
- package/templates/adr-viewer/_components/ADRViewer.tsx +326 -0
- package/templates/api-dev-state.json +33 -1
- package/templates/api-showcase/_components/APIModal.tsx +100 -8
- package/templates/api-showcase/_components/APIShowcase.tsx +36 -4
- package/templates/api-showcase/_components/APITester.tsx +367 -58
- package/templates/brand-page/page.tsx +645 -0
- package/templates/component/Component.visual.spec.ts +30 -24
- package/templates/docs/page.tsx +230 -0
- package/templates/eslint-plugin-zod-schema/index.js +446 -0
- package/templates/eslint-plugin-zod-schema/package.json +26 -0
- package/templates/github-workflows/security.yml +274 -0
- package/templates/hustle-build-defaults.json +136 -0
- package/templates/hustle-dev-dashboard/page.tsx +365 -0
- package/templates/page/page.e2e.test.ts +30 -26
- package/templates/performance-budgets.json +63 -5
- package/templates/playwright-report/page.tsx +258 -0
- package/templates/registry.json +279 -3
- package/templates/review-dashboard/page.tsx +510 -0
- package/templates/settings.json +155 -7
- package/templates/test-results/page.tsx +237 -0
- package/templates/typedoc.json +19 -0
- package/templates/ui-showcase/_components/UIShowcase.tsx +48 -1
- package/templates/ui-showcase/_components/VisualTestingDashboard.tsx +579 -0
- package/templates/ui-showcase/page.tsx +1 -1
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-all
|
|
3
|
+
description: Run comprehensive test suite - unit, e2e, visual, builds, and code review
|
|
4
|
+
tools: Bash, Read, Glob, TodoWrite, Task
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test All Skill
|
|
9
|
+
|
|
10
|
+
Run the complete test suite in sequence: unit tests, E2E tests, visual tests, build verification, and code review.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Before creating a pull request
|
|
15
|
+
- After completing a major feature
|
|
16
|
+
- Before deploying to production
|
|
17
|
+
- As a final verification step
|
|
18
|
+
|
|
19
|
+
## Execution Sequence
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌──────────────────────────────────────────────────┐
|
|
23
|
+
│ /test-all │
|
|
24
|
+
├──────────────────────────────────────────────────┤
|
|
25
|
+
│ │
|
|
26
|
+
│ 1. Unit Tests (/test-unit) │
|
|
27
|
+
│ └─→ If fails: Stop and report │
|
|
28
|
+
│ │
|
|
29
|
+
│ 2. E2E Tests (/test-e2e) │
|
|
30
|
+
│ └─→ If fails: Stop and report │
|
|
31
|
+
│ │
|
|
32
|
+
│ 3. Visual Tests (/test-visual) │
|
|
33
|
+
│ └─→ If fails: Stop and report │
|
|
34
|
+
│ │
|
|
35
|
+
│ 4. Build Verification (/test-builds) │
|
|
36
|
+
│ └─→ If fails: Stop and report │
|
|
37
|
+
│ │
|
|
38
|
+
│ 5. Code Review (/test-review) │
|
|
39
|
+
│ └─→ Report findings (doesn't block) │
|
|
40
|
+
│ │
|
|
41
|
+
│ ✅ All Passed → Ready for PR │
|
|
42
|
+
│ │
|
|
43
|
+
└──────────────────────────────────────────────────┘
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Execution Steps
|
|
47
|
+
|
|
48
|
+
### Step 1: Unit Tests
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Run unit tests with coverage
|
|
52
|
+
pnpm test:coverage
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Gate:** Must pass before continuing.
|
|
56
|
+
|
|
57
|
+
### Step 2: E2E Tests
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Run Playwright tests
|
|
61
|
+
npx playwright test
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Gate:** Must pass before continuing.
|
|
65
|
+
|
|
66
|
+
### Step 3: Visual Tests
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Run visual regression
|
|
70
|
+
pnpm test-storybook
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Gate:** Must pass before continuing.
|
|
74
|
+
|
|
75
|
+
### Step 4: Build Verification
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Verify all platforms build
|
|
79
|
+
pnpm build
|
|
80
|
+
|
|
81
|
+
# TypeScript check
|
|
82
|
+
pnpm typecheck
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Gate:** Must pass before continuing.
|
|
86
|
+
|
|
87
|
+
### Step 5: Code Review
|
|
88
|
+
|
|
89
|
+
Spawn code-reviewer agent for analysis:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Task({
|
|
93
|
+
subagent_type: "code-reviewer",
|
|
94
|
+
prompt: "Review recent changes for security, performance, and best practices"
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Note:** Findings are reported but don't block.
|
|
99
|
+
|
|
100
|
+
## Progress Tracking
|
|
101
|
+
|
|
102
|
+
Use TodoWrite for visibility:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
[ ] Unit Tests
|
|
106
|
+
[ ] E2E Tests
|
|
107
|
+
[ ] Visual Tests
|
|
108
|
+
[ ] Build Verification
|
|
109
|
+
[ ] Code Review
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Report Format
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
═══════════════════════════════════════════════════════
|
|
116
|
+
TEST SUITE RESULTS
|
|
117
|
+
═══════════════════════════════════════════════════════
|
|
118
|
+
|
|
119
|
+
┌─────────────────┬────────┬──────────┬───────────────┐
|
|
120
|
+
│ Suite │ Status │ Duration │ Details │
|
|
121
|
+
├─────────────────┼────────┼──────────┼───────────────┤
|
|
122
|
+
│ Unit Tests │ ✅ │ 3.2s │ 42 passed │
|
|
123
|
+
│ E2E Tests │ ✅ │ 45s │ 96 passed │
|
|
124
|
+
│ Visual Tests │ ✅ │ 28s │ 84 screenshots│
|
|
125
|
+
│ Build │ ✅ │ 12s │ All platforms │
|
|
126
|
+
│ Code Review │ ⚠️ │ 5s │ 2 suggestions │
|
|
127
|
+
└─────────────────┴────────┴──────────┴───────────────┘
|
|
128
|
+
|
|
129
|
+
Total Duration: 1m 33s
|
|
130
|
+
|
|
131
|
+
Code Review Findings:
|
|
132
|
+
1. [Minor] Consider memoizing expensive calculation in Dashboard
|
|
133
|
+
2. [Suggestion] Add rate limiting to public API endpoints
|
|
134
|
+
|
|
135
|
+
═══════════════════════════════════════════════════════
|
|
136
|
+
✅ READY FOR PR
|
|
137
|
+
═══════════════════════════════════════════════════════
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Failure Handling
|
|
141
|
+
|
|
142
|
+
When a suite fails, stop immediately and report:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
═══════════════════════════════════════════════════════
|
|
146
|
+
TEST SUITE FAILED
|
|
147
|
+
═══════════════════════════════════════════════════════
|
|
148
|
+
|
|
149
|
+
Failed at: E2E Tests
|
|
150
|
+
|
|
151
|
+
✅ Unit Tests - 42 passed
|
|
152
|
+
❌ E2E Tests - 1 failed
|
|
153
|
+
|
|
154
|
+
Failure Details:
|
|
155
|
+
─────────────────────────────────────────────────────
|
|
156
|
+
Test: tests/auth.spec.ts:24
|
|
157
|
+
Name: "should redirect after login"
|
|
158
|
+
Error: Timeout waiting for navigation
|
|
159
|
+
|
|
160
|
+
Screenshot: test-results/auth-should-redirect.png
|
|
161
|
+
Trace: test-results/auth-should-redirect/trace.zip
|
|
162
|
+
|
|
163
|
+
Suggested Fix:
|
|
164
|
+
- Check login API response
|
|
165
|
+
- Verify redirect URL configuration
|
|
166
|
+
─────────────────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
Remaining suites skipped:
|
|
169
|
+
- Visual Tests
|
|
170
|
+
- Build Verification
|
|
171
|
+
- Code Review
|
|
172
|
+
|
|
173
|
+
Fix the failure and run /test-all again.
|
|
174
|
+
═══════════════════════════════════════════════════════
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Arguments
|
|
178
|
+
|
|
179
|
+
| Argument | Description | Default |
|
|
180
|
+
|----------|-------------|---------|
|
|
181
|
+
| `--skip-visual` | Skip visual tests | false |
|
|
182
|
+
| `--skip-review` | Skip code review | false |
|
|
183
|
+
| `--continue-on-fail` | Don't stop on failure | false |
|
|
184
|
+
|
|
185
|
+
## Examples
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Run complete suite
|
|
189
|
+
/test-all
|
|
190
|
+
|
|
191
|
+
# Skip visual tests (faster)
|
|
192
|
+
/test-all --skip-visual
|
|
193
|
+
|
|
194
|
+
# Continue even if tests fail
|
|
195
|
+
/test-all --continue-on-fail
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Integration
|
|
199
|
+
|
|
200
|
+
This is typically the final step before:
|
|
201
|
+
- `/commit` - Create commit
|
|
202
|
+
- `/pr` - Create pull request
|
|
203
|
+
|
|
204
|
+
## See Also
|
|
205
|
+
|
|
206
|
+
- `/test-unit` - Unit tests only
|
|
207
|
+
- `/test-e2e` - E2E tests only
|
|
208
|
+
- `/test-visual` - Visual tests only
|
|
209
|
+
- `/test-builds` - Build verification only
|
|
210
|
+
- `/test-review` - Code review only
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-builds
|
|
3
|
+
description: Verify web builds and cross-browser compatibility (Chrome, Firefox, Safari/WebKit)
|
|
4
|
+
tools: Bash, Read, Glob, TodoWrite
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Builds Skill
|
|
9
|
+
|
|
10
|
+
Verify that the application builds successfully and runs correctly across all major browsers.
|
|
11
|
+
|
|
12
|
+
> **Note:** This skill focuses on **web builds and browser testing**. For native desktop
|
|
13
|
+
> (Tauri/Electron) or mobile (Capacitor) builds, those should be tested separately
|
|
14
|
+
> as they theoretically work with the same web code but require native toolchains.
|
|
15
|
+
|
|
16
|
+
## Philosophy
|
|
17
|
+
|
|
18
|
+
If your app works in Chrome, Firefox, and Safari (WebKit), it will work in:
|
|
19
|
+
- **Tauri** - Uses system WebView (WebKit on macOS, Chromium on Windows/Linux)
|
|
20
|
+
- **Capacitor** - Uses WKWebView (iOS) and Android WebView (Chromium)
|
|
21
|
+
- **Electron** - Bundles Chromium
|
|
22
|
+
- **PWA** - Runs in user's browser
|
|
23
|
+
|
|
24
|
+
Therefore, comprehensive browser testing = comprehensive platform coverage.
|
|
25
|
+
|
|
26
|
+
## When to Use
|
|
27
|
+
|
|
28
|
+
- Before releasing a new version
|
|
29
|
+
- After major dependency updates
|
|
30
|
+
- After CSS/layout changes
|
|
31
|
+
- As part of CI/CD pipeline verification
|
|
32
|
+
|
|
33
|
+
## Execution Steps
|
|
34
|
+
|
|
35
|
+
### Step 1: Web Build Verification
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Build the Next.js/Vite application
|
|
39
|
+
pnpm build
|
|
40
|
+
|
|
41
|
+
# Verify output exists
|
|
42
|
+
ls -la .next/ || ls -la dist/
|
|
43
|
+
|
|
44
|
+
# TypeScript check
|
|
45
|
+
pnpm typecheck || npx tsc --noEmit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 2: Cross-Browser Testing with Playwright
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Run E2E tests across all 3 browser engines
|
|
52
|
+
npx playwright test --project=chromium
|
|
53
|
+
npx playwright test --project=firefox
|
|
54
|
+
npx playwright test --project=webkit
|
|
55
|
+
|
|
56
|
+
# Or all at once
|
|
57
|
+
npx playwright test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Browser Coverage:**
|
|
61
|
+
|
|
62
|
+
| Browser Engine | Covers | Test Project |
|
|
63
|
+
|----------------|--------|--------------|
|
|
64
|
+
| **Chromium** | Chrome, Edge, Opera, Brave, Android WebView | `--project=chromium` |
|
|
65
|
+
| **Firefox** | Firefox, Firefox ESR | `--project=firefox` |
|
|
66
|
+
| **WebKit** | Safari, iOS Safari, WKWebView | `--project=webkit` |
|
|
67
|
+
|
|
68
|
+
### Step 3: PWA Compliance Check (if applicable)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Check if manifest.json exists and is valid
|
|
72
|
+
cat public/manifest.json | jq .
|
|
73
|
+
|
|
74
|
+
# Verify service worker registration
|
|
75
|
+
grep -r "serviceWorker" src/
|
|
76
|
+
|
|
77
|
+
# Check for required PWA assets
|
|
78
|
+
ls -la public/icon-*.png
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 4: Bundle Analysis
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Next.js bundle analysis
|
|
85
|
+
ANALYZE=true pnpm build
|
|
86
|
+
|
|
87
|
+
# Or Vite bundle visualizer
|
|
88
|
+
npx vite-bundle-visualizer
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Report Format
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
═══════════════════════════════════════════════════════
|
|
95
|
+
BUILD RESULTS
|
|
96
|
+
═══════════════════════════════════════════════════════
|
|
97
|
+
|
|
98
|
+
Web Build:
|
|
99
|
+
┌─────────────┬────────┬──────────┬─────────────────────┐
|
|
100
|
+
│ Step │ Status │ Duration │ Details │
|
|
101
|
+
├─────────────┼────────┼──────────┼─────────────────────┤
|
|
102
|
+
│ Build │ ✅ │ 12.3s │ .next/ (4.2 MB) │
|
|
103
|
+
│ TypeScript │ ✅ │ 3.2s │ No errors │
|
|
104
|
+
│ ESLint │ ✅ │ 5.1s │ No warnings │
|
|
105
|
+
└─────────────┴────────┴──────────┴─────────────────────┘
|
|
106
|
+
|
|
107
|
+
Cross-Browser Testing:
|
|
108
|
+
┌─────────────┬────────┬──────────┬─────────────────────┐
|
|
109
|
+
│ Browser │ Status │ Tests │ Coverage │
|
|
110
|
+
├─────────────┼────────┼──────────┼─────────────────────┤
|
|
111
|
+
│ Chromium │ ✅ │ 45/45 │ Chrome, Edge, Brave │
|
|
112
|
+
│ Firefox │ ✅ │ 45/45 │ Firefox │
|
|
113
|
+
│ WebKit │ ✅ │ 45/45 │ Safari, iOS Safari │
|
|
114
|
+
└─────────────┴────────┴──────────┴─────────────────────┘
|
|
115
|
+
|
|
116
|
+
Bundle Size Analysis:
|
|
117
|
+
───────────────────────────────────────
|
|
118
|
+
Total: 245 KB (gzipped)
|
|
119
|
+
- First Load JS: 87 KB
|
|
120
|
+
- Shared Chunks: 158 KB
|
|
121
|
+
|
|
122
|
+
Platform Compatibility:
|
|
123
|
+
───────────────────────────────────────
|
|
124
|
+
✅ Chromium-based apps (Tauri Win/Linux, Capacitor Android, Electron)
|
|
125
|
+
✅ WebKit-based apps (Tauri macOS, Capacitor iOS)
|
|
126
|
+
✅ PWA (all browsers)
|
|
127
|
+
|
|
128
|
+
Note: Native builds (Tauri/Capacitor) should be tested separately
|
|
129
|
+
with their respective toolchains if using native features.
|
|
130
|
+
|
|
131
|
+
═══════════════════════════════════════════════════════
|
|
132
|
+
✅ ALL BROWSER TESTS PASSED
|
|
133
|
+
═══════════════════════════════════════════════════════
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Native Platform Notes
|
|
137
|
+
|
|
138
|
+
### If You Use Tauri (Desktop)
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Install Tauri CLI
|
|
142
|
+
pnpm add -D @tauri-apps/cli
|
|
143
|
+
|
|
144
|
+
# Test desktop build (requires Rust)
|
|
145
|
+
pnpm tauri build --debug
|
|
146
|
+
|
|
147
|
+
# Platforms:
|
|
148
|
+
# - macOS: Uses WebKit (tested via Playwright webkit)
|
|
149
|
+
# - Windows/Linux: Uses WebView2/Chromium (tested via Playwright chromium)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### If You Use Capacitor (Mobile)
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Install Capacitor
|
|
156
|
+
pnpm add @capacitor/core @capacitor/ios @capacitor/android
|
|
157
|
+
|
|
158
|
+
# Sync web assets to native projects
|
|
159
|
+
npx cap sync
|
|
160
|
+
|
|
161
|
+
# Platforms:
|
|
162
|
+
# - iOS: Uses WKWebView (tested via Playwright webkit)
|
|
163
|
+
# - Android: Uses Android WebView (tested via Playwright chromium)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Why We Don't Build These By Default
|
|
167
|
+
|
|
168
|
+
1. **Requires native toolchains** - Xcode, Android Studio, Rust
|
|
169
|
+
2. **LLM interpretation varies** - Native setup is complex, error-prone
|
|
170
|
+
3. **Web testing is sufficient** - If it works in browsers, it works in webviews
|
|
171
|
+
4. **Separation of concerns** - Web build vs native packaging
|
|
172
|
+
|
|
173
|
+
## Arguments
|
|
174
|
+
|
|
175
|
+
| Argument | Description | Default |
|
|
176
|
+
|----------|-------------|---------|
|
|
177
|
+
| `--browsers` | Specific browsers to test | All 3 |
|
|
178
|
+
| `--analyze` | Include bundle analysis | false |
|
|
179
|
+
| `--pwa` | Check PWA compliance | auto-detect |
|
|
180
|
+
|
|
181
|
+
## Examples
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Full build + all browsers
|
|
185
|
+
/test-builds
|
|
186
|
+
|
|
187
|
+
# Quick check (Chromium only)
|
|
188
|
+
/test-builds --browsers=chromium
|
|
189
|
+
|
|
190
|
+
# With bundle analysis
|
|
191
|
+
/test-builds --analyze
|
|
192
|
+
|
|
193
|
+
# PWA compliance check
|
|
194
|
+
/test-builds --pwa
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Integration
|
|
198
|
+
|
|
199
|
+
This skill is invoked:
|
|
200
|
+
- During `/test-all` as step 4
|
|
201
|
+
- Before release workflows
|
|
202
|
+
- In CI/CD pipelines
|
|
203
|
+
|
|
204
|
+
## See Also
|
|
205
|
+
|
|
206
|
+
- `/test-all` - Complete test suite
|
|
207
|
+
- `/test-e2e` - E2E tests (uses same Playwright)
|
|
208
|
+
- `/test-visual` - Visual regression
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-debug
|
|
3
|
+
description: Analyze Playwright test failures with screenshots, DOM snapshots, and root cause diagnosis
|
|
4
|
+
tools: Bash, Read, Glob, Grep, Task
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Debug Skill
|
|
9
|
+
|
|
10
|
+
Diagnose and debug test failures by analyzing error messages, screenshots, traces, and DOM snapshots to identify root causes.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- When tests fail and you don't know why
|
|
15
|
+
- After seeing a failing test report
|
|
16
|
+
- When tests pass locally but fail in CI
|
|
17
|
+
- To understand flaky test behavior
|
|
18
|
+
|
|
19
|
+
## Execution Steps
|
|
20
|
+
|
|
21
|
+
### Step 1: Identify Failed Tests
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Find recent test failures
|
|
25
|
+
ls -la test-results/
|
|
26
|
+
|
|
27
|
+
# Or parse last test run
|
|
28
|
+
cat test-results/.last-run.json 2>/dev/null
|
|
29
|
+
|
|
30
|
+
# Find Playwright traces
|
|
31
|
+
find test-results -name "trace.zip"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 2: Gather Failure Context
|
|
35
|
+
|
|
36
|
+
For each failed test, collect:
|
|
37
|
+
|
|
38
|
+
1. **Error Message**
|
|
39
|
+
```bash
|
|
40
|
+
cat test-results/test-name/error.txt
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. **Screenshot** (if available)
|
|
44
|
+
```bash
|
|
45
|
+
ls test-results/test-name/*.png
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. **Trace File** (for Playwright)
|
|
49
|
+
```bash
|
|
50
|
+
ls test-results/test-name/trace.zip
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. **Console Logs**
|
|
54
|
+
```bash
|
|
55
|
+
cat test-results/test-name/console.log
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 3: Analyze Failure
|
|
59
|
+
|
|
60
|
+
Present structured analysis:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
═══════════════════════════════════════════════════════
|
|
64
|
+
TEST FAILURE ANALYSIS
|
|
65
|
+
═══════════════════════════════════════════════════════
|
|
66
|
+
|
|
67
|
+
Test: tests/dashboard.spec.ts:42
|
|
68
|
+
Name: "should display user stats after login"
|
|
69
|
+
|
|
70
|
+
Error Type: TimeoutError
|
|
71
|
+
Message: Timeout 30000ms exceeded waiting for selector "[data-testid='stats-card']"
|
|
72
|
+
|
|
73
|
+
Timeline:
|
|
74
|
+
───────────────────────────────────────
|
|
75
|
+
00:00 - Navigation to /login
|
|
76
|
+
00:02 - Fill email input
|
|
77
|
+
00:03 - Fill password input
|
|
78
|
+
00:04 - Click submit button
|
|
79
|
+
00:05 - Wait for redirect to /dashboard
|
|
80
|
+
00:08 - ❌ TIMEOUT waiting for stats-card
|
|
81
|
+
───────────────────────────────────────
|
|
82
|
+
|
|
83
|
+
Screenshot Analysis:
|
|
84
|
+
───────────────────────────────────────
|
|
85
|
+
The page shows an error message:
|
|
86
|
+
"Failed to load user data. Please try again."
|
|
87
|
+
|
|
88
|
+
This indicates the API call failed, not a selector issue.
|
|
89
|
+
───────────────────────────────────────
|
|
90
|
+
|
|
91
|
+
Root Cause: API Error
|
|
92
|
+
───────────────────────────────────────
|
|
93
|
+
The test failed because the backend API returned an error,
|
|
94
|
+
preventing the stats-card component from rendering.
|
|
95
|
+
|
|
96
|
+
Likely Causes:
|
|
97
|
+
1. Backend server not running during test
|
|
98
|
+
2. Test database not seeded with user data
|
|
99
|
+
3. API rate limiting triggered during test run
|
|
100
|
+
4. Authentication token expired
|
|
101
|
+
|
|
102
|
+
Suggested Fixes:
|
|
103
|
+
1. Ensure test backend is running:
|
|
104
|
+
pnpm test:backend &
|
|
105
|
+
|
|
106
|
+
2. Seed test database before tests:
|
|
107
|
+
pnpm db:seed:test
|
|
108
|
+
|
|
109
|
+
3. Check API mock configuration:
|
|
110
|
+
tests/mocks/handlers.ts
|
|
111
|
+
|
|
112
|
+
4. Add retry logic for flaky API calls:
|
|
113
|
+
await expect(page.getByTestId('stats-card'))
|
|
114
|
+
.toBeVisible({ timeout: 60000 });
|
|
115
|
+
|
|
116
|
+
═══════════════════════════════════════════════════════
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step 4: Provide Actionable Fix
|
|
120
|
+
|
|
121
|
+
Based on root cause, suggest specific code changes:
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
// Before (failing)
|
|
125
|
+
await expect(page.getByTestId('stats-card')).toBeVisible();
|
|
126
|
+
|
|
127
|
+
// After (fixed)
|
|
128
|
+
// Wait for loading to complete first
|
|
129
|
+
await page.waitForLoadState('networkidle');
|
|
130
|
+
await expect(page.getByTestId('stats-card')).toBeVisible({ timeout: 60000 });
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Failure Categories
|
|
134
|
+
|
|
135
|
+
| Category | Symptoms | Common Causes |
|
|
136
|
+
|----------|----------|---------------|
|
|
137
|
+
| Timeout | "Timeout exceeded" | Slow API, missing element |
|
|
138
|
+
| Selector | "Cannot find element" | Wrong selector, dynamic ID |
|
|
139
|
+
| Assertion | "Expected X, got Y" | Logic error, race condition |
|
|
140
|
+
| Network | "NetworkError" | Backend down, CORS |
|
|
141
|
+
| Authentication | "401 Unauthorized" | Token expired, wrong env |
|
|
142
|
+
|
|
143
|
+
## Debug Commands
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# View Playwright trace in browser
|
|
147
|
+
npx playwright show-trace test-results/test-name/trace.zip
|
|
148
|
+
|
|
149
|
+
# Open HTML report
|
|
150
|
+
npx playwright show-report
|
|
151
|
+
|
|
152
|
+
# Run specific test with debug mode
|
|
153
|
+
npx playwright test tests/failing.spec.ts --debug
|
|
154
|
+
|
|
155
|
+
# Run with headed browser to see what's happening
|
|
156
|
+
npx playwright test tests/failing.spec.ts --headed
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Arguments
|
|
160
|
+
|
|
161
|
+
| Argument | Description | Default |
|
|
162
|
+
|----------|-------------|---------|
|
|
163
|
+
| `[test-name]` | Specific test to debug | Latest failed |
|
|
164
|
+
| `--trace` | Open trace viewer | false |
|
|
165
|
+
| `--headed` | Re-run in headed mode | false |
|
|
166
|
+
| `--step` | Step through test | false |
|
|
167
|
+
|
|
168
|
+
## Examples
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Debug latest failure
|
|
172
|
+
/test-debug
|
|
173
|
+
|
|
174
|
+
# Debug specific test
|
|
175
|
+
/test-debug dashboard-login
|
|
176
|
+
|
|
177
|
+
# Open trace viewer
|
|
178
|
+
/test-debug --trace
|
|
179
|
+
|
|
180
|
+
# Re-run with visible browser
|
|
181
|
+
/test-debug --headed
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Output Format
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
═══════════════════════════════════════
|
|
188
|
+
Debug Analysis: 🔍 Complete
|
|
189
|
+
═══════════════════════════════════════
|
|
190
|
+
Failed Test: dashboard-login
|
|
191
|
+
Root Cause: API Error (backend not running)
|
|
192
|
+
Confidence: High (screenshot shows error message)
|
|
193
|
+
Fix Applied: No (waiting for approval)
|
|
194
|
+
|
|
195
|
+
Next Steps:
|
|
196
|
+
1. Start test backend: pnpm test:backend
|
|
197
|
+
2. Re-run test: pnpm test dashboard
|
|
198
|
+
═══════════════════════════════════════
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Integration
|
|
202
|
+
|
|
203
|
+
This skill is useful after:
|
|
204
|
+
- `/test-e2e` fails
|
|
205
|
+
- `/test-all` stops on failure
|
|
206
|
+
- CI pipeline fails
|
|
207
|
+
|
|
208
|
+
## See Also
|
|
209
|
+
|
|
210
|
+
- `/test-e2e` - Run E2E tests
|
|
211
|
+
- `/test-all` - Complete test suite
|
|
212
|
+
- `/test-visual` - Visual tests
|