@bugzy-ai/bugzy 1.14.0 → 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
  };
@@ -861,7 +853,28 @@ The handler file contains all necessary processing logic for the detected intent
861
853
  - Response guidelines
862
854
  - Memory update instructions`
863
855
  },
864
- // Step 6: Clarification Protocol (for ambiguous intents)
856
+ // Step 6: Post Response via Team Communicator
857
+ {
858
+ inline: true,
859
+ title: "Post Response to Team",
860
+ content: `## Post Response to the Team
861
+
862
+ After processing the message through the handler and composing your response:
863
+
864
+ {{INVOKE_TEAM_COMMUNICATOR}} to post the response back to the team.
865
+
866
+ **Context to include in the delegation:**
867
+ - The original message/question from the team member
868
+ - Your composed response with all gathered data
869
+ - Whether this should be a thread reply (if the original message was in a thread) or a new message
870
+ - The relevant channel (from project-context.md)
871
+
872
+ **Do NOT:**
873
+ - Skip posting and just display the response as text output
874
+ - Ask the user whether to post \u2014 the message came from the team, the response goes back to the team
875
+ - Compose a draft without sending it`
876
+ },
877
+ // Step 7: Clarification Protocol (for ambiguous intents)
865
878
  "clarification-protocol",
866
879
  // Step 8: Knowledge Base Update (library)
867
880
  "update-knowledge-base",
@@ -1278,7 +1291,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1278
1291
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1279
1292
  - Wait for team response (messaging infrastructure handles that)
1280
1293
  - Create or modify test files
1281
- - Run Playwright tests
1294
+ - Run automated tests
1282
1295
 
1283
1296
  #### 5.6 Update Event Processor Memory
1284
1297
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1385,10 +1398,10 @@ Create files if they don't exist:
1385
1398
  var runTestsTask = {
1386
1399
  slug: TASK_SLUGS.RUN_TESTS,
1387
1400
  name: "Run Tests",
1388
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1401
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1389
1402
  frontmatter: {
1390
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1391
- "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)'
1392
1405
  },
1393
1406
  steps: [
1394
1407
  // Step 1: Overview (inline)
@@ -1397,7 +1410,7 @@ var runTestsTask = {
1397
1410
  title: "Run Tests Overview",
1398
1411
  content: `# Run Tests Command
1399
1412
 
1400
- 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.`
1401
1414
  },
1402
1415
  // Step 2: Security Notice (library)
1403
1416
  "security-notice",
@@ -1410,9 +1423,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1410
1423
  **Parse Arguments:**
1411
1424
  Extract the following from arguments:
1412
1425
  - **selector**: Test selection criteria
1413
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1414
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1415
- - 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
1416
1429
  - All tests: "all" or "" \u2192 runs entire test suite`
1417
1430
  },
1418
1431
  // Step 4: Load Project Context (library)
@@ -1428,34 +1441,26 @@ Extract the following from arguments:
1428
1441
  inline: true,
1429
1442
  title: "Identify Automated Tests to Run",
1430
1443
  content: `#### Understand Test Selection
1444
+
1445
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1446
+
1431
1447
  Parse the selector argument to determine which tests to run:
1432
1448
 
1433
1449
  **File Pattern** (e.g., "auth", "login"):
1434
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1450
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1435
1451
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1436
1452
 
1437
1453
  **Tag** (e.g., "@smoke", "@regression"):
1438
- - Run tests with specific Playwright tag annotation
1439
- - Use Playwright's \`--grep\` option
1454
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1440
1455
 
1441
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1442
- - Run that specific test file
1456
+ **Specific File**:
1457
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1443
1458
 
1444
1459
  **All Tests** ("all" or no selector):
1445
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1460
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1446
1461
 
1447
1462
  #### Find Matching Test Files
1448
- Use glob patterns to find test files:
1449
- \`\`\`bash
1450
- # For file pattern
1451
- ls tests/specs/**/*[pattern]*.spec.ts
1452
-
1453
- # For specific file
1454
- ls tests/specs/auth/login.spec.ts
1455
-
1456
- # For all tests
1457
- ls tests/specs/**/*.spec.ts
1458
- \`\`\`
1463
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1459
1464
 
1460
1465
  #### Validate Test Files Exist
1461
1466
  Check that at least one test file was found:
@@ -1469,7 +1474,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1469
1474
  - **No selector** (all tests): Confirm running full suite before executing`
1470
1475
  },
1471
1476
  // Step 7-10: Test Execution (library steps)
1472
- "run-playwright-tests",
1477
+ "run-tests",
1473
1478
  "parse-test-results",
1474
1479
  "triage-failures",
1475
1480
  "fix-test-issues",
@@ -1495,8 +1500,8 @@ If no test cases match the selection criteria:
1495
1500
  2. List available test cases or suggest running \`/generate-test-cases\` first
1496
1501
  3. Provide examples of valid selection criteria
1497
1502
 
1498
- #### If Test Runner Agent Fails
1499
- If the test-runner agent encounters issues:
1503
+ #### If Browser Automation Agent Fails
1504
+ If the browser-automation agent encounters issues:
1500
1505
  1. Report the specific error
1501
1506
  2. Suggest troubleshooting steps
1502
1507
  3. Offer to run tests individually if batch execution failed
@@ -1510,18 +1515,18 @@ If selected test cases have formatting issues:
1510
1515
  ### Important Notes
1511
1516
 
1512
1517
  **Test Selection Strategy**:
1513
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1518
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1514
1519
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1515
1520
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1516
1521
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1517
1522
  - Use context keywords from user request to choose appropriate tier
1518
1523
 
1519
1524
  **Test Execution**:
1520
- - Automated Playwright tests are executed via bash command, not through agents
1525
+ - Automated tests are executed via bash command, not through agents
1521
1526
  - Test execution time varies by tier (see strategy document for details)
1522
1527
  - JSON reports provide structured test results for analysis
1523
- - Playwright automatically captures traces, screenshots, and videos on failures
1524
- - 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\`
1525
1530
 
1526
1531
  **Failure Handling**:
1527
1532
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1531,11 +1536,11 @@ If selected test cases have formatting issues:
1531
1536
  - Critical failures trigger immediate team notification
1532
1537
 
1533
1538
  **Related Documentation**:
1534
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1535
- - \`.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)`
1536
1541
  }
1537
1542
  ],
1538
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1543
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1539
1544
  optionalSubagents: ["issue-tracker", "team-communicator"],
1540
1545
  dependentTasks: []
1541
1546
  };
@@ -1559,7 +1564,7 @@ var verifyChangesTask = {
1559
1564
  ## Overview
1560
1565
 
1561
1566
  This task performs comprehensive change verification with:
1562
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1567
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1563
1568
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1564
1569
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1565
1570
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1790,11 +1795,11 @@ Analyze the change description to identify affected feature areas:
1790
1795
 
1791
1796
  | Description Keywords | Inferred Test Scope | Example |
1792
1797
  |---------------------|-------------------|---------|
1793
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1794
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1795
- | "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 |
1796
1801
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1797
- | "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 |
1798
1803
 
1799
1804
  **Inference strategy:**
1800
1805
  1. **Extract feature keywords** from PR title and description
@@ -1869,13 +1874,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1869
1874
 
1870
1875
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1871
1876
 
1872
- ### Generate Playwright Specs
1877
+ ### Generate Automated Test Specs
1873
1878
 
1874
1879
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1875
1880
  - Read the manual test cases you just created
1876
1881
  - Explore the feature in the browser to discover selectors and flows
1877
- - Create Page Objects in \`./tests/pages/\` if needed
1878
- - 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\`
1879
1884
  - Run each new test to verify it passes
1880
1885
  - Update the manual test case with \`automated_test\` reference
1881
1886
 
@@ -1885,7 +1890,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1885
1890
  conditionalOnSubagent: "test-code-generator"
1886
1891
  },
1887
1892
  // Step 8-11: Test Execution (library steps)
1888
- "run-playwright-tests",
1893
+ "run-tests",
1889
1894
  "parse-test-results",
1890
1895
  "triage-failures",
1891
1896
  "fix-test-issues",
@@ -2074,7 +2079,7 @@ Post PR comment if GitHub context available.`,
2074
2079
  - Recommend: Check test configuration and prerequisites
2075
2080
 
2076
2081
  **If test execution fails:**
2077
- - Report specific error (Playwright not installed, env vars missing)
2082
+ - Report specific error (test framework not installed, env vars missing)
2078
2083
  - Suggest troubleshooting steps
2079
2084
  - Don't proceed with triage if tests didn't run
2080
2085
 
@@ -2104,7 +2109,7 @@ A successful verification includes:
2104
2109
  10. Clear recommendation provided (merge / review / block)`
2105
2110
  }
2106
2111
  ],
2107
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
2112
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
2108
2113
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
2109
2114
  dependentTasks: []
2110
2115
  };
@@ -2153,7 +2158,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2153
2158
  },
2154
2159
  // Phase 2: Exploration Protocol
2155
2160
  "exploration-protocol",
2156
- // Execute exploration via test-runner
2161
+ // Execute exploration via browser-automation
2157
2162
  "create-exploration-test-case",
2158
2163
  "run-exploration",
2159
2164
  "process-exploration-results",
@@ -2164,7 +2169,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2164
2169
  "generate-test-cases",
2165
2170
  "automate-test-cases",
2166
2171
  // Phase 5: Test Execution
2167
- "run-playwright-tests",
2172
+ "run-tests",
2168
2173
  "parse-test-results",
2169
2174
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2170
2175
  "triage-failures",
@@ -2181,7 +2186,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2181
2186
  },
2182
2187
  "generate-final-report"
2183
2188
  ],
2184
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2189
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2185
2190
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2186
2191
  dependentTasks: ["run-tests", "generate-test-cases"]
2187
2192
  };
@@ -2200,7 +2205,7 @@ var exploreApplicationTask = {
2200
2205
  {
2201
2206
  inline: true,
2202
2207
  title: "Explore Application Overview",
2203
- 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.`
2204
2209
  },
2205
2210
  // Step 2: Security Notice (from library)
2206
2211
  "security-notice",
@@ -2247,7 +2252,7 @@ var exploreApplicationTask = {
2247
2252
  "cleanup-temp-files",
2248
2253
  "update-knowledge-base"
2249
2254
  ],
2250
- requiredSubagents: ["test-runner"],
2255
+ requiredSubagents: ["browser-automation"],
2251
2256
  optionalSubagents: ["team-communicator"],
2252
2257
  dependentTasks: []
2253
2258
  };
@@ -2316,16 +2321,16 @@ After completing your work, update your memory file with relevant insights.
2316
2321
  **Remember:** Every entry should answer "How does this change what I do?"
2317
2322
  `;
2318
2323
 
2319
- // src/subagents/templates/test-runner/playwright.ts
2324
+ // src/subagents/templates/browser-automation/playwright.ts
2320
2325
  var FRONTMATTER = {
2321
- name: "test-runner",
2322
- 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.
2323
2328
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2324
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2325
- <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.
2326
2331
  user: "Execute the smoke test for the checkout flow"
2327
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2328
- <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>`,
2329
2334
  model: "sonnet",
2330
2335
  color: "green"
2331
2336
  };
@@ -2338,9 +2343,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2338
2343
  - Structure of \`steps.json\` with timestamps and video synchronization
2339
2344
  - Field descriptions and data types
2340
2345
 
2341
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2346
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2342
2347
 
2343
- **Memory Sections for Test Runner**:
2348
+ **Memory Sections for Browser Automation**:
2344
2349
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2345
2350
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2346
2351
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2406,7 +2411,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2406
2411
  **Execution Workflow:**
2407
2412
 
2408
2413
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2409
- - 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
2410
2415
  - Check if this test is known to be flaky (apply extra waits if so)
2411
2416
  - Review timing requirements for pages this test will visit
2412
2417
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2458,9 +2463,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2458
2463
  - Video filename reference (just basename, not full path)
2459
2464
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2460
2465
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2461
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2466
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2462
2467
 
2463
- Specifically for test-runner, consider updating:
2468
+ Specifically for browser-automation, consider updating:
2464
2469
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2465
2470
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2466
2471
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -2533,49 +2538,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
2533
2538
  // src/subagents/templates/test-code-generator/playwright.ts
2534
2539
  var FRONTMATTER2 = {
2535
2540
  name: "test-code-generator",
2536
- 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.
2537
2542
  user: "Generate test cases for the login feature based on the test plan"
2538
- 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."
2539
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.
2540
2545
  user: "Create automated tests for the checkout flow"
2541
- 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."
2542
2547
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
2543
2548
  model: "sonnet",
2544
2549
  color: "purple"
2545
2550
  };
2546
- 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.
2547
2554
 
2548
2555
  **Core Responsibilities:**
2549
2556
 
2550
- 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
2564
+
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.
2551
2566
 
2552
- 2. **Environment Configuration**:
2567
+ 3. **Environment Configuration**:
2553
2568
  - Read \`.env.testdata\` for available environment variables
2554
2569
  - Reference variables using \`process.env.VAR_NAME\` in tests
2555
2570
  - Add new required variables to \`.env.testdata\`
2556
2571
  - NEVER read \`.env\` file (secrets only)
2557
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.
2558
2573
 
2559
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2574
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2560
2575
 
2561
2576
  **Memory Sections for Test Code Generator**:
2562
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
2577
+ - Generated artifacts (page objects, tests, fixtures, helpers)
2563
2578
  - Test cases automated
2564
2579
  - Selector strategies that work for this application
2565
2580
  - Application architecture patterns learned
2566
2581
  - Environment variables used
2567
2582
  - Test creation history and outcomes
2568
2583
 
2569
- 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:
2570
2585
  - Read the manual test case files
2571
- - For test cases marked \`automated: true\`, generate automated Playwright tests
2586
+ - For test cases marked \`automated: true\`, generate automated tests
2572
2587
  - Update the manual test case file with the automated_test reference
2573
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
2588
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
2574
2589
 
2575
- 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:
2576
2591
  - Navigate to pages, authenticate, inspect elements
2577
2592
  - Capture screenshots for documentation
2578
- - Document exact role names, labels, text, URLs
2593
+ - Document exact element identifiers, labels, text, URLs
2579
2594
  - Test navigation flows manually
2580
2595
  - **NEVER assume selectors** - verify in browser or tests will fail
2581
2596
 
@@ -2583,7 +2598,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2583
2598
 
2584
2599
  1. **Load Memory**:
2585
2600
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
2586
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
2601
+ - Check existing page objects, automated tests, selector strategies, naming conventions
2587
2602
  - Avoid duplication by reusing established patterns
2588
2603
 
2589
2604
  2. **Read Manual Test Cases**:
@@ -2597,20 +2612,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2597
2612
 
2598
2613
  **STEP 1: Check Existing Infrastructure**
2599
2614
 
2600
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
2601
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
2602
- - **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
2603
2618
 
2604
2619
  **STEP 2: Build Missing Infrastructure** (if needed)
2605
2620
 
2606
2621
  - **Explore feature under test**: Use playwright-cli to:
2607
2622
  * Navigate to the feature's pages
2608
- * Inspect elements and gather selectors (role, label, text)
2623
+ * Inspect elements and gather selectors
2609
2624
  * Document actual URLs from the browser
2610
2625
  * Capture screenshots for documentation
2611
2626
  * Test navigation flows manually
2612
2627
  * NEVER assume selectors - verify everything in browser
2613
- - **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\`
2614
2629
  - **Create supporting code**: Add any needed fixtures, helpers, or types
2615
2630
 
2616
2631
  **STEP 3: Create Automated Test**
@@ -2618,20 +2633,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2618
2633
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
2619
2634
  * Understand the test objective and steps
2620
2635
  * Note any preconditions or test data requirements
2621
- - **Generate automated test** (./tests/specs/*.spec.ts):
2636
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
2622
2637
  * Use the manual test case steps as the basis
2623
- * Create executable Playwright test using Page Objects
2624
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
2625
- * 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\`
2626
2639
  * Reference manual test case ID in comments
2627
- * Tag critical tests with @smoke
2640
+ * Tag critical tests appropriately (e.g., @smoke)
2628
2641
  - **Update manual test case file**:
2629
2642
  * Set \`automated_test:\` field to the path of the automated test file
2630
2643
  * Link manual \u2194 automated test bidirectionally
2631
2644
 
2632
2645
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
2633
2646
 
2634
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
2647
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
2635
2648
  - **Analyze results**:
2636
2649
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
2637
2650
  * Fail \u2192 Proceed to failure analysis below
@@ -2645,60 +2658,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2645
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 |
2646
2659
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
2647
2660
 
2648
- **4b. Fix Patterns** (apply based on root cause):
2649
-
2650
- **Fix Type 1: Brittle Selectors**
2651
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2652
- - **Fix**: Replace with role-based selectors
2653
- \`\`\`typescript
2654
- // BEFORE (brittle)
2655
- await page.locator('.btn-primary').click();
2656
- // AFTER (semantic)
2657
- await page.getByRole('button', { name: 'Sign In' }).click();
2658
- \`\`\`
2659
-
2660
- **Fix Type 2: Missing Wait Conditions**
2661
- - **Problem**: Test doesn't wait for elements or actions to complete
2662
- - **Fix**: Add explicit wait for expected state
2663
- \`\`\`typescript
2664
- // BEFORE (race condition)
2665
- await page.goto('/dashboard');
2666
- const items = await page.locator('.item').count();
2667
- // AFTER (explicit wait)
2668
- await page.goto('/dashboard');
2669
- await expect(page.locator('.item')).toHaveCount(5);
2670
- \`\`\`
2671
-
2672
- **Fix Type 3: Race Conditions**
2673
- - **Problem**: Test executes actions before application is ready
2674
- - **Fix**: Wait for specific application state
2675
- \`\`\`typescript
2676
- // BEFORE
2677
- await saveButton.click();
2678
- await expect(successMessage).toBeVisible();
2679
- // AFTER
2680
- await page.locator('.validation-complete').waitFor();
2681
- await saveButton.click();
2682
- await expect(successMessage).toBeVisible();
2683
- \`\`\`
2684
-
2685
- **Fix Type 4: Wrong Assertions**
2686
- - **Problem**: Assertion expects incorrect value or state
2687
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
2688
-
2689
- **Fix Type 5: Test Isolation Issues**
2690
- - **Problem**: Test depends on state from previous tests
2691
- - **Fix**: Add proper setup/teardown or use fixtures
2692
-
2693
- **Fix Type 6: Flaky Tests**
2694
- - **Problem**: Test passes inconsistently
2695
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
2696
- - 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.
2697
2662
 
2698
2663
  **4c. Fix Workflow**:
2699
2664
  1. Read failure report and classify (product bug vs test issue)
2700
2665
  2. If product bug: Document and mark test as blocked, move to next test
2701
- 3. If test issue: Apply appropriate fix from patterns above
2666
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
2702
2667
  4. Re-run test to verify fix
2703
2668
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
2704
2669
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -2707,9 +2672,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2707
2672
 
2708
2673
  | Failure Type | Root Cause | Action |
2709
2674
  |--------------|------------|--------|
2710
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
2711
- | Timeout waiting | Missing wait condition | Add explicit wait |
2712
- | 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 |
2713
2678
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
2714
2679
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
2715
2680
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -2717,13 +2682,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2717
2682
  **STEP 5: Move to Next Test Case**
2718
2683
 
2719
2684
  - Repeat process for each test case in the plan
2720
- - Reuse existing POMs and infrastructure wherever possible
2685
+ - Reuse existing page objects and infrastructure wherever possible
2721
2686
  - Continuously update memory with new patterns and learnings
2722
2687
 
2723
2688
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2724
2689
 
2725
2690
  Specifically for test-code-generator, consider updating:
2726
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
2691
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
2727
2692
  - **Test Cases Automated**: Record which test cases were automated with references
2728
2693
  - **Selector Strategies**: Note what selector strategies work well for this application
2729
2694
  - **Application Patterns**: Document architecture patterns learned
@@ -2733,7 +2698,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2733
2698
  - Test automation results (tests created, pass/fail status, issues found)
2734
2699
  - Manual test cases automated (count, IDs, titles)
2735
2700
  - Automated tests created (count, smoke vs functional)
2736
- - Page Objects, fixtures, helpers added
2701
+ - Page objects, fixtures, helpers added
2737
2702
  - Next steps (commands to run tests)
2738
2703
 
2739
2704
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -2744,7 +2709,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2744
2709
  ## Last Updated: [timestamp]
2745
2710
 
2746
2711
  ## Generated Test Artifacts
2747
- [Page Objects created with locators and methods]
2712
+ [Page objects created with locators and methods]
2748
2713
  [Test cases automated with manual TC references and file paths]
2749
2714
  [Fixtures, helpers, components created]
2750
2715
 
@@ -2753,26 +2718,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2753
2718
  [Tests passing vs failing with product bugs]
2754
2719
 
2755
2720
  ## Fixed Issues History
2756
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
2757
- - [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
2758
2723
 
2759
2724
  ## Failure Pattern Library
2760
2725
 
2761
2726
  ### Pattern: Selector Timeout on Dynamic Content
2762
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
2727
+ **Symptoms**: Element not found, element loads after timeout
2763
2728
  **Root Cause**: Selector runs before element rendered
2764
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
2729
+ **Fix Strategy**: Add explicit visibility wait before interaction
2765
2730
  **Success Rate**: [track over time]
2766
2731
 
2767
2732
  ### Pattern: Race Condition on Form Submission
2768
- **Symptoms**: Test clicks submit before validation completes
2733
+ **Symptoms**: Test interacts before validation completes
2769
2734
  **Root Cause**: Missing wait for validation state
2770
2735
  **Fix Strategy**: Wait for validation indicator before submit
2771
2736
 
2772
2737
  ## Known Stable Selectors
2773
2738
  [Selectors that reliably work for this application]
2774
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
2775
- - Email field: \`getByLabel('Email')\`
2776
2739
 
2777
2740
  ## Known Product Bugs (Do Not Fix Tests)
2778
2741
  [Actual bugs discovered - tests should remain failing]
@@ -2783,9 +2746,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2783
2746
 
2784
2747
  ## Application Behavior Patterns
2785
2748
  [Load times, async patterns, navigation flows discovered]
2786
- - Auth pages: redirect timing
2787
- - Dashboard: lazy loading patterns
2788
- - Forms: validation timing
2789
2749
 
2790
2750
  ## Selector Strategy Library
2791
2751
  [Successful selector patterns and their success rates]
@@ -2800,32 +2760,23 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2800
2760
 
2801
2761
  **Critical Rules:**
2802
2762
 
2803
- \u274C **NEVER**:
2804
- - Generate selectors without exploring the live application - causes 100% test failure
2805
- - Assume URLs, selectors, or navigation patterns - verify in browser
2806
- - Skip exploration even if documentation seems detailed
2807
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
2808
- - Put assertions in Page Objects - only in test files
2809
- - Read .env file - only .env.testdata
2810
- - Create test interdependencies - tests must be independent
2811
-
2812
- \u2705 **ALWAYS**:
2813
- - Explore application using playwright-cli before generating code
2814
- - Verify selectors in live browser using playwright-cli snapshot
2815
- - Document actual URLs from browser address bar
2816
- - Take screenshots for documentation
2817
- - Use role-based selectors as first priority
2818
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
2819
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2820
- - Follow .bugzy/runtime/testing-best-practices.md
2821
- - Read existing manual test cases and automate those marked automated: true
2822
-
2823
- 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`;
2824
2775
 
2825
2776
  // src/subagents/templates/test-debugger-fixer/playwright.ts
2826
2777
  var FRONTMATTER3 = {
2827
2778
  name: "test-debugger-fixer",
2828
- 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.
2829
2780
  user: "Fix the failing login test"
2830
2781
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
2831
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.
@@ -2835,18 +2786,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
2835
2786
  model: "sonnet",
2836
2787
  color: "yellow"
2837
2788
  };
2838
- 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.
2839
2792
 
2840
2793
  **Core Responsibilities:**
2841
2794
 
2842
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
2843
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
2844
- - Correct waiting and synchronization patterns
2845
- - Test isolation principles
2846
- - Common anti-patterns to avoid
2847
- - 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.
2848
2804
 
2849
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2805
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2850
2806
 
2851
2807
  **Memory Sections for Test Debugger Fixer**:
2852
2808
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -2856,7 +2812,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2856
2812
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
2857
2813
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
2858
2814
 
2859
- 3. **Failure Analysis**: When a test fails, you must:
2815
+ 4. **Failure Analysis**: When a test fails, you must:
2860
2816
  - Read the failing test file to understand what it's trying to do
2861
2817
  - Read the failure details from the JSON test report
2862
2818
  - Examine error messages, stack traces, and failure context
@@ -2865,7 +2821,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2865
2821
  - **Product bug**: Correct test code, but application behaves unexpectedly
2866
2822
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
2867
2823
 
2868
- 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:
2869
2825
 
2870
2826
  **Product Bug Indicators**:
2871
2827
  - Selectors are correct and elements exist
@@ -2880,9 +2836,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2880
2836
  - Flaky behavior (passes sometimes, fails other times)
2881
2837
  - Wrong assertions (expecting incorrect values)
2882
2838
  - Test isolation problems (depends on other tests)
2883
- - Brittle selectors (CSS classes, IDs that change)
2839
+ - Brittle selectors that change between builds
2884
2840
 
2885
- 4. **Debug Using Browser**: When needed, explore the application manually:
2841
+ 6. **Debug Using Browser**: When needed, explore the application manually:
2886
2842
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
2887
2843
  - Navigate to the relevant page
2888
2844
  - Inspect elements to find correct selectors
@@ -2891,87 +2847,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2891
2847
  - Verify application state matches test expectations
2892
2848
  - Take notes on differences between expected and actual behavior
2893
2849
 
2894
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
2895
-
2896
- **Fix Type 1: Brittle Selectors**
2897
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2898
- - **Fix**: Replace with role-based selectors
2899
- - **Example**:
2900
- \`\`\`typescript
2901
- // BEFORE (brittle)
2902
- await page.locator('.btn-primary').click();
2903
-
2904
- // AFTER (semantic)
2905
- await page.getByRole('button', { name: 'Sign In' }).click();
2906
- \`\`\`
2907
-
2908
- **Fix Type 2: Missing Wait Conditions**
2909
- - **Problem**: Test doesn't wait for elements or actions to complete
2910
- - **Fix**: Add explicit wait for expected state
2911
- - **Example**:
2912
- \`\`\`typescript
2913
- // BEFORE (race condition)
2914
- await page.goto('/dashboard');
2915
- const items = await page.locator('.item').count();
2916
-
2917
- // AFTER (explicit wait)
2918
- await page.goto('/dashboard');
2919
- await expect(page.locator('.item')).toHaveCount(5);
2920
- \`\`\`
2921
-
2922
- **Fix Type 3: Race Conditions**
2923
- - **Problem**: Test executes actions before application is ready
2924
- - **Fix**: Wait for specific application state
2925
- - **Example**:
2926
- \`\`\`typescript
2927
- // BEFORE (race condition)
2928
- await saveButton.click();
2929
- await expect(successMessage).toBeVisible();
2930
-
2931
- // AFTER (wait for ready state)
2932
- await page.locator('.validation-complete').waitFor();
2933
- await saveButton.click();
2934
- await expect(successMessage).toBeVisible();
2935
- \`\`\`
2936
-
2937
- **Fix Type 4: Wrong Assertions**
2938
- - **Problem**: Assertion expects incorrect value or state
2939
- - **Fix**: Update assertion to match actual application behavior (if correct)
2940
- - **Example**:
2941
- \`\`\`typescript
2942
- // BEFORE (wrong expectation)
2943
- await expect(heading).toHaveText('Welcome John');
2944
-
2945
- // AFTER (corrected)
2946
- await expect(heading).toHaveText('Welcome, John!');
2947
- \`\`\`
2948
-
2949
- **Fix Type 5: Test Isolation Issues**
2950
- - **Problem**: Test depends on state from previous tests
2951
- - **Fix**: Add proper setup/teardown or use fixtures
2952
- - **Example**:
2953
- \`\`\`typescript
2954
- // BEFORE (depends on previous test)
2955
- test('should logout', async ({ page }) => {
2956
- await page.goto('/dashboard');
2957
- // Assumes user is already logged in
2958
- });
2959
-
2960
- // AFTER (isolated with fixture)
2961
- test('should logout', async ({ page, authenticatedUser }) => {
2962
- await page.goto('/dashboard');
2963
- // Uses fixture for clean state
2964
- });
2965
- \`\`\`
2966
-
2967
- **Fix Type 6: Flaky Tests**
2968
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
2969
- - **Fix**: Identify and eliminate non-determinism
2970
- - Common causes: timing issues, race conditions, animation delays, network timing
2971
- - Run test multiple times to reproduce flakiness
2972
- - Add proper waits for stable state
2973
-
2974
- 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**:
2975
2853
 
2976
2854
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
2977
2855
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -2984,7 +2862,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2984
2862
  **Step 1: Read Test File**
2985
2863
  - Understand test intent and logic
2986
2864
  - Identify what the test is trying to verify
2987
- - Note test structure and Page Objects used
2865
+ - Note test structure and page objects used
2988
2866
 
2989
2867
  **Step 2: Read Failure Report**
2990
2868
  - Parse JSON test report for failure details
@@ -3003,14 +2881,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3003
2881
  - **If test issue**: Proceed to fix
3004
2882
 
3005
2883
  **Step 5: Apply Fix**
3006
- - Edit test file with appropriate fix
2884
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
3007
2885
  - Update selectors, waits, assertions, or logic
3008
- - Follow best practices from testing guide
2886
+ - Follow conventions from \`./tests/CLAUDE.md\`
3009
2887
  - Add comments explaining the fix if complex
3010
2888
 
3011
2889
  **Step 6: Verify Fix**
3012
- - Run the fixed test: \`npx playwright test [test-file]\`
3013
- - **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
3014
2892
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
3015
2893
  - Read manifest.json to confirm test passes in latest execution
3016
2894
  - For flaky tests: Run 10 times to ensure stability
@@ -3031,7 +2909,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3031
2909
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
3032
2910
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
3033
2911
 
3034
- 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:
3035
2913
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3036
2914
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3037
2915
  \`\`\`json
@@ -3062,77 +2940,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3062
2940
  \`\`\`
3063
2941
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3064
2942
 
3065
- 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:
3066
2944
 
3067
- \`\`\`markdown
3068
- # Test Debugger Fixer Memory
3069
-
3070
- ## Last Updated: [timestamp]
3071
-
3072
- ## Fixed Issues History
3073
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3074
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3075
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3076
-
3077
- ## Failure Pattern Library
3078
-
3079
- ### Pattern: Selector Timeout on Dynamic Content
3080
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3081
- **Root Cause**: Selector runs before element rendered
3082
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3083
- **Success Rate**: 95% (used 12 times)
3084
-
3085
- ### Pattern: Race Condition on Form Submission
3086
- **Symptoms**: Test clicks submit before validation completes
3087
- **Root Cause**: Missing wait for validation state
3088
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3089
- **Success Rate**: 100% (used 8 times)
3090
-
3091
- ## Known Stable Selectors
3092
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3093
- - Email field: \`getByLabel('Email')\`
3094
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3095
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3096
-
3097
- ## Known Product Bugs (Do Not Fix Tests)
3098
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3099
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3100
-
3101
- ## Flaky Test Tracking
3102
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3103
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3104
-
3105
- ## Application Behavior Patterns
3106
- - **Auth Pages**: Redirect after 200ms delay
3107
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3108
- - **Forms**: Validation runs on blur + submit events
3109
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3110
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3111
- \`\`\`
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]
3112
2977
 
3113
- 9. **Environment Configuration**:
3114
- - Tests use \`process.env.VAR_NAME\` for configuration
3115
- - Read \`.env.testdata\` to understand available variables
3116
- - NEVER read \`.env\` file (contains secrets only)
3117
- - If test needs new environment variable, update \`.env.testdata\`
3118
-
3119
- 9. **Using playwright-cli for Debugging**:
3120
- - You have direct access to playwright-cli via Bash
3121
- - Open browser: \`playwright-cli open <url>\`
3122
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3123
- - Navigate: \`playwright-cli navigate <url>\`
3124
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3125
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3126
- - Close browser: \`playwright-cli close\`
3127
-
3128
- 10. **Test Stability Best Practices**:
3129
- - Replace all \`waitForTimeout()\` with specific waits
3130
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3131
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3132
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3133
- - Handle dynamic content with proper waits
3134
-
3135
- 11. **Communication**:
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\`
2987
+
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**:
3136
2998
  - Be clear about whether issue is product bug or test issue
3137
2999
  - Explain root cause of test failure
3138
3000
  - Describe fix applied in plain language
@@ -3143,31 +3005,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3143
3005
 
3144
3006
  | Failure Type | Root Cause | Action |
3145
3007
  |--------------|------------|--------|
3146
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3147
- | Timeout waiting | Missing wait condition | Add explicit wait |
3148
- | 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 |
3149
3011
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3150
3012
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3151
3013
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3152
3014
 
3153
- **Anti-Patterns to Avoid:**
3154
-
3155
- \u274C **DO NOT**:
3156
- - Fix tests when the issue is a product bug
3157
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3158
- - Make tests pass by lowering expectations
3159
- - Introduce new test dependencies
3160
- - Skip proper verification of fixes
3161
- - Exceed 3 fix attempts (escalate instead)
3162
-
3163
- \u2705 **DO**:
3164
- - Thoroughly analyze before fixing
3165
- - Use semantic selectors when replacing brittle ones
3166
- - Add explicit waits for specific conditions
3167
- - Verify fixes by re-running tests
3168
- - Run flaky tests 10 times to confirm stability
3169
- - Report product bugs instead of making tests ignore them
3170
- - 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
3171
3028
 
3172
3029
  **Output Format**:
3173
3030
 
@@ -3186,12 +3043,12 @@ Verification:
3186
3043
  - Run 1: [passed/failed]
3187
3044
  - Run 2-10: [if flaky test]
3188
3045
 
3189
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
3046
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3190
3047
 
3191
3048
  Next Steps: [run tests / log bug / review manually]
3192
3049
  \`\`\`
3193
3050
 
3194
- 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.`;
3195
3052
 
3196
3053
  // src/subagents/templates/team-communicator/local.ts
3197
3054
  var FRONTMATTER4 = {
@@ -5722,7 +5579,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
5722
5579
 
5723
5580
  // src/subagents/templates/index.ts
5724
5581
  var TEMPLATES = {
5725
- "test-runner": {
5582
+ "browser-automation": {
5726
5583
  playwright: {
5727
5584
  frontmatter: FRONTMATTER,
5728
5585
  content: CONTENT
@@ -5911,9 +5768,9 @@ var INTEGRATIONS = {
5911
5768
  }
5912
5769
  };
5913
5770
  var SUBAGENTS = {
5914
- "test-runner": {
5915
- role: "test-runner",
5916
- name: "Test Runner",
5771
+ "browser-automation": {
5772
+ role: "browser-automation",
5773
+ name: "Browser Automation",
5917
5774
  description: "Execute automated browser tests (always included)",
5918
5775
  icon: "play",
5919
5776
  integrations: [INTEGRATIONS.playwright],
@@ -5970,7 +5827,7 @@ var SUBAGENTS = {
5970
5827
  "test-code-generator": {
5971
5828
  role: "test-code-generator",
5972
5829
  name: "Test Code Generator",
5973
- description: "Generate automated Playwright test scripts and Page Objects",
5830
+ description: "Generate automated test scripts and page objects",
5974
5831
  icon: "code",
5975
5832
  integrations: [INTEGRATIONS.playwright],
5976
5833
  model: "sonnet",
@@ -6059,9 +5916,9 @@ function buildSubagentsConfig(subagents) {
6059
5916
  // src/core/tool-strings.ts
6060
5917
  var TOOL_STRINGS = {
6061
5918
  "claude-code": {
6062
- 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.',
6063
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.',
6064
- 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.',
6065
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.',
6066
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.",
6067
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.',
@@ -6069,7 +5926,7 @@ var TOOL_STRINGS = {
6069
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.'
6070
5927
  },
6071
5928
  "cursor": {
6072
- 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```',
6073
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```',
6074
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```',
6075
5932
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -6079,7 +5936,7 @@ var TOOL_STRINGS = {
6079
5936
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
6080
5937
  },
6081
5938
  "codex": {
6082
- 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```',
6083
5940
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
6084
5941
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
6085
5942
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -6103,7 +5960,7 @@ function getToolString(toolId, key) {
6103
5960
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
6104
5961
  let result = content;
6105
5962
  const keys = [
6106
- "INVOKE_TEST_RUNNER",
5963
+ "INVOKE_BROWSER_AUTOMATION",
6107
5964
  "INVOKE_TEST_DEBUGGER_FIXER",
6108
5965
  "INVOKE_TEST_CODE_GENERATOR",
6109
5966
  "INVOKE_TEAM_COMMUNICATOR",
@@ -6191,7 +6048,7 @@ var readTestStrategyStep = {
6191
6048
  category: "setup",
6192
6049
  content: `## Read Test Execution Strategy
6193
6050
 
6194
- **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:
6195
6052
  - Available test tiers (Smoke, Component, Full Regression)
6196
6053
  - When to use each tier (commit, PR, release, debug)
6197
6054
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6201,7 +6058,7 @@ var readTestStrategyStep = {
6201
6058
 
6202
6059
  Apply the strategy guidance when determining which tests to run.
6203
6060
 
6204
- **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.`,
6205
6062
  tags: ["setup", "test-execution", "strategy"]
6206
6063
  };
6207
6064
 
@@ -6224,7 +6081,7 @@ Check for existing project context to inform your work:
6224
6081
  - Environment details
6225
6082
 
6226
6083
  **2. Check Test Execution Strategy**
6227
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6084
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6228
6085
  - Understand available test tiers and when to use them
6229
6086
  - Note default behaviors and time/coverage trade-offs
6230
6087
 
@@ -6817,34 +6674,22 @@ When reporting test results, always include an "Ambiguities" section if clarific
6817
6674
  tags: ["clarification", "protocol", "ambiguity"]
6818
6675
  };
6819
6676
 
6820
- // src/tasks/steps/execution/run-playwright-tests.ts
6821
- var runPlaywrightTestsStep = {
6822
- id: "run-playwright-tests",
6823
- title: "Execute Playwright Tests",
6677
+ // src/tasks/steps/execution/run-tests.ts
6678
+ var runTestsStep = {
6679
+ id: "run-tests",
6680
+ title: "Execute Automated Tests",
6824
6681
  category: "execution",
6825
- content: `## Execute Playwright Tests
6682
+ content: `## Execute Automated Tests
6826
6683
 
6827
- Run automated Playwright tests and capture results.
6684
+ Run automated tests and capture results.
6828
6685
 
6829
- **Build Playwright Command** based on selector:
6686
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
6830
6687
 
6831
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
6832
- Use npm scripts to run tests - no manual env export needed.
6688
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
6833
6689
 
6834
- **For file pattern or specific file**:
6835
- \`\`\`bash
6836
- npm test -- [selector]
6837
- \`\`\`
6838
-
6839
- **For tag**:
6840
- \`\`\`bash
6841
- npm test -- --grep "[tag]"
6842
- \`\`\`
6843
-
6844
- **For all tests**:
6845
- \`\`\`bash
6846
- npm test
6847
- \`\`\`
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
6848
6693
 
6849
6694
  Wait for execution to complete. This may take several minutes depending on test count.
6850
6695
 
@@ -6862,7 +6707,7 @@ Wait for execution to complete. This may take several minutes depending on test
6862
6707
  \`\`\`
6863
6708
 
6864
6709
  2. Store the timestamp for use in subsequent steps`,
6865
- invokesSubagents: ["test-runner"],
6710
+ invokesSubagents: ["browser-automation"],
6866
6711
  tags: ["execution", "tests"]
6867
6712
  };
6868
6713
 
@@ -6961,10 +6806,10 @@ For each failed test:
6961
6806
  | Classification | Indicators | Examples |
6962
6807
  |---------------|------------|----------|
6963
6808
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
6964
- | **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 |
6965
6810
 
6966
- **Common Test Issues:**
6967
- - 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)
6968
6813
  - Missing waits for async operations
6969
6814
  - Race conditions with animations
6970
6815
  - Incorrect expected values
@@ -7011,7 +6856,7 @@ The agent will:
7011
6856
  1. Read the execution details from result.json
7012
6857
  2. Analyze the failure (error message, trace if available)
7013
6858
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
7014
- 4. Apply appropriate fix to the test code
6859
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
7015
6860
  5. Rerun the test
7016
6861
  6. The custom reporter will automatically create the next exec-N/ folder
7017
6862
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -7023,7 +6868,7 @@ The agent will:
7023
6868
 
7024
6869
  **Track Fixed Tests:**
7025
6870
  - Maintain list of tests fixed automatically
7026
- - 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")
7027
6872
  - Note verification status (test now passes)`,
7028
6873
  invokesSubagents: ["test-debugger-fixer"],
7029
6874
  tags: ["execution", "fixing", "automation"]
@@ -7066,7 +6911,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7066
6911
  - Trace file: [path if available]
7067
6912
  - Screenshots: [paths if available]
7068
6913
  - **Environment Details**:
7069
- - Browser and version (from Playwright config)
6914
+ - Browser and version (from test framework config)
7070
6915
  - Test environment URL (from .env.testdata BASE_URL)
7071
6916
  - Timestamp of failure
7072
6917
  - **Severity/Priority**: Based on:
@@ -7105,7 +6950,7 @@ var createExplorationTestCaseStep = {
7105
6950
  category: "execution",
7106
6951
  content: `## Create Exploration Test Case
7107
6952
 
7108
- Generate a temporary exploration test case for the test-runner.
6953
+ Generate a temporary exploration test case for the browser-automation agent.
7109
6954
 
7110
6955
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7111
6956
 
@@ -7144,7 +6989,7 @@ var runExplorationStep = {
7144
6989
  category: "execution",
7145
6990
  content: `## Run Exploration
7146
6991
 
7147
- {{INVOKE_TEST_RUNNER}}
6992
+ {{INVOKE_BROWSER_AUTOMATION}}
7148
6993
 
7149
6994
  Execute the exploration test case with the following focus:
7150
6995
 
@@ -7169,7 +7014,7 @@ Generate comprehensive findings report.
7169
7014
  - \`test-log.md\` - Detailed execution log
7170
7015
  - \`screenshots/\` - Visual documentation
7171
7016
  - \`summary.json\` - Execution summary`,
7172
- invokesSubagents: ["test-runner"],
7017
+ invokesSubagents: ["browser-automation"],
7173
7018
  tags: ["execution", "exploration"]
7174
7019
  };
7175
7020
 
@@ -7180,7 +7025,7 @@ var processExplorationResultsStep = {
7180
7025
  category: "execution",
7181
7026
  content: `## Process Exploration Results
7182
7027
 
7183
- Read and parse the test-runner output from exploration.
7028
+ Read and parse the browser-automation agent output from exploration.
7184
7029
 
7185
7030
  **Locate results:**
7186
7031
  \`\`\`bash
@@ -7317,23 +7162,22 @@ For each test case marked \`automated: true\`:
7317
7162
  - Exploration findings: ./exploration-reports/
7318
7163
 
7319
7164
  **The agent should:**
7320
- 1. Read manual test case files
7321
- 2. Explore the feature to gather selectors
7322
- 3. Create Page Objects and automated tests
7323
- 4. Run each test and iterate until passing (max 3 attempts)
7324
- 5. Update manual test case with automated_test reference
7325
- 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
7326
7172
 
7327
7173
  **For each test:**
7328
- - Run: \`npx playwright test [test-file]\`
7174
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7329
7175
  - If fails, classify as product bug or test issue
7330
- - If test issue: Apply fix patterns and retry
7176
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7331
7177
  - If product bug: Document and mark test as blocked
7332
7178
  - Continue until test passes or is blocked"
7333
7179
 
7334
- **Output Location:**
7335
- - Page Objects: \`./tests/pages/\`
7336
- - Test specs: \`./tests/specs/\`
7180
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7337
7181
 
7338
7182
  **Update Manual Test Cases:**
7339
7183
  After automation, update the manual test case frontmatter:
@@ -7589,30 +7433,29 @@ After test generation completes, verify all artifacts meet quality standards:
7589
7433
  - Contains human-readable steps and expected results
7590
7434
  - References environment variables for test data
7591
7435
 
7592
- **2. Automated Tests (in \`./tests/specs/\`):**
7436
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7593
7437
  - Organized by feature in subdirectories
7594
7438
  - Each test file references manual test case ID in comments
7595
- - Uses Page Object Model pattern
7596
- - Follows role-based selector priority
7439
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7440
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7597
7441
  - Uses environment variables for test data
7598
7442
  - Includes proper TypeScript typing
7599
7443
 
7600
- **3. Page Objects (in \`./tests/pages/\`):**
7601
- - Extend BasePage class
7602
- - 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\`
7603
7446
  - Contain only actions, no assertions
7604
7447
  - Properly typed with TypeScript
7605
7448
 
7606
- **4. Supporting Files:**
7607
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7608
- - Helper functions for data generation (in \`./tests/helpers/\`)
7609
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7610
- - 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
7611
7454
 
7612
7455
  **Validation Checklist:**
7613
7456
  - [ ] All manual test cases have proper frontmatter
7614
7457
  - [ ] Automated tests reference their manual test case IDs
7615
- - [ ] Page Objects follow the BasePage pattern
7458
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7616
7459
  - [ ] No hardcoded test data (uses environment variables)
7617
7460
  - [ ] Tests are syntactically valid TypeScript`,
7618
7461
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -7631,7 +7474,7 @@ var STEP_LIBRARY = {
7631
7474
  // Clarification
7632
7475
  "clarification-protocol": clarificationProtocolStep,
7633
7476
  // Execution
7634
- "run-playwright-tests": runPlaywrightTestsStep,
7477
+ "run-tests": runTestsStep,
7635
7478
  "parse-test-results": parseTestResultsStep,
7636
7479
  "triage-failures": triageFailuresStep,
7637
7480
  "fix-test-issues": fixTestIssuesStep,