@bugzy-ai/bugzy 1.9.3 → 1.9.4

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 (48) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +273 -273
  3. package/dist/cli/index.cjs +25 -57
  4. package/dist/cli/index.cjs.map +1 -1
  5. package/dist/cli/index.js +24 -56
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/index.cjs +22 -53
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +22 -53
  10. package/dist/index.js.map +1 -1
  11. package/dist/subagents/index.cjs.map +1 -1
  12. package/dist/subagents/index.js.map +1 -1
  13. package/dist/subagents/metadata.cjs.map +1 -1
  14. package/dist/subagents/metadata.js.map +1 -1
  15. package/dist/tasks/index.cjs +20 -9
  16. package/dist/tasks/index.cjs.map +1 -1
  17. package/dist/tasks/index.js +20 -9
  18. package/dist/tasks/index.js.map +1 -1
  19. package/dist/templates/init/.bugzy/runtime/knowledge-base.md +61 -0
  20. package/dist/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -0
  21. package/dist/templates/init/.bugzy/runtime/project-context.md +35 -0
  22. package/dist/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -0
  23. package/dist/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -0
  24. package/dist/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -0
  25. package/dist/templates/init/.bugzy/runtime/test-execution-strategy.md +535 -0
  26. package/dist/templates/init/.bugzy/runtime/testing-best-practices.md +632 -0
  27. package/dist/templates/init/.gitignore-template +25 -0
  28. package/package.json +95 -95
  29. package/templates/init/.bugzy/runtime/knowledge-base.md +61 -61
  30. package/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -97
  31. package/templates/init/.bugzy/runtime/project-context.md +35 -35
  32. package/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -87
  33. package/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -50
  34. package/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -498
  35. package/templates/init/.bugzy/runtime/test-execution-strategy.md +535 -535
  36. package/templates/init/.bugzy/runtime/testing-best-practices.md +724 -724
  37. package/templates/init/.env.testdata +18 -18
  38. package/templates/init/.gitignore-template +24 -24
  39. package/templates/init/AGENTS.md +155 -155
  40. package/templates/init/CLAUDE.md +157 -157
  41. package/templates/init/test-runs/README.md +45 -45
  42. package/templates/playwright/BasePage.template.ts +190 -190
  43. package/templates/playwright/auth.setup.template.ts +89 -89
  44. package/templates/playwright/dataGenerators.helper.template.ts +148 -148
  45. package/templates/playwright/dateUtils.helper.template.ts +96 -96
  46. package/templates/playwright/pages.fixture.template.ts +50 -50
  47. package/templates/playwright/playwright.config.template.ts +97 -97
  48. package/templates/playwright/reporters/bugzy-reporter.ts +454 -454
@@ -0,0 +1,498 @@
1
+ # Test Result Schema
2
+
3
+ This document defines the structure for test execution results with video recording and structured reporting.
4
+
5
+ ## Overview
6
+
7
+ There are two formats depending on the execution method:
8
+
9
+ 1. **Automated Test Execution** - For Playwright test specs run via `/run-tests` command
10
+ 2. **Manual Test Execution** - For manual test cases executed via test-runner agent
11
+
12
+ ---
13
+
14
+ ## Automated Test Execution Format
15
+
16
+ Used by: `/run-tests` command with custom Bugzy reporter
17
+
18
+ ### Directory Structure
19
+
20
+ ```
21
+ test-runs/
22
+ YYYYMMDD-HHMMSS/ # Test run session
23
+ execution-id.txt # BUGZY_EXECUTION_ID
24
+ manifest.json # Run metadata and summary
25
+ TC-001-login/ # Test case folder
26
+ exec-1/ # First execution attempt
27
+ result.json # Playwright result format
28
+ video.webm # Video recording
29
+ trace.zip # Trace (if failed)
30
+ screenshots/ # Screenshots (if failed)
31
+ exec-2/ # Re-run after fix (if applicable)
32
+ result.json
33
+ video.webm
34
+ TC-002-navigation/
35
+ exec-1/
36
+ result.json
37
+ video.webm
38
+ ```
39
+
40
+ ### execution-id.txt
41
+
42
+ Plain text file containing the BUGZY_EXECUTION_ID:
43
+ ```
44
+ 70a59676-cfd0-4ffd-b8ad-69ceff25c31d
45
+ ```
46
+
47
+ ### manifest.json
48
+
49
+ Overall test run metadata:
50
+
51
+ ```json
52
+ {
53
+ "bugzyExecutionId": "70a59676-cfd0-4ffd-b8ad-69ceff25c31d",
54
+ "timestamp": "20251115-123456",
55
+ "startTime": "2025-11-15T12:34:56.789Z",
56
+ "endTime": "2025-11-15T12:45:23.456Z",
57
+ "status": "passed",
58
+ "stats": {
59
+ "totalTests": 10,
60
+ "passed": 8,
61
+ "failed": 2,
62
+ "totalExecutions": 12
63
+ },
64
+ "testCases": [
65
+ {
66
+ "id": "TC-001-login",
67
+ "name": "Login functionality",
68
+ "totalExecutions": 2,
69
+ "finalStatus": "passed",
70
+ "executions": [
71
+ {
72
+ "number": 1,
73
+ "status": "failed",
74
+ "duration": 5234,
75
+ "videoFile": "video.webm",
76
+ "hasTrace": true,
77
+ "hasScreenshots": true,
78
+ "error": "Locator.click: Timeout 30000ms exceeded..."
79
+ },
80
+ {
81
+ "number": 2,
82
+ "status": "passed",
83
+ "duration": 4123,
84
+ "videoFile": "video.webm",
85
+ "hasTrace": false,
86
+ "hasScreenshots": false,
87
+ "error": null
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ }
93
+ ```
94
+
95
+ ### result.json (Per Execution)
96
+
97
+ Playwright test result format:
98
+
99
+ ```json
100
+ {
101
+ "status": "passed",
102
+ "duration": 4123,
103
+ "errors": [],
104
+ "retry": 0,
105
+ "startTime": "2025-11-15T12:34:56.789Z",
106
+ "attachments": [
107
+ {
108
+ "name": "video",
109
+ "path": "video.webm",
110
+ "contentType": "video/webm"
111
+ }
112
+ ]
113
+ }
114
+ ```
115
+
116
+ ### steps.json (Per Execution - Optional)
117
+
118
+ Generated when test uses `test.step()` API for step-level tracking:
119
+
120
+ ```json
121
+ {
122
+ "steps": [
123
+ {
124
+ "index": 1,
125
+ "timestamp": "2025-11-15T12:34:56.789Z",
126
+ "videoTimeSeconds": 0,
127
+ "action": "Navigate to login page",
128
+ "status": "success",
129
+ "description": "Navigate to login page - completed successfully",
130
+ "technicalDetails": "test.step",
131
+ "duration": 1234
132
+ },
133
+ {
134
+ "index": 2,
135
+ "timestamp": "2025-11-15T12:34:58.023Z",
136
+ "videoTimeSeconds": 1,
137
+ "action": "Login with valid credentials",
138
+ "status": "success",
139
+ "description": "Login with valid credentials - completed successfully",
140
+ "technicalDetails": "test.step",
141
+ "duration": 2145
142
+ }
143
+ ],
144
+ "summary": {
145
+ "totalSteps": 9,
146
+ "successfulSteps": 9,
147
+ "failedSteps": 0,
148
+ "skippedSteps": 0
149
+ }
150
+ }
151
+ ```
152
+
153
+ **Field Descriptions**:
154
+ - `index`: Step number (1, 2, 3...)
155
+ - `timestamp`: ISO timestamp when step started
156
+ - `videoTimeSeconds`: Elapsed seconds from test start for video navigation
157
+ - `action`: Step title from `test.step('title', ...)`
158
+ - `status`: 'success', 'failed', or 'skipped'
159
+ - `description`: Step title + outcome
160
+ - `technicalDetails`: Always 'test.step' for automated tests
161
+ - `duration`: Step duration in milliseconds
162
+
163
+ For failed tests, includes trace and screenshots:
164
+
165
+ ```json
166
+ {
167
+ "status": "failed",
168
+ "duration": 5234,
169
+ "errors": [
170
+ {
171
+ "message": "Locator.click: Timeout 30000ms exceeded...",
172
+ "stack": "Error: Locator.click: Timeout..."
173
+ }
174
+ ],
175
+ "retry": 0,
176
+ "startTime": "2025-11-15T12:34:56.789Z",
177
+ "attachments": [
178
+ {
179
+ "name": "video",
180
+ "path": "video.webm",
181
+ "contentType": "video/webm"
182
+ },
183
+ {
184
+ "name": "trace",
185
+ "path": "trace.zip",
186
+ "contentType": "application/zip"
187
+ },
188
+ {
189
+ "name": "screenshot",
190
+ "path": "screenshots/failure.png",
191
+ "contentType": "image/png"
192
+ }
193
+ ]
194
+ }
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Manual Test Execution Format
200
+
201
+ Used by: test-runner agent for markdown test cases
202
+
203
+ ### File Structure
204
+
205
+ Each test execution creates a folder: `test-runs/YYYYMMDD-HHMMSS/TC-XXX/`
206
+
207
+ Required files:
208
+ - `summary.json` - Structured test result data with metadata and status
209
+ - `steps.json` - Detailed execution steps with timestamps and video synchronization
210
+ - Video file in `.playwright-mcp/` folder (uploaded to GCS separately)
211
+
212
+ ## summary.json Format
213
+
214
+ ### Example: Passed Test
215
+ ```json
216
+ {
217
+ "testRun": {
218
+ "id": "TC-001",
219
+ "testCaseName": "User can successfully log in",
220
+ "status": "PASS",
221
+ "type": "functional",
222
+ "priority": "high",
223
+ "duration": {
224
+ "minutes": 2,
225
+ "seconds": 45
226
+ }
227
+ },
228
+ "executionSummary": {
229
+ "totalPhases": 5,
230
+ "phasesCompleted": 5,
231
+ "overallResult": "All phases completed successfully",
232
+ "browserUsed": "chromium"
233
+ },
234
+ "video": {
235
+ "filename": "video.webm",
236
+ "durationSeconds": 165,
237
+ "sizeBytes": 1234567
238
+ },
239
+ "metadata": {
240
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
241
+ "startTime": "2025-10-14T10:30:00Z",
242
+ "endTime": "2025-10-14T10:32:45Z",
243
+ "testRunFolder": "test-runs/20251014-103000"
244
+ }
245
+ }
246
+ ```
247
+
248
+ ### Example: Failed Test
249
+ ```json
250
+ {
251
+ "testRun": {
252
+ "id": "TC-001",
253
+ "testCaseName": "User can successfully log in",
254
+ "status": "FAIL",
255
+ "type": "functional",
256
+ "priority": "high",
257
+ "failureReason": "Timeout waiting for login button at step 4",
258
+ "duration": {
259
+ "minutes": 1,
260
+ "seconds": 30
261
+ }
262
+ },
263
+ "executionSummary": {
264
+ "totalPhases": 5,
265
+ "phasesCompleted": 3,
266
+ "overallResult": "Failed at phase 4: Button element not found",
267
+ "browserUsed": "chromium"
268
+ },
269
+ "video": {
270
+ "filename": "video.webm",
271
+ "durationSeconds": 90,
272
+ "sizeBytes": 734821
273
+ },
274
+ "metadata": {
275
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
276
+ "startTime": "2025-10-14T10:30:00Z",
277
+ "endTime": "2025-10-14T10:31:30Z",
278
+ "testRunFolder": "test-runs/20251014-103000"
279
+ }
280
+ }
281
+ ```
282
+
283
+ ### Example: Skipped Test
284
+ ```json
285
+ {
286
+ "testRun": {
287
+ "id": "TC-003",
288
+ "testCaseName": "Project Settings Update",
289
+ "status": "SKIP",
290
+ "type": "functional",
291
+ "priority": "high",
292
+ "skipReason": "Dependency failed: TC-001 (Login) - Timeout waiting for login button at step 4",
293
+ "duration": {
294
+ "minutes": 0,
295
+ "seconds": 0
296
+ }
297
+ },
298
+ "executionSummary": {
299
+ "totalPhases": 0,
300
+ "phasesCompleted": 0,
301
+ "overallResult": "Test skipped due to blocker failure"
302
+ },
303
+ "metadata": {
304
+ "executionId": "550e8400-e29b-41d4-a716-446655440000",
305
+ "startTime": "2025-10-14T10:30:00Z",
306
+ "endTime": "2025-10-14T10:30:00Z",
307
+ "testRunFolder": "test-runs/20251014-103000"
308
+ }
309
+ }
310
+ ```
311
+
312
+ ## steps.json Format
313
+
314
+ ### Example: Executed Test
315
+ ```json
316
+ {
317
+ "steps": [
318
+ {
319
+ "index": 1,
320
+ "timestamp": "2025-10-14T10:30:05Z",
321
+ "videoTimeSeconds": 5.2,
322
+ "action": "Navigate to login page",
323
+ "status": "success",
324
+ "description": "Opened https://example.com/login and verified page loaded",
325
+ "technicalDetails": "browser.goto('https://example.com/login')"
326
+ },
327
+ {
328
+ "index": 2,
329
+ "timestamp": "2025-10-14T10:30:12Z",
330
+ "videoTimeSeconds": 12.8,
331
+ "action": "Enter username",
332
+ "status": "success",
333
+ "description": "Filled in username field with test user credentials",
334
+ "technicalDetails": "page.fill('#username', 'testuser@example.com')"
335
+ },
336
+ {
337
+ "index": 3,
338
+ "timestamp": "2025-10-14T10:30:15Z",
339
+ "videoTimeSeconds": 15.4,
340
+ "action": "Enter password",
341
+ "status": "success",
342
+ "description": "Filled in password field",
343
+ "technicalDetails": "page.fill('#password', '***')"
344
+ },
345
+ {
346
+ "index": 4,
347
+ "timestamp": "2025-10-14T10:30:18Z",
348
+ "videoTimeSeconds": 18.1,
349
+ "action": "Click login button",
350
+ "status": "success",
351
+ "description": "Clicked the login button to submit credentials",
352
+ "technicalDetails": "page.click('button[type=\"submit\"]')"
353
+ },
354
+ {
355
+ "index": 5,
356
+ "timestamp": "2025-10-14T10:30:22Z",
357
+ "videoTimeSeconds": 22.7,
358
+ "action": "Verify successful login",
359
+ "status": "success",
360
+ "description": "Confirmed redirect to dashboard and welcome message displayed",
361
+ "technicalDetails": "expect(page).toHaveURL('/dashboard')"
362
+ }
363
+ ],
364
+ "summary": {
365
+ "totalSteps": 5,
366
+ "successfulSteps": 5,
367
+ "failedSteps": 0,
368
+ "skippedSteps": 0
369
+ }
370
+ }
371
+ ```
372
+
373
+ ### Example: Skipped Test
374
+ ```json
375
+ {
376
+ "steps": [],
377
+ "summary": {
378
+ "totalSteps": 0,
379
+ "successfulSteps": 0,
380
+ "failedSteps": 0,
381
+ "skippedSteps": 0,
382
+ "skipNote": "Test was not executed because dependency TC-001 (Login) failed"
383
+ }
384
+ }
385
+ ```
386
+
387
+ ## Field Descriptions
388
+
389
+ ### summary.json
390
+
391
+ **testRun:**
392
+ - `id` - Test case identifier (e.g., TC-001)
393
+ - `testCaseName` - Human-readable test name
394
+ - `status` - Overall test result: PASS, FAIL, or SKIP
395
+ - `type` - Test type: functional, exploratory, regression, or smoke
396
+ - `priority` - Test priority level
397
+ - `failureReason` - Explanation of failure (only present if status is FAIL)
398
+ - `skipReason` - Explanation of why test was skipped (only present if status is SKIP). Format: "Dependency failed: TC-XXX (Test Name) - Failure reason"
399
+ - `duration` - Test execution time
400
+
401
+ **executionSummary:**
402
+ - `totalPhases` - Number of test phases/sections
403
+ - `phasesCompleted` - How many phases were executed
404
+ - `overallResult` - Human-readable summary
405
+ - `browserUsed` - Browser engine (chromium, firefox, webkit)
406
+
407
+ **video:**
408
+ - `filename` - Video filename in .playwright-mcp/ folder (e.g., "test-abc123.webm")
409
+ - Agent stores ONLY the filename
410
+ - External service uploads video to GCS after task completion
411
+ - UI streams video via signed URLs from GCS
412
+
413
+ **metadata:**
414
+ - `executionId` - UUID of the task execution (used to construct GCS paths for video streaming)
415
+ - `startTime` - ISO 8601 timestamp when test started
416
+ - `endTime` - ISO 8601 timestamp when test completed
417
+ - `testRunFolder` - Path to test run folder (timestamp-based folder name in git repository)
418
+
419
+ ### steps.json
420
+
421
+ **steps array:**
422
+ - `index` - Step number (1-indexed)
423
+ - `timestamp` - ISO 8601 timestamp when step executed
424
+ - `videoTimeSeconds` - Corresponding time in video (for synchronization)
425
+ - `action` - User-friendly action description (shown in UI)
426
+ - `status` - Step result: success, failed, or skipped
427
+ - `description` - Detailed explanation of what happened
428
+ - `technicalDetails` - Technical command/code for debugging (optional)
429
+
430
+ **summary:**
431
+ - `totalSteps` - Total number of steps
432
+ - `successfulSteps` - Steps that passed
433
+ - `failedSteps` - Steps that failed
434
+ - `skippedSteps` - Steps that were skipped
435
+ - `skipNote` - Optional explanation of why entire test was skipped (only present when steps array is empty and test was skipped)
436
+
437
+ ## Video Recording
438
+
439
+ - Format: WebM with VP9 codec
440
+ - Resolution: Playwright default (typically 1280x720)
441
+ - Frame rate: 25 fps
442
+ - Audio: Not recorded
443
+ - Location: Remains in `.playwright-mcp/` folder (not copied or moved)
444
+ - Storage: External service uploads to GCS after task completes
445
+ - Access: UI fetches signed URLs for streaming
446
+
447
+ ## Usage Guidelines
448
+
449
+ ### For Test Execution
450
+ 1. Start video recording before test begins
451
+ 2. Track each significant action with timestamp
452
+ 3. Use user-friendly language for actions (not technical details)
453
+ 4. Record video timestamp at each step
454
+ 5. Extract execution ID from BUGZY_EXECUTION_ID environment variable
455
+ 6. Generate both summary.json and steps.json
456
+ 7. Find latest video in `.playwright-mcp/`: `basename $(ls -t .playwright-mcp/*.webm | head -1)`
457
+ 8. Store execution ID in metadata.executionId field: `{ "metadata": { "executionId": "uuid-from-env" } }`
458
+ 9. Store ONLY filename in summary.json: `{ "video": { "filename": "test-abc123.webm" } }`
459
+ 10. Do NOT copy, move, or delete videos - external service handles uploads
460
+ 11. Do NOT perform git operations - external service handles commits/pushes
461
+
462
+ ### For UI Display
463
+ 1. Load summary.json for test overview
464
+ 2. Load steps.json for timeline navigation
465
+ 3. Extract executionId from summary.json metadata (required for GCS video path)
466
+ 4. Fetch signed video URL from API: `/api/projects/{projectId}/test-runs/{executionId}/videos/{filename}`
467
+ 5. Display video with synchronized step highlighting using signed URL
468
+ 6. Allow clicking steps to jump to video timestamp
469
+ 7. Highlight current step based on video playback time
470
+ 8. Show test metadata and status clearly
471
+
472
+ ## Migration from Old Format
473
+
474
+ Old format (screenshots):
475
+ ```
476
+ test-runs/YYYYMMDD-HHMMSS/TC-XXX/
477
+ ├── test-log.md
478
+ ├── summary.json (old format)
479
+ ├── findings.md
480
+ └── screenshots/
481
+ ├── step1.png
482
+ ├── step2.png
483
+ └── step3.png
484
+ ```
485
+
486
+ New format (video + structured steps):
487
+ ```
488
+ test-runs/YYYYMMDD-HHMMSS/TC-XXX/
489
+ ├── summary.json (new format with video metadata)
490
+ ├── steps.json (structured steps with timestamps)
491
+ └── video.webm (video recording)
492
+ ```
493
+
494
+ **Note**: `test-log.md` and `findings.md` are no longer generated:
495
+ - Step-by-step information → `steps.json` (timestamps, actions, descriptions, status)
496
+ - Test findings/failures → `summary.json` (`failureReason` field) or `steps.json` (`description` fields)
497
+
498
+ UI handles both old and new formats gracefully for backwards compatibility.