@bugzy-ai/bugzy 1.5.0 → 1.6.0

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 (36) hide show
  1. package/README.md +10 -7
  2. package/dist/cli/index.cjs +6168 -5848
  3. package/dist/cli/index.cjs.map +1 -1
  4. package/dist/cli/index.js +6168 -5848
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/index.cjs +5563 -5302
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +5 -4
  9. package/dist/index.d.ts +5 -4
  10. package/dist/index.js +5560 -5300
  11. package/dist/index.js.map +1 -1
  12. package/dist/subagents/index.cjs +368 -51
  13. package/dist/subagents/index.cjs.map +1 -1
  14. package/dist/subagents/index.js +368 -51
  15. package/dist/subagents/index.js.map +1 -1
  16. package/dist/subagents/metadata.cjs +10 -2
  17. package/dist/subagents/metadata.cjs.map +1 -1
  18. package/dist/subagents/metadata.js +10 -2
  19. package/dist/subagents/metadata.js.map +1 -1
  20. package/dist/tasks/index.cjs +864 -2391
  21. package/dist/tasks/index.cjs.map +1 -1
  22. package/dist/tasks/index.d.cts +48 -5
  23. package/dist/tasks/index.d.ts +48 -5
  24. package/dist/tasks/index.js +862 -2389
  25. package/dist/tasks/index.js.map +1 -1
  26. package/dist/templates/init/.bugzy/runtime/knowledge-base.md +61 -0
  27. package/dist/templates/init/.bugzy/runtime/knowledge-maintenance-guide.md +97 -0
  28. package/dist/templates/init/.bugzy/runtime/subagent-memory-guide.md +87 -0
  29. package/dist/templates/init/.bugzy/runtime/templates/test-plan-template.md +41 -16
  30. package/dist/templates/init/.bugzy/runtime/templates/test-result-schema.md +498 -0
  31. package/dist/templates/init/.bugzy/runtime/test-execution-strategy.md +535 -0
  32. package/dist/templates/init/.bugzy/runtime/testing-best-practices.md +368 -14
  33. package/dist/templates/init/.gitignore-template +23 -2
  34. package/package.json +1 -1
  35. package/templates/init/.bugzy/runtime/templates/test-plan-template.md +41 -16
  36. package/templates/init/.env.testdata +18 -0
@@ -1,5 +1,69 @@
1
1
  # Testing Best Practices Reference
2
2
 
3
+ ## Two-Phase Test Automation Workflow
4
+
5
+ **Critical Distinction**: Separate test scenario discovery from automation implementation.
6
+
7
+ ### Phase 1: Test Scenario Discovery (WHAT to test)
8
+
9
+ **Goal**: Understand application behavior and identify what needs testing coverage.
10
+
11
+ **Activities**:
12
+ - Explore features and user workflows through manual interaction
13
+ - Identify critical user paths and edge cases
14
+ - Document test scenarios in human-readable format
15
+ - Evaluate automation ROI for each scenario
16
+ - Create manual test case documentation
17
+
18
+ **Output**: Test plan with prioritized scenarios and automation decisions
19
+
20
+ ### Phase 2: Automation Implementation (HOW to automate)
21
+
22
+ **Goal**: Build robust test automation framework validated with working tests.
23
+
24
+ **Activities**:
25
+ - Technical exploration to identify correct selectors
26
+ - Create Page Object infrastructure
27
+ - Generate ONE smoke test to validate framework
28
+ - Run and debug until test passes consistently
29
+ - Scale to additional tests only after validation
30
+
31
+ **Output**: Working test automation with validated Page Objects
32
+
33
+ ### The "Test One First" Validation Loop
34
+
35
+ **CRITICAL**: Always validate your framework with ONE working test before scaling.
36
+
37
+ ```
38
+ 1. Explore app for selectors (use Playwright MCP or codegen)
39
+ 2. Create Page Objects with verified selectors
40
+ 3. Write ONE critical path test (e.g., login)
41
+ 4. Run the test: npx playwright test <test-file>
42
+ 5. If fails → Debug and fix → Go to step 4
43
+ 6. If passes → Run 3-5 more times to ensure stability
44
+ 7. Once stable → Scale to additional tests
45
+ ```
46
+
47
+ **Why this matters**:
48
+ - Catches framework issues early (config, setup, auth)
49
+ - Validates selectors work in real application
50
+ - Prevents generating 50 broken tests
51
+ - Builds confidence in Page Object reliability
52
+
53
+ **Example validation workflow**:
54
+ ```bash
55
+ # Generate ONE test first
56
+ npx playwright test tests/specs/auth/login.spec.ts
57
+
58
+ # Run multiple times to verify stability
59
+ npx playwright test tests/specs/auth/login.spec.ts --repeat-each=5
60
+
61
+ # Check for flakiness
62
+ npx playwright test tests/specs/auth/login.spec.ts --workers=1
63
+
64
+ # Once stable, generate more tests
65
+ ```
66
+
3
67
  ## Page Object Model (POM) Architecture
4
68
 
5
69
  **Core Principle**: Separate locators, actions, and assertions into distinct layers to isolate UI changes from test logic.
@@ -69,6 +133,105 @@ Add `data-testid` attributes for:
69
133
  await page.getByTestId('checkout-submit').click();
70
134
  ```
71
135
 
136
+ ## Playwright Codegen for Selector Discovery
137
+
138
+ **Playwright's built-in codegen is faster and more reliable than manual selector creation.**
139
+
140
+ ### Using Codegen
141
+
142
+ ```bash
143
+ # Start codegen from specific URL
144
+ npx playwright codegen https://your-app.com
145
+
146
+ # With authentication (loads saved state)
147
+ npx playwright codegen --load-storage=tests/.auth/user.json https://your-app.com
148
+
149
+ # Target specific browser
150
+ npx playwright codegen --browser=chromium https://your-app.com
151
+ ```
152
+
153
+ **Workflow**:
154
+ 1. Run codegen and interact with your application
155
+ 2. Playwright generates test code with verified selectors
156
+ 3. Copy generated selectors to your Page Objects
157
+ 4. Refactor code to follow Page Object Model pattern
158
+ 5. Extract reusable logic to fixtures and helpers
159
+
160
+ ### Hybrid Approach: Codegen + AI Refactoring
161
+
162
+ ```
163
+ 1. Use Playwright codegen → Generates working test with selectors
164
+ 2. Use AI (Claude) → Refactor to Page Objects, extract fixtures, add types
165
+ 3. Best of both worlds: Reliability (codegen) + Intelligence (AI)
166
+ ```
167
+
168
+ **Example**:
169
+ ```typescript
170
+ // Raw codegen output
171
+ await page.goto('https://example.com/');
172
+ await page.getByLabel('Email').click();
173
+ await page.getByLabel('Email').fill('test@example.com');
174
+
175
+ // After AI refactoring into Page Object
176
+ class LoginPage {
177
+ readonly emailInput = this.page.getByLabel('Email');
178
+
179
+ async fillEmail(email: string) {
180
+ await this.emailInput.fill(email);
181
+ }
182
+ }
183
+ ```
184
+
185
+ ## Smoke Test Strategy
186
+
187
+ **Smoke tests are a minimal suite of critical path tests that validate core functionality.**
188
+
189
+ ### Characteristics
190
+
191
+ - **Fast**: Target < 5 minutes total execution time
192
+ - **Critical**: Cover must-work features (login, core user flows)
193
+ - **Stable**: High reliability, minimal flakiness
194
+ - **CI/CD**: Run on every commit/pull request
195
+
196
+ ### Tagging Smoke Tests
197
+
198
+ ```typescript
199
+ // tests/specs/auth/login.spec.ts
200
+ test('should login with valid credentials @smoke', async ({ page }) => {
201
+ // Critical path test
202
+ });
203
+
204
+ test('should show error with invalid password', async ({ page }) => {
205
+ // Not tagged - functional test only
206
+ });
207
+ ```
208
+
209
+ ### Running Smoke Tests
210
+
211
+ ```bash
212
+ # Run only smoke tests
213
+ npx playwright test --grep @smoke
214
+
215
+ # In CI/CD pipeline
216
+ npx playwright test --grep @smoke --workers=2
217
+
218
+ # Smoke tests as gate for full suite
219
+ npx playwright test --grep @smoke && npx playwright test
220
+ ```
221
+
222
+ ### Smoke Test Suite Example
223
+
224
+ ```
225
+ @smoke test coverage:
226
+ ✓ Login with valid credentials
227
+ ✓ Navigate to dashboard
228
+ ✓ Create new item (core feature)
229
+ ✓ View item details
230
+ ✓ Logout
231
+
232
+ Target: < 5 minutes, 100% pass rate
233
+ ```
234
+
72
235
  ## Test Organization
73
236
 
74
237
  ### File Structure by Feature
@@ -89,7 +252,13 @@ tests/
89
252
  └── setup/ # Global setup/teardown
90
253
  ```
91
254
 
92
- ### Test Structure
255
+ ### Test Structure with test.step()
256
+
257
+ **REQUIRED**: All tests must use `test.step()` to organize actions into high-level logical phases. This enables:
258
+ - Video navigation by step (users can jump to specific phases in test execution videos)
259
+ - Clear test structure and intent
260
+ - Granular error tracking (know exactly which phase failed)
261
+ - Better debugging with step-level timing
93
262
 
94
263
  ```typescript
95
264
  test.describe('Purchase flow', () => {
@@ -98,15 +267,186 @@ test.describe('Purchase flow', () => {
98
267
  });
99
268
 
100
269
  test('should complete purchase with credit card', async ({ page }) => {
101
- // Arrange: Set up page objects
102
270
  const checkoutPage = new CheckoutPage(page);
103
271
 
104
- // Act: Perform actions
105
- await checkoutPage.fillPaymentInfo({/*...*/});
106
- await checkoutPage.submitOrder();
272
+ await test.step('Add item to cart', async () => {
273
+ await checkoutPage.addItemToCart('Product A');
274
+ await expect(checkoutPage.cartCount).toHaveText('1');
275
+ });
276
+
277
+ await test.step('Navigate to checkout', async () => {
278
+ await checkoutPage.goToCheckout();
279
+ await expect(page).toHaveURL('/checkout');
280
+ });
281
+
282
+ await test.step('Fill payment information', async () => {
283
+ await checkoutPage.fillPaymentInfo({
284
+ cardNumber: '4111111111111111',
285
+ expiry: '12/25',
286
+ cvv: '123'
287
+ });
288
+ });
289
+
290
+ await test.step('Submit order', async () => {
291
+ await checkoutPage.submitOrder();
292
+ await expect(page).toHaveURL('/confirmation');
293
+ });
294
+
295
+ await test.step('Verify order confirmation', async () => {
296
+ await expect(checkoutPage.confirmationMessage).toBeVisible();
297
+ await expect(checkoutPage.orderNumber).toContain('ORD-');
298
+ });
299
+ });
300
+ });
301
+ ```
302
+
303
+ **Step Granularity Guidelines**:
304
+ - Target **3-7 steps per test** for optimal video navigation
305
+ - Each step should represent a logical phase (e.g., "Login", "Navigate to settings", "Update profile")
306
+ - Avoid micro-steps (e.g., "Click button", "Fill field") - group related actions
307
+ - Step titles should be user-friendly and descriptive
308
+
309
+ ## Video-Synchronized Test Steps
310
+
311
+ **REQUIRED for all tests**: Use `test.step()` API to create video-navigable test execution.
312
+
313
+ ### Why test.step() is Required
314
+
315
+ Every test generates a video recording with `steps.json` file containing:
316
+ - Step-by-step breakdown of test actions
317
+ - Video timestamps for each step (in seconds from test start)
318
+ - Step status (success/failed)
319
+ - Step duration
320
+
321
+ This enables users to:
322
+ - Click on a step to jump to that point in the video
323
+ - See exactly when and where a test failed
324
+ - Navigate through test execution like a timeline
325
+ - Debug issues by reviewing specific test phases
326
+
327
+ ### test.step() Best Practices
328
+
329
+ ```typescript
330
+ import { test, expect } from '@playwright/test';
331
+
332
+ test('user can update profile settings', async ({ page }) => {
333
+ const settingsPage = new SettingsPage(page);
334
+ const profilePage = new ProfilePage(page);
335
+
336
+ await test.step('Navigate to settings page', async () => {
337
+ await settingsPage.navigate();
338
+ await expect(settingsPage.pageHeading).toBeVisible();
339
+ });
340
+
341
+ await test.step('Open profile section', async () => {
342
+ await settingsPage.clickProfileTab();
343
+ await expect(profilePage.nameInput).toBeVisible();
344
+ });
345
+
346
+ await test.step('Update profile information', async () => {
347
+ await profilePage.updateName('John Doe');
348
+ await profilePage.updateEmail('john@example.com');
349
+ });
350
+
351
+ await test.step('Save changes', async () => {
352
+ await profilePage.clickSaveButton();
353
+ await expect(profilePage.successMessage).toBeVisible();
354
+ });
355
+
356
+ await test.step('Verify changes persisted', async () => {
357
+ await page.reload();
358
+ await expect(profilePage.nameInput).toHaveValue('John Doe');
359
+ await expect(profilePage.emailInput).toHaveValue('john@example.com');
360
+ });
361
+ });
362
+ ```
363
+
364
+ ### What Gets Recorded in steps.json
365
+
366
+ ```json
367
+ {
368
+ "steps": [
369
+ {
370
+ "index": 1,
371
+ "timestamp": "2025-11-17T09:26:22.335Z",
372
+ "videoTimeSeconds": 0,
373
+ "action": "Navigate to settings page",
374
+ "status": "success",
375
+ "description": "Navigate to settings page - completed successfully",
376
+ "technicalDetails": "test.step",
377
+ "duration": 1234
378
+ },
379
+ {
380
+ "index": 2,
381
+ "timestamp": "2025-11-17T09:26:23.569Z",
382
+ "videoTimeSeconds": 1,
383
+ "action": "Open profile section",
384
+ "status": "success",
385
+ "description": "Open profile section - completed successfully",
386
+ "technicalDetails": "test.step",
387
+ "duration": 856
388
+ }
389
+ ],
390
+ "summary": {
391
+ "totalSteps": 5,
392
+ "successfulSteps": 5,
393
+ "failedSteps": 0,
394
+ "skippedSteps": 0
395
+ }
396
+ }
397
+ ```
398
+
399
+ ### Step Naming Conventions
107
400
 
108
- // Assert: Verify outcomes
109
- await expect(page).toHaveURL('/confirmation');
401
+ **Good step names** (user-friendly, high-level):
402
+ - "Navigate to login page"
403
+ - "Login with valid credentials"
404
+ - "Add item to cart"
405
+ - "Complete checkout process"
406
+ - "Verify order confirmation"
407
+
408
+ ❌ **Bad step names** (too technical, too granular):
409
+ - "Click the login button"
410
+ - "Fill email field"
411
+ - "Wait for page load"
412
+ - "Assert element visible"
413
+ - "page.goto('/login')"
414
+
415
+ ### Smoke Test Example with test.step()
416
+
417
+ ```typescript
418
+ // tests/specs/auth/login.spec.ts
419
+ test('should login and navigate through all main pages @smoke', async ({ page }) => {
420
+ const loginPage = new LoginPage(page);
421
+ const dashboardPage = new DashboardPage(page);
422
+
423
+ await test.step('Navigate to login page', async () => {
424
+ await loginPage.navigate();
425
+ await expect(loginPage.pageHeading).toBeVisible();
426
+ });
427
+
428
+ await test.step('Login with valid credentials', async () => {
429
+ await loginPage.login(
430
+ process.env.TEST_OWNER_EMAIL!,
431
+ process.env.TEST_OWNER_PASSWORD!
432
+ );
433
+ await page.waitForURL(/.*\/dashboard/);
434
+ });
435
+
436
+ await test.step('Navigate to Overview page', async () => {
437
+ await dashboardPage.navigateToOverview();
438
+ await expect(dashboardPage.overviewNavLink).toBeVisible();
439
+ });
440
+
441
+ await test.step('Navigate to Settings page', async () => {
442
+ await dashboardPage.navigateToSettings();
443
+ await expect(dashboardPage.settingsNavLink).toBeVisible();
444
+ });
445
+
446
+ await test.step('Logout and verify redirect', async () => {
447
+ await dashboardPage.logout();
448
+ await page.waitForURL(/.*\/login/);
449
+ await expect(loginPage.pageHeading).toBeVisible();
110
450
  });
111
451
  });
112
452
  ```
@@ -119,7 +459,7 @@ test.describe('Purchase flow', () => {
119
459
  // tests/setup/auth.setup.ts
120
460
  import { test as setup } from '@playwright/test';
121
461
 
122
- const authFile = 'playwright/.auth/user.json';
462
+ const authFile = 'tests/.auth/user.json';
123
463
 
124
464
  setup('authenticate', async ({ page }) => {
125
465
  await page.goto('/login');
@@ -139,7 +479,7 @@ projects: [
139
479
  { name: 'setup', testMatch: /.*\.setup\.ts/ },
140
480
  {
141
481
  name: 'chromium',
142
- use: { storageState: 'playwright/.auth/user.json' },
482
+ use: { storageState: 'tests/.auth/user.json' },
143
483
  dependencies: ['setup'],
144
484
  },
145
485
  ]
@@ -264,15 +604,29 @@ export default defineConfig({
264
604
  - [ ] Assertions in test files, not Page Objects
265
605
  - [ ] Role-based selectors prioritized
266
606
  - [ ] No hardcoded credentials
607
+ - [ ] Framework validated with ONE working test before scaling
608
+ - [ ] Smoke tests tagged with @smoke for CI/CD
609
+ - [ ] All tests use `test.step()` for video-navigable execution (3-7 steps per test)
610
+
611
+ **Test Independence Validation:**
612
+ - [ ] Each test can run in isolation: `npx playwright test <single-test>`
613
+ - [ ] Tests pass in parallel: `npx playwright test --workers=4`
614
+ - [ ] Tests pass in random order: `npx playwright test --shard=1/3` (run multiple shards)
615
+ - [ ] No shared state between tests (each uses fixtures)
616
+ - [ ] Tests cleanup after themselves (via fixtures or API)
267
617
 
268
618
  **CI/CD:**
269
- - [ ] Tests run on every pull request
619
+ - [ ] Smoke tests run on every commit (`npx playwright test --grep @smoke`)
620
+ - [ ] Full suite runs on pull requests
270
621
  - [ ] Artifacts uploaded (reports, traces)
271
622
  - [ ] Failure notifications configured
623
+ - [ ] Test results published to PR comments
272
624
 
273
625
  ---
274
626
 
275
- **Remember**: The three critical pillars are:
276
- 1. **Page Object Model** - Isolate UI changes from test logic
277
- 2. **Role-based selectors** - Resist breakage
278
- 3. **Authentication state reuse** - Maximize speed
627
+ **Remember**: The five critical pillars are:
628
+ 1. **Two-Phase Approach** - Separate WHAT to test from HOW to automate
629
+ 2. **Test One First** - Validate framework with ONE working test before scaling
630
+ 3. **Page Object Model** - Isolate UI changes from test logic
631
+ 4. **Role-based selectors** - Resist breakage with semantic HTML
632
+ 5. **Authentication state reuse** - Maximize speed and reliability
@@ -1,4 +1,25 @@
1
-
2
- # Bugzy
1
+ # Environment files (keep .env.testdata tracked, .env.example managed externally)
3
2
  .env
4
3
  .env.local
4
+
5
+ # Logs and temporary files
6
+ logs/
7
+ tmp/
8
+
9
+ # Playwright MCP cache
10
+ .playwright-mcp/
11
+
12
+ # Playwright test results
13
+ test-results/
14
+ playwright-report/
15
+ playwright/.cache/
16
+ tests/.auth/
17
+
18
+ # Node modules if using any Node.js tooling
19
+ node_modules/
20
+ .DS_Store
21
+
22
+ # Test result media files
23
+ **/*.webm
24
+ **/*.zip
25
+ **/*.png
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugzy-ai/bugzy",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Open-source AI agent configuration for QA automation with Claude Code",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,25 +1,50 @@
1
- # Test Plan Template
1
+ ---
2
+ version: 1.0.0
3
+ created_at: [DATE]
4
+ updated_at: [DATE]
5
+ status: draft
6
+ ---
2
7
 
3
- ## Test Scenarios
8
+ # Test Plan: [PROJECT_NAME]
4
9
 
5
- ### Scenario 1: [Name]
6
- **Objective**: [What are we testing?]
10
+ ## Overview
7
11
 
8
- **Test Cases**:
9
- 1. [Test case description]
10
- 2. [Test case description]
12
+ [2-3 sentences describing what the application does and the testing focus]
11
13
 
12
- **Expected Results**:
13
- - [Expected outcome]
14
+ ## Features to Test
14
15
 
15
- ### Scenario 2: [Name]
16
- **Objective**: [What are we testing?]
16
+ ### [Feature Area 1]
17
+ - [ ] Feature 1.1 - Brief description
18
+ - [ ] Feature 1.2 - Brief description
17
19
 
18
- **Test Cases**:
19
- 1. [Test case description]
20
+ ### [Feature Area 2]
21
+ - [ ] Feature 2.1 - Brief description
22
+ - [ ] Feature 2.2 - Brief description
20
23
 
21
- **Expected Results**:
22
- - [Expected outcome]
24
+ ### [Feature Area 3]
25
+ - [ ] Feature 3.1 - Brief description
26
+
27
+ ## Out of Scope
28
+
29
+ - Item 1 - Reason (e.g., requires native mobile app)
30
+ - Item 2 - Reason (e.g., backend-only, no UI)
31
+
32
+ ## Test Environment
33
+
34
+ - **URL**: TEST_BASE_URL
35
+ - **User Credentials**: TEST_USER_EMAIL / TEST_USER_PASSWORD
36
+ - **Admin Credentials**: TEST_ADMIN_EMAIL / TEST_ADMIN_PASSWORD (if applicable)
37
+
38
+ ## Automation Priority
39
+
40
+ | Priority | Criteria |
41
+ |----------|----------|
42
+ | High | Critical user flows, smoke tests, frequent regression areas |
43
+ | Medium | Important features, moderate user impact |
44
+ | Low | Edge cases, rarely used features |
23
45
 
24
46
  ## Notes
25
- [Add any additional context or requirements]
47
+
48
+ - See `./exploration-reports/` for detailed UI element discovery
49
+ - See `.bugzy/runtime/knowledge-base.md` for technical patterns
50
+ - See `.bugzy/runtime/project-context.md` for SDLC and team info
@@ -0,0 +1,18 @@
1
+ # Non-Secret Test Data
2
+ # This file contains actual test values (non-sensitive) and IS committed to version control
3
+ # This file will be populated by /onboard-testing command with discovered test data
4
+ #
5
+ # IMPORTANT: Passwords and API keys go in .env (not here!)
6
+ # This file only contains non-sensitive data like URLs and email addresses.
7
+
8
+ # Application Under Test
9
+ TEST_BASE_URL=https://example.com
10
+
11
+ # Test User Identifiers (non-secret - emails can be committed)
12
+ # TEST_OWNER_EMAIL=owner@test.example.com
13
+ # TEST_ADMIN_EMAIL=admin@test.example.com
14
+
15
+ # NOTE: The corresponding passwords/secrets should be added to .env:
16
+ # TEST_OWNER_PASSWORD=<add to .env>
17
+ # TEST_ADMIN_PASSWORD=<add to .env>
18
+ # TEST_API_KEY=<add to .env>