@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.js CHANGED
@@ -228,9 +228,9 @@ var TASK_SLUGS = {
228
228
  var generateTestCasesTask = {
229
229
  slug: TASK_SLUGS.GENERATE_TEST_CASES,
230
230
  name: "Generate Test Cases",
231
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
231
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
232
232
  frontmatter: {
233
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
233
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
234
234
  "argument-hint": "--type [exploratory|functional|regression|smoke] --focus [optional-feature]"
235
235
  },
236
236
  steps: [
@@ -238,12 +238,12 @@ var generateTestCasesTask = {
238
238
  {
239
239
  inline: true,
240
240
  title: "Generate Test Cases Overview",
241
- content: `Generate comprehensive test artifacts including BOTH manual test case documentation AND automated Playwright test scripts.
241
+ 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.
242
242
 
243
243
  This command generates:
244
244
  1. **Manual Test Case Documentation** (in \`./test-cases/\`) - Human-readable test cases in markdown format
245
- 2. **Automated Playwright Tests** (in \`./tests/specs/\`) - Executable TypeScript test scripts
246
- 3. **Page Object Models** (in \`./tests/pages/\`) - Reusable page classes for automated tests
245
+ 2. **Automated Test Scripts** (in directory from \`./tests/CLAUDE.md\`) - Executable test scripts
246
+ 3. **Page Objects** (in directory from \`./tests/CLAUDE.md\`) - Reusable page classes for automated tests
247
247
  4. **Supporting Files** (fixtures, helpers, components) - As needed for test automation`
248
248
  },
249
249
  // Step 2: Security Notice (library)
@@ -278,9 +278,9 @@ Read the test plan from \`test-plan.md\` to understand:
278
278
 
279
279
  **1.2 Check Existing Test Cases and Tests**
280
280
  - List all files in \`./test-cases/\` to understand existing manual test coverage
281
- - List all files in \`./tests/specs/\` to understand existing automated tests
281
+ - List existing automated tests in the test directory (see \`./tests/CLAUDE.md\` for structure)
282
282
  - Determine next test case ID (TC-XXX format)
283
- - Identify existing Page Objects in \`./tests/pages/\`
283
+ - Identify existing page objects (see \`./tests/CLAUDE.md\` for directory)
284
284
  - Avoid creating overlapping test cases or duplicate automation`
285
285
  },
286
286
  // Step 6: Documentation Researcher (conditional library step)
@@ -389,8 +389,8 @@ Before invoking the agent, identify the test cases for the current area:
389
389
  - Test type: {type}
390
390
  - Test plan: test-plan.md
391
391
  - Manual test cases directory: ./test-cases/
392
- - Existing automated tests: ./tests/specs/
393
- - Existing Page Objects: ./tests/pages/
392
+ - Existing automated tests: [directory from ./tests/CLAUDE.md]
393
+ - Existing page objects: [directory from ./tests/CLAUDE.md]
394
394
 
395
395
  **Knowledge Base Patterns (MUST APPLY):**
396
396
  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.
@@ -401,7 +401,7 @@ Include ALL relevant testing patterns from the knowledge base that apply to this
401
401
  3. Explore the feature area to understand implementation (gather selectors, URLs, flows)
402
402
  4. Build missing Page Objects and supporting code
403
403
  5. For each test case marked \`automated: true\`:
404
- - Create automated Playwright test in ./tests/specs/
404
+ - Create automated test in the test directory (from ./tests/CLAUDE.md)
405
405
  - Update the manual test case file to reference the automated test path
406
406
  - Apply ALL knowledge base patterns listed above (timing, selectors, assertions)
407
407
  6. Run and iterate on each test until it passes or fails with a product bug
@@ -432,15 +432,7 @@ Move to the next area and repeat until all areas are complete.
432
432
  {
433
433
  inline: true,
434
434
  title: "Create Directories if Needed",
435
- content: `Ensure required directories exist:
436
- \`\`\`bash
437
- mkdir -p ./test-cases
438
- mkdir -p ./tests/specs
439
- mkdir -p ./tests/pages
440
- mkdir -p ./tests/components
441
- mkdir -p ./tests/fixtures
442
- mkdir -p ./tests/helpers
443
- \`\`\``
435
+ 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).`
444
436
  },
445
437
  // Step 14: Extract Env Variables (library)
446
438
  "extract-env-variables",
@@ -460,7 +452,7 @@ mkdir -p ./tests/helpers
460
452
  - Features covered by automation
461
453
  - Areas kept manual-only (and why)
462
454
  3. Highlight key automated test scenarios
463
- 4. Share command to run automated tests: npx playwright test
455
+ 4. Share command to run automated tests (from \`./tests/CLAUDE.md\`)
464
456
  5. Ask for team review and validation
465
457
  6. Mention any areas needing exploration or clarification
466
458
  7. Use appropriate channel and threading for the update
@@ -505,8 +497,8 @@ The team communication should include:
505
497
  - Areas kept manual-only (and why)
506
498
 
507
499
  **Next Steps:**
508
- - Command to run automated tests: \`npx playwright test\`
509
- - Instructions to run specific test file
500
+ - Command to run automated tests (from \`./tests/CLAUDE.md\`)
501
+ - Instructions to run specific test file (from \`./tests/CLAUDE.md\`)
510
502
  - Note about copying .env.testdata to .env
511
503
  - Mention any exploration needed for edge cases
512
504
 
@@ -522,7 +514,7 @@ The team communication should include:
522
514
  - **Test Independence**: Each test must be runnable in isolation and in parallel`
523
515
  }
524
516
  ],
525
- requiredSubagents: ["test-runner", "test-code-generator"],
517
+ requiredSubagents: ["browser-automation", "test-code-generator"],
526
518
  optionalSubagents: ["documentation-researcher", "team-communicator"],
527
519
  dependentTasks: []
528
520
  };
@@ -721,7 +713,7 @@ The team communication should include:
721
713
  - Instructions for the user to fill in actual values in .env.testdata before running tests`
722
714
  }
723
715
  ],
724
- requiredSubagents: ["test-runner"],
716
+ requiredSubagents: ["browser-automation"],
725
717
  optionalSubagents: ["documentation-researcher", "team-communicator"],
726
718
  dependentTasks: []
727
719
  };
@@ -1243,7 +1235,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1243
1235
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1244
1236
  - Wait for team response (messaging infrastructure handles that)
1245
1237
  - Create or modify test files
1246
- - Run Playwright tests
1238
+ - Run automated tests
1247
1239
 
1248
1240
  #### 5.6 Update Event Processor Memory
1249
1241
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1350,10 +1342,10 @@ Create files if they don't exist:
1350
1342
  var runTestsTask = {
1351
1343
  slug: TASK_SLUGS.RUN_TESTS,
1352
1344
  name: "Run Tests",
1353
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1345
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1354
1346
  frontmatter: {
1355
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1356
- "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", "tests/specs/login.spec.ts")'
1347
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1348
+ "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", or a specific test file path)'
1357
1349
  },
1358
1350
  steps: [
1359
1351
  // Step 1: Overview (inline)
@@ -1362,7 +1354,7 @@ var runTestsTask = {
1362
1354
  title: "Run Tests Overview",
1363
1355
  content: `# Run Tests Command
1364
1356
 
1365
- Execute automated Playwright tests, analyze failures using JSON reports, automatically fix test issues, and log product bugs.`
1357
+ 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.`
1366
1358
  },
1367
1359
  // Step 2: Security Notice (library)
1368
1360
  "security-notice",
@@ -1375,9 +1367,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1375
1367
  **Parse Arguments:**
1376
1368
  Extract the following from arguments:
1377
1369
  - **selector**: Test selection criteria
1378
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1379
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1380
- - Specific file: "tests/specs/login.spec.ts"
1370
+ - File pattern: "auth" \u2192 find matching test files (see \`./tests/CLAUDE.md\` for directory structure)
1371
+ - Tag: "@smoke" \u2192 runs tests with tag annotation
1372
+ - Specific file: path to a specific test file
1381
1373
  - All tests: "all" or "" \u2192 runs entire test suite`
1382
1374
  },
1383
1375
  // Step 4: Load Project Context (library)
@@ -1393,34 +1385,26 @@ Extract the following from arguments:
1393
1385
  inline: true,
1394
1386
  title: "Identify Automated Tests to Run",
1395
1387
  content: `#### Understand Test Selection
1388
+
1389
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1390
+
1396
1391
  Parse the selector argument to determine which tests to run:
1397
1392
 
1398
1393
  **File Pattern** (e.g., "auth", "login"):
1399
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1394
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1400
1395
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1401
1396
 
1402
1397
  **Tag** (e.g., "@smoke", "@regression"):
1403
- - Run tests with specific Playwright tag annotation
1404
- - Use Playwright's \`--grep\` option
1398
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1405
1399
 
1406
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1407
- - Run that specific test file
1400
+ **Specific File**:
1401
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1408
1402
 
1409
1403
  **All Tests** ("all" or no selector):
1410
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1404
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1411
1405
 
1412
1406
  #### Find Matching Test Files
1413
- Use glob patterns to find test files:
1414
- \`\`\`bash
1415
- # For file pattern
1416
- ls tests/specs/**/*[pattern]*.spec.ts
1417
-
1418
- # For specific file
1419
- ls tests/specs/auth/login.spec.ts
1420
-
1421
- # For all tests
1422
- ls tests/specs/**/*.spec.ts
1423
- \`\`\`
1407
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1424
1408
 
1425
1409
  #### Validate Test Files Exist
1426
1410
  Check that at least one test file was found:
@@ -1434,7 +1418,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1434
1418
  - **No selector** (all tests): Confirm running full suite before executing`
1435
1419
  },
1436
1420
  // Step 7-10: Test Execution (library steps)
1437
- "run-playwright-tests",
1421
+ "run-tests",
1438
1422
  "parse-test-results",
1439
1423
  "triage-failures",
1440
1424
  "fix-test-issues",
@@ -1460,8 +1444,8 @@ If no test cases match the selection criteria:
1460
1444
  2. List available test cases or suggest running \`/generate-test-cases\` first
1461
1445
  3. Provide examples of valid selection criteria
1462
1446
 
1463
- #### If Test Runner Agent Fails
1464
- If the test-runner agent encounters issues:
1447
+ #### If Browser Automation Agent Fails
1448
+ If the browser-automation agent encounters issues:
1465
1449
  1. Report the specific error
1466
1450
  2. Suggest troubleshooting steps
1467
1451
  3. Offer to run tests individually if batch execution failed
@@ -1475,18 +1459,18 @@ If selected test cases have formatting issues:
1475
1459
  ### Important Notes
1476
1460
 
1477
1461
  **Test Selection Strategy**:
1478
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1462
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1479
1463
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1480
1464
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1481
1465
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1482
1466
  - Use context keywords from user request to choose appropriate tier
1483
1467
 
1484
1468
  **Test Execution**:
1485
- - Automated Playwright tests are executed via bash command, not through agents
1469
+ - Automated tests are executed via bash command, not through agents
1486
1470
  - Test execution time varies by tier (see strategy document for details)
1487
1471
  - JSON reports provide structured test results for analysis
1488
- - Playwright automatically captures traces, screenshots, and videos on failures
1489
- - Test artifacts are stored in test-results/ directory
1472
+ - Test framework may capture traces, screenshots, and videos on failures (see \`./tests/CLAUDE.md\`)
1473
+ - Test artifacts are stored as defined in \`./tests/CLAUDE.md\`
1490
1474
 
1491
1475
  **Failure Handling**:
1492
1476
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1496,11 +1480,11 @@ If selected test cases have formatting issues:
1496
1480
  - Critical failures trigger immediate team notification
1497
1481
 
1498
1482
  **Related Documentation**:
1499
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1500
- - \`.bugzy/runtime/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1483
+ - \`./tests/docs/test-execution-strategy.md\` - When and why to run specific tests
1484
+ - \`./tests/docs/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1501
1485
  }
1502
1486
  ],
1503
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1487
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1504
1488
  optionalSubagents: ["issue-tracker", "team-communicator"],
1505
1489
  dependentTasks: []
1506
1490
  };
@@ -1524,7 +1508,7 @@ var verifyChangesTask = {
1524
1508
  ## Overview
1525
1509
 
1526
1510
  This task performs comprehensive change verification with:
1527
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1511
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1528
1512
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1529
1513
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1530
1514
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1755,11 +1739,11 @@ Analyze the change description to identify affected feature areas:
1755
1739
 
1756
1740
  | Description Keywords | Inferred Test Scope | Example |
1757
1741
  |---------------------|-------------------|---------|
1758
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1759
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1760
- | "cart", "shopping cart", "add to cart" | \`tests/specs/cart/\` | "Update cart calculations" -> Cart tests |
1742
+ | "login", "authentication", "sign in/up" | Auth test suite | "Fix login page validation" -> Auth tests |
1743
+ | "checkout", "payment", "purchase" | Checkout test suite | "Optimize checkout flow" -> Checkout tests |
1744
+ | "cart", "shopping cart", "add to cart" | Cart test suite | "Update cart calculations" -> Cart tests |
1761
1745
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1762
- | "profile", "account", "settings" | \`tests/specs/profile/\` or \`tests/specs/settings/\` | "Profile page redesign" -> Profile tests |
1746
+ | "profile", "account", "settings" | Profile/settings test suite | "Profile page redesign" -> Profile tests |
1763
1747
 
1764
1748
  **Inference strategy:**
1765
1749
  1. **Extract feature keywords** from PR title and description
@@ -1834,13 +1818,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1834
1818
 
1835
1819
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1836
1820
 
1837
- ### Generate Playwright Specs
1821
+ ### Generate Automated Test Specs
1838
1822
 
1839
1823
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1840
1824
  - Read the manual test cases you just created
1841
1825
  - Explore the feature in the browser to discover selectors and flows
1842
- - Create Page Objects in \`./tests/pages/\` if needed
1843
- - Create test specs in \`./tests/specs/\` matching the test cases
1826
+ - Create page objects in the directory specified by \`./tests/CLAUDE.md\`
1827
+ - Create test specs in the directory specified by \`./tests/CLAUDE.md\`
1844
1828
  - Run each new test to verify it passes
1845
1829
  - Update the manual test case with \`automated_test\` reference
1846
1830
 
@@ -1850,7 +1834,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1850
1834
  conditionalOnSubagent: "test-code-generator"
1851
1835
  },
1852
1836
  // Step 8-11: Test Execution (library steps)
1853
- "run-playwright-tests",
1837
+ "run-tests",
1854
1838
  "parse-test-results",
1855
1839
  "triage-failures",
1856
1840
  "fix-test-issues",
@@ -2039,7 +2023,7 @@ Post PR comment if GitHub context available.`,
2039
2023
  - Recommend: Check test configuration and prerequisites
2040
2024
 
2041
2025
  **If test execution fails:**
2042
- - Report specific error (Playwright not installed, env vars missing)
2026
+ - Report specific error (test framework not installed, env vars missing)
2043
2027
  - Suggest troubleshooting steps
2044
2028
  - Don't proceed with triage if tests didn't run
2045
2029
 
@@ -2069,7 +2053,7 @@ A successful verification includes:
2069
2053
  10. Clear recommendation provided (merge / review / block)`
2070
2054
  }
2071
2055
  ],
2072
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
2056
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
2073
2057
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
2074
2058
  dependentTasks: []
2075
2059
  };
@@ -2118,7 +2102,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2118
2102
  },
2119
2103
  // Phase 2: Exploration Protocol
2120
2104
  "exploration-protocol",
2121
- // Execute exploration via test-runner
2105
+ // Execute exploration via browser-automation
2122
2106
  "create-exploration-test-case",
2123
2107
  "run-exploration",
2124
2108
  "process-exploration-results",
@@ -2129,7 +2113,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2129
2113
  "generate-test-cases",
2130
2114
  "automate-test-cases",
2131
2115
  // Phase 5: Test Execution
2132
- "run-playwright-tests",
2116
+ "run-tests",
2133
2117
  "parse-test-results",
2134
2118
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2135
2119
  "triage-failures",
@@ -2146,7 +2130,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2146
2130
  },
2147
2131
  "generate-final-report"
2148
2132
  ],
2149
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2133
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2150
2134
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2151
2135
  dependentTasks: ["run-tests", "generate-test-cases"]
2152
2136
  };
@@ -2165,7 +2149,7 @@ var exploreApplicationTask = {
2165
2149
  {
2166
2150
  inline: true,
2167
2151
  title: "Explore Application Overview",
2168
- content: `Discover actual UI elements, workflows, and behaviors using the test-runner agent. Updates test plan and project documentation with findings.`
2152
+ content: `Discover actual UI elements, workflows, and behaviors using the browser-automation agent. Updates test plan and project documentation with findings.`
2169
2153
  },
2170
2154
  // Step 2: Security Notice (from library)
2171
2155
  "security-notice",
@@ -2212,7 +2196,7 @@ var exploreApplicationTask = {
2212
2196
  "cleanup-temp-files",
2213
2197
  "update-knowledge-base"
2214
2198
  ],
2215
- requiredSubagents: ["test-runner"],
2199
+ requiredSubagents: ["browser-automation"],
2216
2200
  optionalSubagents: ["team-communicator"],
2217
2201
  dependentTasks: []
2218
2202
  };
@@ -2281,16 +2265,16 @@ After completing your work, update your memory file with relevant insights.
2281
2265
  **Remember:** Every entry should answer "How does this change what I do?"
2282
2266
  `;
2283
2267
 
2284
- // src/subagents/templates/test-runner/playwright.ts
2268
+ // src/subagents/templates/browser-automation/playwright.ts
2285
2269
  var FRONTMATTER = {
2286
- name: "test-runner",
2287
- 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.
2270
+ name: "browser-automation",
2271
+ 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.
2288
2272
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2289
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2290
- <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.
2273
+ assistant: "I'll use the browser-automation agent to execute this test case and capture all the results with video evidence."
2274
+ <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.
2291
2275
  user: "Execute the smoke test for the checkout flow"
2292
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2293
- <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>`,
2276
+ assistant: "Let me use the browser-automation agent to execute the checkout smoke test and record all findings with video."
2277
+ <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>`,
2294
2278
  model: "sonnet",
2295
2279
  color: "green"
2296
2280
  };
@@ -2303,9 +2287,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2303
2287
  - Structure of \`steps.json\` with timestamps and video synchronization
2304
2288
  - Field descriptions and data types
2305
2289
 
2306
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2290
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2307
2291
 
2308
- **Memory Sections for Test Runner**:
2292
+ **Memory Sections for Browser Automation**:
2309
2293
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2310
2294
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2311
2295
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2371,7 +2355,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2371
2355
  **Execution Workflow:**
2372
2356
 
2373
2357
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2374
- - Read \`.bugzy/runtime/memory/test-runner.md\` to access your working knowledge
2358
+ - Read \`.bugzy/runtime/memory/browser-automation.md\` to access your working knowledge
2375
2359
  - Check if this test is known to be flaky (apply extra waits if so)
2376
2360
  - Review timing requirements for pages this test will visit
2377
2361
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2423,9 +2407,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2423
2407
  - Video filename reference (just basename, not full path)
2424
2408
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2425
2409
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2426
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2410
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2427
2411
 
2428
- Specifically for test-runner, consider updating:
2412
+ Specifically for browser-automation, consider updating:
2429
2413
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2430
2414
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2431
2415
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -2498,49 +2482,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
2498
2482
  // src/subagents/templates/test-code-generator/playwright.ts
2499
2483
  var FRONTMATTER2 = {
2500
2484
  name: "test-code-generator",
2501
- 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.
2485
+ 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.
2502
2486
  user: "Generate test cases for the login feature based on the test plan"
2503
- assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated Playwright test scripts with Page Objects."
2487
+ assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated test scripts with page objects."
2504
2488
  <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.
2505
2489
  user: "Create automated tests for the checkout flow"
2506
- assistant: "Let me use the test-code-generator agent to generate test scripts, Page Objects, and test case documentation for the checkout flow."
2490
+ assistant: "Let me use the test-code-generator agent to generate test scripts, page objects, and test case documentation for the checkout flow."
2507
2491
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
2508
2492
  model: "sonnet",
2509
2493
  color: "purple"
2510
2494
  };
2511
- var CONTENT2 = `You are an expert Playwright test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
2495
+ var CONTENT2 = `You are an expert test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
2496
+
2497
+ **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.
2512
2498
 
2513
2499
  **Core Responsibilities:**
2514
2500
 
2515
- 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.
2501
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
2502
+ - The test framework and language used
2503
+ - Directory structure (where to put test specs, page objects, fixtures, helpers)
2504
+ - Test structure conventions (how to organize test steps, tagging, etc.)
2505
+ - Selector priority and strategies
2506
+ - How to run tests
2507
+ - Common fix patterns
2516
2508
 
2517
- 2. **Environment Configuration**:
2509
+ 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.
2510
+
2511
+ 3. **Environment Configuration**:
2518
2512
  - Read \`.env.testdata\` for available environment variables
2519
2513
  - Reference variables using \`process.env.VAR_NAME\` in tests
2520
2514
  - Add new required variables to \`.env.testdata\`
2521
2515
  - NEVER read \`.env\` file (secrets only)
2522
2516
  - **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.
2523
2517
 
2524
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2518
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2525
2519
 
2526
2520
  **Memory Sections for Test Code Generator**:
2527
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
2521
+ - Generated artifacts (page objects, tests, fixtures, helpers)
2528
2522
  - Test cases automated
2529
2523
  - Selector strategies that work for this application
2530
2524
  - Application architecture patterns learned
2531
2525
  - Environment variables used
2532
2526
  - Test creation history and outcomes
2533
2527
 
2534
- 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:
2528
+ 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:
2535
2529
  - Read the manual test case files
2536
- - For test cases marked \`automated: true\`, generate automated Playwright tests
2530
+ - For test cases marked \`automated: true\`, generate automated tests
2537
2531
  - Update the manual test case file with the automated_test reference
2538
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
2532
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
2539
2533
 
2540
- 5. **Mandatory Application Exploration**: NEVER generate Page Objects without exploring the live application first using playwright-cli:
2534
+ 6. **Mandatory Application Exploration**: NEVER generate page objects without exploring the live application first using playwright-cli:
2541
2535
  - Navigate to pages, authenticate, inspect elements
2542
2536
  - Capture screenshots for documentation
2543
- - Document exact role names, labels, text, URLs
2537
+ - Document exact element identifiers, labels, text, URLs
2544
2538
  - Test navigation flows manually
2545
2539
  - **NEVER assume selectors** - verify in browser or tests will fail
2546
2540
 
@@ -2548,7 +2542,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2548
2542
 
2549
2543
  1. **Load Memory**:
2550
2544
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
2551
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
2545
+ - Check existing page objects, automated tests, selector strategies, naming conventions
2552
2546
  - Avoid duplication by reusing established patterns
2553
2547
 
2554
2548
  2. **Read Manual Test Cases**:
@@ -2562,20 +2556,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2562
2556
 
2563
2557
  **STEP 1: Check Existing Infrastructure**
2564
2558
 
2565
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
2566
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
2567
- - **Identify gaps**: Determine what POMs or helpers are missing for this test
2559
+ - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing page objects
2560
+ - **Scan codebase**: Look for relevant page objects in the directory specified by \`./tests/CLAUDE.md\`
2561
+ - **Identify gaps**: Determine what page objects or helpers are missing for this test
2568
2562
 
2569
2563
  **STEP 2: Build Missing Infrastructure** (if needed)
2570
2564
 
2571
2565
  - **Explore feature under test**: Use playwright-cli to:
2572
2566
  * Navigate to the feature's pages
2573
- * Inspect elements and gather selectors (role, label, text)
2567
+ * Inspect elements and gather selectors
2574
2568
  * Document actual URLs from the browser
2575
2569
  * Capture screenshots for documentation
2576
2570
  * Test navigation flows manually
2577
2571
  * NEVER assume selectors - verify everything in browser
2578
- - **Create Page Objects**: Build POMs for new pages/components using verified selectors
2572
+ - **Create page objects**: Build page objects for new pages/components using verified selectors, following conventions from \`./tests/CLAUDE.md\`
2579
2573
  - **Create supporting code**: Add any needed fixtures, helpers, or types
2580
2574
 
2581
2575
  **STEP 3: Create Automated Test**
@@ -2583,20 +2577,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2583
2577
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
2584
2578
  * Understand the test objective and steps
2585
2579
  * Note any preconditions or test data requirements
2586
- - **Generate automated test** (./tests/specs/*.spec.ts):
2580
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
2587
2581
  * Use the manual test case steps as the basis
2588
- * Create executable Playwright test using Page Objects
2589
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
2590
- * Each test.step() should directly correspond to a numbered step in the manual test case
2582
+ * Follow the test structure conventions from \`./tests/CLAUDE.md\`
2591
2583
  * Reference manual test case ID in comments
2592
- * Tag critical tests with @smoke
2584
+ * Tag critical tests appropriately (e.g., @smoke)
2593
2585
  - **Update manual test case file**:
2594
2586
  * Set \`automated_test:\` field to the path of the automated test file
2595
2587
  * Link manual \u2194 automated test bidirectionally
2596
2588
 
2597
2589
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
2598
2590
 
2599
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
2591
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
2600
2592
  - **Analyze results**:
2601
2593
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
2602
2594
  * Fail \u2192 Proceed to failure analysis below
@@ -2610,60 +2602,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2610
2602
  | **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 |
2611
2603
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
2612
2604
 
2613
- **4b. Fix Patterns** (apply based on root cause):
2614
-
2615
- **Fix Type 1: Brittle Selectors**
2616
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2617
- - **Fix**: Replace with role-based selectors
2618
- \`\`\`typescript
2619
- // BEFORE (brittle)
2620
- await page.locator('.btn-primary').click();
2621
- // AFTER (semantic)
2622
- await page.getByRole('button', { name: 'Sign In' }).click();
2623
- \`\`\`
2624
-
2625
- **Fix Type 2: Missing Wait Conditions**
2626
- - **Problem**: Test doesn't wait for elements or actions to complete
2627
- - **Fix**: Add explicit wait for expected state
2628
- \`\`\`typescript
2629
- // BEFORE (race condition)
2630
- await page.goto('/dashboard');
2631
- const items = await page.locator('.item').count();
2632
- // AFTER (explicit wait)
2633
- await page.goto('/dashboard');
2634
- await expect(page.locator('.item')).toHaveCount(5);
2635
- \`\`\`
2636
-
2637
- **Fix Type 3: Race Conditions**
2638
- - **Problem**: Test executes actions before application is ready
2639
- - **Fix**: Wait for specific application state
2640
- \`\`\`typescript
2641
- // BEFORE
2642
- await saveButton.click();
2643
- await expect(successMessage).toBeVisible();
2644
- // AFTER
2645
- await page.locator('.validation-complete').waitFor();
2646
- await saveButton.click();
2647
- await expect(successMessage).toBeVisible();
2648
- \`\`\`
2649
-
2650
- **Fix Type 4: Wrong Assertions**
2651
- - **Problem**: Assertion expects incorrect value or state
2652
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
2653
-
2654
- **Fix Type 5: Test Isolation Issues**
2655
- - **Problem**: Test depends on state from previous tests
2656
- - **Fix**: Add proper setup/teardown or use fixtures
2657
-
2658
- **Fix Type 6: Flaky Tests**
2659
- - **Problem**: Test passes inconsistently
2660
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
2661
- - Run test 10 times to confirm stability after fix
2605
+ **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.
2662
2606
 
2663
2607
  **4c. Fix Workflow**:
2664
2608
  1. Read failure report and classify (product bug vs test issue)
2665
2609
  2. If product bug: Document and mark test as blocked, move to next test
2666
- 3. If test issue: Apply appropriate fix from patterns above
2610
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
2667
2611
  4. Re-run test to verify fix
2668
2612
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
2669
2613
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -2672,9 +2616,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2672
2616
 
2673
2617
  | Failure Type | Root Cause | Action |
2674
2618
  |--------------|------------|--------|
2675
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
2676
- | Timeout waiting | Missing wait condition | Add explicit wait |
2677
- | Flaky (timing) | Race condition | Add synchronization wait |
2619
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
2620
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
2621
+ | Flaky (timing) | Race condition | Apply synchronization fix pattern from CLAUDE.md |
2678
2622
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
2679
2623
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
2680
2624
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -2682,13 +2626,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2682
2626
  **STEP 5: Move to Next Test Case**
2683
2627
 
2684
2628
  - Repeat process for each test case in the plan
2685
- - Reuse existing POMs and infrastructure wherever possible
2629
+ - Reuse existing page objects and infrastructure wherever possible
2686
2630
  - Continuously update memory with new patterns and learnings
2687
2631
 
2688
2632
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2689
2633
 
2690
2634
  Specifically for test-code-generator, consider updating:
2691
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
2635
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
2692
2636
  - **Test Cases Automated**: Record which test cases were automated with references
2693
2637
  - **Selector Strategies**: Note what selector strategies work well for this application
2694
2638
  - **Application Patterns**: Document architecture patterns learned
@@ -2698,7 +2642,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2698
2642
  - Test automation results (tests created, pass/fail status, issues found)
2699
2643
  - Manual test cases automated (count, IDs, titles)
2700
2644
  - Automated tests created (count, smoke vs functional)
2701
- - Page Objects, fixtures, helpers added
2645
+ - Page objects, fixtures, helpers added
2702
2646
  - Next steps (commands to run tests)
2703
2647
 
2704
2648
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -2709,7 +2653,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2709
2653
  ## Last Updated: [timestamp]
2710
2654
 
2711
2655
  ## Generated Test Artifacts
2712
- [Page Objects created with locators and methods]
2656
+ [Page objects created with locators and methods]
2713
2657
  [Test cases automated with manual TC references and file paths]
2714
2658
  [Fixtures, helpers, components created]
2715
2659
 
@@ -2718,26 +2662,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2718
2662
  [Tests passing vs failing with product bugs]
2719
2663
 
2720
2664
  ## Fixed Issues History
2721
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
2722
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState for async validation
2665
+ - [Date] TC-001: Applied selector fix pattern
2666
+ - [Date] TC-003: Applied wait fix pattern for async validation
2723
2667
 
2724
2668
  ## Failure Pattern Library
2725
2669
 
2726
2670
  ### Pattern: Selector Timeout on Dynamic Content
2727
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
2671
+ **Symptoms**: Element not found, element loads after timeout
2728
2672
  **Root Cause**: Selector runs before element rendered
2729
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
2673
+ **Fix Strategy**: Add explicit visibility wait before interaction
2730
2674
  **Success Rate**: [track over time]
2731
2675
 
2732
2676
  ### Pattern: Race Condition on Form Submission
2733
- **Symptoms**: Test clicks submit before validation completes
2677
+ **Symptoms**: Test interacts before validation completes
2734
2678
  **Root Cause**: Missing wait for validation state
2735
2679
  **Fix Strategy**: Wait for validation indicator before submit
2736
2680
 
2737
2681
  ## Known Stable Selectors
2738
2682
  [Selectors that reliably work for this application]
2739
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
2740
- - Email field: \`getByLabel('Email')\`
2741
2683
 
2742
2684
  ## Known Product Bugs (Do Not Fix Tests)
2743
2685
  [Actual bugs discovered - tests should remain failing]
@@ -2748,9 +2690,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2748
2690
 
2749
2691
  ## Application Behavior Patterns
2750
2692
  [Load times, async patterns, navigation flows discovered]
2751
- - Auth pages: redirect timing
2752
- - Dashboard: lazy loading patterns
2753
- - Forms: validation timing
2754
2693
 
2755
2694
  ## Selector Strategy Library
2756
2695
  [Successful selector patterns and their success rates]
@@ -2765,32 +2704,23 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2765
2704
 
2766
2705
  **Critical Rules:**
2767
2706
 
2768
- \u274C **NEVER**:
2769
- - Generate selectors without exploring the live application - causes 100% test failure
2770
- - Assume URLs, selectors, or navigation patterns - verify in browser
2771
- - Skip exploration even if documentation seems detailed
2772
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
2773
- - Put assertions in Page Objects - only in test files
2774
- - Read .env file - only .env.testdata
2775
- - Create test interdependencies - tests must be independent
2776
-
2777
- \u2705 **ALWAYS**:
2778
- - Explore application using playwright-cli before generating code
2779
- - Verify selectors in live browser using playwright-cli snapshot
2780
- - Document actual URLs from browser address bar
2781
- - Take screenshots for documentation
2782
- - Use role-based selectors as first priority
2783
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
2784
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2785
- - Follow .bugzy/runtime/testing-best-practices.md
2786
- - Read existing manual test cases and automate those marked automated: true
2787
-
2788
- Follow .bugzy/runtime/testing-best-practices.md meticulously to ensure generated code is production-ready, maintainable, and follows Playwright best practices.`;
2707
+ - **NEVER** generate selectors without exploring the live application - causes 100% test failure
2708
+ - **NEVER** assume URLs, selectors, or navigation patterns - verify in browser
2709
+ - **NEVER** skip exploration even if documentation seems detailed
2710
+ - **NEVER** read .env file - only .env.testdata
2711
+ - **NEVER** create test interdependencies - tests must be independent
2712
+ - **ALWAYS** explore application using playwright-cli before generating code
2713
+ - **ALWAYS** verify selectors in live browser using playwright-cli snapshot
2714
+ - **ALWAYS** document actual URLs from browser address bar
2715
+ - **ALWAYS** follow conventions defined in \`./tests/CLAUDE.md\`
2716
+ - **ALWAYS** link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2717
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
2718
+ - **ALWAYS** read existing manual test cases and automate those marked automated: true`;
2789
2719
 
2790
2720
  // src/subagents/templates/test-debugger-fixer/playwright.ts
2791
2721
  var FRONTMATTER3 = {
2792
2722
  name: "test-debugger-fixer",
2793
- 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".
2723
+ 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.
2794
2724
  user: "Fix the failing login test"
2795
2725
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
2796
2726
  <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.
@@ -2800,18 +2730,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
2800
2730
  model: "sonnet",
2801
2731
  color: "yellow"
2802
2732
  };
2803
- 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.
2733
+ 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.
2734
+
2735
+ **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.
2804
2736
 
2805
2737
  **Core Responsibilities:**
2806
2738
 
2807
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
2808
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
2809
- - Correct waiting and synchronization patterns
2810
- - Test isolation principles
2811
- - Common anti-patterns to avoid
2812
- - Debugging workflow and techniques
2739
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
2740
+ - The test framework and language used
2741
+ - Selector strategies and priorities
2742
+ - Waiting and synchronization patterns
2743
+ - Common fix patterns for this framework
2744
+ - How to run tests
2745
+ - Test result artifacts format
2746
+
2747
+ 2. **Best Practices Reference**: Read \`./tests/docs/testing-best-practices.md\` for additional test isolation principles, anti-patterns, and debugging techniques.
2813
2748
 
2814
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2749
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2815
2750
 
2816
2751
  **Memory Sections for Test Debugger Fixer**:
2817
2752
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -2821,7 +2756,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2821
2756
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
2822
2757
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
2823
2758
 
2824
- 3. **Failure Analysis**: When a test fails, you must:
2759
+ 4. **Failure Analysis**: When a test fails, you must:
2825
2760
  - Read the failing test file to understand what it's trying to do
2826
2761
  - Read the failure details from the JSON test report
2827
2762
  - Examine error messages, stack traces, and failure context
@@ -2830,7 +2765,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2830
2765
  - **Product bug**: Correct test code, but application behaves unexpectedly
2831
2766
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
2832
2767
 
2833
- 3. **Triage Decision**: Determine if this is a product bug or test issue:
2768
+ 5. **Triage Decision**: Determine if this is a product bug or test issue:
2834
2769
 
2835
2770
  **Product Bug Indicators**:
2836
2771
  - Selectors are correct and elements exist
@@ -2845,9 +2780,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2845
2780
  - Flaky behavior (passes sometimes, fails other times)
2846
2781
  - Wrong assertions (expecting incorrect values)
2847
2782
  - Test isolation problems (depends on other tests)
2848
- - Brittle selectors (CSS classes, IDs that change)
2783
+ - Brittle selectors that change between builds
2849
2784
 
2850
- 4. **Debug Using Browser**: When needed, explore the application manually:
2785
+ 6. **Debug Using Browser**: When needed, explore the application manually:
2851
2786
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
2852
2787
  - Navigate to the relevant page
2853
2788
  - Inspect elements to find correct selectors
@@ -2856,87 +2791,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2856
2791
  - Verify application state matches test expectations
2857
2792
  - Take notes on differences between expected and actual behavior
2858
2793
 
2859
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
2860
-
2861
- **Fix Type 1: Brittle Selectors**
2862
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2863
- - **Fix**: Replace with role-based selectors
2864
- - **Example**:
2865
- \`\`\`typescript
2866
- // BEFORE (brittle)
2867
- await page.locator('.btn-primary').click();
2868
-
2869
- // AFTER (semantic)
2870
- await page.getByRole('button', { name: 'Sign In' }).click();
2871
- \`\`\`
2872
-
2873
- **Fix Type 2: Missing Wait Conditions**
2874
- - **Problem**: Test doesn't wait for elements or actions to complete
2875
- - **Fix**: Add explicit wait for expected state
2876
- - **Example**:
2877
- \`\`\`typescript
2878
- // BEFORE (race condition)
2879
- await page.goto('/dashboard');
2880
- const items = await page.locator('.item').count();
2881
-
2882
- // AFTER (explicit wait)
2883
- await page.goto('/dashboard');
2884
- await expect(page.locator('.item')).toHaveCount(5);
2885
- \`\`\`
2886
-
2887
- **Fix Type 3: Race Conditions**
2888
- - **Problem**: Test executes actions before application is ready
2889
- - **Fix**: Wait for specific application state
2890
- - **Example**:
2891
- \`\`\`typescript
2892
- // BEFORE (race condition)
2893
- await saveButton.click();
2894
- await expect(successMessage).toBeVisible();
2895
-
2896
- // AFTER (wait for ready state)
2897
- await page.locator('.validation-complete').waitFor();
2898
- await saveButton.click();
2899
- await expect(successMessage).toBeVisible();
2900
- \`\`\`
2901
-
2902
- **Fix Type 4: Wrong Assertions**
2903
- - **Problem**: Assertion expects incorrect value or state
2904
- - **Fix**: Update assertion to match actual application behavior (if correct)
2905
- - **Example**:
2906
- \`\`\`typescript
2907
- // BEFORE (wrong expectation)
2908
- await expect(heading).toHaveText('Welcome John');
2909
-
2910
- // AFTER (corrected)
2911
- await expect(heading).toHaveText('Welcome, John!');
2912
- \`\`\`
2913
-
2914
- **Fix Type 5: Test Isolation Issues**
2915
- - **Problem**: Test depends on state from previous tests
2916
- - **Fix**: Add proper setup/teardown or use fixtures
2917
- - **Example**:
2918
- \`\`\`typescript
2919
- // BEFORE (depends on previous test)
2920
- test('should logout', async ({ page }) => {
2921
- await page.goto('/dashboard');
2922
- // Assumes user is already logged in
2923
- });
2924
-
2925
- // AFTER (isolated with fixture)
2926
- test('should logout', async ({ page, authenticatedUser }) => {
2927
- await page.goto('/dashboard');
2928
- // Uses fixture for clean state
2929
- });
2930
- \`\`\`
2931
-
2932
- **Fix Type 6: Flaky Tests**
2933
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
2934
- - **Fix**: Identify and eliminate non-determinism
2935
- - Common causes: timing issues, race conditions, animation delays, network timing
2936
- - Run test multiple times to reproduce flakiness
2937
- - Add proper waits for stable state
2938
-
2939
- 6. **Fixing Workflow**:
2794
+ 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.
2795
+
2796
+ 8. **Fixing Workflow**:
2940
2797
 
2941
2798
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
2942
2799
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -2949,7 +2806,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2949
2806
  **Step 1: Read Test File**
2950
2807
  - Understand test intent and logic
2951
2808
  - Identify what the test is trying to verify
2952
- - Note test structure and Page Objects used
2809
+ - Note test structure and page objects used
2953
2810
 
2954
2811
  **Step 2: Read Failure Report**
2955
2812
  - Parse JSON test report for failure details
@@ -2968,14 +2825,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2968
2825
  - **If test issue**: Proceed to fix
2969
2826
 
2970
2827
  **Step 5: Apply Fix**
2971
- - Edit test file with appropriate fix
2828
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
2972
2829
  - Update selectors, waits, assertions, or logic
2973
- - Follow best practices from testing guide
2830
+ - Follow conventions from \`./tests/CLAUDE.md\`
2974
2831
  - Add comments explaining the fix if complex
2975
2832
 
2976
2833
  **Step 6: Verify Fix**
2977
- - Run the fixed test: \`npx playwright test [test-file]\`
2978
- - **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
2834
+ - Run the fixed test using the command from \`./tests/CLAUDE.md\`
2835
+ - **IMPORTANT: Do NOT use \`--reporter\` flag** - the custom bugzy-reporter must run to create the hierarchical test-runs output needed for analysis
2979
2836
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
2980
2837
  - Read manifest.json to confirm test passes in latest execution
2981
2838
  - For flaky tests: Run 10 times to ensure stability
@@ -2996,7 +2853,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2996
2853
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
2997
2854
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
2998
2855
 
2999
- 7. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
2856
+ 9. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3000
2857
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3001
2858
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3002
2859
  \`\`\`json
@@ -3027,77 +2884,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3027
2884
  \`\`\`
3028
2885
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3029
2886
 
3030
- 8. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
2887
+ 10. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3031
2888
 
3032
- \`\`\`markdown
3033
- # Test Debugger Fixer Memory
3034
-
3035
- ## Last Updated: [timestamp]
3036
-
3037
- ## Fixed Issues History
3038
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3039
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3040
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3041
-
3042
- ## Failure Pattern Library
3043
-
3044
- ### Pattern: Selector Timeout on Dynamic Content
3045
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3046
- **Root Cause**: Selector runs before element rendered
3047
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3048
- **Success Rate**: 95% (used 12 times)
3049
-
3050
- ### Pattern: Race Condition on Form Submission
3051
- **Symptoms**: Test clicks submit before validation completes
3052
- **Root Cause**: Missing wait for validation state
3053
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3054
- **Success Rate**: 100% (used 8 times)
3055
-
3056
- ## Known Stable Selectors
3057
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3058
- - Email field: \`getByLabel('Email')\`
3059
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3060
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3061
-
3062
- ## Known Product Bugs (Do Not Fix Tests)
3063
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3064
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3065
-
3066
- ## Flaky Test Tracking
3067
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3068
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3069
-
3070
- ## Application Behavior Patterns
3071
- - **Auth Pages**: Redirect after 200ms delay
3072
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3073
- - **Forms**: Validation runs on blur + submit events
3074
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3075
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3076
- \`\`\`
2889
+ \`\`\`markdown
2890
+ # Test Debugger Fixer Memory
2891
+
2892
+ ## Last Updated: [timestamp]
2893
+
2894
+ ## Fixed Issues History
2895
+ - [Date] TC-001: Applied selector fix pattern
2896
+ - [Date] TC-003: Applied wait fix pattern for async validation
2897
+ - [Date] TC-005: Fixed race condition with explicit wait for data load
2898
+
2899
+ ## Failure Pattern Library
2900
+
2901
+ ### Pattern: Selector Timeout on Dynamic Content
2902
+ **Symptoms**: Element not found, element loads after timeout
2903
+ **Root Cause**: Selector runs before element rendered
2904
+ **Fix Strategy**: Add explicit visibility wait before interaction
2905
+ **Success Rate**: 95% (used 12 times)
2906
+
2907
+ ### Pattern: Race Condition on Form Submission
2908
+ **Symptoms**: Test interacts before validation completes
2909
+ **Root Cause**: Missing wait for validation state
2910
+ **Fix Strategy**: Wait for validation indicator before submit
2911
+ **Success Rate**: 100% (used 8 times)
2912
+
2913
+ ## Known Stable Selectors
2914
+ [Selectors that reliably work for this application]
2915
+
2916
+ ## Known Product Bugs (Do Not Fix Tests)
2917
+ [Actual bugs discovered - tests should remain failing]
2918
+
2919
+ ## Flaky Test Tracking
2920
+ [Tests with intermittent failures and their root causes]
2921
+
2922
+ ## Application Behavior Patterns
2923
+ [Load times, async patterns, navigation flows discovered]
2924
+ \`\`\`
2925
+
2926
+ 11. **Environment Configuration**:
2927
+ - Tests use \`process.env.VAR_NAME\` for configuration
2928
+ - Read \`.env.testdata\` to understand available variables
2929
+ - NEVER read \`.env\` file (contains secrets only)
2930
+ - If test needs new environment variable, update \`.env.testdata\`
3077
2931
 
3078
- 9. **Environment Configuration**:
3079
- - Tests use \`process.env.VAR_NAME\` for configuration
3080
- - Read \`.env.testdata\` to understand available variables
3081
- - NEVER read \`.env\` file (contains secrets only)
3082
- - If test needs new environment variable, update \`.env.testdata\`
3083
-
3084
- 9. **Using playwright-cli for Debugging**:
3085
- - You have direct access to playwright-cli via Bash
3086
- - Open browser: \`playwright-cli open <url>\`
3087
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3088
- - Navigate: \`playwright-cli navigate <url>\`
3089
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3090
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3091
- - Close browser: \`playwright-cli close\`
3092
-
3093
- 10. **Test Stability Best Practices**:
3094
- - Replace all \`waitForTimeout()\` with specific waits
3095
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3096
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3097
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3098
- - Handle dynamic content with proper waits
3099
-
3100
- 11. **Communication**:
2932
+ 12. **Using playwright-cli for Debugging**:
2933
+ - You have direct access to playwright-cli via Bash
2934
+ - Open browser: \`playwright-cli open <url>\`
2935
+ - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
2936
+ - Navigate: \`playwright-cli navigate <url>\`
2937
+ - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
2938
+ - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
2939
+ - Close browser: \`playwright-cli close\`
2940
+
2941
+ 13. **Communication**:
3101
2942
  - Be clear about whether issue is product bug or test issue
3102
2943
  - Explain root cause of test failure
3103
2944
  - Describe fix applied in plain language
@@ -3108,31 +2949,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3108
2949
 
3109
2950
  | Failure Type | Root Cause | Action |
3110
2951
  |--------------|------------|--------|
3111
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3112
- | Timeout waiting | Missing wait condition | Add explicit wait |
3113
- | Flaky (timing) | Race condition | Add synchronization wait |
2952
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
2953
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
2954
+ | Flaky (timing) | Race condition | Apply synchronization fix from CLAUDE.md |
3114
2955
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3115
2956
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3116
2957
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3117
2958
 
3118
- **Anti-Patterns to Avoid:**
3119
-
3120
- \u274C **DO NOT**:
3121
- - Fix tests when the issue is a product bug
3122
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3123
- - Make tests pass by lowering expectations
3124
- - Introduce new test dependencies
3125
- - Skip proper verification of fixes
3126
- - Exceed 3 fix attempts (escalate instead)
3127
-
3128
- \u2705 **DO**:
3129
- - Thoroughly analyze before fixing
3130
- - Use semantic selectors when replacing brittle ones
3131
- - Add explicit waits for specific conditions
3132
- - Verify fixes by re-running tests
3133
- - Run flaky tests 10 times to confirm stability
3134
- - Report product bugs instead of making tests ignore them
3135
- - Follow testing best practices guide
2959
+ **Critical Rules:**
2960
+
2961
+ - **NEVER** fix tests when the issue is a product bug
2962
+ - **NEVER** make tests pass by lowering expectations
2963
+ - **NEVER** introduce new test dependencies
2964
+ - **NEVER** skip proper verification of fixes
2965
+ - **NEVER** exceed 3 fix attempts (escalate instead)
2966
+ - **ALWAYS** thoroughly analyze before fixing
2967
+ - **ALWAYS** follow fix patterns from \`./tests/CLAUDE.md\`
2968
+ - **ALWAYS** verify fixes by re-running tests
2969
+ - **ALWAYS** run flaky tests 10 times to confirm stability
2970
+ - **ALWAYS** report product bugs instead of making tests ignore them
2971
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3136
2972
 
3137
2973
  **Output Format**:
3138
2974
 
@@ -3151,12 +2987,12 @@ Verification:
3151
2987
  - Run 1: [passed/failed]
3152
2988
  - Run 2-10: [if flaky test]
3153
2989
 
3154
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
2990
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3155
2991
 
3156
2992
  Next Steps: [run tests / log bug / review manually]
3157
2993
  \`\`\`
3158
2994
 
3159
- 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.`;
2995
+ 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.`;
3160
2996
 
3161
2997
  // src/subagents/templates/team-communicator/local.ts
3162
2998
  var FRONTMATTER4 = {
@@ -5687,7 +5523,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
5687
5523
 
5688
5524
  // src/subagents/templates/index.ts
5689
5525
  var TEMPLATES = {
5690
- "test-runner": {
5526
+ "browser-automation": {
5691
5527
  playwright: {
5692
5528
  frontmatter: FRONTMATTER,
5693
5529
  content: CONTENT
@@ -5876,9 +5712,9 @@ var INTEGRATIONS = {
5876
5712
  }
5877
5713
  };
5878
5714
  var SUBAGENTS = {
5879
- "test-runner": {
5880
- role: "test-runner",
5881
- name: "Test Runner",
5715
+ "browser-automation": {
5716
+ role: "browser-automation",
5717
+ name: "Browser Automation",
5882
5718
  description: "Execute automated browser tests (always included)",
5883
5719
  icon: "play",
5884
5720
  integrations: [INTEGRATIONS.playwright],
@@ -5935,7 +5771,7 @@ var SUBAGENTS = {
5935
5771
  "test-code-generator": {
5936
5772
  role: "test-code-generator",
5937
5773
  name: "Test Code Generator",
5938
- description: "Generate automated Playwright test scripts and Page Objects",
5774
+ description: "Generate automated test scripts and page objects",
5939
5775
  icon: "code",
5940
5776
  integrations: [INTEGRATIONS.playwright],
5941
5777
  model: "sonnet",
@@ -6024,9 +5860,9 @@ function buildSubagentsConfig(subagents) {
6024
5860
  // src/core/tool-strings.ts
6025
5861
  var TOOL_STRINGS = {
6026
5862
  "claude-code": {
6027
- 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.',
5863
+ 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.',
6028
5864
  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.',
6029
- 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.',
5865
+ 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.',
6030
5866
  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.',
6031
5867
  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.",
6032
5868
  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.',
@@ -6034,7 +5870,7 @@ var TOOL_STRINGS = {
6034
5870
  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.'
6035
5871
  },
6036
5872
  "cursor": {
6037
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-runner.md)" --output-format text\n```',
5873
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/browser-automation.md)" --output-format text\n```',
6038
5874
  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```',
6039
5875
  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```',
6040
5876
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -6044,7 +5880,7 @@ var TOOL_STRINGS = {
6044
5880
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
6045
5881
  },
6046
5882
  "codex": {
6047
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncodex -p "$(cat .codex/agents/test-runner.md)"\n```',
5883
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncodex -p "$(cat .codex/agents/browser-automation.md)"\n```',
6048
5884
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
6049
5885
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
6050
5886
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -6068,7 +5904,7 @@ function getToolString(toolId, key) {
6068
5904
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
6069
5905
  let result = content;
6070
5906
  const keys = [
6071
- "INVOKE_TEST_RUNNER",
5907
+ "INVOKE_BROWSER_AUTOMATION",
6072
5908
  "INVOKE_TEST_DEBUGGER_FIXER",
6073
5909
  "INVOKE_TEST_CODE_GENERATOR",
6074
5910
  "INVOKE_TEAM_COMMUNICATOR",
@@ -6156,7 +5992,7 @@ var readTestStrategyStep = {
6156
5992
  category: "setup",
6157
5993
  content: `## Read Test Execution Strategy
6158
5994
 
6159
- **IMPORTANT**: Before selecting tests, read \`.bugzy/runtime/test-execution-strategy.md\` to understand:
5995
+ **IMPORTANT**: Before selecting tests, read \`./tests/docs/test-execution-strategy.md\` to understand:
6160
5996
  - Available test tiers (Smoke, Component, Full Regression)
6161
5997
  - When to use each tier (commit, PR, release, debug)
6162
5998
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6166,7 +6002,7 @@ var readTestStrategyStep = {
6166
6002
 
6167
6003
  Apply the strategy guidance when determining which tests to run.
6168
6004
 
6169
- **First**, consult \`.bugzy/runtime/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6005
+ **First**, consult \`./tests/docs/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6170
6006
  tags: ["setup", "test-execution", "strategy"]
6171
6007
  };
6172
6008
 
@@ -6189,7 +6025,7 @@ Check for existing project context to inform your work:
6189
6025
  - Environment details
6190
6026
 
6191
6027
  **2. Check Test Execution Strategy**
6192
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6028
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6193
6029
  - Understand available test tiers and when to use them
6194
6030
  - Note default behaviors and time/coverage trade-offs
6195
6031
 
@@ -6782,34 +6618,22 @@ When reporting test results, always include an "Ambiguities" section if clarific
6782
6618
  tags: ["clarification", "protocol", "ambiguity"]
6783
6619
  };
6784
6620
 
6785
- // src/tasks/steps/execution/run-playwright-tests.ts
6786
- var runPlaywrightTestsStep = {
6787
- id: "run-playwright-tests",
6788
- title: "Execute Playwright Tests",
6621
+ // src/tasks/steps/execution/run-tests.ts
6622
+ var runTestsStep = {
6623
+ id: "run-tests",
6624
+ title: "Execute Automated Tests",
6789
6625
  category: "execution",
6790
- content: `## Execute Playwright Tests
6626
+ content: `## Execute Automated Tests
6791
6627
 
6792
- Run automated Playwright tests and capture results.
6628
+ Run automated tests and capture results.
6793
6629
 
6794
- **Build Playwright Command** based on selector:
6630
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
6795
6631
 
6796
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
6797
- Use npm scripts to run tests - no manual env export needed.
6798
-
6799
- **For file pattern or specific file**:
6800
- \`\`\`bash
6801
- npm test -- [selector]
6802
- \`\`\`
6632
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
6803
6633
 
6804
- **For tag**:
6805
- \`\`\`bash
6806
- npm test -- --grep "[tag]"
6807
- \`\`\`
6808
-
6809
- **For all tests**:
6810
- \`\`\`bash
6811
- npm test
6812
- \`\`\`
6634
+ - **For file pattern or specific file**: Use the framework's file selection command
6635
+ - **For tag**: Use the framework's tag/grep filtering command
6636
+ - **For all tests**: Use the default run-all command
6813
6637
 
6814
6638
  Wait for execution to complete. This may take several minutes depending on test count.
6815
6639
 
@@ -6827,7 +6651,7 @@ Wait for execution to complete. This may take several minutes depending on test
6827
6651
  \`\`\`
6828
6652
 
6829
6653
  2. Store the timestamp for use in subsequent steps`,
6830
- invokesSubagents: ["test-runner"],
6654
+ invokesSubagents: ["browser-automation"],
6831
6655
  tags: ["execution", "tests"]
6832
6656
  };
6833
6657
 
@@ -6926,10 +6750,10 @@ For each failed test:
6926
6750
  | Classification | Indicators | Examples |
6927
6751
  |---------------|------------|----------|
6928
6752
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
6929
- | **Test Issue** | Test code needs fixing | Selector not found but element exists, \`expect(locator).toBeVisible()\` timeout on existing element, Race condition, Wrong assertion |
6753
+ | **Test Issue** | Test code needs fixing | Selector not found but element exists, Timeout on existing element, Race condition, Wrong assertion |
6930
6754
 
6931
- **Common Test Issues:**
6932
- - Brittle selectors (CSS path instead of data-testid or role)
6755
+ **Common Test Issues** (refer to \`./tests/CLAUDE.md\` "Common Fix Patterns" for framework-specific guidance):
6756
+ - Brittle selectors (not following selector priority from CLAUDE.md)
6933
6757
  - Missing waits for async operations
6934
6758
  - Race conditions with animations
6935
6759
  - Incorrect expected values
@@ -6976,7 +6800,7 @@ The agent will:
6976
6800
  1. Read the execution details from result.json
6977
6801
  2. Analyze the failure (error message, trace if available)
6978
6802
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
6979
- 4. Apply appropriate fix to the test code
6803
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
6980
6804
  5. Rerun the test
6981
6805
  6. The custom reporter will automatically create the next exec-N/ folder
6982
6806
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -6988,7 +6812,7 @@ The agent will:
6988
6812
 
6989
6813
  **Track Fixed Tests:**
6990
6814
  - Maintain list of tests fixed automatically
6991
- - Include fix description (e.g., "Updated selector from CSS to role-based")
6815
+ - Include fix description (e.g., "Applied selector fix pattern from CLAUDE.md")
6992
6816
  - Note verification status (test now passes)`,
6993
6817
  invokesSubagents: ["test-debugger-fixer"],
6994
6818
  tags: ["execution", "fixing", "automation"]
@@ -7031,7 +6855,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7031
6855
  - Trace file: [path if available]
7032
6856
  - Screenshots: [paths if available]
7033
6857
  - **Environment Details**:
7034
- - Browser and version (from Playwright config)
6858
+ - Browser and version (from test framework config)
7035
6859
  - Test environment URL (from .env.testdata BASE_URL)
7036
6860
  - Timestamp of failure
7037
6861
  - **Severity/Priority**: Based on:
@@ -7070,7 +6894,7 @@ var createExplorationTestCaseStep = {
7070
6894
  category: "execution",
7071
6895
  content: `## Create Exploration Test Case
7072
6896
 
7073
- Generate a temporary exploration test case for the test-runner.
6897
+ Generate a temporary exploration test case for the browser-automation agent.
7074
6898
 
7075
6899
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7076
6900
 
@@ -7109,7 +6933,7 @@ var runExplorationStep = {
7109
6933
  category: "execution",
7110
6934
  content: `## Run Exploration
7111
6935
 
7112
- {{INVOKE_TEST_RUNNER}}
6936
+ {{INVOKE_BROWSER_AUTOMATION}}
7113
6937
 
7114
6938
  Execute the exploration test case with the following focus:
7115
6939
 
@@ -7134,7 +6958,7 @@ Generate comprehensive findings report.
7134
6958
  - \`test-log.md\` - Detailed execution log
7135
6959
  - \`screenshots/\` - Visual documentation
7136
6960
  - \`summary.json\` - Execution summary`,
7137
- invokesSubagents: ["test-runner"],
6961
+ invokesSubagents: ["browser-automation"],
7138
6962
  tags: ["execution", "exploration"]
7139
6963
  };
7140
6964
 
@@ -7145,7 +6969,7 @@ var processExplorationResultsStep = {
7145
6969
  category: "execution",
7146
6970
  content: `## Process Exploration Results
7147
6971
 
7148
- Read and parse the test-runner output from exploration.
6972
+ Read and parse the browser-automation agent output from exploration.
7149
6973
 
7150
6974
  **Locate results:**
7151
6975
  \`\`\`bash
@@ -7282,23 +7106,22 @@ For each test case marked \`automated: true\`:
7282
7106
  - Exploration findings: ./exploration-reports/
7283
7107
 
7284
7108
  **The agent should:**
7285
- 1. Read manual test case files
7286
- 2. Explore the feature to gather selectors
7287
- 3. Create Page Objects and automated tests
7288
- 4. Run each test and iterate until passing (max 3 attempts)
7289
- 5. Update manual test case with automated_test reference
7290
- 6. Document any product bugs discovered
7109
+ 1. Read \`./tests/CLAUDE.md\` for framework conventions, directory structure, and commands
7110
+ 2. Read manual test case files
7111
+ 3. Explore the feature to gather selectors
7112
+ 4. Create page objects and automated tests following conventions from CLAUDE.md
7113
+ 5. Run each test using the command from CLAUDE.md and iterate until passing (max 3 attempts)
7114
+ 6. Update manual test case with automated_test reference
7115
+ 7. Document any product bugs discovered
7291
7116
 
7292
7117
  **For each test:**
7293
- - Run: \`npx playwright test [test-file]\`
7118
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7294
7119
  - If fails, classify as product bug or test issue
7295
- - If test issue: Apply fix patterns and retry
7120
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7296
7121
  - If product bug: Document and mark test as blocked
7297
7122
  - Continue until test passes or is blocked"
7298
7123
 
7299
- **Output Location:**
7300
- - Page Objects: \`./tests/pages/\`
7301
- - Test specs: \`./tests/specs/\`
7124
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7302
7125
 
7303
7126
  **Update Manual Test Cases:**
7304
7127
  After automation, update the manual test case frontmatter:
@@ -7554,30 +7377,29 @@ After test generation completes, verify all artifacts meet quality standards:
7554
7377
  - Contains human-readable steps and expected results
7555
7378
  - References environment variables for test data
7556
7379
 
7557
- **2. Automated Tests (in \`./tests/specs/\`):**
7380
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7558
7381
  - Organized by feature in subdirectories
7559
7382
  - Each test file references manual test case ID in comments
7560
- - Uses Page Object Model pattern
7561
- - Follows role-based selector priority
7383
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7384
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7562
7385
  - Uses environment variables for test data
7563
7386
  - Includes proper TypeScript typing
7564
7387
 
7565
- **3. Page Objects (in \`./tests/pages/\`):**
7566
- - Extend BasePage class
7567
- - Use semantic selectors (getByRole, getByLabel, getByText)
7388
+ **3. Page Objects** (in directory specified by \`./tests/CLAUDE.md\`):
7389
+ - Follow page object conventions from \`./tests/CLAUDE.md\`
7568
7390
  - Contain only actions, no assertions
7569
7391
  - Properly typed with TypeScript
7570
7392
 
7571
- **4. Supporting Files:**
7572
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7573
- - Helper functions for data generation (in \`./tests/helpers/\`)
7574
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7575
- - Types defined as needed (in \`./tests/types/\`)
7393
+ **4. Supporting Files** (in directories specified by \`./tests/CLAUDE.md\`):
7394
+ - Fixtures created for common setup
7395
+ - Helper functions for data generation
7396
+ - Component objects for reusable UI elements
7397
+ - Types defined as needed
7576
7398
 
7577
7399
  **Validation Checklist:**
7578
7400
  - [ ] All manual test cases have proper frontmatter
7579
7401
  - [ ] Automated tests reference their manual test case IDs
7580
- - [ ] Page Objects follow the BasePage pattern
7402
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7581
7403
  - [ ] No hardcoded test data (uses environment variables)
7582
7404
  - [ ] Tests are syntactically valid TypeScript`,
7583
7405
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -7596,7 +7418,7 @@ var STEP_LIBRARY = {
7596
7418
  // Clarification
7597
7419
  "clarification-protocol": clarificationProtocolStep,
7598
7420
  // Execution
7599
- "run-playwright-tests": runPlaywrightTestsStep,
7421
+ "run-tests": runTestsStep,
7600
7422
  "parse-test-results": parseTestResultsStep,
7601
7423
  "triage-failures": triageFailuresStep,
7602
7424
  "fix-test-issues": fixTestIssuesStep,