@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.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
  };
@@ -805,7 +797,28 @@ The handler file contains all necessary processing logic for the detected intent
805
797
  - Response guidelines
806
798
  - Memory update instructions`
807
799
  },
808
- // Step 6: Clarification Protocol (for ambiguous intents)
800
+ // Step 6: Post Response via Team Communicator
801
+ {
802
+ inline: true,
803
+ title: "Post Response to Team",
804
+ content: `## Post Response to the Team
805
+
806
+ After processing the message through the handler and composing your response:
807
+
808
+ {{INVOKE_TEAM_COMMUNICATOR}} to post the response back to the team.
809
+
810
+ **Context to include in the delegation:**
811
+ - The original message/question from the team member
812
+ - Your composed response with all gathered data
813
+ - Whether this should be a thread reply (if the original message was in a thread) or a new message
814
+ - The relevant channel (from project-context.md)
815
+
816
+ **Do NOT:**
817
+ - Skip posting and just display the response as text output
818
+ - Ask the user whether to post \u2014 the message came from the team, the response goes back to the team
819
+ - Compose a draft without sending it`
820
+ },
821
+ // Step 7: Clarification Protocol (for ambiguous intents)
809
822
  "clarification-protocol",
810
823
  // Step 8: Knowledge Base Update (library)
811
824
  "update-knowledge-base",
@@ -1222,7 +1235,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1222
1235
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1223
1236
  - Wait for team response (messaging infrastructure handles that)
1224
1237
  - Create or modify test files
1225
- - Run Playwright tests
1238
+ - Run automated tests
1226
1239
 
1227
1240
  #### 5.6 Update Event Processor Memory
1228
1241
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1329,10 +1342,10 @@ Create files if they don't exist:
1329
1342
  var runTestsTask = {
1330
1343
  slug: TASK_SLUGS.RUN_TESTS,
1331
1344
  name: "Run Tests",
1332
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1345
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1333
1346
  frontmatter: {
1334
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1335
- "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)'
1336
1349
  },
1337
1350
  steps: [
1338
1351
  // Step 1: Overview (inline)
@@ -1341,7 +1354,7 @@ var runTestsTask = {
1341
1354
  title: "Run Tests Overview",
1342
1355
  content: `# Run Tests Command
1343
1356
 
1344
- 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.`
1345
1358
  },
1346
1359
  // Step 2: Security Notice (library)
1347
1360
  "security-notice",
@@ -1354,9 +1367,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1354
1367
  **Parse Arguments:**
1355
1368
  Extract the following from arguments:
1356
1369
  - **selector**: Test selection criteria
1357
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1358
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1359
- - 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
1360
1373
  - All tests: "all" or "" \u2192 runs entire test suite`
1361
1374
  },
1362
1375
  // Step 4: Load Project Context (library)
@@ -1372,34 +1385,26 @@ Extract the following from arguments:
1372
1385
  inline: true,
1373
1386
  title: "Identify Automated Tests to Run",
1374
1387
  content: `#### Understand Test Selection
1388
+
1389
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1390
+
1375
1391
  Parse the selector argument to determine which tests to run:
1376
1392
 
1377
1393
  **File Pattern** (e.g., "auth", "login"):
1378
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1394
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1379
1395
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1380
1396
 
1381
1397
  **Tag** (e.g., "@smoke", "@regression"):
1382
- - Run tests with specific Playwright tag annotation
1383
- - Use Playwright's \`--grep\` option
1398
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1384
1399
 
1385
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1386
- - Run that specific test file
1400
+ **Specific File**:
1401
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1387
1402
 
1388
1403
  **All Tests** ("all" or no selector):
1389
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1404
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1390
1405
 
1391
1406
  #### Find Matching Test Files
1392
- Use glob patterns to find test files:
1393
- \`\`\`bash
1394
- # For file pattern
1395
- ls tests/specs/**/*[pattern]*.spec.ts
1396
-
1397
- # For specific file
1398
- ls tests/specs/auth/login.spec.ts
1399
-
1400
- # For all tests
1401
- ls tests/specs/**/*.spec.ts
1402
- \`\`\`
1407
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1403
1408
 
1404
1409
  #### Validate Test Files Exist
1405
1410
  Check that at least one test file was found:
@@ -1413,7 +1418,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1413
1418
  - **No selector** (all tests): Confirm running full suite before executing`
1414
1419
  },
1415
1420
  // Step 7-10: Test Execution (library steps)
1416
- "run-playwright-tests",
1421
+ "run-tests",
1417
1422
  "parse-test-results",
1418
1423
  "triage-failures",
1419
1424
  "fix-test-issues",
@@ -1439,8 +1444,8 @@ If no test cases match the selection criteria:
1439
1444
  2. List available test cases or suggest running \`/generate-test-cases\` first
1440
1445
  3. Provide examples of valid selection criteria
1441
1446
 
1442
- #### If Test Runner Agent Fails
1443
- If the test-runner agent encounters issues:
1447
+ #### If Browser Automation Agent Fails
1448
+ If the browser-automation agent encounters issues:
1444
1449
  1. Report the specific error
1445
1450
  2. Suggest troubleshooting steps
1446
1451
  3. Offer to run tests individually if batch execution failed
@@ -1454,18 +1459,18 @@ If selected test cases have formatting issues:
1454
1459
  ### Important Notes
1455
1460
 
1456
1461
  **Test Selection Strategy**:
1457
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1462
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1458
1463
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1459
1464
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1460
1465
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1461
1466
  - Use context keywords from user request to choose appropriate tier
1462
1467
 
1463
1468
  **Test Execution**:
1464
- - Automated Playwright tests are executed via bash command, not through agents
1469
+ - Automated tests are executed via bash command, not through agents
1465
1470
  - Test execution time varies by tier (see strategy document for details)
1466
1471
  - JSON reports provide structured test results for analysis
1467
- - Playwright automatically captures traces, screenshots, and videos on failures
1468
- - 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\`
1469
1474
 
1470
1475
  **Failure Handling**:
1471
1476
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1475,11 +1480,11 @@ If selected test cases have formatting issues:
1475
1480
  - Critical failures trigger immediate team notification
1476
1481
 
1477
1482
  **Related Documentation**:
1478
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1479
- - \`.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)`
1480
1485
  }
1481
1486
  ],
1482
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1487
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1483
1488
  optionalSubagents: ["issue-tracker", "team-communicator"],
1484
1489
  dependentTasks: []
1485
1490
  };
@@ -1503,7 +1508,7 @@ var verifyChangesTask = {
1503
1508
  ## Overview
1504
1509
 
1505
1510
  This task performs comprehensive change verification with:
1506
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1511
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1507
1512
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1508
1513
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1509
1514
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1734,11 +1739,11 @@ Analyze the change description to identify affected feature areas:
1734
1739
 
1735
1740
  | Description Keywords | Inferred Test Scope | Example |
1736
1741
  |---------------------|-------------------|---------|
1737
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1738
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1739
- | "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 |
1740
1745
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1741
- | "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 |
1742
1747
 
1743
1748
  **Inference strategy:**
1744
1749
  1. **Extract feature keywords** from PR title and description
@@ -1813,13 +1818,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1813
1818
 
1814
1819
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1815
1820
 
1816
- ### Generate Playwright Specs
1821
+ ### Generate Automated Test Specs
1817
1822
 
1818
1823
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1819
1824
  - Read the manual test cases you just created
1820
1825
  - Explore the feature in the browser to discover selectors and flows
1821
- - Create Page Objects in \`./tests/pages/\` if needed
1822
- - 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\`
1823
1828
  - Run each new test to verify it passes
1824
1829
  - Update the manual test case with \`automated_test\` reference
1825
1830
 
@@ -1829,7 +1834,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1829
1834
  conditionalOnSubagent: "test-code-generator"
1830
1835
  },
1831
1836
  // Step 8-11: Test Execution (library steps)
1832
- "run-playwright-tests",
1837
+ "run-tests",
1833
1838
  "parse-test-results",
1834
1839
  "triage-failures",
1835
1840
  "fix-test-issues",
@@ -2018,7 +2023,7 @@ Post PR comment if GitHub context available.`,
2018
2023
  - Recommend: Check test configuration and prerequisites
2019
2024
 
2020
2025
  **If test execution fails:**
2021
- - Report specific error (Playwright not installed, env vars missing)
2026
+ - Report specific error (test framework not installed, env vars missing)
2022
2027
  - Suggest troubleshooting steps
2023
2028
  - Don't proceed with triage if tests didn't run
2024
2029
 
@@ -2048,7 +2053,7 @@ A successful verification includes:
2048
2053
  10. Clear recommendation provided (merge / review / block)`
2049
2054
  }
2050
2055
  ],
2051
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
2056
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
2052
2057
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
2053
2058
  dependentTasks: []
2054
2059
  };
@@ -2097,7 +2102,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2097
2102
  },
2098
2103
  // Phase 2: Exploration Protocol
2099
2104
  "exploration-protocol",
2100
- // Execute exploration via test-runner
2105
+ // Execute exploration via browser-automation
2101
2106
  "create-exploration-test-case",
2102
2107
  "run-exploration",
2103
2108
  "process-exploration-results",
@@ -2108,7 +2113,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2108
2113
  "generate-test-cases",
2109
2114
  "automate-test-cases",
2110
2115
  // Phase 5: Test Execution
2111
- "run-playwright-tests",
2116
+ "run-tests",
2112
2117
  "parse-test-results",
2113
2118
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2114
2119
  "triage-failures",
@@ -2125,7 +2130,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2125
2130
  },
2126
2131
  "generate-final-report"
2127
2132
  ],
2128
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2133
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2129
2134
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2130
2135
  dependentTasks: ["run-tests", "generate-test-cases"]
2131
2136
  };
@@ -2144,7 +2149,7 @@ var exploreApplicationTask = {
2144
2149
  {
2145
2150
  inline: true,
2146
2151
  title: "Explore Application Overview",
2147
- 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.`
2148
2153
  },
2149
2154
  // Step 2: Security Notice (from library)
2150
2155
  "security-notice",
@@ -2191,7 +2196,7 @@ var exploreApplicationTask = {
2191
2196
  "cleanup-temp-files",
2192
2197
  "update-knowledge-base"
2193
2198
  ],
2194
- requiredSubagents: ["test-runner"],
2199
+ requiredSubagents: ["browser-automation"],
2195
2200
  optionalSubagents: ["team-communicator"],
2196
2201
  dependentTasks: []
2197
2202
  };
@@ -2260,16 +2265,16 @@ After completing your work, update your memory file with relevant insights.
2260
2265
  **Remember:** Every entry should answer "How does this change what I do?"
2261
2266
  `;
2262
2267
 
2263
- // src/subagents/templates/test-runner/playwright.ts
2268
+ // src/subagents/templates/browser-automation/playwright.ts
2264
2269
  var FRONTMATTER = {
2265
- name: "test-runner",
2266
- 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.
2267
2272
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2268
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2269
- <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.
2270
2275
  user: "Execute the smoke test for the checkout flow"
2271
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2272
- <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>`,
2273
2278
  model: "sonnet",
2274
2279
  color: "green"
2275
2280
  };
@@ -2282,9 +2287,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2282
2287
  - Structure of \`steps.json\` with timestamps and video synchronization
2283
2288
  - Field descriptions and data types
2284
2289
 
2285
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2290
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2286
2291
 
2287
- **Memory Sections for Test Runner**:
2292
+ **Memory Sections for Browser Automation**:
2288
2293
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2289
2294
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2290
2295
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2350,7 +2355,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2350
2355
  **Execution Workflow:**
2351
2356
 
2352
2357
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2353
- - 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
2354
2359
  - Check if this test is known to be flaky (apply extra waits if so)
2355
2360
  - Review timing requirements for pages this test will visit
2356
2361
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2402,9 +2407,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2402
2407
  - Video filename reference (just basename, not full path)
2403
2408
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2404
2409
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2405
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2410
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2406
2411
 
2407
- Specifically for test-runner, consider updating:
2412
+ Specifically for browser-automation, consider updating:
2408
2413
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2409
2414
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2410
2415
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -2477,49 +2482,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
2477
2482
  // src/subagents/templates/test-code-generator/playwright.ts
2478
2483
  var FRONTMATTER2 = {
2479
2484
  name: "test-code-generator",
2480
- 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.
2481
2486
  user: "Generate test cases for the login feature based on the test plan"
2482
- 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."
2483
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.
2484
2489
  user: "Create automated tests for the checkout flow"
2485
- 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."
2486
2491
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
2487
2492
  model: "sonnet",
2488
2493
  color: "purple"
2489
2494
  };
2490
- 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.
2491
2498
 
2492
2499
  **Core Responsibilities:**
2493
2500
 
2494
- 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
2508
+
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.
2495
2510
 
2496
- 2. **Environment Configuration**:
2511
+ 3. **Environment Configuration**:
2497
2512
  - Read \`.env.testdata\` for available environment variables
2498
2513
  - Reference variables using \`process.env.VAR_NAME\` in tests
2499
2514
  - Add new required variables to \`.env.testdata\`
2500
2515
  - NEVER read \`.env\` file (secrets only)
2501
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.
2502
2517
 
2503
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2518
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2504
2519
 
2505
2520
  **Memory Sections for Test Code Generator**:
2506
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
2521
+ - Generated artifacts (page objects, tests, fixtures, helpers)
2507
2522
  - Test cases automated
2508
2523
  - Selector strategies that work for this application
2509
2524
  - Application architecture patterns learned
2510
2525
  - Environment variables used
2511
2526
  - Test creation history and outcomes
2512
2527
 
2513
- 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:
2514
2529
  - Read the manual test case files
2515
- - For test cases marked \`automated: true\`, generate automated Playwright tests
2530
+ - For test cases marked \`automated: true\`, generate automated tests
2516
2531
  - Update the manual test case file with the automated_test reference
2517
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
2532
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
2518
2533
 
2519
- 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:
2520
2535
  - Navigate to pages, authenticate, inspect elements
2521
2536
  - Capture screenshots for documentation
2522
- - Document exact role names, labels, text, URLs
2537
+ - Document exact element identifiers, labels, text, URLs
2523
2538
  - Test navigation flows manually
2524
2539
  - **NEVER assume selectors** - verify in browser or tests will fail
2525
2540
 
@@ -2527,7 +2542,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2527
2542
 
2528
2543
  1. **Load Memory**:
2529
2544
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
2530
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
2545
+ - Check existing page objects, automated tests, selector strategies, naming conventions
2531
2546
  - Avoid duplication by reusing established patterns
2532
2547
 
2533
2548
  2. **Read Manual Test Cases**:
@@ -2541,20 +2556,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2541
2556
 
2542
2557
  **STEP 1: Check Existing Infrastructure**
2543
2558
 
2544
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
2545
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
2546
- - **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
2547
2562
 
2548
2563
  **STEP 2: Build Missing Infrastructure** (if needed)
2549
2564
 
2550
2565
  - **Explore feature under test**: Use playwright-cli to:
2551
2566
  * Navigate to the feature's pages
2552
- * Inspect elements and gather selectors (role, label, text)
2567
+ * Inspect elements and gather selectors
2553
2568
  * Document actual URLs from the browser
2554
2569
  * Capture screenshots for documentation
2555
2570
  * Test navigation flows manually
2556
2571
  * NEVER assume selectors - verify everything in browser
2557
- - **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\`
2558
2573
  - **Create supporting code**: Add any needed fixtures, helpers, or types
2559
2574
 
2560
2575
  **STEP 3: Create Automated Test**
@@ -2562,20 +2577,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2562
2577
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
2563
2578
  * Understand the test objective and steps
2564
2579
  * Note any preconditions or test data requirements
2565
- - **Generate automated test** (./tests/specs/*.spec.ts):
2580
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
2566
2581
  * Use the manual test case steps as the basis
2567
- * Create executable Playwright test using Page Objects
2568
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
2569
- * 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\`
2570
2583
  * Reference manual test case ID in comments
2571
- * Tag critical tests with @smoke
2584
+ * Tag critical tests appropriately (e.g., @smoke)
2572
2585
  - **Update manual test case file**:
2573
2586
  * Set \`automated_test:\` field to the path of the automated test file
2574
2587
  * Link manual \u2194 automated test bidirectionally
2575
2588
 
2576
2589
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
2577
2590
 
2578
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
2591
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
2579
2592
  - **Analyze results**:
2580
2593
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
2581
2594
  * Fail \u2192 Proceed to failure analysis below
@@ -2589,60 +2602,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2589
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 |
2590
2603
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
2591
2604
 
2592
- **4b. Fix Patterns** (apply based on root cause):
2593
-
2594
- **Fix Type 1: Brittle Selectors**
2595
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2596
- - **Fix**: Replace with role-based selectors
2597
- \`\`\`typescript
2598
- // BEFORE (brittle)
2599
- await page.locator('.btn-primary').click();
2600
- // AFTER (semantic)
2601
- await page.getByRole('button', { name: 'Sign In' }).click();
2602
- \`\`\`
2603
-
2604
- **Fix Type 2: Missing Wait Conditions**
2605
- - **Problem**: Test doesn't wait for elements or actions to complete
2606
- - **Fix**: Add explicit wait for expected state
2607
- \`\`\`typescript
2608
- // BEFORE (race condition)
2609
- await page.goto('/dashboard');
2610
- const items = await page.locator('.item').count();
2611
- // AFTER (explicit wait)
2612
- await page.goto('/dashboard');
2613
- await expect(page.locator('.item')).toHaveCount(5);
2614
- \`\`\`
2615
-
2616
- **Fix Type 3: Race Conditions**
2617
- - **Problem**: Test executes actions before application is ready
2618
- - **Fix**: Wait for specific application state
2619
- \`\`\`typescript
2620
- // BEFORE
2621
- await saveButton.click();
2622
- await expect(successMessage).toBeVisible();
2623
- // AFTER
2624
- await page.locator('.validation-complete').waitFor();
2625
- await saveButton.click();
2626
- await expect(successMessage).toBeVisible();
2627
- \`\`\`
2628
-
2629
- **Fix Type 4: Wrong Assertions**
2630
- - **Problem**: Assertion expects incorrect value or state
2631
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
2632
-
2633
- **Fix Type 5: Test Isolation Issues**
2634
- - **Problem**: Test depends on state from previous tests
2635
- - **Fix**: Add proper setup/teardown or use fixtures
2636
-
2637
- **Fix Type 6: Flaky Tests**
2638
- - **Problem**: Test passes inconsistently
2639
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
2640
- - 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.
2641
2606
 
2642
2607
  **4c. Fix Workflow**:
2643
2608
  1. Read failure report and classify (product bug vs test issue)
2644
2609
  2. If product bug: Document and mark test as blocked, move to next test
2645
- 3. If test issue: Apply appropriate fix from patterns above
2610
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
2646
2611
  4. Re-run test to verify fix
2647
2612
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
2648
2613
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -2651,9 +2616,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2651
2616
 
2652
2617
  | Failure Type | Root Cause | Action |
2653
2618
  |--------------|------------|--------|
2654
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
2655
- | Timeout waiting | Missing wait condition | Add explicit wait |
2656
- | 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 |
2657
2622
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
2658
2623
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
2659
2624
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -2661,13 +2626,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2661
2626
  **STEP 5: Move to Next Test Case**
2662
2627
 
2663
2628
  - Repeat process for each test case in the plan
2664
- - Reuse existing POMs and infrastructure wherever possible
2629
+ - Reuse existing page objects and infrastructure wherever possible
2665
2630
  - Continuously update memory with new patterns and learnings
2666
2631
 
2667
2632
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
2668
2633
 
2669
2634
  Specifically for test-code-generator, consider updating:
2670
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
2635
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
2671
2636
  - **Test Cases Automated**: Record which test cases were automated with references
2672
2637
  - **Selector Strategies**: Note what selector strategies work well for this application
2673
2638
  - **Application Patterns**: Document architecture patterns learned
@@ -2677,7 +2642,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2677
2642
  - Test automation results (tests created, pass/fail status, issues found)
2678
2643
  - Manual test cases automated (count, IDs, titles)
2679
2644
  - Automated tests created (count, smoke vs functional)
2680
- - Page Objects, fixtures, helpers added
2645
+ - Page objects, fixtures, helpers added
2681
2646
  - Next steps (commands to run tests)
2682
2647
 
2683
2648
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -2688,7 +2653,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2688
2653
  ## Last Updated: [timestamp]
2689
2654
 
2690
2655
  ## Generated Test Artifacts
2691
- [Page Objects created with locators and methods]
2656
+ [Page objects created with locators and methods]
2692
2657
  [Test cases automated with manual TC references and file paths]
2693
2658
  [Fixtures, helpers, components created]
2694
2659
 
@@ -2697,26 +2662,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2697
2662
  [Tests passing vs failing with product bugs]
2698
2663
 
2699
2664
  ## Fixed Issues History
2700
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
2701
- - [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
2702
2667
 
2703
2668
  ## Failure Pattern Library
2704
2669
 
2705
2670
  ### Pattern: Selector Timeout on Dynamic Content
2706
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
2671
+ **Symptoms**: Element not found, element loads after timeout
2707
2672
  **Root Cause**: Selector runs before element rendered
2708
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
2673
+ **Fix Strategy**: Add explicit visibility wait before interaction
2709
2674
  **Success Rate**: [track over time]
2710
2675
 
2711
2676
  ### Pattern: Race Condition on Form Submission
2712
- **Symptoms**: Test clicks submit before validation completes
2677
+ **Symptoms**: Test interacts before validation completes
2713
2678
  **Root Cause**: Missing wait for validation state
2714
2679
  **Fix Strategy**: Wait for validation indicator before submit
2715
2680
 
2716
2681
  ## Known Stable Selectors
2717
2682
  [Selectors that reliably work for this application]
2718
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
2719
- - Email field: \`getByLabel('Email')\`
2720
2683
 
2721
2684
  ## Known Product Bugs (Do Not Fix Tests)
2722
2685
  [Actual bugs discovered - tests should remain failing]
@@ -2727,9 +2690,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2727
2690
 
2728
2691
  ## Application Behavior Patterns
2729
2692
  [Load times, async patterns, navigation flows discovered]
2730
- - Auth pages: redirect timing
2731
- - Dashboard: lazy loading patterns
2732
- - Forms: validation timing
2733
2693
 
2734
2694
  ## Selector Strategy Library
2735
2695
  [Successful selector patterns and their success rates]
@@ -2744,32 +2704,23 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
2744
2704
 
2745
2705
  **Critical Rules:**
2746
2706
 
2747
- \u274C **NEVER**:
2748
- - Generate selectors without exploring the live application - causes 100% test failure
2749
- - Assume URLs, selectors, or navigation patterns - verify in browser
2750
- - Skip exploration even if documentation seems detailed
2751
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
2752
- - Put assertions in Page Objects - only in test files
2753
- - Read .env file - only .env.testdata
2754
- - Create test interdependencies - tests must be independent
2755
-
2756
- \u2705 **ALWAYS**:
2757
- - Explore application using playwright-cli before generating code
2758
- - Verify selectors in live browser using playwright-cli snapshot
2759
- - Document actual URLs from browser address bar
2760
- - Take screenshots for documentation
2761
- - Use role-based selectors as first priority
2762
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
2763
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
2764
- - Follow .bugzy/runtime/testing-best-practices.md
2765
- - Read existing manual test cases and automate those marked automated: true
2766
-
2767
- 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`;
2768
2719
 
2769
2720
  // src/subagents/templates/test-debugger-fixer/playwright.ts
2770
2721
  var FRONTMATTER3 = {
2771
2722
  name: "test-debugger-fixer",
2772
- 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.
2773
2724
  user: "Fix the failing login test"
2774
2725
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
2775
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.
@@ -2779,18 +2730,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
2779
2730
  model: "sonnet",
2780
2731
  color: "yellow"
2781
2732
  };
2782
- 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.
2783
2736
 
2784
2737
  **Core Responsibilities:**
2785
2738
 
2786
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
2787
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
2788
- - Correct waiting and synchronization patterns
2789
- - Test isolation principles
2790
- - Common anti-patterns to avoid
2791
- - 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.
2792
2748
 
2793
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2749
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
2794
2750
 
2795
2751
  **Memory Sections for Test Debugger Fixer**:
2796
2752
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -2800,7 +2756,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2800
2756
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
2801
2757
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
2802
2758
 
2803
- 3. **Failure Analysis**: When a test fails, you must:
2759
+ 4. **Failure Analysis**: When a test fails, you must:
2804
2760
  - Read the failing test file to understand what it's trying to do
2805
2761
  - Read the failure details from the JSON test report
2806
2762
  - Examine error messages, stack traces, and failure context
@@ -2809,7 +2765,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2809
2765
  - **Product bug**: Correct test code, but application behaves unexpectedly
2810
2766
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
2811
2767
 
2812
- 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:
2813
2769
 
2814
2770
  **Product Bug Indicators**:
2815
2771
  - Selectors are correct and elements exist
@@ -2824,9 +2780,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2824
2780
  - Flaky behavior (passes sometimes, fails other times)
2825
2781
  - Wrong assertions (expecting incorrect values)
2826
2782
  - Test isolation problems (depends on other tests)
2827
- - Brittle selectors (CSS classes, IDs that change)
2783
+ - Brittle selectors that change between builds
2828
2784
 
2829
- 4. **Debug Using Browser**: When needed, explore the application manually:
2785
+ 6. **Debug Using Browser**: When needed, explore the application manually:
2830
2786
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
2831
2787
  - Navigate to the relevant page
2832
2788
  - Inspect elements to find correct selectors
@@ -2835,87 +2791,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2835
2791
  - Verify application state matches test expectations
2836
2792
  - Take notes on differences between expected and actual behavior
2837
2793
 
2838
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
2839
-
2840
- **Fix Type 1: Brittle Selectors**
2841
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
2842
- - **Fix**: Replace with role-based selectors
2843
- - **Example**:
2844
- \`\`\`typescript
2845
- // BEFORE (brittle)
2846
- await page.locator('.btn-primary').click();
2847
-
2848
- // AFTER (semantic)
2849
- await page.getByRole('button', { name: 'Sign In' }).click();
2850
- \`\`\`
2851
-
2852
- **Fix Type 2: Missing Wait Conditions**
2853
- - **Problem**: Test doesn't wait for elements or actions to complete
2854
- - **Fix**: Add explicit wait for expected state
2855
- - **Example**:
2856
- \`\`\`typescript
2857
- // BEFORE (race condition)
2858
- await page.goto('/dashboard');
2859
- const items = await page.locator('.item').count();
2860
-
2861
- // AFTER (explicit wait)
2862
- await page.goto('/dashboard');
2863
- await expect(page.locator('.item')).toHaveCount(5);
2864
- \`\`\`
2865
-
2866
- **Fix Type 3: Race Conditions**
2867
- - **Problem**: Test executes actions before application is ready
2868
- - **Fix**: Wait for specific application state
2869
- - **Example**:
2870
- \`\`\`typescript
2871
- // BEFORE (race condition)
2872
- await saveButton.click();
2873
- await expect(successMessage).toBeVisible();
2874
-
2875
- // AFTER (wait for ready state)
2876
- await page.locator('.validation-complete').waitFor();
2877
- await saveButton.click();
2878
- await expect(successMessage).toBeVisible();
2879
- \`\`\`
2880
-
2881
- **Fix Type 4: Wrong Assertions**
2882
- - **Problem**: Assertion expects incorrect value or state
2883
- - **Fix**: Update assertion to match actual application behavior (if correct)
2884
- - **Example**:
2885
- \`\`\`typescript
2886
- // BEFORE (wrong expectation)
2887
- await expect(heading).toHaveText('Welcome John');
2888
-
2889
- // AFTER (corrected)
2890
- await expect(heading).toHaveText('Welcome, John!');
2891
- \`\`\`
2892
-
2893
- **Fix Type 5: Test Isolation Issues**
2894
- - **Problem**: Test depends on state from previous tests
2895
- - **Fix**: Add proper setup/teardown or use fixtures
2896
- - **Example**:
2897
- \`\`\`typescript
2898
- // BEFORE (depends on previous test)
2899
- test('should logout', async ({ page }) => {
2900
- await page.goto('/dashboard');
2901
- // Assumes user is already logged in
2902
- });
2903
-
2904
- // AFTER (isolated with fixture)
2905
- test('should logout', async ({ page, authenticatedUser }) => {
2906
- await page.goto('/dashboard');
2907
- // Uses fixture for clean state
2908
- });
2909
- \`\`\`
2910
-
2911
- **Fix Type 6: Flaky Tests**
2912
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
2913
- - **Fix**: Identify and eliminate non-determinism
2914
- - Common causes: timing issues, race conditions, animation delays, network timing
2915
- - Run test multiple times to reproduce flakiness
2916
- - Add proper waits for stable state
2917
-
2918
- 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**:
2919
2797
 
2920
2798
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
2921
2799
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -2928,7 +2806,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2928
2806
  **Step 1: Read Test File**
2929
2807
  - Understand test intent and logic
2930
2808
  - Identify what the test is trying to verify
2931
- - Note test structure and Page Objects used
2809
+ - Note test structure and page objects used
2932
2810
 
2933
2811
  **Step 2: Read Failure Report**
2934
2812
  - Parse JSON test report for failure details
@@ -2947,14 +2825,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2947
2825
  - **If test issue**: Proceed to fix
2948
2826
 
2949
2827
  **Step 5: Apply Fix**
2950
- - Edit test file with appropriate fix
2828
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
2951
2829
  - Update selectors, waits, assertions, or logic
2952
- - Follow best practices from testing guide
2830
+ - Follow conventions from \`./tests/CLAUDE.md\`
2953
2831
  - Add comments explaining the fix if complex
2954
2832
 
2955
2833
  **Step 6: Verify Fix**
2956
- - Run the fixed test: \`npx playwright test [test-file]\`
2957
- - **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
2958
2836
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
2959
2837
  - Read manifest.json to confirm test passes in latest execution
2960
2838
  - For flaky tests: Run 10 times to ensure stability
@@ -2975,7 +2853,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
2975
2853
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
2976
2854
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
2977
2855
 
2978
- 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:
2979
2857
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
2980
2858
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
2981
2859
  \`\`\`json
@@ -3006,77 +2884,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3006
2884
  \`\`\`
3007
2885
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3008
2886
 
3009
- 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:
3010
2888
 
3011
- \`\`\`markdown
3012
- # Test Debugger Fixer Memory
3013
-
3014
- ## Last Updated: [timestamp]
3015
-
3016
- ## Fixed Issues History
3017
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3018
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3019
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3020
-
3021
- ## Failure Pattern Library
3022
-
3023
- ### Pattern: Selector Timeout on Dynamic Content
3024
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3025
- **Root Cause**: Selector runs before element rendered
3026
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3027
- **Success Rate**: 95% (used 12 times)
3028
-
3029
- ### Pattern: Race Condition on Form Submission
3030
- **Symptoms**: Test clicks submit before validation completes
3031
- **Root Cause**: Missing wait for validation state
3032
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3033
- **Success Rate**: 100% (used 8 times)
3034
-
3035
- ## Known Stable Selectors
3036
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3037
- - Email field: \`getByLabel('Email')\`
3038
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3039
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3040
-
3041
- ## Known Product Bugs (Do Not Fix Tests)
3042
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3043
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3044
-
3045
- ## Flaky Test Tracking
3046
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3047
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3048
-
3049
- ## Application Behavior Patterns
3050
- - **Auth Pages**: Redirect after 200ms delay
3051
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3052
- - **Forms**: Validation runs on blur + submit events
3053
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3054
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3055
- \`\`\`
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]
3056
2921
 
3057
- 9. **Environment Configuration**:
3058
- - Tests use \`process.env.VAR_NAME\` for configuration
3059
- - Read \`.env.testdata\` to understand available variables
3060
- - NEVER read \`.env\` file (contains secrets only)
3061
- - If test needs new environment variable, update \`.env.testdata\`
3062
-
3063
- 9. **Using playwright-cli for Debugging**:
3064
- - You have direct access to playwright-cli via Bash
3065
- - Open browser: \`playwright-cli open <url>\`
3066
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3067
- - Navigate: \`playwright-cli navigate <url>\`
3068
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3069
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3070
- - Close browser: \`playwright-cli close\`
3071
-
3072
- 10. **Test Stability Best Practices**:
3073
- - Replace all \`waitForTimeout()\` with specific waits
3074
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3075
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3076
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3077
- - Handle dynamic content with proper waits
3078
-
3079
- 11. **Communication**:
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\`
2931
+
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**:
3080
2942
  - Be clear about whether issue is product bug or test issue
3081
2943
  - Explain root cause of test failure
3082
2944
  - Describe fix applied in plain language
@@ -3087,31 +2949,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3087
2949
 
3088
2950
  | Failure Type | Root Cause | Action |
3089
2951
  |--------------|------------|--------|
3090
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3091
- | Timeout waiting | Missing wait condition | Add explicit wait |
3092
- | 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 |
3093
2955
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3094
2956
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3095
2957
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3096
2958
 
3097
- **Anti-Patterns to Avoid:**
3098
-
3099
- \u274C **DO NOT**:
3100
- - Fix tests when the issue is a product bug
3101
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3102
- - Make tests pass by lowering expectations
3103
- - Introduce new test dependencies
3104
- - Skip proper verification of fixes
3105
- - Exceed 3 fix attempts (escalate instead)
3106
-
3107
- \u2705 **DO**:
3108
- - Thoroughly analyze before fixing
3109
- - Use semantic selectors when replacing brittle ones
3110
- - Add explicit waits for specific conditions
3111
- - Verify fixes by re-running tests
3112
- - Run flaky tests 10 times to confirm stability
3113
- - Report product bugs instead of making tests ignore them
3114
- - 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
3115
2972
 
3116
2973
  **Output Format**:
3117
2974
 
@@ -3130,12 +2987,12 @@ Verification:
3130
2987
  - Run 1: [passed/failed]
3131
2988
  - Run 2-10: [if flaky test]
3132
2989
 
3133
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
2990
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3134
2991
 
3135
2992
  Next Steps: [run tests / log bug / review manually]
3136
2993
  \`\`\`
3137
2994
 
3138
- 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.`;
3139
2996
 
3140
2997
  // src/subagents/templates/team-communicator/local.ts
3141
2998
  var FRONTMATTER4 = {
@@ -5666,7 +5523,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
5666
5523
 
5667
5524
  // src/subagents/templates/index.ts
5668
5525
  var TEMPLATES = {
5669
- "test-runner": {
5526
+ "browser-automation": {
5670
5527
  playwright: {
5671
5528
  frontmatter: FRONTMATTER,
5672
5529
  content: CONTENT
@@ -5855,9 +5712,9 @@ var INTEGRATIONS = {
5855
5712
  }
5856
5713
  };
5857
5714
  var SUBAGENTS = {
5858
- "test-runner": {
5859
- role: "test-runner",
5860
- name: "Test Runner",
5715
+ "browser-automation": {
5716
+ role: "browser-automation",
5717
+ name: "Browser Automation",
5861
5718
  description: "Execute automated browser tests (always included)",
5862
5719
  icon: "play",
5863
5720
  integrations: [INTEGRATIONS.playwright],
@@ -5914,7 +5771,7 @@ var SUBAGENTS = {
5914
5771
  "test-code-generator": {
5915
5772
  role: "test-code-generator",
5916
5773
  name: "Test Code Generator",
5917
- description: "Generate automated Playwright test scripts and Page Objects",
5774
+ description: "Generate automated test scripts and page objects",
5918
5775
  icon: "code",
5919
5776
  integrations: [INTEGRATIONS.playwright],
5920
5777
  model: "sonnet",
@@ -6003,9 +5860,9 @@ function buildSubagentsConfig(subagents) {
6003
5860
  // src/core/tool-strings.ts
6004
5861
  var TOOL_STRINGS = {
6005
5862
  "claude-code": {
6006
- 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.',
6007
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.',
6008
- 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.',
6009
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.',
6010
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.",
6011
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.',
@@ -6013,7 +5870,7 @@ var TOOL_STRINGS = {
6013
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.'
6014
5871
  },
6015
5872
  "cursor": {
6016
- 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```',
6017
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```',
6018
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```',
6019
5876
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -6023,7 +5880,7 @@ var TOOL_STRINGS = {
6023
5880
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
6024
5881
  },
6025
5882
  "codex": {
6026
- 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```',
6027
5884
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
6028
5885
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
6029
5886
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -6047,7 +5904,7 @@ function getToolString(toolId, key) {
6047
5904
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
6048
5905
  let result = content;
6049
5906
  const keys = [
6050
- "INVOKE_TEST_RUNNER",
5907
+ "INVOKE_BROWSER_AUTOMATION",
6051
5908
  "INVOKE_TEST_DEBUGGER_FIXER",
6052
5909
  "INVOKE_TEST_CODE_GENERATOR",
6053
5910
  "INVOKE_TEAM_COMMUNICATOR",
@@ -6135,7 +5992,7 @@ var readTestStrategyStep = {
6135
5992
  category: "setup",
6136
5993
  content: `## Read Test Execution Strategy
6137
5994
 
6138
- **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:
6139
5996
  - Available test tiers (Smoke, Component, Full Regression)
6140
5997
  - When to use each tier (commit, PR, release, debug)
6141
5998
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6145,7 +6002,7 @@ var readTestStrategyStep = {
6145
6002
 
6146
6003
  Apply the strategy guidance when determining which tests to run.
6147
6004
 
6148
- **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.`,
6149
6006
  tags: ["setup", "test-execution", "strategy"]
6150
6007
  };
6151
6008
 
@@ -6168,7 +6025,7 @@ Check for existing project context to inform your work:
6168
6025
  - Environment details
6169
6026
 
6170
6027
  **2. Check Test Execution Strategy**
6171
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6028
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6172
6029
  - Understand available test tiers and when to use them
6173
6030
  - Note default behaviors and time/coverage trade-offs
6174
6031
 
@@ -6761,34 +6618,22 @@ When reporting test results, always include an "Ambiguities" section if clarific
6761
6618
  tags: ["clarification", "protocol", "ambiguity"]
6762
6619
  };
6763
6620
 
6764
- // src/tasks/steps/execution/run-playwright-tests.ts
6765
- var runPlaywrightTestsStep = {
6766
- id: "run-playwright-tests",
6767
- title: "Execute Playwright Tests",
6621
+ // src/tasks/steps/execution/run-tests.ts
6622
+ var runTestsStep = {
6623
+ id: "run-tests",
6624
+ title: "Execute Automated Tests",
6768
6625
  category: "execution",
6769
- content: `## Execute Playwright Tests
6626
+ content: `## Execute Automated Tests
6770
6627
 
6771
- Run automated Playwright tests and capture results.
6628
+ Run automated tests and capture results.
6772
6629
 
6773
- **Build Playwright Command** based on selector:
6630
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
6774
6631
 
6775
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
6776
- Use npm scripts to run tests - no manual env export needed.
6632
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
6777
6633
 
6778
- **For file pattern or specific file**:
6779
- \`\`\`bash
6780
- npm test -- [selector]
6781
- \`\`\`
6782
-
6783
- **For tag**:
6784
- \`\`\`bash
6785
- npm test -- --grep "[tag]"
6786
- \`\`\`
6787
-
6788
- **For all tests**:
6789
- \`\`\`bash
6790
- npm test
6791
- \`\`\`
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
6792
6637
 
6793
6638
  Wait for execution to complete. This may take several minutes depending on test count.
6794
6639
 
@@ -6806,7 +6651,7 @@ Wait for execution to complete. This may take several minutes depending on test
6806
6651
  \`\`\`
6807
6652
 
6808
6653
  2. Store the timestamp for use in subsequent steps`,
6809
- invokesSubagents: ["test-runner"],
6654
+ invokesSubagents: ["browser-automation"],
6810
6655
  tags: ["execution", "tests"]
6811
6656
  };
6812
6657
 
@@ -6905,10 +6750,10 @@ For each failed test:
6905
6750
  | Classification | Indicators | Examples |
6906
6751
  |---------------|------------|----------|
6907
6752
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
6908
- | **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 |
6909
6754
 
6910
- **Common Test Issues:**
6911
- - 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)
6912
6757
  - Missing waits for async operations
6913
6758
  - Race conditions with animations
6914
6759
  - Incorrect expected values
@@ -6955,7 +6800,7 @@ The agent will:
6955
6800
  1. Read the execution details from result.json
6956
6801
  2. Analyze the failure (error message, trace if available)
6957
6802
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
6958
- 4. Apply appropriate fix to the test code
6803
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
6959
6804
  5. Rerun the test
6960
6805
  6. The custom reporter will automatically create the next exec-N/ folder
6961
6806
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -6967,7 +6812,7 @@ The agent will:
6967
6812
 
6968
6813
  **Track Fixed Tests:**
6969
6814
  - Maintain list of tests fixed automatically
6970
- - 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")
6971
6816
  - Note verification status (test now passes)`,
6972
6817
  invokesSubagents: ["test-debugger-fixer"],
6973
6818
  tags: ["execution", "fixing", "automation"]
@@ -7010,7 +6855,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7010
6855
  - Trace file: [path if available]
7011
6856
  - Screenshots: [paths if available]
7012
6857
  - **Environment Details**:
7013
- - Browser and version (from Playwright config)
6858
+ - Browser and version (from test framework config)
7014
6859
  - Test environment URL (from .env.testdata BASE_URL)
7015
6860
  - Timestamp of failure
7016
6861
  - **Severity/Priority**: Based on:
@@ -7049,7 +6894,7 @@ var createExplorationTestCaseStep = {
7049
6894
  category: "execution",
7050
6895
  content: `## Create Exploration Test Case
7051
6896
 
7052
- Generate a temporary exploration test case for the test-runner.
6897
+ Generate a temporary exploration test case for the browser-automation agent.
7053
6898
 
7054
6899
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7055
6900
 
@@ -7088,7 +6933,7 @@ var runExplorationStep = {
7088
6933
  category: "execution",
7089
6934
  content: `## Run Exploration
7090
6935
 
7091
- {{INVOKE_TEST_RUNNER}}
6936
+ {{INVOKE_BROWSER_AUTOMATION}}
7092
6937
 
7093
6938
  Execute the exploration test case with the following focus:
7094
6939
 
@@ -7113,7 +6958,7 @@ Generate comprehensive findings report.
7113
6958
  - \`test-log.md\` - Detailed execution log
7114
6959
  - \`screenshots/\` - Visual documentation
7115
6960
  - \`summary.json\` - Execution summary`,
7116
- invokesSubagents: ["test-runner"],
6961
+ invokesSubagents: ["browser-automation"],
7117
6962
  tags: ["execution", "exploration"]
7118
6963
  };
7119
6964
 
@@ -7124,7 +6969,7 @@ var processExplorationResultsStep = {
7124
6969
  category: "execution",
7125
6970
  content: `## Process Exploration Results
7126
6971
 
7127
- Read and parse the test-runner output from exploration.
6972
+ Read and parse the browser-automation agent output from exploration.
7128
6973
 
7129
6974
  **Locate results:**
7130
6975
  \`\`\`bash
@@ -7261,23 +7106,22 @@ For each test case marked \`automated: true\`:
7261
7106
  - Exploration findings: ./exploration-reports/
7262
7107
 
7263
7108
  **The agent should:**
7264
- 1. Read manual test case files
7265
- 2. Explore the feature to gather selectors
7266
- 3. Create Page Objects and automated tests
7267
- 4. Run each test and iterate until passing (max 3 attempts)
7268
- 5. Update manual test case with automated_test reference
7269
- 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
7270
7116
 
7271
7117
  **For each test:**
7272
- - Run: \`npx playwright test [test-file]\`
7118
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7273
7119
  - If fails, classify as product bug or test issue
7274
- - If test issue: Apply fix patterns and retry
7120
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7275
7121
  - If product bug: Document and mark test as blocked
7276
7122
  - Continue until test passes or is blocked"
7277
7123
 
7278
- **Output Location:**
7279
- - Page Objects: \`./tests/pages/\`
7280
- - Test specs: \`./tests/specs/\`
7124
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7281
7125
 
7282
7126
  **Update Manual Test Cases:**
7283
7127
  After automation, update the manual test case frontmatter:
@@ -7533,30 +7377,29 @@ After test generation completes, verify all artifacts meet quality standards:
7533
7377
  - Contains human-readable steps and expected results
7534
7378
  - References environment variables for test data
7535
7379
 
7536
- **2. Automated Tests (in \`./tests/specs/\`):**
7380
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7537
7381
  - Organized by feature in subdirectories
7538
7382
  - Each test file references manual test case ID in comments
7539
- - Uses Page Object Model pattern
7540
- - Follows role-based selector priority
7383
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7384
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7541
7385
  - Uses environment variables for test data
7542
7386
  - Includes proper TypeScript typing
7543
7387
 
7544
- **3. Page Objects (in \`./tests/pages/\`):**
7545
- - Extend BasePage class
7546
- - 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\`
7547
7390
  - Contain only actions, no assertions
7548
7391
  - Properly typed with TypeScript
7549
7392
 
7550
- **4. Supporting Files:**
7551
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7552
- - Helper functions for data generation (in \`./tests/helpers/\`)
7553
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7554
- - 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
7555
7398
 
7556
7399
  **Validation Checklist:**
7557
7400
  - [ ] All manual test cases have proper frontmatter
7558
7401
  - [ ] Automated tests reference their manual test case IDs
7559
- - [ ] Page Objects follow the BasePage pattern
7402
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7560
7403
  - [ ] No hardcoded test data (uses environment variables)
7561
7404
  - [ ] Tests are syntactically valid TypeScript`,
7562
7405
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -7575,7 +7418,7 @@ var STEP_LIBRARY = {
7575
7418
  // Clarification
7576
7419
  "clarification-protocol": clarificationProtocolStep,
7577
7420
  // Execution
7578
- "run-playwright-tests": runPlaywrightTestsStep,
7421
+ "run-tests": runTestsStep,
7579
7422
  "parse-test-results": parseTestResultsStep,
7580
7423
  "triage-failures": triageFailuresStep,
7581
7424
  "fix-test-issues": fixTestIssuesStep,