@bugzy-ai/bugzy 1.18.2 → 1.18.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 (61) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +273 -273
  3. package/dist/cli/index.cjs +295 -210
  4. package/dist/cli/index.cjs.map +1 -1
  5. package/dist/cli/index.js +294 -209
  6. package/dist/cli/index.js.map +1 -1
  7. package/dist/index.cjs +291 -206
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.js +291 -206
  10. package/dist/index.js.map +1 -1
  11. package/dist/subagents/index.cjs +115 -137
  12. package/dist/subagents/index.cjs.map +1 -1
  13. package/dist/subagents/index.js +115 -137
  14. package/dist/subagents/index.js.map +1 -1
  15. package/dist/subagents/metadata.cjs +12 -18
  16. package/dist/subagents/metadata.cjs.map +1 -1
  17. package/dist/subagents/metadata.js +12 -18
  18. package/dist/subagents/metadata.js.map +1 -1
  19. package/dist/tasks/index.cjs +142 -54
  20. package/dist/tasks/index.cjs.map +1 -1
  21. package/dist/tasks/index.js +142 -54
  22. package/dist/tasks/index.js.map +1 -1
  23. package/dist/templates/init/.bugzy/runtime/knowledge-base.md +61 -0
  24. package/dist/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -0
  25. package/dist/templates/init/.bugzy/runtime/project-context.md +35 -0
  26. package/dist/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -0
  27. package/dist/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -0
  28. package/dist/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -0
  29. package/dist/templates/init/.bugzy/runtime/test-execution-strategy.md +535 -0
  30. package/dist/templates/init/.bugzy/runtime/testing-best-practices.md +632 -0
  31. package/dist/templates/init/.gitignore-template +25 -0
  32. package/package.json +95 -95
  33. package/templates/init/.bugzy/runtime/knowledge-base.md +61 -61
  34. package/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -97
  35. package/templates/init/.bugzy/runtime/project-context.md +35 -35
  36. package/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -87
  37. package/templates/init/.bugzy/runtime/templates/event-examples.md +194 -194
  38. package/templates/init/.bugzy/runtime/templates/test-plan-template.md +50 -50
  39. package/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -498
  40. package/templates/init/.claude/settings.json +28 -28
  41. package/templates/init/.env.testdata +18 -18
  42. package/templates/init/.gitignore-template +24 -24
  43. package/templates/init/AGENTS.md +155 -155
  44. package/templates/init/CLAUDE.md +157 -157
  45. package/templates/init/test-runs/README.md +45 -45
  46. package/templates/init/tests/CLAUDE.md +193 -193
  47. package/templates/init/tests/docs/test-execution-strategy.md +535 -535
  48. package/templates/init/tests/docs/testing-best-practices.md +724 -724
  49. package/templates/playwright/BasePage.template.ts +190 -190
  50. package/templates/playwright/auth.setup.template.ts +89 -89
  51. package/templates/playwright/dataGenerators.helper.template.ts +148 -148
  52. package/templates/playwright/dateUtils.helper.template.ts +96 -96
  53. package/templates/playwright/pages.fixture.template.ts +50 -50
  54. package/templates/playwright/playwright.config.template.ts +97 -97
  55. package/templates/playwright/reporters/__tests__/bugzy-reporter-failure-classification.test.ts +299 -299
  56. package/templates/playwright/reporters/__tests__/bugzy-reporter-manifest-merge.test.ts +329 -329
  57. package/templates/playwright/reporters/__tests__/playwright.config.ts +5 -5
  58. package/templates/playwright/reporters/bugzy-reporter.ts +784 -784
  59. package/templates/init/.bugzy/runtime/handlers/messages/feedback.md +0 -178
  60. package/templates/init/.bugzy/runtime/handlers/messages/question.md +0 -122
  61. package/templates/init/.bugzy/runtime/handlers/messages/status.md +0 -146
@@ -1,193 +1,193 @@
1
- # Testing Framework
2
-
3
- ## Framework
4
- Playwright with TypeScript
5
-
6
- ## Test Execution
7
-
8
- Run commands from the project root directory.
9
-
10
- **Run all tests:**
11
- ```bash
12
- npm test
13
- ```
14
-
15
- **Run specific file:**
16
- ```bash
17
- npm test -- tests/specs/login.spec.ts
18
- ```
19
-
20
- **Run by file pattern:**
21
- ```bash
22
- npm test -- [selector]
23
- ```
24
-
25
- **Run by tag:**
26
- ```bash
27
- npm test -- --grep "@smoke"
28
- ```
29
-
30
- **Run single test file directly:**
31
- ```bash
32
- npx playwright test [test-file]
33
- ```
34
-
35
- **Configuration:** `playwright.config.ts` automatically loads environment variables from `.env.testdata` and `.env` files. No manual env export needed.
36
-
37
- **Custom Reporter:** The Bugzy reporter runs automatically via `playwright.config.ts` — do NOT use `--reporter` flag, as the custom reporter must run to create the hierarchical test-runs output.
38
-
39
- ## Directory Structure
40
-
41
- - **Test specs:** `./tests/specs/` — organized by feature in subdirectories
42
- - **Page Objects:** `./tests/pages/` — extend BasePage class
43
- - **Components:** `./tests/components/` — reusable UI element objects
44
- - **Fixtures:** `./tests/fixtures/` — common test setup (e.g., `pages.fixture.ts`)
45
- - **Helpers:** `./tests/helpers/` — data generation and utilities (e.g., `dateUtils.ts`, `dataGenerators.ts`)
46
- - **Types:** `./tests/types/` — TypeScript type definitions
47
- - **Setup:** `./tests/setup/` — auth setup and global config (e.g., `auth.setup.ts`)
48
- - **Test data:** `./tests/data/` — static test data files
49
- - **Auth state:** `./tests/.auth/` — stored authentication state
50
- - **Reporters:** `./reporters/` — custom Bugzy reporter (`bugzy-reporter.ts`)
51
- - **Test results:** `./test-runs/` — hierarchical results: `{timestamp}/{testCaseId}/exec-{N}/`
52
-
53
- ## Conventions
54
-
55
- ### Test Structure
56
- - Every test uses `test.step()` calls matching the manual test case steps one-to-one
57
- - Each `test.step()` should directly correspond to a numbered step in the manual test case
58
- - Reference manual test case ID in comments
59
- - Tag critical tests with `@smoke`
60
- - Tests must be independent — no test interdependencies
61
-
62
- ### Page Object Model
63
- - Page Objects extend `BasePage` class
64
- - **No assertions in Page Objects** — only actions and getters
65
- - Page Objects contain semantic selectors verified in the live application
66
- - Properly typed with TypeScript
67
-
68
- ### Selector Priority
69
- Use selectors in this priority order:
70
- 1. `getByRole('button', { name: 'Sign In' })` — role-based (preferred)
71
- 2. `getByLabel('Email')` — label-based
72
- 3. `getByText('Welcome')` — text content
73
- 4. `[data-testid="submit"]` — test IDs
74
- 5. CSS selectors — **last resort only**
75
-
76
- **NEVER assume selectors** — always verify in the live application using browser automation before writing tests.
77
-
78
- ### Waiting and Synchronization
79
- - **Never use `waitForTimeout()`** — rely on Playwright's auto-waiting
80
- - Use `toBeVisible()`, `toHaveCount()`, `toHaveText()` assertions for waits
81
- - Prefer `waitFor({ state: 'visible' })` over arbitrary delays
82
- - Use `page.waitForLoadState('networkidle')` after navigation
83
- - Handle dynamic content with explicit waits for specific conditions
84
-
85
- ### Environment Variables
86
- - Reference variables using `process.env.VAR_NAME` in tests
87
- - Read `.env.testdata` for available non-secret environment variables
88
- - **NEVER read `.env` file** (contains secrets only)
89
- - Add new required variables to `.env.testdata` with `# TODO: configure` comment
90
-
91
- ## Common Fix Patterns
92
-
93
- ### Fix Type 1: Brittle Selectors
94
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
95
- - **Fix**: Replace with role-based selectors
96
- ```typescript
97
- // BEFORE (brittle)
98
- await page.locator('.btn-primary').click();
99
- // AFTER (semantic)
100
- await page.getByRole('button', { name: 'Sign In' }).click();
101
- ```
102
-
103
- ### Fix Type 2: Missing Wait Conditions
104
- - **Problem**: Test doesn't wait for elements or actions to complete
105
- - **Fix**: Add explicit wait for expected state
106
- ```typescript
107
- // BEFORE (race condition)
108
- await page.goto('/dashboard');
109
- const items = await page.locator('.item').count();
110
- // AFTER (explicit wait)
111
- await page.goto('/dashboard');
112
- await expect(page.locator('.item')).toHaveCount(5);
113
- ```
114
-
115
- ### Fix Type 3: Race Conditions
116
- - **Problem**: Test executes actions before application is ready
117
- - **Fix**: Wait for specific application state
118
- ```typescript
119
- // BEFORE
120
- await saveButton.click();
121
- await expect(successMessage).toBeVisible();
122
- // AFTER
123
- await page.locator('.validation-complete').waitFor();
124
- await saveButton.click();
125
- await expect(successMessage).toBeVisible();
126
- ```
127
-
128
- ### Fix Type 4: Wrong Assertions
129
- - **Problem**: Assertion expects incorrect value or state
130
- - **Fix**: Update assertion to match actual application behavior (if application is correct)
131
-
132
- ### Fix Type 5: Test Isolation Issues
133
- - **Problem**: Test depends on state from previous tests
134
- - **Fix**: Add proper setup/teardown or use fixtures
135
-
136
- ### Fix Type 6: Flaky Tests
137
- - **Problem**: Test passes inconsistently
138
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
139
- - Run test 10 times to confirm stability after fix
140
-
141
- ## Failure Triage Guide
142
-
143
- **Classification Decision Matrix:**
144
-
145
- | Failure Type | Root Cause | Action |
146
- |--------------|------------|--------|
147
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
148
- | Timeout waiting | Missing wait condition | Add explicit wait |
149
- | Flaky (timing) | Race condition | Add synchronization wait |
150
- | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
151
- | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
152
- | Product bug | App behaves incorrectly | STOP — report as bug, don't fix test |
153
-
154
- **Product Bug Indicators:**
155
- - Selectors are correct and elements exist
156
- - Test logic matches intended user flow
157
- - Application behavior doesn't match requirements
158
- - Error indicates functional problem (API error, validation failure)
159
- - Screenshots show application in wrong state
160
-
161
- **Test Issue Indicators:**
162
- - Selector not found (element exists but selector is wrong)
163
- - Timeout errors (missing wait conditions)
164
- - Flaky behavior (passes sometimes, fails other times)
165
- - Wrong assertions (expecting incorrect values)
166
- - Test isolation problems (depends on other tests)
167
-
168
- ## Test Result Artifacts
169
-
170
- Test results follow the hierarchical structure created by the Bugzy reporter:
171
-
172
- - **Manifest**: `test-runs/{timestamp}/manifest.json` — overall run summary
173
- - **Per-execution results**: `test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json`
174
- - **Attachments**: Video, trace, and screenshots in the same `exec-{num}/` folder
175
- - **Execution ID**: `test-runs/{timestamp}/execution-id.txt` (from BUGZY_EXECUTION_ID)
176
-
177
- Video recording is automatic via playwright-cli `--save-video` flag. Videos are saved to `.playwright-mcp/` and uploaded to GCS by external service. Do NOT copy, move, or delete video files.
178
-
179
- ## Reference Guides
180
-
181
- Detailed testing guides are available in `./docs/`:
182
- - `testing-best-practices.md` — Test organization, Page Object Model, selector strategies, authentication, debugging, and production-ready checklist
183
- - `test-execution-strategy.md` — Test tier selection (Smoke, Component, Full Regression), tag taxonomy, and decision tree for choosing which tests to run
184
-
185
- ## Anti-Patterns
186
-
187
- - **DO NOT** use `waitForTimeout()` — masks real timing issues
188
- - **DO NOT** put assertions in Page Objects — only in test files
189
- - **DO NOT** hardcode test data — use environment variables
190
- - **DO NOT** create test interdependencies — tests must be independent
191
- - **DO NOT** assume selectors without verifying in the live application
192
- - **DO NOT** make tests pass by lowering expectations
193
- - **DO NOT** skip proper verification of fixes
1
+ # Testing Framework
2
+
3
+ ## Framework
4
+ Playwright with TypeScript
5
+
6
+ ## Test Execution
7
+
8
+ Run commands from the project root directory.
9
+
10
+ **Run all tests:**
11
+ ```bash
12
+ npm test
13
+ ```
14
+
15
+ **Run specific file:**
16
+ ```bash
17
+ npm test -- tests/specs/login.spec.ts
18
+ ```
19
+
20
+ **Run by file pattern:**
21
+ ```bash
22
+ npm test -- [selector]
23
+ ```
24
+
25
+ **Run by tag:**
26
+ ```bash
27
+ npm test -- --grep "@smoke"
28
+ ```
29
+
30
+ **Run single test file directly:**
31
+ ```bash
32
+ npx playwright test [test-file]
33
+ ```
34
+
35
+ **Configuration:** `playwright.config.ts` automatically loads environment variables from `.env.testdata` and `.env` files. No manual env export needed.
36
+
37
+ **Custom Reporter:** The Bugzy reporter runs automatically via `playwright.config.ts` — do NOT use `--reporter` flag, as the custom reporter must run to create the hierarchical test-runs output.
38
+
39
+ ## Directory Structure
40
+
41
+ - **Test specs:** `./tests/specs/` — organized by feature in subdirectories
42
+ - **Page Objects:** `./tests/pages/` — extend BasePage class
43
+ - **Components:** `./tests/components/` — reusable UI element objects
44
+ - **Fixtures:** `./tests/fixtures/` — common test setup (e.g., `pages.fixture.ts`)
45
+ - **Helpers:** `./tests/helpers/` — data generation and utilities (e.g., `dateUtils.ts`, `dataGenerators.ts`)
46
+ - **Types:** `./tests/types/` — TypeScript type definitions
47
+ - **Setup:** `./tests/setup/` — auth setup and global config (e.g., `auth.setup.ts`)
48
+ - **Test data:** `./tests/data/` — static test data files
49
+ - **Auth state:** `./tests/.auth/` — stored authentication state
50
+ - **Reporters:** `./reporters/` — custom Bugzy reporter (`bugzy-reporter.ts`)
51
+ - **Test results:** `./test-runs/` — hierarchical results: `{timestamp}/{testCaseId}/exec-{N}/`
52
+
53
+ ## Conventions
54
+
55
+ ### Test Structure
56
+ - Every test uses `test.step()` calls matching the manual test case steps one-to-one
57
+ - Each `test.step()` should directly correspond to a numbered step in the manual test case
58
+ - Reference manual test case ID in comments
59
+ - Tag critical tests with `@smoke`
60
+ - Tests must be independent — no test interdependencies
61
+
62
+ ### Page Object Model
63
+ - Page Objects extend `BasePage` class
64
+ - **No assertions in Page Objects** — only actions and getters
65
+ - Page Objects contain semantic selectors verified in the live application
66
+ - Properly typed with TypeScript
67
+
68
+ ### Selector Priority
69
+ Use selectors in this priority order:
70
+ 1. `getByRole('button', { name: 'Sign In' })` — role-based (preferred)
71
+ 2. `getByLabel('Email')` — label-based
72
+ 3. `getByText('Welcome')` — text content
73
+ 4. `[data-testid="submit"]` — test IDs
74
+ 5. CSS selectors — **last resort only**
75
+
76
+ **NEVER assume selectors** — always verify in the live application using browser automation before writing tests.
77
+
78
+ ### Waiting and Synchronization
79
+ - **Never use `waitForTimeout()`** — rely on Playwright's auto-waiting
80
+ - Use `toBeVisible()`, `toHaveCount()`, `toHaveText()` assertions for waits
81
+ - Prefer `waitFor({ state: 'visible' })` over arbitrary delays
82
+ - Use `page.waitForLoadState('networkidle')` after navigation
83
+ - Handle dynamic content with explicit waits for specific conditions
84
+
85
+ ### Environment Variables
86
+ - Reference variables using `process.env.VAR_NAME` in tests
87
+ - Read `.env.testdata` for available non-secret environment variables
88
+ - **NEVER read `.env` file** (contains secrets only)
89
+ - Add new required variables to `.env.testdata` with `# TODO: configure` comment
90
+
91
+ ## Common Fix Patterns
92
+
93
+ ### Fix Type 1: Brittle Selectors
94
+ - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
95
+ - **Fix**: Replace with role-based selectors
96
+ ```typescript
97
+ // BEFORE (brittle)
98
+ await page.locator('.btn-primary').click();
99
+ // AFTER (semantic)
100
+ await page.getByRole('button', { name: 'Sign In' }).click();
101
+ ```
102
+
103
+ ### Fix Type 2: Missing Wait Conditions
104
+ - **Problem**: Test doesn't wait for elements or actions to complete
105
+ - **Fix**: Add explicit wait for expected state
106
+ ```typescript
107
+ // BEFORE (race condition)
108
+ await page.goto('/dashboard');
109
+ const items = await page.locator('.item').count();
110
+ // AFTER (explicit wait)
111
+ await page.goto('/dashboard');
112
+ await expect(page.locator('.item')).toHaveCount(5);
113
+ ```
114
+
115
+ ### Fix Type 3: Race Conditions
116
+ - **Problem**: Test executes actions before application is ready
117
+ - **Fix**: Wait for specific application state
118
+ ```typescript
119
+ // BEFORE
120
+ await saveButton.click();
121
+ await expect(successMessage).toBeVisible();
122
+ // AFTER
123
+ await page.locator('.validation-complete').waitFor();
124
+ await saveButton.click();
125
+ await expect(successMessage).toBeVisible();
126
+ ```
127
+
128
+ ### Fix Type 4: Wrong Assertions
129
+ - **Problem**: Assertion expects incorrect value or state
130
+ - **Fix**: Update assertion to match actual application behavior (if application is correct)
131
+
132
+ ### Fix Type 5: Test Isolation Issues
133
+ - **Problem**: Test depends on state from previous tests
134
+ - **Fix**: Add proper setup/teardown or use fixtures
135
+
136
+ ### Fix Type 6: Flaky Tests
137
+ - **Problem**: Test passes inconsistently
138
+ - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
139
+ - Run test 10 times to confirm stability after fix
140
+
141
+ ## Failure Triage Guide
142
+
143
+ **Classification Decision Matrix:**
144
+
145
+ | Failure Type | Root Cause | Action |
146
+ |--------------|------------|--------|
147
+ | Selector not found | Element exists, wrong selector | Replace with semantic selector |
148
+ | Timeout waiting | Missing wait condition | Add explicit wait |
149
+ | Flaky (timing) | Race condition | Add synchronization wait |
150
+ | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
151
+ | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
152
+ | Product bug | App behaves incorrectly | STOP — report as bug, don't fix test |
153
+
154
+ **Product Bug Indicators:**
155
+ - Selectors are correct and elements exist
156
+ - Test logic matches intended user flow
157
+ - Application behavior doesn't match requirements
158
+ - Error indicates functional problem (API error, validation failure)
159
+ - Screenshots show application in wrong state
160
+
161
+ **Test Issue Indicators:**
162
+ - Selector not found (element exists but selector is wrong)
163
+ - Timeout errors (missing wait conditions)
164
+ - Flaky behavior (passes sometimes, fails other times)
165
+ - Wrong assertions (expecting incorrect values)
166
+ - Test isolation problems (depends on other tests)
167
+
168
+ ## Test Result Artifacts
169
+
170
+ Test results follow the hierarchical structure created by the Bugzy reporter:
171
+
172
+ - **Manifest**: `test-runs/{timestamp}/manifest.json` — overall run summary
173
+ - **Per-execution results**: `test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json`
174
+ - **Attachments**: Video, trace, and screenshots in the same `exec-{num}/` folder
175
+ - **Execution ID**: `test-runs/{timestamp}/execution-id.txt` (from BUGZY_EXECUTION_ID)
176
+
177
+ Video recording is automatic via playwright-cli `--save-video` flag. Videos are saved to `.playwright-mcp/` and uploaded to GCS by external service. Do NOT copy, move, or delete video files.
178
+
179
+ ## Reference Guides
180
+
181
+ Detailed testing guides are available in `./docs/`:
182
+ - `testing-best-practices.md` — Test organization, Page Object Model, selector strategies, authentication, debugging, and production-ready checklist
183
+ - `test-execution-strategy.md` — Test tier selection (Smoke, Component, Full Regression), tag taxonomy, and decision tree for choosing which tests to run
184
+
185
+ ## Anti-Patterns
186
+
187
+ - **DO NOT** use `waitForTimeout()` — masks real timing issues
188
+ - **DO NOT** put assertions in Page Objects — only in test files
189
+ - **DO NOT** hardcode test data — use environment variables
190
+ - **DO NOT** create test interdependencies — tests must be independent
191
+ - **DO NOT** assume selectors without verifying in the live application
192
+ - **DO NOT** make tests pass by lowering expectations
193
+ - **DO NOT** skip proper verification of fixes