@bugzy-ai/bugzy 1.14.1 → 1.15.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.
package/dist/index.cjs CHANGED
@@ -284,9 +284,9 @@ var TASK_SLUGS = {
284
284
  var generateTestCasesTask = {
285
285
  slug: TASK_SLUGS.GENERATE_TEST_CASES,
286
286
  name: "Generate Test Cases",
287
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
287
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
288
288
  frontmatter: {
289
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
289
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
290
290
  "argument-hint": "--type [exploratory|functional|regression|smoke] --focus [optional-feature]"
291
291
  },
292
292
  steps: [
@@ -294,12 +294,12 @@ var generateTestCasesTask = {
294
294
  {
295
295
  inline: true,
296
296
  title: "Generate Test Cases Overview",
297
- content: `Generate comprehensive test artifacts including BOTH manual test case documentation AND automated Playwright test scripts.
297
+ content: `Generate comprehensive test artifacts including BOTH manual test case documentation AND automated test scripts. Read \`./tests/CLAUDE.md\` for framework-specific conventions, directory structure, and commands.
298
298
 
299
299
  This command generates:
300
300
  1. **Manual Test Case Documentation** (in \`./test-cases/\`) - Human-readable test cases in markdown format
301
- 2. **Automated Playwright Tests** (in \`./tests/specs/\`) - Executable TypeScript test scripts
302
- 3. **Page Object Models** (in \`./tests/pages/\`) - Reusable page classes for automated tests
301
+ 2. **Automated Test Scripts** (in directory from \`./tests/CLAUDE.md\`) - Executable test scripts
302
+ 3. **Page Objects** (in directory from \`./tests/CLAUDE.md\`) - Reusable page classes for automated tests
303
303
  4. **Supporting Files** (fixtures, helpers, components) - As needed for test automation`
304
304
  },
305
305
  // Step 2: Security Notice (library)
@@ -334,9 +334,9 @@ Read the test plan from \`test-plan.md\` to understand:
334
334
 
335
335
  **1.2 Check Existing Test Cases and Tests**
336
336
  - List all files in \`./test-cases/\` to understand existing manual test coverage
337
- - List all files in \`./tests/specs/\` to understand existing automated tests
337
+ - List existing automated tests in the test directory (see \`./tests/CLAUDE.md\` for structure)
338
338
  - Determine next test case ID (TC-XXX format)
339
- - Identify existing Page Objects in \`./tests/pages/\`
339
+ - Identify existing page objects (see \`./tests/CLAUDE.md\` for directory)
340
340
  - Avoid creating overlapping test cases or duplicate automation`
341
341
  },
342
342
  // Step 6: Documentation Researcher (conditional library step)
@@ -445,8 +445,8 @@ Before invoking the agent, identify the test cases for the current area:
445
445
  - Test type: {type}
446
446
  - Test plan: test-plan.md
447
447
  - Manual test cases directory: ./test-cases/
448
- - Existing automated tests: ./tests/specs/
449
- - Existing Page Objects: ./tests/pages/
448
+ - Existing automated tests: [directory from ./tests/CLAUDE.md]
449
+ - Existing page objects: [directory from ./tests/CLAUDE.md]
450
450
 
451
451
  **Knowledge Base Patterns (MUST APPLY):**
452
452
  Include ALL relevant testing patterns from the knowledge base that apply to this area. For example, if the KB documents timing behaviors (animation delays, loading states), selector gotchas, or recommended assertion approaches \u2014 list them here explicitly and instruct the agent to use the specific patterns described (e.g., specific assertion methods with specific timeouts). The test-code-generator does not have access to the knowledge base, so you MUST relay the exact patterns and recommended code approaches.
@@ -457,7 +457,7 @@ Include ALL relevant testing patterns from the knowledge base that apply to this
457
457
  3. Explore the feature area to understand implementation (gather selectors, URLs, flows)
458
458
  4. Build missing Page Objects and supporting code
459
459
  5. For each test case marked \`automated: true\`:
460
- - Create automated Playwright test in ./tests/specs/
460
+ - Create automated test in the test directory (from ./tests/CLAUDE.md)
461
461
  - Update the manual test case file to reference the automated test path
462
462
  - Apply ALL knowledge base patterns listed above (timing, selectors, assertions)
463
463
  6. Run and iterate on each test until it passes or fails with a product bug
@@ -488,15 +488,7 @@ Move to the next area and repeat until all areas are complete.
488
488
  {
489
489
  inline: true,
490
490
  title: "Create Directories if Needed",
491
- content: `Ensure required directories exist:
492
- \`\`\`bash
493
- mkdir -p ./test-cases
494
- mkdir -p ./tests/specs
495
- mkdir -p ./tests/pages
496
- mkdir -p ./tests/components
497
- mkdir -p ./tests/fixtures
498
- mkdir -p ./tests/helpers
499
- \`\`\``
491
+ content: `Ensure required directories exist. Create the \`./test-cases/\` directory for manual test cases, and create the test directories specified in \`./tests/CLAUDE.md\` (test specs, page objects, components, fixtures, helpers).`
500
492
  },
501
493
  // Step 14: Extract Env Variables (library)
502
494
  "extract-env-variables",
@@ -516,7 +508,7 @@ mkdir -p ./tests/helpers
516
508
  - Features covered by automation
517
509
  - Areas kept manual-only (and why)
518
510
  3. Highlight key automated test scenarios
519
- 4. Share command to run automated tests: npx playwright test
511
+ 4. Share command to run automated tests (from \`./tests/CLAUDE.md\`)
520
512
  5. Ask for team review and validation
521
513
  6. Mention any areas needing exploration or clarification
522
514
  7. Use appropriate channel and threading for the update
@@ -561,8 +553,8 @@ The team communication should include:
561
553
  - Areas kept manual-only (and why)
562
554
 
563
555
  **Next Steps:**
564
- - Command to run automated tests: \`npx playwright test\`
565
- - Instructions to run specific test file
556
+ - Command to run automated tests (from \`./tests/CLAUDE.md\`)
557
+ - Instructions to run specific test file (from \`./tests/CLAUDE.md\`)
566
558
  - Note about copying .env.testdata to .env
567
559
  - Mention any exploration needed for edge cases
568
560
 
@@ -578,7 +570,7 @@ The team communication should include:
578
570
  - **Test Independence**: Each test must be runnable in isolation and in parallel`
579
571
  }
580
572
  ],
581
- requiredSubagents: ["test-runner", "test-code-generator"],
573
+ requiredSubagents: ["browser-automation", "test-code-generator"],
582
574
  optionalSubagents: ["documentation-researcher", "team-communicator"],
583
575
  dependentTasks: []
584
576
  };
@@ -777,7 +769,7 @@ The team communication should include:
777
769
  - Instructions for the user to fill in actual values in .env.testdata before running tests`
778
770
  }
779
771
  ],
780
- requiredSubagents: ["test-runner"],
772
+ requiredSubagents: ["browser-automation"],
781
773
  optionalSubagents: ["documentation-researcher", "team-communicator"],
782
774
  dependentTasks: []
783
775
  };
@@ -1299,7 +1291,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1299
1291
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1300
1292
  - Wait for team response (messaging infrastructure handles that)
1301
1293
  - Create or modify test files
1302
- - Run Playwright tests
1294
+ - Run automated tests
1303
1295
 
1304
1296
  #### 5.6 Update Event Processor Memory
1305
1297
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1406,10 +1398,10 @@ Create files if they don't exist:
1406
1398
  var runTestsTask = {
1407
1399
  slug: TASK_SLUGS.RUN_TESTS,
1408
1400
  name: "Run Tests",
1409
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1401
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1410
1402
  frontmatter: {
1411
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1412
- "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", "tests/specs/login.spec.ts")'
1403
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1404
+ "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", or a specific test file path)'
1413
1405
  },
1414
1406
  steps: [
1415
1407
  // Step 1: Overview (inline)
@@ -1418,7 +1410,7 @@ var runTestsTask = {
1418
1410
  title: "Run Tests Overview",
1419
1411
  content: `# Run Tests Command
1420
1412
 
1421
- Execute automated Playwright tests, analyze failures using JSON reports, automatically fix test issues, and log product bugs.`
1413
+ Execute automated tests, analyze failures using JSON reports, automatically fix test issues, and log product bugs. Read \`./tests/CLAUDE.md\` for framework-specific conventions and commands.`
1422
1414
  },
1423
1415
  // Step 2: Security Notice (library)
1424
1416
  "security-notice",
@@ -1431,9 +1423,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1431
1423
  **Parse Arguments:**
1432
1424
  Extract the following from arguments:
1433
1425
  - **selector**: Test selection criteria
1434
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1435
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1436
- - Specific file: "tests/specs/login.spec.ts"
1426
+ - File pattern: "auth" \u2192 find matching test files (see \`./tests/CLAUDE.md\` for directory structure)
1427
+ - Tag: "@smoke" \u2192 runs tests with tag annotation
1428
+ - Specific file: path to a specific test file
1437
1429
  - All tests: "all" or "" \u2192 runs entire test suite`
1438
1430
  },
1439
1431
  // Step 4: Load Project Context (library)
@@ -1449,34 +1441,26 @@ Extract the following from arguments:
1449
1441
  inline: true,
1450
1442
  title: "Identify Automated Tests to Run",
1451
1443
  content: `#### Understand Test Selection
1444
+
1445
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1446
+
1452
1447
  Parse the selector argument to determine which tests to run:
1453
1448
 
1454
1449
  **File Pattern** (e.g., "auth", "login"):
1455
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1450
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1456
1451
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1457
1452
 
1458
1453
  **Tag** (e.g., "@smoke", "@regression"):
1459
- - Run tests with specific Playwright tag annotation
1460
- - Use Playwright's \`--grep\` option
1454
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1461
1455
 
1462
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1463
- - Run that specific test file
1456
+ **Specific File**:
1457
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1464
1458
 
1465
1459
  **All Tests** ("all" or no selector):
1466
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1460
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1467
1461
 
1468
1462
  #### Find Matching Test Files
1469
- Use glob patterns to find test files:
1470
- \`\`\`bash
1471
- # For file pattern
1472
- ls tests/specs/**/*[pattern]*.spec.ts
1473
-
1474
- # For specific file
1475
- ls tests/specs/auth/login.spec.ts
1476
-
1477
- # For all tests
1478
- ls tests/specs/**/*.spec.ts
1479
- \`\`\`
1463
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1480
1464
 
1481
1465
  #### Validate Test Files Exist
1482
1466
  Check that at least one test file was found:
@@ -1490,7 +1474,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1490
1474
  - **No selector** (all tests): Confirm running full suite before executing`
1491
1475
  },
1492
1476
  // Step 7-10: Test Execution (library steps)
1493
- "run-playwright-tests",
1477
+ "run-tests",
1494
1478
  "parse-test-results",
1495
1479
  "triage-failures",
1496
1480
  "fix-test-issues",
@@ -1516,8 +1500,8 @@ If no test cases match the selection criteria:
1516
1500
  2. List available test cases or suggest running \`/generate-test-cases\` first
1517
1501
  3. Provide examples of valid selection criteria
1518
1502
 
1519
- #### If Test Runner Agent Fails
1520
- If the test-runner agent encounters issues:
1503
+ #### If Browser Automation Agent Fails
1504
+ If the browser-automation agent encounters issues:
1521
1505
  1. Report the specific error
1522
1506
  2. Suggest troubleshooting steps
1523
1507
  3. Offer to run tests individually if batch execution failed
@@ -1531,18 +1515,18 @@ If selected test cases have formatting issues:
1531
1515
  ### Important Notes
1532
1516
 
1533
1517
  **Test Selection Strategy**:
1534
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1518
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1535
1519
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1536
1520
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1537
1521
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1538
1522
  - Use context keywords from user request to choose appropriate tier
1539
1523
 
1540
1524
  **Test Execution**:
1541
- - Automated Playwright tests are executed via bash command, not through agents
1525
+ - Automated tests are executed via bash command, not through agents
1542
1526
  - Test execution time varies by tier (see strategy document for details)
1543
1527
  - JSON reports provide structured test results for analysis
1544
- - Playwright automatically captures traces, screenshots, and videos on failures
1545
- - Test artifacts are stored in test-results/ directory
1528
+ - Test framework may capture traces, screenshots, and videos on failures (see \`./tests/CLAUDE.md\`)
1529
+ - Test artifacts are stored as defined in \`./tests/CLAUDE.md\`
1546
1530
 
1547
1531
  **Failure Handling**:
1548
1532
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1552,11 +1536,11 @@ If selected test cases have formatting issues:
1552
1536
  - Critical failures trigger immediate team notification
1553
1537
 
1554
1538
  **Related Documentation**:
1555
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1556
- - \`.bugzy/runtime/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1539
+ - \`./tests/docs/test-execution-strategy.md\` - When and why to run specific tests
1540
+ - \`./tests/docs/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1557
1541
  }
1558
1542
  ],
1559
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1543
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1560
1544
  optionalSubagents: ["issue-tracker", "team-communicator"],
1561
1545
  dependentTasks: []
1562
1546
  };
@@ -1580,7 +1564,7 @@ var verifyChangesTask = {
1580
1564
  ## Overview
1581
1565
 
1582
1566
  This task performs comprehensive change verification with:
1583
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1567
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1584
1568
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1585
1569
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1586
1570
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1811,11 +1795,11 @@ Analyze the change description to identify affected feature areas:
1811
1795
 
1812
1796
  | Description Keywords | Inferred Test Scope | Example |
1813
1797
  |---------------------|-------------------|---------|
1814
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1815
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1816
- | "cart", "shopping cart", "add to cart" | \`tests/specs/cart/\` | "Update cart calculations" -> Cart tests |
1798
+ | "login", "authentication", "sign in/up" | Auth test suite | "Fix login page validation" -> Auth tests |
1799
+ | "checkout", "payment", "purchase" | Checkout test suite | "Optimize checkout flow" -> Checkout tests |
1800
+ | "cart", "shopping cart", "add to cart" | Cart test suite | "Update cart calculations" -> Cart tests |
1817
1801
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1818
- | "profile", "account", "settings" | \`tests/specs/profile/\` or \`tests/specs/settings/\` | "Profile page redesign" -> Profile tests |
1802
+ | "profile", "account", "settings" | Profile/settings test suite | "Profile page redesign" -> Profile tests |
1819
1803
 
1820
1804
  **Inference strategy:**
1821
1805
  1. **Extract feature keywords** from PR title and description
@@ -1890,13 +1874,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1890
1874
 
1891
1875
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1892
1876
 
1893
- ### Generate Playwright Specs
1877
+ ### Generate Automated Test Specs
1894
1878
 
1895
1879
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1896
1880
  - Read the manual test cases you just created
1897
1881
  - Explore the feature in the browser to discover selectors and flows
1898
- - Create Page Objects in \`./tests/pages/\` if needed
1899
- - Create test specs in \`./tests/specs/\` matching the test cases
1882
+ - Create page objects in the directory specified by \`./tests/CLAUDE.md\`
1883
+ - Create test specs in the directory specified by \`./tests/CLAUDE.md\`
1900
1884
  - Run each new test to verify it passes
1901
1885
  - Update the manual test case with \`automated_test\` reference
1902
1886
 
@@ -1906,7 +1890,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1906
1890
  conditionalOnSubagent: "test-code-generator"
1907
1891
  },
1908
1892
  // Step 8-11: Test Execution (library steps)
1909
- "run-playwright-tests",
1893
+ "run-tests",
1910
1894
  "parse-test-results",
1911
1895
  "triage-failures",
1912
1896
  "fix-test-issues",
@@ -2095,7 +2079,7 @@ Post PR comment if GitHub context available.`,
2095
2079
  - Recommend: Check test configuration and prerequisites
2096
2080
 
2097
2081
  **If test execution fails:**
2098
- - Report specific error (Playwright not installed, env vars missing)
2082
+ - Report specific error (test framework not installed, env vars missing)
2099
2083
  - Suggest troubleshooting steps
2100
2084
  - Don't proceed with triage if tests didn't run
2101
2085
 
@@ -2125,7 +2109,7 @@ A successful verification includes:
2125
2109
  10. Clear recommendation provided (merge / review / block)`
2126
2110
  }
2127
2111
  ],
2128
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
2112
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
2129
2113
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
2130
2114
  dependentTasks: []
2131
2115
  };
@@ -2174,7 +2158,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2174
2158
  },
2175
2159
  // Phase 2: Exploration Protocol
2176
2160
  "exploration-protocol",
2177
- // Execute exploration via test-runner
2161
+ // Execute exploration via browser-automation
2178
2162
  "create-exploration-test-case",
2179
2163
  "run-exploration",
2180
2164
  "process-exploration-results",
@@ -2185,7 +2169,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2185
2169
  "generate-test-cases",
2186
2170
  "automate-test-cases",
2187
2171
  // Phase 5: Test Execution
2188
- "run-playwright-tests",
2172
+ "run-tests",
2189
2173
  "parse-test-results",
2190
2174
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2191
2175
  "triage-failures",
@@ -2202,7 +2186,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2202
2186
  },
2203
2187
  "generate-final-report"
2204
2188
  ],
2205
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2189
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2206
2190
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2207
2191
  dependentTasks: ["run-tests", "generate-test-cases"]
2208
2192
  };
@@ -2221,7 +2205,7 @@ var exploreApplicationTask = {
2221
2205
  {
2222
2206
  inline: true,
2223
2207
  title: "Explore Application Overview",
2224
- content: `Discover actual UI elements, workflows, and behaviors using the test-runner agent. Updates test plan and project documentation with findings.`
2208
+ content: `Discover actual UI elements, workflows, and behaviors using the browser-automation agent. Updates test plan and project documentation with findings.`
2225
2209
  },
2226
2210
  // Step 2: Security Notice (from library)
2227
2211
  "security-notice",
@@ -2268,7 +2252,7 @@ var exploreApplicationTask = {
2268
2252
  "cleanup-temp-files",
2269
2253
  "update-knowledge-base"
2270
2254
  ],
2271
- requiredSubagents: ["test-runner"],
2255
+ requiredSubagents: ["browser-automation"],
2272
2256
  optionalSubagents: ["team-communicator"],
2273
2257
  dependentTasks: []
2274
2258
  };
@@ -2337,16 +2321,16 @@ After completing your work, update your memory file with relevant insights.
2337
2321
  **Remember:** Every entry should answer "How does this change what I do?"
2338
2322
  `;
2339
2323
 
2340
- // src/subagents/templates/test-runner/playwright.ts
2324
+ // src/subagents/templates/browser-automation/playwright.ts
2341
2325
  var FRONTMATTER = {
2342
- name: "test-runner",
2343
- description: `Execute test cases using Playwright browser automation with comprehensive logging and evidence capture. Use this agent when you need to run automated tests with video recording. Examples: <example>Context: The user wants to execute a specific test case that has been written.
2326
+ name: "browser-automation",
2327
+ description: `Execute test cases using browser automation with comprehensive logging and evidence capture. Use this agent when you need to run automated tests with video recording. Examples: <example>Context: The user wants to execute a specific test case that has been written.
2344
2328
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2345
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2346
- <commentary>Since the user wants to execute a test case file, use the Task tool to launch the test-runner agent with the test case file path.</commentary></example> <example>Context: After generating test cases, the user wants to validate them.
2329
+ assistant: "I'll use the browser-automation agent to execute this test case and capture all the results with video evidence."
2330
+ <commentary>Since the user wants to execute a test case file, use the Task tool to launch the browser-automation agent with the test case file path.</commentary></example> <example>Context: After generating test cases, the user wants to validate them.
2347
2331
  user: "Execute the smoke test for the checkout flow"
2348
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2349
- <commentary>The user needs to run a specific test, so launch the test-runner agent to perform the browser automation with video recording and capture results.</commentary></example>`,
2332
+ assistant: "Let me use the browser-automation agent to execute the checkout smoke test and record all findings with video."
2333
+ <commentary>The user needs to run a specific test, so launch the browser-automation agent to perform the browser automation with video recording and capture results.</commentary></example>`,
2350
2334
  model: "sonnet",
2351
2335
  color: "green"
2352
2336
  };
@@ -2359,9 +2343,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2359
2343
  - Structure of \`steps.json\` with timestamps and video synchronization
2360
2344
  - Field descriptions and data types
2361
2345
 
2362
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2346
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2363
2347
 
2364
- **Memory Sections for Test Runner**:
2348
+ **Memory Sections for Browser Automation**:
2365
2349
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2366
2350
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2367
2351
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2427,7 +2411,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2427
2411
  **Execution Workflow:**
2428
2412
 
2429
2413
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2430
- - Read \`.bugzy/runtime/memory/test-runner.md\` to access your working knowledge
2414
+ - Read \`.bugzy/runtime/memory/browser-automation.md\` to access your working knowledge
2431
2415
  - Check if this test is known to be flaky (apply extra waits if so)
2432
2416
  - Review timing requirements for pages this test will visit
2433
2417
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2479,9 +2463,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2479
2463
  - Video filename reference (just basename, not full path)
2480
2464
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2481
2465
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2482
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2466
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2483
2467
 
2484
- Specifically for test-runner, consider updating:
2468
+ Specifically for browser-automation, consider updating:
2485
2469
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2486
2470
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2487
2471
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -2554,49 +2538,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
2554
2538
  // src/subagents/templates/test-code-generator/playwright.ts
2555
2539
  var FRONTMATTER2 = {
2556
2540
  name: "test-code-generator",
2557
- description: `Generate automated Playwright test scripts, Page Objects, and manual test case documentation from test plans. Use this agent when you need to create executable test code. Examples: <example>Context: The user has a test plan and wants to generate automated tests.
2541
+ description: `Generate automated test scripts, page objects, and test case documentation from test plans. Use this agent when you need to create executable test code. Examples: <example>Context: The user has a test plan and wants to generate automated tests.
2558
2542
  user: "Generate test cases for the login feature based on the test plan"
2559
- assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated Playwright test scripts with Page Objects."
2543
+ assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated test scripts with page objects."
2560
2544
  <commentary>Since the user wants to generate test code from a test plan, use the Task tool to launch the test-code-generator agent.</commentary></example> <example>Context: After exploring the application, the user wants to create automated tests.
2561
2545
  user: "Create automated tests for the checkout flow"
2562
- assistant: "Let me use the test-code-generator agent to generate test scripts, Page Objects, and test case documentation for the checkout flow."
2546
+ assistant: "Let me use the test-code-generator agent to generate test scripts, page objects, and test case documentation for the checkout flow."
2563
2547
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
2564
2548
  model: "sonnet",
2565
2549
  color: "purple"
2566
2550
  };
2567
- var CONTENT2 = `You are an expert Playwright test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
2551
+ var CONTENT2 = `You are an expert test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
2552
+
2553
+ **IMPORTANT: Read \`./tests/CLAUDE.md\` first.** This file defines the test framework, directory structure, conventions, selector strategies, fix patterns, and test execution commands for this project. All generated code must follow these conventions.
2568
2554
 
2569
2555
  **Core Responsibilities:**
2570
2556
 
2571
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\`. This guide contains all detailed patterns for Page Object Model, selector strategies, test organization, authentication, TypeScript practices, and anti-patterns. Follow it meticulously.
2557
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
2558
+ - The test framework and language used
2559
+ - Directory structure (where to put test specs, page objects, fixtures, helpers)
2560
+ - Test structure conventions (how to organize test steps, tagging, etc.)
2561
+ - Selector priority and strategies
2562
+ - How to run tests
2563
+ - Common fix patterns
2572
2564
 
2573
- 2. **Environment Configuration**:
2565
+ 2. **Best Practices Reference**: Read \`./tests/docs/testing-best-practices.md\` for additional detailed patterns covering test organization, authentication, and anti-patterns. Follow it meticulously.
2566
+
2567
+ 3. **Environment Configuration**:
2574
2568
  - Read \`.env.testdata\` for available environment variables
2575
2569
  - Reference variables using \`process.env.VAR_NAME\` in tests
2576
2570
  - Add new required variables to \`.env.testdata\`
2577
2571
  - NEVER read \`.env\` file (secrets only)
2578
2572
  - **If a required variable is missing from \`.env.testdata\`**: Add it with an empty value and a \`# TODO: configure\` comment. Continue creating tests using \`process.env.VAR_NAME\` \u2014 tests will fail until configured, which is expected. Do NOT skip test creation because of missing data.
2579
2573
 
2580
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2574
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2581
2575
 
2582
2576
  **Memory Sections for Test Code Generator**:
2583
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
2577
+ - Generated artifacts (page objects, tests, fixtures, helpers)
2584
2578
  - Test cases automated
2585
2579
  - Selector strategies that work for this application
2586
2580
  - Application architecture patterns learned
2587
2581
  - Environment variables used
2588
2582
  - Test creation history and outcomes
2589
2583
 
2590
- 4. **Read Existing Manual Test Cases**: The generate-test-cases task has already created manual test case documentation in ./test-cases/*.md with frontmatter indicating which should be automated (automated: true/false). Your job is to:
2584
+ 5. **Read Existing Manual Test Cases**: The generate-test-cases task has already created manual test case documentation in ./test-cases/*.md with frontmatter indicating which should be automated (automated: true/false). Your job is to:
2591
2585
  - Read the manual test case files
2592
- - For test cases marked \`automated: true\`, generate automated Playwright tests
2586
+ - For test cases marked \`automated: true\`, generate automated tests
2593
2587
  - Update the manual test case file with the automated_test reference
2594
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
2588
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
2595
2589
 
2596
- 5. **Mandatory Application Exploration**: NEVER generate Page Objects without exploring the live application first using playwright-cli:
2590
+ 6. **Mandatory Application Exploration**: NEVER generate page objects without exploring the live application first using playwright-cli:
2597
2591
  - Navigate to pages, authenticate, inspect elements
2598
2592
  - Capture screenshots for documentation
2599
- - Document exact role names, labels, text, URLs
2593
+ - Document exact element identifiers, labels, text, URLs
2600
2594
  - Test navigation flows manually
2601
2595
  - **NEVER assume selectors** - verify in browser or tests will fail
2602
2596
 
@@ -2604,7 +2598,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2604
2598
 
2605
2599
  1. **Load Memory**:
2606
2600
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
2607
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
2601
+ - Check existing page objects, automated tests, selector strategies, naming conventions
2608
2602
  - Avoid duplication by reusing established patterns
2609
2603
 
2610
2604
  2. **Read Manual Test Cases**:
@@ -2618,20 +2612,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2618
2612
 
2619
2613
  **STEP 1: Check Existing Infrastructure**
2620
2614
 
2621
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
2622
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
2623
- - **Identify gaps**: Determine what POMs or helpers are missing for this test
2615
+ - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing page objects
2616
+ - **Scan codebase**: Look for relevant page objects in the directory specified by \`./tests/CLAUDE.md\`
2617
+ - **Identify gaps**: Determine what page objects or helpers are missing for this test
2624
2618
 
2625
2619
  **STEP 2: Build Missing Infrastructure** (if needed)
2626
2620
 
2627
2621
  - **Explore feature under test**: Use playwright-cli to:
2628
2622
  * Navigate to the feature's pages
2629
- * Inspect elements and gather selectors (role, label, text)
2623
+ * Inspect elements and gather selectors
2630
2624
  * Document actual URLs from the browser
2631
2625
  * Capture screenshots for documentation
2632
2626
  * Test navigation flows manually
2633
2627
  * NEVER assume selectors - verify everything in browser
2634
- - **Create Page Objects**: Build POMs for new pages/components using verified selectors
2628
+ - **Create page objects**: Build page objects for new pages/components using verified selectors, following conventions from \`./tests/CLAUDE.md\`
2635
2629
  - **Create supporting code**: Add any needed fixtures, helpers, or types
2636
2630
 
2637
2631
  **STEP 3: Create Automated Test**
@@ -2639,20 +2633,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2639
2633
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
2640
2634
  * Understand the test objective and steps
2641
2635
  * Note any preconditions or test data requirements
2642
- - **Generate automated test** (./tests/specs/*.spec.ts):
2636
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
2643
2637
  * Use the manual test case steps as the basis
2644
- * Create executable Playwright test using Page Objects
2645
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
2646
- * Each test.step() should directly correspond to a numbered step in the manual test case
2638
+ * Follow the test structure conventions from \`./tests/CLAUDE.md\`
2647
2639
  * Reference manual test case ID in comments
2648
- * Tag critical tests with @smoke
2640
+ * Tag critical tests appropriately (e.g., @smoke)
2649
2641
  - **Update manual test case file**:
2650
2642
  * Set \`automated_test:\` field to the path of the automated test file
2651
2643
  * Link manual \u2194 automated test bidirectionally
2652
2644
 
2653
2645
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
2654
2646
 
2655
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
2647
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
2656
2648
  - **Analyze results**:
2657
2649
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
2658
2650
  * Fail \u2192 Proceed to failure analysis below
@@ -2666,60 +2658,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2666
2658
  | **Product Bug** | Selectors are correct, test logic matches user flow, app behaves unexpectedly, screenshots show app in wrong state | STOP fixing - document as bug, mark test as blocked |
2667
2659
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
2668
2660
 
2669
- **4b. Fix Patterns** (apply based on root cause):
2670
-
2671
- **Fix Type 1: Brittle Selectors**
2672
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2673
- - **Fix**: Replace with role-based selectors
2674
- \`\`\`typescript
2675
- // BEFORE (brittle)
2676
- await page.locator('.btn-primary').click();
2677
- // AFTER (semantic)
2678
- await page.getByRole('button', { name: 'Sign In' }).click();
2679
- \`\`\`
2680
-
2681
- **Fix Type 2: Missing Wait Conditions**
2682
- - **Problem**: Test doesn't wait for elements or actions to complete
2683
- - **Fix**: Add explicit wait for expected state
2684
- \`\`\`typescript
2685
- // BEFORE (race condition)
2686
- await page.goto('/dashboard');
2687
- const items = await page.locator('.item').count();
2688
- // AFTER (explicit wait)
2689
- await page.goto('/dashboard');
2690
- await expect(page.locator('.item')).toHaveCount(5);
2691
- \`\`\`
2692
-
2693
- **Fix Type 3: Race Conditions**
2694
- - **Problem**: Test executes actions before application is ready
2695
- - **Fix**: Wait for specific application state
2696
- \`\`\`typescript
2697
- // BEFORE
2698
- await saveButton.click();
2699
- await expect(successMessage).toBeVisible();
2700
- // AFTER
2701
- await page.locator('.validation-complete').waitFor();
2702
- await saveButton.click();
2703
- await expect(successMessage).toBeVisible();
2704
- \`\`\`
2705
-
2706
- **Fix Type 4: Wrong Assertions**
2707
- - **Problem**: Assertion expects incorrect value or state
2708
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
2709
-
2710
- **Fix Type 5: Test Isolation Issues**
2711
- - **Problem**: Test depends on state from previous tests
2712
- - **Fix**: Add proper setup/teardown or use fixtures
2713
-
2714
- **Fix Type 6: Flaky Tests**
2715
- - **Problem**: Test passes inconsistently
2716
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
2717
- - Run test 10 times to confirm stability after fix
2661
+ **4b. Fix Patterns**: Refer to the "Common Fix Patterns" section in \`./tests/CLAUDE.md\` for framework-specific fix strategies. Apply the appropriate pattern based on root cause.
2718
2662
 
2719
2663
  **4c. Fix Workflow**:
2720
2664
  1. Read failure report and classify (product bug vs test issue)
2721
2665
  2. If product bug: Document and mark test as blocked, move to next test
2722
- 3. If test issue: Apply appropriate fix from patterns above
2666
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
2723
2667
  4. Re-run test to verify fix
2724
2668
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
2725
2669
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -2728,9 +2672,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2728
2672
 
2729
2673
  | Failure Type | Root Cause | Action |
2730
2674
  |--------------|------------|--------|
2731
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
2732
- | Timeout waiting | Missing wait condition | Add explicit wait |
2733
- | Flaky (timing) | Race condition | Add synchronization wait |
2675
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
2676
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
2677
+ | Flaky (timing) | Race condition | Apply synchronization fix pattern from CLAUDE.md |
2734
2678
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
2735
2679
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
2736
2680
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -2738,13 +2682,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2738
2682
  **STEP 5: Move to Next Test Case**
2739
2683
 
2740
2684
  - Repeat process for each test case in the plan
2741
- - Reuse existing POMs and infrastructure wherever possible
2685
+ - Reuse existing page objects and infrastructure wherever possible
2742
2686
  - Continuously update memory with new patterns and learnings
2743
2687
 
2744
2688
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2745
2689
 
2746
2690
  Specifically for test-code-generator, consider updating:
2747
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
2691
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
2748
2692
  - **Test Cases Automated**: Record which test cases were automated with references
2749
2693
  - **Selector Strategies**: Note what selector strategies work well for this application
2750
2694
  - **Application Patterns**: Document architecture patterns learned
@@ -2754,7 +2698,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2754
2698
  - Test automation results (tests created, pass/fail status, issues found)
2755
2699
  - Manual test cases automated (count, IDs, titles)
2756
2700
  - Automated tests created (count, smoke vs functional)
2757
- - Page Objects, fixtures, helpers added
2701
+ - Page objects, fixtures, helpers added
2758
2702
  - Next steps (commands to run tests)
2759
2703
 
2760
2704
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -2765,7 +2709,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2765
2709
  ## Last Updated: [timestamp]
2766
2710
 
2767
2711
  ## Generated Test Artifacts
2768
- [Page Objects created with locators and methods]
2712
+ [Page objects created with locators and methods]
2769
2713
  [Test cases automated with manual TC references and file paths]
2770
2714
  [Fixtures, helpers, components created]
2771
2715
 
@@ -2774,26 +2718,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2774
2718
  [Tests passing vs failing with product bugs]
2775
2719
 
2776
2720
  ## Fixed Issues History
2777
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
2778
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState for async validation
2721
+ - [Date] TC-001: Applied selector fix pattern
2722
+ - [Date] TC-003: Applied wait fix pattern for async validation
2779
2723
 
2780
2724
  ## Failure Pattern Library
2781
2725
 
2782
2726
  ### Pattern: Selector Timeout on Dynamic Content
2783
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
2727
+ **Symptoms**: Element not found, element loads after timeout
2784
2728
  **Root Cause**: Selector runs before element rendered
2785
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
2729
+ **Fix Strategy**: Add explicit visibility wait before interaction
2786
2730
  **Success Rate**: [track over time]
2787
2731
 
2788
2732
  ### Pattern: Race Condition on Form Submission
2789
- **Symptoms**: Test clicks submit before validation completes
2733
+ **Symptoms**: Test interacts before validation completes
2790
2734
  **Root Cause**: Missing wait for validation state
2791
2735
  **Fix Strategy**: Wait for validation indicator before submit
2792
2736
 
2793
2737
  ## Known Stable Selectors
2794
2738
  [Selectors that reliably work for this application]
2795
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
2796
- - Email field: \`getByLabel('Email')\`
2797
2739
 
2798
2740
  ## Known Product Bugs (Do Not Fix Tests)
2799
2741
  [Actual bugs discovered - tests should remain failing]
@@ -2804,9 +2746,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2804
2746
 
2805
2747
  ## Application Behavior Patterns
2806
2748
  [Load times, async patterns, navigation flows discovered]
2807
- - Auth pages: redirect timing
2808
- - Dashboard: lazy loading patterns
2809
- - Forms: validation timing
2810
2749
 
2811
2750
  ## Selector Strategy Library
2812
2751
  [Successful selector patterns and their success rates]
@@ -2821,32 +2760,23 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2821
2760
 
2822
2761
  **Critical Rules:**
2823
2762
 
2824
- \u274C **NEVER**:
2825
- - Generate selectors without exploring the live application - causes 100% test failure
2826
- - Assume URLs, selectors, or navigation patterns - verify in browser
2827
- - Skip exploration even if documentation seems detailed
2828
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
2829
- - Put assertions in Page Objects - only in test files
2830
- - Read .env file - only .env.testdata
2831
- - Create test interdependencies - tests must be independent
2832
-
2833
- \u2705 **ALWAYS**:
2834
- - Explore application using playwright-cli before generating code
2835
- - Verify selectors in live browser using playwright-cli snapshot
2836
- - Document actual URLs from browser address bar
2837
- - Take screenshots for documentation
2838
- - Use role-based selectors as first priority
2839
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
2840
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2841
- - Follow .bugzy/runtime/testing-best-practices.md
2842
- - Read existing manual test cases and automate those marked automated: true
2843
-
2844
- Follow .bugzy/runtime/testing-best-practices.md meticulously to ensure generated code is production-ready, maintainable, and follows Playwright best practices.`;
2763
+ - **NEVER** generate selectors without exploring the live application - causes 100% test failure
2764
+ - **NEVER** assume URLs, selectors, or navigation patterns - verify in browser
2765
+ - **NEVER** skip exploration even if documentation seems detailed
2766
+ - **NEVER** read .env file - only .env.testdata
2767
+ - **NEVER** create test interdependencies - tests must be independent
2768
+ - **ALWAYS** explore application using playwright-cli before generating code
2769
+ - **ALWAYS** verify selectors in live browser using playwright-cli snapshot
2770
+ - **ALWAYS** document actual URLs from browser address bar
2771
+ - **ALWAYS** follow conventions defined in \`./tests/CLAUDE.md\`
2772
+ - **ALWAYS** link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2773
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
2774
+ - **ALWAYS** read existing manual test cases and automate those marked automated: true`;
2845
2775
 
2846
2776
  // src/subagents/templates/test-debugger-fixer/playwright.ts
2847
2777
  var FRONTMATTER3 = {
2848
2778
  name: "test-debugger-fixer",
2849
- description: `Debug and fix failing automated tests by analyzing failures, exploring the application, and updating test code. Use this agent when automated Playwright tests fail and need to be fixed. Examples: <example>Context: Automated test failed with "Timeout waiting for selector".
2779
+ description: `Debug and fix failing automated tests by analyzing failures, exploring the application, and updating test code. Use this agent when automated tests fail and need to be fixed. Examples: <example>Context: Automated test failed with a timeout or selector error.
2850
2780
  user: "Fix the failing login test"
2851
2781
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
2852
2782
  <commentary>Since an automated test is failing, use the Task tool to launch the test-debugger-fixer agent.</commentary></example> <example>Context: Test is flaky, passing 7/10 times.
@@ -2856,18 +2786,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
2856
2786
  model: "sonnet",
2857
2787
  color: "yellow"
2858
2788
  };
2859
- var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep expertise in automated test maintenance, debugging test failures, and ensuring test stability. Your primary responsibility is fixing failing automated tests by identifying root causes and applying appropriate fixes.
2789
+ var CONTENT3 = `You are an expert test debugger and fixer with deep expertise in automated test maintenance, debugging test failures, and ensuring test stability. Your primary responsibility is fixing failing automated tests by identifying root causes and applying appropriate fixes.
2790
+
2791
+ **IMPORTANT: Read \`./tests/CLAUDE.md\` first.** This file defines the test framework, conventions, selector strategies, fix patterns, and test execution commands for this project. All debugging and fixes must follow these conventions.
2860
2792
 
2861
2793
  **Core Responsibilities:**
2862
2794
 
2863
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
2864
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
2865
- - Correct waiting and synchronization patterns
2866
- - Test isolation principles
2867
- - Common anti-patterns to avoid
2868
- - Debugging workflow and techniques
2795
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
2796
+ - The test framework and language used
2797
+ - Selector strategies and priorities
2798
+ - Waiting and synchronization patterns
2799
+ - Common fix patterns for this framework
2800
+ - How to run tests
2801
+ - Test result artifacts format
2802
+
2803
+ 2. **Best Practices Reference**: Read \`./tests/docs/testing-best-practices.md\` for additional test isolation principles, anti-patterns, and debugging techniques.
2869
2804
 
2870
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2805
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2871
2806
 
2872
2807
  **Memory Sections for Test Debugger Fixer**:
2873
2808
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -2877,7 +2812,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2877
2812
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
2878
2813
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
2879
2814
 
2880
- 3. **Failure Analysis**: When a test fails, you must:
2815
+ 4. **Failure Analysis**: When a test fails, you must:
2881
2816
  - Read the failing test file to understand what it's trying to do
2882
2817
  - Read the failure details from the JSON test report
2883
2818
  - Examine error messages, stack traces, and failure context
@@ -2886,7 +2821,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2886
2821
  - **Product bug**: Correct test code, but application behaves unexpectedly
2887
2822
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
2888
2823
 
2889
- 3. **Triage Decision**: Determine if this is a product bug or test issue:
2824
+ 5. **Triage Decision**: Determine if this is a product bug or test issue:
2890
2825
 
2891
2826
  **Product Bug Indicators**:
2892
2827
  - Selectors are correct and elements exist
@@ -2901,9 +2836,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2901
2836
  - Flaky behavior (passes sometimes, fails other times)
2902
2837
  - Wrong assertions (expecting incorrect values)
2903
2838
  - Test isolation problems (depends on other tests)
2904
- - Brittle selectors (CSS classes, IDs that change)
2839
+ - Brittle selectors that change between builds
2905
2840
 
2906
- 4. **Debug Using Browser**: When needed, explore the application manually:
2841
+ 6. **Debug Using Browser**: When needed, explore the application manually:
2907
2842
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
2908
2843
  - Navigate to the relevant page
2909
2844
  - Inspect elements to find correct selectors
@@ -2912,87 +2847,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2912
2847
  - Verify application state matches test expectations
2913
2848
  - Take notes on differences between expected and actual behavior
2914
2849
 
2915
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
2916
-
2917
- **Fix Type 1: Brittle Selectors**
2918
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2919
- - **Fix**: Replace with role-based selectors
2920
- - **Example**:
2921
- \`\`\`typescript
2922
- // BEFORE (brittle)
2923
- await page.locator('.btn-primary').click();
2924
-
2925
- // AFTER (semantic)
2926
- await page.getByRole('button', { name: 'Sign In' }).click();
2927
- \`\`\`
2928
-
2929
- **Fix Type 2: Missing Wait Conditions**
2930
- - **Problem**: Test doesn't wait for elements or actions to complete
2931
- - **Fix**: Add explicit wait for expected state
2932
- - **Example**:
2933
- \`\`\`typescript
2934
- // BEFORE (race condition)
2935
- await page.goto('/dashboard');
2936
- const items = await page.locator('.item').count();
2937
-
2938
- // AFTER (explicit wait)
2939
- await page.goto('/dashboard');
2940
- await expect(page.locator('.item')).toHaveCount(5);
2941
- \`\`\`
2942
-
2943
- **Fix Type 3: Race Conditions**
2944
- - **Problem**: Test executes actions before application is ready
2945
- - **Fix**: Wait for specific application state
2946
- - **Example**:
2947
- \`\`\`typescript
2948
- // BEFORE (race condition)
2949
- await saveButton.click();
2950
- await expect(successMessage).toBeVisible();
2951
-
2952
- // AFTER (wait for ready state)
2953
- await page.locator('.validation-complete').waitFor();
2954
- await saveButton.click();
2955
- await expect(successMessage).toBeVisible();
2956
- \`\`\`
2957
-
2958
- **Fix Type 4: Wrong Assertions**
2959
- - **Problem**: Assertion expects incorrect value or state
2960
- - **Fix**: Update assertion to match actual application behavior (if correct)
2961
- - **Example**:
2962
- \`\`\`typescript
2963
- // BEFORE (wrong expectation)
2964
- await expect(heading).toHaveText('Welcome John');
2965
-
2966
- // AFTER (corrected)
2967
- await expect(heading).toHaveText('Welcome, John!');
2968
- \`\`\`
2969
-
2970
- **Fix Type 5: Test Isolation Issues**
2971
- - **Problem**: Test depends on state from previous tests
2972
- - **Fix**: Add proper setup/teardown or use fixtures
2973
- - **Example**:
2974
- \`\`\`typescript
2975
- // BEFORE (depends on previous test)
2976
- test('should logout', async ({ page }) => {
2977
- await page.goto('/dashboard');
2978
- // Assumes user is already logged in
2979
- });
2980
-
2981
- // AFTER (isolated with fixture)
2982
- test('should logout', async ({ page, authenticatedUser }) => {
2983
- await page.goto('/dashboard');
2984
- // Uses fixture for clean state
2985
- });
2986
- \`\`\`
2987
-
2988
- **Fix Type 6: Flaky Tests**
2989
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
2990
- - **Fix**: Identify and eliminate non-determinism
2991
- - Common causes: timing issues, race conditions, animation delays, network timing
2992
- - Run test multiple times to reproduce flakiness
2993
- - Add proper waits for stable state
2994
-
2995
- 6. **Fixing Workflow**:
2850
+ 7. **Fix Test Issues**: Apply appropriate fixes based on root cause. Refer to the "Common Fix Patterns" section in \`./tests/CLAUDE.md\` for framework-specific fix strategies and examples.
2851
+
2852
+ 8. **Fixing Workflow**:
2996
2853
 
2997
2854
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
2998
2855
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -3005,7 +2862,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3005
2862
  **Step 1: Read Test File**
3006
2863
  - Understand test intent and logic
3007
2864
  - Identify what the test is trying to verify
3008
- - Note test structure and Page Objects used
2865
+ - Note test structure and page objects used
3009
2866
 
3010
2867
  **Step 2: Read Failure Report**
3011
2868
  - Parse JSON test report for failure details
@@ -3024,14 +2881,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3024
2881
  - **If test issue**: Proceed to fix
3025
2882
 
3026
2883
  **Step 5: Apply Fix**
3027
- - Edit test file with appropriate fix
2884
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
3028
2885
  - Update selectors, waits, assertions, or logic
3029
- - Follow best practices from testing guide
2886
+ - Follow conventions from \`./tests/CLAUDE.md\`
3030
2887
  - Add comments explaining the fix if complex
3031
2888
 
3032
2889
  **Step 6: Verify Fix**
3033
- - Run the fixed test: \`npx playwright test [test-file]\`
3034
- - **IMPORTANT: Do NOT use \`--reporter\` flag** - the custom bugzy-reporter in playwright.config.ts must run to create the hierarchical test-runs output needed for analysis
2890
+ - Run the fixed test using the command from \`./tests/CLAUDE.md\`
2891
+ - **IMPORTANT: Do NOT use \`--reporter\` flag** - the custom bugzy-reporter must run to create the hierarchical test-runs output needed for analysis
3035
2892
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
3036
2893
  - Read manifest.json to confirm test passes in latest execution
3037
2894
  - For flaky tests: Run 10 times to ensure stability
@@ -3052,7 +2909,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3052
2909
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
3053
2910
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
3054
2911
 
3055
- 7. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
2912
+ 9. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3056
2913
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3057
2914
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3058
2915
  \`\`\`json
@@ -3083,77 +2940,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3083
2940
  \`\`\`
3084
2941
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3085
2942
 
3086
- 8. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
2943
+ 10. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3087
2944
 
3088
- \`\`\`markdown
3089
- # Test Debugger Fixer Memory
3090
-
3091
- ## Last Updated: [timestamp]
3092
-
3093
- ## Fixed Issues History
3094
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3095
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3096
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3097
-
3098
- ## Failure Pattern Library
3099
-
3100
- ### Pattern: Selector Timeout on Dynamic Content
3101
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3102
- **Root Cause**: Selector runs before element rendered
3103
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3104
- **Success Rate**: 95% (used 12 times)
3105
-
3106
- ### Pattern: Race Condition on Form Submission
3107
- **Symptoms**: Test clicks submit before validation completes
3108
- **Root Cause**: Missing wait for validation state
3109
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3110
- **Success Rate**: 100% (used 8 times)
3111
-
3112
- ## Known Stable Selectors
3113
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3114
- - Email field: \`getByLabel('Email')\`
3115
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3116
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3117
-
3118
- ## Known Product Bugs (Do Not Fix Tests)
3119
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3120
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3121
-
3122
- ## Flaky Test Tracking
3123
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3124
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3125
-
3126
- ## Application Behavior Patterns
3127
- - **Auth Pages**: Redirect after 200ms delay
3128
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3129
- - **Forms**: Validation runs on blur + submit events
3130
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3131
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3132
- \`\`\`
2945
+ \`\`\`markdown
2946
+ # Test Debugger Fixer Memory
2947
+
2948
+ ## Last Updated: [timestamp]
2949
+
2950
+ ## Fixed Issues History
2951
+ - [Date] TC-001: Applied selector fix pattern
2952
+ - [Date] TC-003: Applied wait fix pattern for async validation
2953
+ - [Date] TC-005: Fixed race condition with explicit wait for data load
2954
+
2955
+ ## Failure Pattern Library
2956
+
2957
+ ### Pattern: Selector Timeout on Dynamic Content
2958
+ **Symptoms**: Element not found, element loads after timeout
2959
+ **Root Cause**: Selector runs before element rendered
2960
+ **Fix Strategy**: Add explicit visibility wait before interaction
2961
+ **Success Rate**: 95% (used 12 times)
2962
+
2963
+ ### Pattern: Race Condition on Form Submission
2964
+ **Symptoms**: Test interacts before validation completes
2965
+ **Root Cause**: Missing wait for validation state
2966
+ **Fix Strategy**: Wait for validation indicator before submit
2967
+ **Success Rate**: 100% (used 8 times)
2968
+
2969
+ ## Known Stable Selectors
2970
+ [Selectors that reliably work for this application]
2971
+
2972
+ ## Known Product Bugs (Do Not Fix Tests)
2973
+ [Actual bugs discovered - tests should remain failing]
2974
+
2975
+ ## Flaky Test Tracking
2976
+ [Tests with intermittent failures and their root causes]
2977
+
2978
+ ## Application Behavior Patterns
2979
+ [Load times, async patterns, navigation flows discovered]
2980
+ \`\`\`
2981
+
2982
+ 11. **Environment Configuration**:
2983
+ - Tests use \`process.env.VAR_NAME\` for configuration
2984
+ - Read \`.env.testdata\` to understand available variables
2985
+ - NEVER read \`.env\` file (contains secrets only)
2986
+ - If test needs new environment variable, update \`.env.testdata\`
3133
2987
 
3134
- 9. **Environment Configuration**:
3135
- - Tests use \`process.env.VAR_NAME\` for configuration
3136
- - Read \`.env.testdata\` to understand available variables
3137
- - NEVER read \`.env\` file (contains secrets only)
3138
- - If test needs new environment variable, update \`.env.testdata\`
3139
-
3140
- 9. **Using playwright-cli for Debugging**:
3141
- - You have direct access to playwright-cli via Bash
3142
- - Open browser: \`playwright-cli open <url>\`
3143
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3144
- - Navigate: \`playwright-cli navigate <url>\`
3145
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3146
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3147
- - Close browser: \`playwright-cli close\`
3148
-
3149
- 10. **Test Stability Best Practices**:
3150
- - Replace all \`waitForTimeout()\` with specific waits
3151
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3152
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3153
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3154
- - Handle dynamic content with proper waits
3155
-
3156
- 11. **Communication**:
2988
+ 12. **Using playwright-cli for Debugging**:
2989
+ - You have direct access to playwright-cli via Bash
2990
+ - Open browser: \`playwright-cli open <url>\`
2991
+ - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
2992
+ - Navigate: \`playwright-cli navigate <url>\`
2993
+ - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
2994
+ - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
2995
+ - Close browser: \`playwright-cli close\`
2996
+
2997
+ 13. **Communication**:
3157
2998
  - Be clear about whether issue is product bug or test issue
3158
2999
  - Explain root cause of test failure
3159
3000
  - Describe fix applied in plain language
@@ -3164,31 +3005,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3164
3005
 
3165
3006
  | Failure Type | Root Cause | Action |
3166
3007
  |--------------|------------|--------|
3167
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3168
- | Timeout waiting | Missing wait condition | Add explicit wait |
3169
- | Flaky (timing) | Race condition | Add synchronization wait |
3008
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
3009
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
3010
+ | Flaky (timing) | Race condition | Apply synchronization fix from CLAUDE.md |
3170
3011
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3171
3012
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3172
3013
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3173
3014
 
3174
- **Anti-Patterns to Avoid:**
3175
-
3176
- \u274C **DO NOT**:
3177
- - Fix tests when the issue is a product bug
3178
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3179
- - Make tests pass by lowering expectations
3180
- - Introduce new test dependencies
3181
- - Skip proper verification of fixes
3182
- - Exceed 3 fix attempts (escalate instead)
3183
-
3184
- \u2705 **DO**:
3185
- - Thoroughly analyze before fixing
3186
- - Use semantic selectors when replacing brittle ones
3187
- - Add explicit waits for specific conditions
3188
- - Verify fixes by re-running tests
3189
- - Run flaky tests 10 times to confirm stability
3190
- - Report product bugs instead of making tests ignore them
3191
- - Follow testing best practices guide
3015
+ **Critical Rules:**
3016
+
3017
+ - **NEVER** fix tests when the issue is a product bug
3018
+ - **NEVER** make tests pass by lowering expectations
3019
+ - **NEVER** introduce new test dependencies
3020
+ - **NEVER** skip proper verification of fixes
3021
+ - **NEVER** exceed 3 fix attempts (escalate instead)
3022
+ - **ALWAYS** thoroughly analyze before fixing
3023
+ - **ALWAYS** follow fix patterns from \`./tests/CLAUDE.md\`
3024
+ - **ALWAYS** verify fixes by re-running tests
3025
+ - **ALWAYS** run flaky tests 10 times to confirm stability
3026
+ - **ALWAYS** report product bugs instead of making tests ignore them
3027
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3192
3028
 
3193
3029
  **Output Format**:
3194
3030
 
@@ -3207,12 +3043,12 @@ Verification:
3207
3043
  - Run 1: [passed/failed]
3208
3044
  - Run 2-10: [if flaky test]
3209
3045
 
3210
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
3046
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3211
3047
 
3212
3048
  Next Steps: [run tests / log bug / review manually]
3213
3049
  \`\`\`
3214
3050
 
3215
- Follow the testing best practices guide meticulously. Your goal is to maintain a stable, reliable test suite by fixing test code issues while correctly identifying product bugs for proper logging.`;
3051
+ Follow the conventions in \`./tests/CLAUDE.md\` and the testing best practices guide meticulously. Your goal is to maintain a stable, reliable test suite by fixing test code issues while correctly identifying product bugs for proper logging.`;
3216
3052
 
3217
3053
  // src/subagents/templates/team-communicator/local.ts
3218
3054
  var FRONTMATTER4 = {
@@ -5743,7 +5579,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
5743
5579
 
5744
5580
  // src/subagents/templates/index.ts
5745
5581
  var TEMPLATES = {
5746
- "test-runner": {
5582
+ "browser-automation": {
5747
5583
  playwright: {
5748
5584
  frontmatter: FRONTMATTER,
5749
5585
  content: CONTENT
@@ -5932,9 +5768,9 @@ var INTEGRATIONS = {
5932
5768
  }
5933
5769
  };
5934
5770
  var SUBAGENTS = {
5935
- "test-runner": {
5936
- role: "test-runner",
5937
- name: "Test Runner",
5771
+ "browser-automation": {
5772
+ role: "browser-automation",
5773
+ name: "Browser Automation",
5938
5774
  description: "Execute automated browser tests (always included)",
5939
5775
  icon: "play",
5940
5776
  integrations: [INTEGRATIONS.playwright],
@@ -5991,7 +5827,7 @@ var SUBAGENTS = {
5991
5827
  "test-code-generator": {
5992
5828
  role: "test-code-generator",
5993
5829
  name: "Test Code Generator",
5994
- description: "Generate automated Playwright test scripts and Page Objects",
5830
+ description: "Generate automated test scripts and page objects",
5995
5831
  icon: "code",
5996
5832
  integrations: [INTEGRATIONS.playwright],
5997
5833
  model: "sonnet",
@@ -6080,9 +5916,9 @@ function buildSubagentsConfig(subagents) {
6080
5916
  // src/core/tool-strings.ts
6081
5917
  var TOOL_STRINGS = {
6082
5918
  "claude-code": {
6083
- INVOKE_TEST_RUNNER: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "test-runner"` to delegate test execution.\nThe test-runner agent will handle all browser automation. DO NOT execute Playwright MCP tools directly.\nInclude the test case path and any specific instructions in the prompt.',
5919
+ INVOKE_BROWSER_AUTOMATION: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "browser-automation"` to delegate test execution.\nThe browser-automation agent will handle all browser automation. DO NOT execute Playwright MCP tools directly.\nInclude the test case path and any specific instructions in the prompt.',
6084
5920
  INVOKE_TEST_DEBUGGER_FIXER: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "test-debugger-fixer"` to delegate debugging.\nThe agent will analyze failures and fix test code. Include error details and test path in the prompt.',
6085
- INVOKE_TEST_CODE_GENERATOR: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "test-code-generator"` to delegate code generation.\nThe agent will create Playwright tests and Page Objects. Include test case files in the prompt.',
5921
+ INVOKE_TEST_CODE_GENERATOR: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "test-code-generator"` to delegate code generation.\nThe agent will create automated tests and page objects. Include test case files in the prompt.',
6086
5922
  INVOKE_TEAM_COMMUNICATOR: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "team-communicator"` to send team notifications.\nThe agent will post to Slack/Teams/Email. Include message content and context in the prompt.',
6087
5923
  INLINE_TEAM_COMMUNICATOR: "**TEAM COMMUNICATION**: Read `.claude/agents/team-communicator.md` and follow its instructions to communicate with the team.\nUse the tools and guidelines specified in that file within this context. Do NOT spawn a sub-agent.",
6088
5924
  INVOKE_ISSUE_TRACKER: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "issue-tracker"` to create/update issues.\nThe agent will interact with Jira. Include bug details and classification in the prompt.',
@@ -6090,7 +5926,7 @@ var TOOL_STRINGS = {
6090
5926
  INVOKE_CHANGELOG_HISTORIAN: '**DELEGATE TO SUBAGENT**: Use the Task tool with `subagent_type: "changelog-historian"` to retrieve change history.\nThe agent will query GitHub for PRs and commits. Include repo context and date range in the prompt.'
6091
5927
  },
6092
5928
  "cursor": {
6093
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-runner.md)" --output-format text\n```',
5929
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/browser-automation.md)" --output-format text\n```',
6094
5930
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-debugger-fixer.md)" --output-format text\n```',
6095
5931
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-code-generator.md)" --output-format text\n```',
6096
5932
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -6100,7 +5936,7 @@ var TOOL_STRINGS = {
6100
5936
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
6101
5937
  },
6102
5938
  "codex": {
6103
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncodex -p "$(cat .codex/agents/test-runner.md)"\n```',
5939
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncodex -p "$(cat .codex/agents/browser-automation.md)"\n```',
6104
5940
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
6105
5941
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
6106
5942
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -6124,7 +5960,7 @@ function getToolString(toolId, key) {
6124
5960
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
6125
5961
  let result = content;
6126
5962
  const keys = [
6127
- "INVOKE_TEST_RUNNER",
5963
+ "INVOKE_BROWSER_AUTOMATION",
6128
5964
  "INVOKE_TEST_DEBUGGER_FIXER",
6129
5965
  "INVOKE_TEST_CODE_GENERATOR",
6130
5966
  "INVOKE_TEAM_COMMUNICATOR",
@@ -6212,7 +6048,7 @@ var readTestStrategyStep = {
6212
6048
  category: "setup",
6213
6049
  content: `## Read Test Execution Strategy
6214
6050
 
6215
- **IMPORTANT**: Before selecting tests, read \`.bugzy/runtime/test-execution-strategy.md\` to understand:
6051
+ **IMPORTANT**: Before selecting tests, read \`./tests/docs/test-execution-strategy.md\` to understand:
6216
6052
  - Available test tiers (Smoke, Component, Full Regression)
6217
6053
  - When to use each tier (commit, PR, release, debug)
6218
6054
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6222,7 +6058,7 @@ var readTestStrategyStep = {
6222
6058
 
6223
6059
  Apply the strategy guidance when determining which tests to run.
6224
6060
 
6225
- **First**, consult \`.bugzy/runtime/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6061
+ **First**, consult \`./tests/docs/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6226
6062
  tags: ["setup", "test-execution", "strategy"]
6227
6063
  };
6228
6064
 
@@ -6245,7 +6081,7 @@ Check for existing project context to inform your work:
6245
6081
  - Environment details
6246
6082
 
6247
6083
  **2. Check Test Execution Strategy**
6248
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6084
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6249
6085
  - Understand available test tiers and when to use them
6250
6086
  - Note default behaviors and time/coverage trade-offs
6251
6087
 
@@ -6838,34 +6674,22 @@ When reporting test results, always include an "Ambiguities" section if clarific
6838
6674
  tags: ["clarification", "protocol", "ambiguity"]
6839
6675
  };
6840
6676
 
6841
- // src/tasks/steps/execution/run-playwright-tests.ts
6842
- var runPlaywrightTestsStep = {
6843
- id: "run-playwright-tests",
6844
- title: "Execute Playwright Tests",
6677
+ // src/tasks/steps/execution/run-tests.ts
6678
+ var runTestsStep = {
6679
+ id: "run-tests",
6680
+ title: "Execute Automated Tests",
6845
6681
  category: "execution",
6846
- content: `## Execute Playwright Tests
6682
+ content: `## Execute Automated Tests
6847
6683
 
6848
- Run automated Playwright tests and capture results.
6684
+ Run automated tests and capture results.
6849
6685
 
6850
- **Build Playwright Command** based on selector:
6686
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
6851
6687
 
6852
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
6853
- Use npm scripts to run tests - no manual env export needed.
6854
-
6855
- **For file pattern or specific file**:
6856
- \`\`\`bash
6857
- npm test -- [selector]
6858
- \`\`\`
6688
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
6859
6689
 
6860
- **For tag**:
6861
- \`\`\`bash
6862
- npm test -- --grep "[tag]"
6863
- \`\`\`
6864
-
6865
- **For all tests**:
6866
- \`\`\`bash
6867
- npm test
6868
- \`\`\`
6690
+ - **For file pattern or specific file**: Use the framework's file selection command
6691
+ - **For tag**: Use the framework's tag/grep filtering command
6692
+ - **For all tests**: Use the default run-all command
6869
6693
 
6870
6694
  Wait for execution to complete. This may take several minutes depending on test count.
6871
6695
 
@@ -6883,7 +6707,7 @@ Wait for execution to complete. This may take several minutes depending on test
6883
6707
  \`\`\`
6884
6708
 
6885
6709
  2. Store the timestamp for use in subsequent steps`,
6886
- invokesSubagents: ["test-runner"],
6710
+ invokesSubagents: ["browser-automation"],
6887
6711
  tags: ["execution", "tests"]
6888
6712
  };
6889
6713
 
@@ -6982,10 +6806,10 @@ For each failed test:
6982
6806
  | Classification | Indicators | Examples |
6983
6807
  |---------------|------------|----------|
6984
6808
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
6985
- | **Test Issue** | Test code needs fixing | Selector not found but element exists, \`expect(locator).toBeVisible()\` timeout on existing element, Race condition, Wrong assertion |
6809
+ | **Test Issue** | Test code needs fixing | Selector not found but element exists, Timeout on existing element, Race condition, Wrong assertion |
6986
6810
 
6987
- **Common Test Issues:**
6988
- - Brittle selectors (CSS path instead of data-testid or role)
6811
+ **Common Test Issues** (refer to \`./tests/CLAUDE.md\` "Common Fix Patterns" for framework-specific guidance):
6812
+ - Brittle selectors (not following selector priority from CLAUDE.md)
6989
6813
  - Missing waits for async operations
6990
6814
  - Race conditions with animations
6991
6815
  - Incorrect expected values
@@ -7032,7 +6856,7 @@ The agent will:
7032
6856
  1. Read the execution details from result.json
7033
6857
  2. Analyze the failure (error message, trace if available)
7034
6858
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
7035
- 4. Apply appropriate fix to the test code
6859
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
7036
6860
  5. Rerun the test
7037
6861
  6. The custom reporter will automatically create the next exec-N/ folder
7038
6862
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -7044,7 +6868,7 @@ The agent will:
7044
6868
 
7045
6869
  **Track Fixed Tests:**
7046
6870
  - Maintain list of tests fixed automatically
7047
- - Include fix description (e.g., "Updated selector from CSS to role-based")
6871
+ - Include fix description (e.g., "Applied selector fix pattern from CLAUDE.md")
7048
6872
  - Note verification status (test now passes)`,
7049
6873
  invokesSubagents: ["test-debugger-fixer"],
7050
6874
  tags: ["execution", "fixing", "automation"]
@@ -7087,7 +6911,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7087
6911
  - Trace file: [path if available]
7088
6912
  - Screenshots: [paths if available]
7089
6913
  - **Environment Details**:
7090
- - Browser and version (from Playwright config)
6914
+ - Browser and version (from test framework config)
7091
6915
  - Test environment URL (from .env.testdata BASE_URL)
7092
6916
  - Timestamp of failure
7093
6917
  - **Severity/Priority**: Based on:
@@ -7126,7 +6950,7 @@ var createExplorationTestCaseStep = {
7126
6950
  category: "execution",
7127
6951
  content: `## Create Exploration Test Case
7128
6952
 
7129
- Generate a temporary exploration test case for the test-runner.
6953
+ Generate a temporary exploration test case for the browser-automation agent.
7130
6954
 
7131
6955
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7132
6956
 
@@ -7165,7 +6989,7 @@ var runExplorationStep = {
7165
6989
  category: "execution",
7166
6990
  content: `## Run Exploration
7167
6991
 
7168
- {{INVOKE_TEST_RUNNER}}
6992
+ {{INVOKE_BROWSER_AUTOMATION}}
7169
6993
 
7170
6994
  Execute the exploration test case with the following focus:
7171
6995
 
@@ -7190,7 +7014,7 @@ Generate comprehensive findings report.
7190
7014
  - \`test-log.md\` - Detailed execution log
7191
7015
  - \`screenshots/\` - Visual documentation
7192
7016
  - \`summary.json\` - Execution summary`,
7193
- invokesSubagents: ["test-runner"],
7017
+ invokesSubagents: ["browser-automation"],
7194
7018
  tags: ["execution", "exploration"]
7195
7019
  };
7196
7020
 
@@ -7201,7 +7025,7 @@ var processExplorationResultsStep = {
7201
7025
  category: "execution",
7202
7026
  content: `## Process Exploration Results
7203
7027
 
7204
- Read and parse the test-runner output from exploration.
7028
+ Read and parse the browser-automation agent output from exploration.
7205
7029
 
7206
7030
  **Locate results:**
7207
7031
  \`\`\`bash
@@ -7338,23 +7162,22 @@ For each test case marked \`automated: true\`:
7338
7162
  - Exploration findings: ./exploration-reports/
7339
7163
 
7340
7164
  **The agent should:**
7341
- 1. Read manual test case files
7342
- 2. Explore the feature to gather selectors
7343
- 3. Create Page Objects and automated tests
7344
- 4. Run each test and iterate until passing (max 3 attempts)
7345
- 5. Update manual test case with automated_test reference
7346
- 6. Document any product bugs discovered
7165
+ 1. Read \`./tests/CLAUDE.md\` for framework conventions, directory structure, and commands
7166
+ 2. Read manual test case files
7167
+ 3. Explore the feature to gather selectors
7168
+ 4. Create page objects and automated tests following conventions from CLAUDE.md
7169
+ 5. Run each test using the command from CLAUDE.md and iterate until passing (max 3 attempts)
7170
+ 6. Update manual test case with automated_test reference
7171
+ 7. Document any product bugs discovered
7347
7172
 
7348
7173
  **For each test:**
7349
- - Run: \`npx playwright test [test-file]\`
7174
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7350
7175
  - If fails, classify as product bug or test issue
7351
- - If test issue: Apply fix patterns and retry
7176
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7352
7177
  - If product bug: Document and mark test as blocked
7353
7178
  - Continue until test passes or is blocked"
7354
7179
 
7355
- **Output Location:**
7356
- - Page Objects: \`./tests/pages/\`
7357
- - Test specs: \`./tests/specs/\`
7180
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7358
7181
 
7359
7182
  **Update Manual Test Cases:**
7360
7183
  After automation, update the manual test case frontmatter:
@@ -7610,30 +7433,29 @@ After test generation completes, verify all artifacts meet quality standards:
7610
7433
  - Contains human-readable steps and expected results
7611
7434
  - References environment variables for test data
7612
7435
 
7613
- **2. Automated Tests (in \`./tests/specs/\`):**
7436
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7614
7437
  - Organized by feature in subdirectories
7615
7438
  - Each test file references manual test case ID in comments
7616
- - Uses Page Object Model pattern
7617
- - Follows role-based selector priority
7439
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7440
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7618
7441
  - Uses environment variables for test data
7619
7442
  - Includes proper TypeScript typing
7620
7443
 
7621
- **3. Page Objects (in \`./tests/pages/\`):**
7622
- - Extend BasePage class
7623
- - Use semantic selectors (getByRole, getByLabel, getByText)
7444
+ **3. Page Objects** (in directory specified by \`./tests/CLAUDE.md\`):
7445
+ - Follow page object conventions from \`./tests/CLAUDE.md\`
7624
7446
  - Contain only actions, no assertions
7625
7447
  - Properly typed with TypeScript
7626
7448
 
7627
- **4. Supporting Files:**
7628
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7629
- - Helper functions for data generation (in \`./tests/helpers/\`)
7630
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7631
- - Types defined as needed (in \`./tests/types/\`)
7449
+ **4. Supporting Files** (in directories specified by \`./tests/CLAUDE.md\`):
7450
+ - Fixtures created for common setup
7451
+ - Helper functions for data generation
7452
+ - Component objects for reusable UI elements
7453
+ - Types defined as needed
7632
7454
 
7633
7455
  **Validation Checklist:**
7634
7456
  - [ ] All manual test cases have proper frontmatter
7635
7457
  - [ ] Automated tests reference their manual test case IDs
7636
- - [ ] Page Objects follow the BasePage pattern
7458
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7637
7459
  - [ ] No hardcoded test data (uses environment variables)
7638
7460
  - [ ] Tests are syntactically valid TypeScript`,
7639
7461
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -7652,7 +7474,7 @@ var STEP_LIBRARY = {
7652
7474
  // Clarification
7653
7475
  "clarification-protocol": clarificationProtocolStep,
7654
7476
  // Execution
7655
- "run-playwright-tests": runPlaywrightTestsStep,
7477
+ "run-tests": runTestsStep,
7656
7478
  "parse-test-results": parseTestResultsStep,
7657
7479
  "triage-failures": triageFailuresStep,
7658
7480
  "fix-test-issues": fixTestIssuesStep,