@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/cli/index.js CHANGED
@@ -96,9 +96,9 @@ var init_generate_test_cases = __esm({
96
96
  generateTestCasesTask = {
97
97
  slug: TASK_SLUGS.GENERATE_TEST_CASES,
98
98
  name: "Generate Test Cases",
99
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
99
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
100
100
  frontmatter: {
101
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
101
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
102
102
  "argument-hint": "--type [exploratory|functional|regression|smoke] --focus [optional-feature]"
103
103
  },
104
104
  steps: [
@@ -106,12 +106,12 @@ var init_generate_test_cases = __esm({
106
106
  {
107
107
  inline: true,
108
108
  title: "Generate Test Cases Overview",
109
- content: `Generate comprehensive test artifacts including BOTH manual test case documentation AND automated Playwright test scripts.
109
+ 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.
110
110
 
111
111
  This command generates:
112
112
  1. **Manual Test Case Documentation** (in \`./test-cases/\`) - Human-readable test cases in markdown format
113
- 2. **Automated Playwright Tests** (in \`./tests/specs/\`) - Executable TypeScript test scripts
114
- 3. **Page Object Models** (in \`./tests/pages/\`) - Reusable page classes for automated tests
113
+ 2. **Automated Test Scripts** (in directory from \`./tests/CLAUDE.md\`) - Executable test scripts
114
+ 3. **Page Objects** (in directory from \`./tests/CLAUDE.md\`) - Reusable page classes for automated tests
115
115
  4. **Supporting Files** (fixtures, helpers, components) - As needed for test automation`
116
116
  },
117
117
  // Step 2: Security Notice (library)
@@ -146,9 +146,9 @@ Read the test plan from \`test-plan.md\` to understand:
146
146
 
147
147
  **1.2 Check Existing Test Cases and Tests**
148
148
  - List all files in \`./test-cases/\` to understand existing manual test coverage
149
- - List all files in \`./tests/specs/\` to understand existing automated tests
149
+ - List existing automated tests in the test directory (see \`./tests/CLAUDE.md\` for structure)
150
150
  - Determine next test case ID (TC-XXX format)
151
- - Identify existing Page Objects in \`./tests/pages/\`
151
+ - Identify existing page objects (see \`./tests/CLAUDE.md\` for directory)
152
152
  - Avoid creating overlapping test cases or duplicate automation`
153
153
  },
154
154
  // Step 6: Documentation Researcher (conditional library step)
@@ -257,8 +257,8 @@ Before invoking the agent, identify the test cases for the current area:
257
257
  - Test type: {type}
258
258
  - Test plan: test-plan.md
259
259
  - Manual test cases directory: ./test-cases/
260
- - Existing automated tests: ./tests/specs/
261
- - Existing Page Objects: ./tests/pages/
260
+ - Existing automated tests: [directory from ./tests/CLAUDE.md]
261
+ - Existing page objects: [directory from ./tests/CLAUDE.md]
262
262
 
263
263
  **Knowledge Base Patterns (MUST APPLY):**
264
264
  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.
@@ -269,7 +269,7 @@ Include ALL relevant testing patterns from the knowledge base that apply to this
269
269
  3. Explore the feature area to understand implementation (gather selectors, URLs, flows)
270
270
  4. Build missing Page Objects and supporting code
271
271
  5. For each test case marked \`automated: true\`:
272
- - Create automated Playwright test in ./tests/specs/
272
+ - Create automated test in the test directory (from ./tests/CLAUDE.md)
273
273
  - Update the manual test case file to reference the automated test path
274
274
  - Apply ALL knowledge base patterns listed above (timing, selectors, assertions)
275
275
  6. Run and iterate on each test until it passes or fails with a product bug
@@ -300,15 +300,7 @@ Move to the next area and repeat until all areas are complete.
300
300
  {
301
301
  inline: true,
302
302
  title: "Create Directories if Needed",
303
- content: `Ensure required directories exist:
304
- \`\`\`bash
305
- mkdir -p ./test-cases
306
- mkdir -p ./tests/specs
307
- mkdir -p ./tests/pages
308
- mkdir -p ./tests/components
309
- mkdir -p ./tests/fixtures
310
- mkdir -p ./tests/helpers
311
- \`\`\``
303
+ 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).`
312
304
  },
313
305
  // Step 14: Extract Env Variables (library)
314
306
  "extract-env-variables",
@@ -328,7 +320,7 @@ mkdir -p ./tests/helpers
328
320
  - Features covered by automation
329
321
  - Areas kept manual-only (and why)
330
322
  3. Highlight key automated test scenarios
331
- 4. Share command to run automated tests: npx playwright test
323
+ 4. Share command to run automated tests (from \`./tests/CLAUDE.md\`)
332
324
  5. Ask for team review and validation
333
325
  6. Mention any areas needing exploration or clarification
334
326
  7. Use appropriate channel and threading for the update
@@ -373,8 +365,8 @@ The team communication should include:
373
365
  - Areas kept manual-only (and why)
374
366
 
375
367
  **Next Steps:**
376
- - Command to run automated tests: \`npx playwright test\`
377
- - Instructions to run specific test file
368
+ - Command to run automated tests (from \`./tests/CLAUDE.md\`)
369
+ - Instructions to run specific test file (from \`./tests/CLAUDE.md\`)
378
370
  - Note about copying .env.testdata to .env
379
371
  - Mention any exploration needed for edge cases
380
372
 
@@ -390,7 +382,7 @@ The team communication should include:
390
382
  - **Test Independence**: Each test must be runnable in isolation and in parallel`
391
383
  }
392
384
  ],
393
- requiredSubagents: ["test-runner", "test-code-generator"],
385
+ requiredSubagents: ["browser-automation", "test-code-generator"],
394
386
  optionalSubagents: ["documentation-researcher", "team-communicator"],
395
387
  dependentTasks: []
396
388
  };
@@ -597,7 +589,7 @@ The team communication should include:
597
589
  - Instructions for the user to fill in actual values in .env.testdata before running tests`
598
590
  }
599
591
  ],
600
- requiredSubagents: ["test-runner"],
592
+ requiredSubagents: ["browser-automation"],
601
593
  optionalSubagents: ["documentation-researcher", "team-communicator"],
602
594
  dependentTasks: []
603
595
  };
@@ -689,7 +681,28 @@ The handler file contains all necessary processing logic for the detected intent
689
681
  - Response guidelines
690
682
  - Memory update instructions`
691
683
  },
692
- // Step 6: Clarification Protocol (for ambiguous intents)
684
+ // Step 6: Post Response via Team Communicator
685
+ {
686
+ inline: true,
687
+ title: "Post Response to Team",
688
+ content: `## Post Response to the Team
689
+
690
+ After processing the message through the handler and composing your response:
691
+
692
+ {{INVOKE_TEAM_COMMUNICATOR}} to post the response back to the team.
693
+
694
+ **Context to include in the delegation:**
695
+ - The original message/question from the team member
696
+ - Your composed response with all gathered data
697
+ - Whether this should be a thread reply (if the original message was in a thread) or a new message
698
+ - The relevant channel (from project-context.md)
699
+
700
+ **Do NOT:**
701
+ - Skip posting and just display the response as text output
702
+ - Ask the user whether to post \u2014 the message came from the team, the response goes back to the team
703
+ - Compose a draft without sending it`
704
+ },
705
+ // Step 7: Clarification Protocol (for ambiguous intents)
693
706
  "clarification-protocol",
694
707
  // Step 8: Knowledge Base Update (library)
695
708
  "update-knowledge-base",
@@ -1114,7 +1127,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1114
1127
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1115
1128
  - Wait for team response (messaging infrastructure handles that)
1116
1129
  - Create or modify test files
1117
- - Run Playwright tests
1130
+ - Run automated tests
1118
1131
 
1119
1132
  #### 5.6 Update Event Processor Memory
1120
1133
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1229,10 +1242,10 @@ var init_run_tests = __esm({
1229
1242
  runTestsTask = {
1230
1243
  slug: TASK_SLUGS.RUN_TESTS,
1231
1244
  name: "Run Tests",
1232
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1245
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1233
1246
  frontmatter: {
1234
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1235
- "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", "tests/specs/login.spec.ts")'
1247
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1248
+ "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", or a specific test file path)'
1236
1249
  },
1237
1250
  steps: [
1238
1251
  // Step 1: Overview (inline)
@@ -1241,7 +1254,7 @@ var init_run_tests = __esm({
1241
1254
  title: "Run Tests Overview",
1242
1255
  content: `# Run Tests Command
1243
1256
 
1244
- Execute automated Playwright tests, analyze failures using JSON reports, automatically fix test issues, and log product bugs.`
1257
+ 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.`
1245
1258
  },
1246
1259
  // Step 2: Security Notice (library)
1247
1260
  "security-notice",
@@ -1254,9 +1267,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1254
1267
  **Parse Arguments:**
1255
1268
  Extract the following from arguments:
1256
1269
  - **selector**: Test selection criteria
1257
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1258
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1259
- - Specific file: "tests/specs/login.spec.ts"
1270
+ - File pattern: "auth" \u2192 find matching test files (see \`./tests/CLAUDE.md\` for directory structure)
1271
+ - Tag: "@smoke" \u2192 runs tests with tag annotation
1272
+ - Specific file: path to a specific test file
1260
1273
  - All tests: "all" or "" \u2192 runs entire test suite`
1261
1274
  },
1262
1275
  // Step 4: Load Project Context (library)
@@ -1272,34 +1285,26 @@ Extract the following from arguments:
1272
1285
  inline: true,
1273
1286
  title: "Identify Automated Tests to Run",
1274
1287
  content: `#### Understand Test Selection
1288
+
1289
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1290
+
1275
1291
  Parse the selector argument to determine which tests to run:
1276
1292
 
1277
1293
  **File Pattern** (e.g., "auth", "login"):
1278
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1294
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1279
1295
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1280
1296
 
1281
1297
  **Tag** (e.g., "@smoke", "@regression"):
1282
- - Run tests with specific Playwright tag annotation
1283
- - Use Playwright's \`--grep\` option
1298
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1284
1299
 
1285
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1286
- - Run that specific test file
1300
+ **Specific File**:
1301
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1287
1302
 
1288
1303
  **All Tests** ("all" or no selector):
1289
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1304
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1290
1305
 
1291
1306
  #### Find Matching Test Files
1292
- Use glob patterns to find test files:
1293
- \`\`\`bash
1294
- # For file pattern
1295
- ls tests/specs/**/*[pattern]*.spec.ts
1296
-
1297
- # For specific file
1298
- ls tests/specs/auth/login.spec.ts
1299
-
1300
- # For all tests
1301
- ls tests/specs/**/*.spec.ts
1302
- \`\`\`
1307
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1303
1308
 
1304
1309
  #### Validate Test Files Exist
1305
1310
  Check that at least one test file was found:
@@ -1313,7 +1318,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1313
1318
  - **No selector** (all tests): Confirm running full suite before executing`
1314
1319
  },
1315
1320
  // Step 7-10: Test Execution (library steps)
1316
- "run-playwright-tests",
1321
+ "run-tests",
1317
1322
  "parse-test-results",
1318
1323
  "triage-failures",
1319
1324
  "fix-test-issues",
@@ -1339,8 +1344,8 @@ If no test cases match the selection criteria:
1339
1344
  2. List available test cases or suggest running \`/generate-test-cases\` first
1340
1345
  3. Provide examples of valid selection criteria
1341
1346
 
1342
- #### If Test Runner Agent Fails
1343
- If the test-runner agent encounters issues:
1347
+ #### If Browser Automation Agent Fails
1348
+ If the browser-automation agent encounters issues:
1344
1349
  1. Report the specific error
1345
1350
  2. Suggest troubleshooting steps
1346
1351
  3. Offer to run tests individually if batch execution failed
@@ -1354,18 +1359,18 @@ If selected test cases have formatting issues:
1354
1359
  ### Important Notes
1355
1360
 
1356
1361
  **Test Selection Strategy**:
1357
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1362
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1358
1363
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1359
1364
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1360
1365
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1361
1366
  - Use context keywords from user request to choose appropriate tier
1362
1367
 
1363
1368
  **Test Execution**:
1364
- - Automated Playwright tests are executed via bash command, not through agents
1369
+ - Automated tests are executed via bash command, not through agents
1365
1370
  - Test execution time varies by tier (see strategy document for details)
1366
1371
  - JSON reports provide structured test results for analysis
1367
- - Playwright automatically captures traces, screenshots, and videos on failures
1368
- - Test artifacts are stored in test-results/ directory
1372
+ - Test framework may capture traces, screenshots, and videos on failures (see \`./tests/CLAUDE.md\`)
1373
+ - Test artifacts are stored as defined in \`./tests/CLAUDE.md\`
1369
1374
 
1370
1375
  **Failure Handling**:
1371
1376
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1375,11 +1380,11 @@ If selected test cases have formatting issues:
1375
1380
  - Critical failures trigger immediate team notification
1376
1381
 
1377
1382
  **Related Documentation**:
1378
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1379
- - \`.bugzy/runtime/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1383
+ - \`./tests/docs/test-execution-strategy.md\` - When and why to run specific tests
1384
+ - \`./tests/docs/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1380
1385
  }
1381
1386
  ],
1382
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1387
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1383
1388
  optionalSubagents: ["issue-tracker", "team-communicator"],
1384
1389
  dependentTasks: []
1385
1390
  };
@@ -1411,7 +1416,7 @@ var init_verify_changes = __esm({
1411
1416
  ## Overview
1412
1417
 
1413
1418
  This task performs comprehensive change verification with:
1414
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1419
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1415
1420
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1416
1421
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1417
1422
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1642,11 +1647,11 @@ Analyze the change description to identify affected feature areas:
1642
1647
 
1643
1648
  | Description Keywords | Inferred Test Scope | Example |
1644
1649
  |---------------------|-------------------|---------|
1645
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1646
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1647
- | "cart", "shopping cart", "add to cart" | \`tests/specs/cart/\` | "Update cart calculations" -> Cart tests |
1650
+ | "login", "authentication", "sign in/up" | Auth test suite | "Fix login page validation" -> Auth tests |
1651
+ | "checkout", "payment", "purchase" | Checkout test suite | "Optimize checkout flow" -> Checkout tests |
1652
+ | "cart", "shopping cart", "add to cart" | Cart test suite | "Update cart calculations" -> Cart tests |
1648
1653
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1649
- | "profile", "account", "settings" | \`tests/specs/profile/\` or \`tests/specs/settings/\` | "Profile page redesign" -> Profile tests |
1654
+ | "profile", "account", "settings" | Profile/settings test suite | "Profile page redesign" -> Profile tests |
1650
1655
 
1651
1656
  **Inference strategy:**
1652
1657
  1. **Extract feature keywords** from PR title and description
@@ -1721,13 +1726,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1721
1726
 
1722
1727
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1723
1728
 
1724
- ### Generate Playwright Specs
1729
+ ### Generate Automated Test Specs
1725
1730
 
1726
1731
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1727
1732
  - Read the manual test cases you just created
1728
1733
  - Explore the feature in the browser to discover selectors and flows
1729
- - Create Page Objects in \`./tests/pages/\` if needed
1730
- - Create test specs in \`./tests/specs/\` matching the test cases
1734
+ - Create page objects in the directory specified by \`./tests/CLAUDE.md\`
1735
+ - Create test specs in the directory specified by \`./tests/CLAUDE.md\`
1731
1736
  - Run each new test to verify it passes
1732
1737
  - Update the manual test case with \`automated_test\` reference
1733
1738
 
@@ -1737,7 +1742,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1737
1742
  conditionalOnSubagent: "test-code-generator"
1738
1743
  },
1739
1744
  // Step 8-11: Test Execution (library steps)
1740
- "run-playwright-tests",
1745
+ "run-tests",
1741
1746
  "parse-test-results",
1742
1747
  "triage-failures",
1743
1748
  "fix-test-issues",
@@ -1926,7 +1931,7 @@ Post PR comment if GitHub context available.`,
1926
1931
  - Recommend: Check test configuration and prerequisites
1927
1932
 
1928
1933
  **If test execution fails:**
1929
- - Report specific error (Playwright not installed, env vars missing)
1934
+ - Report specific error (test framework not installed, env vars missing)
1930
1935
  - Suggest troubleshooting steps
1931
1936
  - Don't proceed with triage if tests didn't run
1932
1937
 
@@ -1956,7 +1961,7 @@ A successful verification includes:
1956
1961
  10. Clear recommendation provided (merge / review / block)`
1957
1962
  }
1958
1963
  ],
1959
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1964
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1960
1965
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
1961
1966
  dependentTasks: []
1962
1967
  };
@@ -2013,7 +2018,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2013
2018
  },
2014
2019
  // Phase 2: Exploration Protocol
2015
2020
  "exploration-protocol",
2016
- // Execute exploration via test-runner
2021
+ // Execute exploration via browser-automation
2017
2022
  "create-exploration-test-case",
2018
2023
  "run-exploration",
2019
2024
  "process-exploration-results",
@@ -2024,7 +2029,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2024
2029
  "generate-test-cases",
2025
2030
  "automate-test-cases",
2026
2031
  // Phase 5: Test Execution
2027
- "run-playwright-tests",
2032
+ "run-tests",
2028
2033
  "parse-test-results",
2029
2034
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2030
2035
  "triage-failures",
@@ -2041,7 +2046,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2041
2046
  },
2042
2047
  "generate-final-report"
2043
2048
  ],
2044
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2049
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2045
2050
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2046
2051
  dependentTasks: ["run-tests", "generate-test-cases"]
2047
2052
  };
@@ -2068,7 +2073,7 @@ var init_explore_application = __esm({
2068
2073
  {
2069
2074
  inline: true,
2070
2075
  title: "Explore Application Overview",
2071
- content: `Discover actual UI elements, workflows, and behaviors using the test-runner agent. Updates test plan and project documentation with findings.`
2076
+ content: `Discover actual UI elements, workflows, and behaviors using the browser-automation agent. Updates test plan and project documentation with findings.`
2072
2077
  },
2073
2078
  // Step 2: Security Notice (from library)
2074
2079
  "security-notice",
@@ -2115,7 +2120,7 @@ var init_explore_application = __esm({
2115
2120
  "cleanup-temp-files",
2116
2121
  "update-knowledge-base"
2117
2122
  ],
2118
- requiredSubagents: ["test-runner"],
2123
+ requiredSubagents: ["browser-automation"],
2119
2124
  optionalSubagents: ["team-communicator"],
2120
2125
  dependentTasks: []
2121
2126
  };
@@ -2486,9 +2491,9 @@ var INTEGRATIONS = {
2486
2491
  }
2487
2492
  };
2488
2493
  var SUBAGENTS = {
2489
- "test-runner": {
2490
- role: "test-runner",
2491
- name: "Test Runner",
2494
+ "browser-automation": {
2495
+ role: "browser-automation",
2496
+ name: "Browser Automation",
2492
2497
  description: "Execute automated browser tests (always included)",
2493
2498
  icon: "play",
2494
2499
  integrations: [INTEGRATIONS.playwright],
@@ -2545,7 +2550,7 @@ var SUBAGENTS = {
2545
2550
  "test-code-generator": {
2546
2551
  role: "test-code-generator",
2547
2552
  name: "Test Code Generator",
2548
- description: "Generate automated Playwright test scripts and Page Objects",
2553
+ description: "Generate automated test scripts and page objects",
2549
2554
  icon: "code",
2550
2555
  integrations: [INTEGRATIONS.playwright],
2551
2556
  model: "sonnet",
@@ -2760,7 +2765,7 @@ init_esm_shims();
2760
2765
  // src/subagents/templates/index.ts
2761
2766
  init_esm_shims();
2762
2767
 
2763
- // src/subagents/templates/test-runner/playwright.ts
2768
+ // src/subagents/templates/browser-automation/playwright.ts
2764
2769
  init_esm_shims();
2765
2770
 
2766
2771
  // src/subagents/templates/memory-template.ts
@@ -2807,16 +2812,16 @@ After completing your work, update your memory file with relevant insights.
2807
2812
  **Remember:** Every entry should answer "How does this change what I do?"
2808
2813
  `;
2809
2814
 
2810
- // src/subagents/templates/test-runner/playwright.ts
2815
+ // src/subagents/templates/browser-automation/playwright.ts
2811
2816
  var FRONTMATTER = {
2812
- name: "test-runner",
2813
- 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.
2817
+ name: "browser-automation",
2818
+ 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.
2814
2819
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2815
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2816
- <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.
2820
+ assistant: "I'll use the browser-automation agent to execute this test case and capture all the results with video evidence."
2821
+ <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.
2817
2822
  user: "Execute the smoke test for the checkout flow"
2818
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2819
- <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>`,
2823
+ assistant: "Let me use the browser-automation agent to execute the checkout smoke test and record all findings with video."
2824
+ <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>`,
2820
2825
  model: "sonnet",
2821
2826
  color: "green"
2822
2827
  };
@@ -2829,9 +2834,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2829
2834
  - Structure of \`steps.json\` with timestamps and video synchronization
2830
2835
  - Field descriptions and data types
2831
2836
 
2832
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2837
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2833
2838
 
2834
- **Memory Sections for Test Runner**:
2839
+ **Memory Sections for Browser Automation**:
2835
2840
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2836
2841
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2837
2842
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2897,7 +2902,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2897
2902
  **Execution Workflow:**
2898
2903
 
2899
2904
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2900
- - Read \`.bugzy/runtime/memory/test-runner.md\` to access your working knowledge
2905
+ - Read \`.bugzy/runtime/memory/browser-automation.md\` to access your working knowledge
2901
2906
  - Check if this test is known to be flaky (apply extra waits if so)
2902
2907
  - Review timing requirements for pages this test will visit
2903
2908
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2949,9 +2954,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2949
2954
  - Video filename reference (just basename, not full path)
2950
2955
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2951
2956
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2952
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2957
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2953
2958
 
2954
- Specifically for test-runner, consider updating:
2959
+ Specifically for browser-automation, consider updating:
2955
2960
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2956
2961
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2957
2962
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -3025,49 +3030,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
3025
3030
  init_esm_shims();
3026
3031
  var FRONTMATTER2 = {
3027
3032
  name: "test-code-generator",
3028
- 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.
3033
+ 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.
3029
3034
  user: "Generate test cases for the login feature based on the test plan"
3030
- assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated Playwright test scripts with Page Objects."
3035
+ assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated test scripts with page objects."
3031
3036
  <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.
3032
3037
  user: "Create automated tests for the checkout flow"
3033
- assistant: "Let me use the test-code-generator agent to generate test scripts, Page Objects, and test case documentation for the checkout flow."
3038
+ assistant: "Let me use the test-code-generator agent to generate test scripts, page objects, and test case documentation for the checkout flow."
3034
3039
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
3035
3040
  model: "sonnet",
3036
3041
  color: "purple"
3037
3042
  };
3038
- var CONTENT2 = `You are an expert Playwright test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
3043
+ var CONTENT2 = `You are an expert test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
3044
+
3045
+ **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.
3039
3046
 
3040
3047
  **Core Responsibilities:**
3041
3048
 
3042
- 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.
3049
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
3050
+ - The test framework and language used
3051
+ - Directory structure (where to put test specs, page objects, fixtures, helpers)
3052
+ - Test structure conventions (how to organize test steps, tagging, etc.)
3053
+ - Selector priority and strategies
3054
+ - How to run tests
3055
+ - Common fix patterns
3056
+
3057
+ 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.
3043
3058
 
3044
- 2. **Environment Configuration**:
3059
+ 3. **Environment Configuration**:
3045
3060
  - Read \`.env.testdata\` for available environment variables
3046
3061
  - Reference variables using \`process.env.VAR_NAME\` in tests
3047
3062
  - Add new required variables to \`.env.testdata\`
3048
3063
  - NEVER read \`.env\` file (secrets only)
3049
3064
  - **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.
3050
3065
 
3051
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3066
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3052
3067
 
3053
3068
  **Memory Sections for Test Code Generator**:
3054
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
3069
+ - Generated artifacts (page objects, tests, fixtures, helpers)
3055
3070
  - Test cases automated
3056
3071
  - Selector strategies that work for this application
3057
3072
  - Application architecture patterns learned
3058
3073
  - Environment variables used
3059
3074
  - Test creation history and outcomes
3060
3075
 
3061
- 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:
3076
+ 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:
3062
3077
  - Read the manual test case files
3063
- - For test cases marked \`automated: true\`, generate automated Playwright tests
3078
+ - For test cases marked \`automated: true\`, generate automated tests
3064
3079
  - Update the manual test case file with the automated_test reference
3065
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
3080
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
3066
3081
 
3067
- 5. **Mandatory Application Exploration**: NEVER generate Page Objects without exploring the live application first using playwright-cli:
3082
+ 6. **Mandatory Application Exploration**: NEVER generate page objects without exploring the live application first using playwright-cli:
3068
3083
  - Navigate to pages, authenticate, inspect elements
3069
3084
  - Capture screenshots for documentation
3070
- - Document exact role names, labels, text, URLs
3085
+ - Document exact element identifiers, labels, text, URLs
3071
3086
  - Test navigation flows manually
3072
3087
  - **NEVER assume selectors** - verify in browser or tests will fail
3073
3088
 
@@ -3075,7 +3090,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3075
3090
 
3076
3091
  1. **Load Memory**:
3077
3092
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
3078
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
3093
+ - Check existing page objects, automated tests, selector strategies, naming conventions
3079
3094
  - Avoid duplication by reusing established patterns
3080
3095
 
3081
3096
  2. **Read Manual Test Cases**:
@@ -3089,20 +3104,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3089
3104
 
3090
3105
  **STEP 1: Check Existing Infrastructure**
3091
3106
 
3092
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
3093
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
3094
- - **Identify gaps**: Determine what POMs or helpers are missing for this test
3107
+ - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing page objects
3108
+ - **Scan codebase**: Look for relevant page objects in the directory specified by \`./tests/CLAUDE.md\`
3109
+ - **Identify gaps**: Determine what page objects or helpers are missing for this test
3095
3110
 
3096
3111
  **STEP 2: Build Missing Infrastructure** (if needed)
3097
3112
 
3098
3113
  - **Explore feature under test**: Use playwright-cli to:
3099
3114
  * Navigate to the feature's pages
3100
- * Inspect elements and gather selectors (role, label, text)
3115
+ * Inspect elements and gather selectors
3101
3116
  * Document actual URLs from the browser
3102
3117
  * Capture screenshots for documentation
3103
3118
  * Test navigation flows manually
3104
3119
  * NEVER assume selectors - verify everything in browser
3105
- - **Create Page Objects**: Build POMs for new pages/components using verified selectors
3120
+ - **Create page objects**: Build page objects for new pages/components using verified selectors, following conventions from \`./tests/CLAUDE.md\`
3106
3121
  - **Create supporting code**: Add any needed fixtures, helpers, or types
3107
3122
 
3108
3123
  **STEP 3: Create Automated Test**
@@ -3110,20 +3125,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3110
3125
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
3111
3126
  * Understand the test objective and steps
3112
3127
  * Note any preconditions or test data requirements
3113
- - **Generate automated test** (./tests/specs/*.spec.ts):
3128
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
3114
3129
  * Use the manual test case steps as the basis
3115
- * Create executable Playwright test using Page Objects
3116
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
3117
- * Each test.step() should directly correspond to a numbered step in the manual test case
3130
+ * Follow the test structure conventions from \`./tests/CLAUDE.md\`
3118
3131
  * Reference manual test case ID in comments
3119
- * Tag critical tests with @smoke
3132
+ * Tag critical tests appropriately (e.g., @smoke)
3120
3133
  - **Update manual test case file**:
3121
3134
  * Set \`automated_test:\` field to the path of the automated test file
3122
3135
  * Link manual \u2194 automated test bidirectionally
3123
3136
 
3124
3137
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
3125
3138
 
3126
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
3139
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
3127
3140
  - **Analyze results**:
3128
3141
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
3129
3142
  * Fail \u2192 Proceed to failure analysis below
@@ -3137,60 +3150,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3137
3150
  | **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 |
3138
3151
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
3139
3152
 
3140
- **4b. Fix Patterns** (apply based on root cause):
3141
-
3142
- **Fix Type 1: Brittle Selectors**
3143
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3144
- - **Fix**: Replace with role-based selectors
3145
- \`\`\`typescript
3146
- // BEFORE (brittle)
3147
- await page.locator('.btn-primary').click();
3148
- // AFTER (semantic)
3149
- await page.getByRole('button', { name: 'Sign In' }).click();
3150
- \`\`\`
3151
-
3152
- **Fix Type 2: Missing Wait Conditions**
3153
- - **Problem**: Test doesn't wait for elements or actions to complete
3154
- - **Fix**: Add explicit wait for expected state
3155
- \`\`\`typescript
3156
- // BEFORE (race condition)
3157
- await page.goto('/dashboard');
3158
- const items = await page.locator('.item').count();
3159
- // AFTER (explicit wait)
3160
- await page.goto('/dashboard');
3161
- await expect(page.locator('.item')).toHaveCount(5);
3162
- \`\`\`
3163
-
3164
- **Fix Type 3: Race Conditions**
3165
- - **Problem**: Test executes actions before application is ready
3166
- - **Fix**: Wait for specific application state
3167
- \`\`\`typescript
3168
- // BEFORE
3169
- await saveButton.click();
3170
- await expect(successMessage).toBeVisible();
3171
- // AFTER
3172
- await page.locator('.validation-complete').waitFor();
3173
- await saveButton.click();
3174
- await expect(successMessage).toBeVisible();
3175
- \`\`\`
3176
-
3177
- **Fix Type 4: Wrong Assertions**
3178
- - **Problem**: Assertion expects incorrect value or state
3179
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
3180
-
3181
- **Fix Type 5: Test Isolation Issues**
3182
- - **Problem**: Test depends on state from previous tests
3183
- - **Fix**: Add proper setup/teardown or use fixtures
3184
-
3185
- **Fix Type 6: Flaky Tests**
3186
- - **Problem**: Test passes inconsistently
3187
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
3188
- - Run test 10 times to confirm stability after fix
3153
+ **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.
3189
3154
 
3190
3155
  **4c. Fix Workflow**:
3191
3156
  1. Read failure report and classify (product bug vs test issue)
3192
3157
  2. If product bug: Document and mark test as blocked, move to next test
3193
- 3. If test issue: Apply appropriate fix from patterns above
3158
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
3194
3159
  4. Re-run test to verify fix
3195
3160
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
3196
3161
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -3199,9 +3164,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3199
3164
 
3200
3165
  | Failure Type | Root Cause | Action |
3201
3166
  |--------------|------------|--------|
3202
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3203
- | Timeout waiting | Missing wait condition | Add explicit wait |
3204
- | Flaky (timing) | Race condition | Add synchronization wait |
3167
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
3168
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
3169
+ | Flaky (timing) | Race condition | Apply synchronization fix pattern from CLAUDE.md |
3205
3170
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3206
3171
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3207
3172
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -3209,13 +3174,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3209
3174
  **STEP 5: Move to Next Test Case**
3210
3175
 
3211
3176
  - Repeat process for each test case in the plan
3212
- - Reuse existing POMs and infrastructure wherever possible
3177
+ - Reuse existing page objects and infrastructure wherever possible
3213
3178
  - Continuously update memory with new patterns and learnings
3214
3179
 
3215
3180
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3216
3181
 
3217
3182
  Specifically for test-code-generator, consider updating:
3218
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
3183
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
3219
3184
  - **Test Cases Automated**: Record which test cases were automated with references
3220
3185
  - **Selector Strategies**: Note what selector strategies work well for this application
3221
3186
  - **Application Patterns**: Document architecture patterns learned
@@ -3225,7 +3190,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3225
3190
  - Test automation results (tests created, pass/fail status, issues found)
3226
3191
  - Manual test cases automated (count, IDs, titles)
3227
3192
  - Automated tests created (count, smoke vs functional)
3228
- - Page Objects, fixtures, helpers added
3193
+ - Page objects, fixtures, helpers added
3229
3194
  - Next steps (commands to run tests)
3230
3195
 
3231
3196
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -3236,7 +3201,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3236
3201
  ## Last Updated: [timestamp]
3237
3202
 
3238
3203
  ## Generated Test Artifacts
3239
- [Page Objects created with locators and methods]
3204
+ [Page objects created with locators and methods]
3240
3205
  [Test cases automated with manual TC references and file paths]
3241
3206
  [Fixtures, helpers, components created]
3242
3207
 
@@ -3245,26 +3210,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3245
3210
  [Tests passing vs failing with product bugs]
3246
3211
 
3247
3212
  ## Fixed Issues History
3248
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
3249
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState for async validation
3213
+ - [Date] TC-001: Applied selector fix pattern
3214
+ - [Date] TC-003: Applied wait fix pattern for async validation
3250
3215
 
3251
3216
  ## Failure Pattern Library
3252
3217
 
3253
3218
  ### Pattern: Selector Timeout on Dynamic Content
3254
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3219
+ **Symptoms**: Element not found, element loads after timeout
3255
3220
  **Root Cause**: Selector runs before element rendered
3256
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3221
+ **Fix Strategy**: Add explicit visibility wait before interaction
3257
3222
  **Success Rate**: [track over time]
3258
3223
 
3259
3224
  ### Pattern: Race Condition on Form Submission
3260
- **Symptoms**: Test clicks submit before validation completes
3225
+ **Symptoms**: Test interacts before validation completes
3261
3226
  **Root Cause**: Missing wait for validation state
3262
3227
  **Fix Strategy**: Wait for validation indicator before submit
3263
3228
 
3264
3229
  ## Known Stable Selectors
3265
3230
  [Selectors that reliably work for this application]
3266
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3267
- - Email field: \`getByLabel('Email')\`
3268
3231
 
3269
3232
  ## Known Product Bugs (Do Not Fix Tests)
3270
3233
  [Actual bugs discovered - tests should remain failing]
@@ -3275,9 +3238,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3275
3238
 
3276
3239
  ## Application Behavior Patterns
3277
3240
  [Load times, async patterns, navigation flows discovered]
3278
- - Auth pages: redirect timing
3279
- - Dashboard: lazy loading patterns
3280
- - Forms: validation timing
3281
3241
 
3282
3242
  ## Selector Strategy Library
3283
3243
  [Successful selector patterns and their success rates]
@@ -3292,33 +3252,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3292
3252
 
3293
3253
  **Critical Rules:**
3294
3254
 
3295
- \u274C **NEVER**:
3296
- - Generate selectors without exploring the live application - causes 100% test failure
3297
- - Assume URLs, selectors, or navigation patterns - verify in browser
3298
- - Skip exploration even if documentation seems detailed
3299
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
3300
- - Put assertions in Page Objects - only in test files
3301
- - Read .env file - only .env.testdata
3302
- - Create test interdependencies - tests must be independent
3303
-
3304
- \u2705 **ALWAYS**:
3305
- - Explore application using playwright-cli before generating code
3306
- - Verify selectors in live browser using playwright-cli snapshot
3307
- - Document actual URLs from browser address bar
3308
- - Take screenshots for documentation
3309
- - Use role-based selectors as first priority
3310
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
3311
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
3312
- - Follow .bugzy/runtime/testing-best-practices.md
3313
- - Read existing manual test cases and automate those marked automated: true
3314
-
3315
- Follow .bugzy/runtime/testing-best-practices.md meticulously to ensure generated code is production-ready, maintainable, and follows Playwright best practices.`;
3255
+ - **NEVER** generate selectors without exploring the live application - causes 100% test failure
3256
+ - **NEVER** assume URLs, selectors, or navigation patterns - verify in browser
3257
+ - **NEVER** skip exploration even if documentation seems detailed
3258
+ - **NEVER** read .env file - only .env.testdata
3259
+ - **NEVER** create test interdependencies - tests must be independent
3260
+ - **ALWAYS** explore application using playwright-cli before generating code
3261
+ - **ALWAYS** verify selectors in live browser using playwright-cli snapshot
3262
+ - **ALWAYS** document actual URLs from browser address bar
3263
+ - **ALWAYS** follow conventions defined in \`./tests/CLAUDE.md\`
3264
+ - **ALWAYS** link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
3265
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3266
+ - **ALWAYS** read existing manual test cases and automate those marked automated: true`;
3316
3267
 
3317
3268
  // src/subagents/templates/test-debugger-fixer/playwright.ts
3318
3269
  init_esm_shims();
3319
3270
  var FRONTMATTER3 = {
3320
3271
  name: "test-debugger-fixer",
3321
- 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".
3272
+ 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.
3322
3273
  user: "Fix the failing login test"
3323
3274
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
3324
3275
  <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.
@@ -3328,18 +3279,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
3328
3279
  model: "sonnet",
3329
3280
  color: "yellow"
3330
3281
  };
3331
- 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.
3282
+ 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.
3283
+
3284
+ **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.
3332
3285
 
3333
3286
  **Core Responsibilities:**
3334
3287
 
3335
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
3336
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
3337
- - Correct waiting and synchronization patterns
3338
- - Test isolation principles
3339
- - Common anti-patterns to avoid
3340
- - Debugging workflow and techniques
3288
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
3289
+ - The test framework and language used
3290
+ - Selector strategies and priorities
3291
+ - Waiting and synchronization patterns
3292
+ - Common fix patterns for this framework
3293
+ - How to run tests
3294
+ - Test result artifacts format
3295
+
3296
+ 2. **Best Practices Reference**: Read \`./tests/docs/testing-best-practices.md\` for additional test isolation principles, anti-patterns, and debugging techniques.
3341
3297
 
3342
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3298
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3343
3299
 
3344
3300
  **Memory Sections for Test Debugger Fixer**:
3345
3301
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -3349,7 +3305,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3349
3305
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
3350
3306
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
3351
3307
 
3352
- 3. **Failure Analysis**: When a test fails, you must:
3308
+ 4. **Failure Analysis**: When a test fails, you must:
3353
3309
  - Read the failing test file to understand what it's trying to do
3354
3310
  - Read the failure details from the JSON test report
3355
3311
  - Examine error messages, stack traces, and failure context
@@ -3358,7 +3314,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3358
3314
  - **Product bug**: Correct test code, but application behaves unexpectedly
3359
3315
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
3360
3316
 
3361
- 3. **Triage Decision**: Determine if this is a product bug or test issue:
3317
+ 5. **Triage Decision**: Determine if this is a product bug or test issue:
3362
3318
 
3363
3319
  **Product Bug Indicators**:
3364
3320
  - Selectors are correct and elements exist
@@ -3373,9 +3329,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3373
3329
  - Flaky behavior (passes sometimes, fails other times)
3374
3330
  - Wrong assertions (expecting incorrect values)
3375
3331
  - Test isolation problems (depends on other tests)
3376
- - Brittle selectors (CSS classes, IDs that change)
3332
+ - Brittle selectors that change between builds
3377
3333
 
3378
- 4. **Debug Using Browser**: When needed, explore the application manually:
3334
+ 6. **Debug Using Browser**: When needed, explore the application manually:
3379
3335
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
3380
3336
  - Navigate to the relevant page
3381
3337
  - Inspect elements to find correct selectors
@@ -3384,87 +3340,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3384
3340
  - Verify application state matches test expectations
3385
3341
  - Take notes on differences between expected and actual behavior
3386
3342
 
3387
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
3388
-
3389
- **Fix Type 1: Brittle Selectors**
3390
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3391
- - **Fix**: Replace with role-based selectors
3392
- - **Example**:
3393
- \`\`\`typescript
3394
- // BEFORE (brittle)
3395
- await page.locator('.btn-primary').click();
3396
-
3397
- // AFTER (semantic)
3398
- await page.getByRole('button', { name: 'Sign In' }).click();
3399
- \`\`\`
3400
-
3401
- **Fix Type 2: Missing Wait Conditions**
3402
- - **Problem**: Test doesn't wait for elements or actions to complete
3403
- - **Fix**: Add explicit wait for expected state
3404
- - **Example**:
3405
- \`\`\`typescript
3406
- // BEFORE (race condition)
3407
- await page.goto('/dashboard');
3408
- const items = await page.locator('.item').count();
3409
-
3410
- // AFTER (explicit wait)
3411
- await page.goto('/dashboard');
3412
- await expect(page.locator('.item')).toHaveCount(5);
3413
- \`\`\`
3414
-
3415
- **Fix Type 3: Race Conditions**
3416
- - **Problem**: Test executes actions before application is ready
3417
- - **Fix**: Wait for specific application state
3418
- - **Example**:
3419
- \`\`\`typescript
3420
- // BEFORE (race condition)
3421
- await saveButton.click();
3422
- await expect(successMessage).toBeVisible();
3423
-
3424
- // AFTER (wait for ready state)
3425
- await page.locator('.validation-complete').waitFor();
3426
- await saveButton.click();
3427
- await expect(successMessage).toBeVisible();
3428
- \`\`\`
3429
-
3430
- **Fix Type 4: Wrong Assertions**
3431
- - **Problem**: Assertion expects incorrect value or state
3432
- - **Fix**: Update assertion to match actual application behavior (if correct)
3433
- - **Example**:
3434
- \`\`\`typescript
3435
- // BEFORE (wrong expectation)
3436
- await expect(heading).toHaveText('Welcome John');
3437
-
3438
- // AFTER (corrected)
3439
- await expect(heading).toHaveText('Welcome, John!');
3440
- \`\`\`
3441
-
3442
- **Fix Type 5: Test Isolation Issues**
3443
- - **Problem**: Test depends on state from previous tests
3444
- - **Fix**: Add proper setup/teardown or use fixtures
3445
- - **Example**:
3446
- \`\`\`typescript
3447
- // BEFORE (depends on previous test)
3448
- test('should logout', async ({ page }) => {
3449
- await page.goto('/dashboard');
3450
- // Assumes user is already logged in
3451
- });
3452
-
3453
- // AFTER (isolated with fixture)
3454
- test('should logout', async ({ page, authenticatedUser }) => {
3455
- await page.goto('/dashboard');
3456
- // Uses fixture for clean state
3457
- });
3458
- \`\`\`
3459
-
3460
- **Fix Type 6: Flaky Tests**
3461
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
3462
- - **Fix**: Identify and eliminate non-determinism
3463
- - Common causes: timing issues, race conditions, animation delays, network timing
3464
- - Run test multiple times to reproduce flakiness
3465
- - Add proper waits for stable state
3466
-
3467
- 6. **Fixing Workflow**:
3343
+ 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.
3344
+
3345
+ 8. **Fixing Workflow**:
3468
3346
 
3469
3347
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
3470
3348
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -3477,7 +3355,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3477
3355
  **Step 1: Read Test File**
3478
3356
  - Understand test intent and logic
3479
3357
  - Identify what the test is trying to verify
3480
- - Note test structure and Page Objects used
3358
+ - Note test structure and page objects used
3481
3359
 
3482
3360
  **Step 2: Read Failure Report**
3483
3361
  - Parse JSON test report for failure details
@@ -3496,14 +3374,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3496
3374
  - **If test issue**: Proceed to fix
3497
3375
 
3498
3376
  **Step 5: Apply Fix**
3499
- - Edit test file with appropriate fix
3377
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
3500
3378
  - Update selectors, waits, assertions, or logic
3501
- - Follow best practices from testing guide
3379
+ - Follow conventions from \`./tests/CLAUDE.md\`
3502
3380
  - Add comments explaining the fix if complex
3503
3381
 
3504
3382
  **Step 6: Verify Fix**
3505
- - Run the fixed test: \`npx playwright test [test-file]\`
3506
- - **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
3383
+ - Run the fixed test using the command from \`./tests/CLAUDE.md\`
3384
+ - **IMPORTANT: Do NOT use \`--reporter\` flag** - the custom bugzy-reporter must run to create the hierarchical test-runs output needed for analysis
3507
3385
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
3508
3386
  - Read manifest.json to confirm test passes in latest execution
3509
3387
  - For flaky tests: Run 10 times to ensure stability
@@ -3524,7 +3402,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3524
3402
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
3525
3403
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
3526
3404
 
3527
- 7. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3405
+ 9. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3528
3406
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3529
3407
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3530
3408
  \`\`\`json
@@ -3555,77 +3433,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3555
3433
  \`\`\`
3556
3434
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3557
3435
 
3558
- 8. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3436
+ 10. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3559
3437
 
3560
- \`\`\`markdown
3561
- # Test Debugger Fixer Memory
3562
-
3563
- ## Last Updated: [timestamp]
3564
-
3565
- ## Fixed Issues History
3566
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3567
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3568
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3569
-
3570
- ## Failure Pattern Library
3571
-
3572
- ### Pattern: Selector Timeout on Dynamic Content
3573
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3574
- **Root Cause**: Selector runs before element rendered
3575
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3576
- **Success Rate**: 95% (used 12 times)
3577
-
3578
- ### Pattern: Race Condition on Form Submission
3579
- **Symptoms**: Test clicks submit before validation completes
3580
- **Root Cause**: Missing wait for validation state
3581
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3582
- **Success Rate**: 100% (used 8 times)
3583
-
3584
- ## Known Stable Selectors
3585
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3586
- - Email field: \`getByLabel('Email')\`
3587
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3588
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3589
-
3590
- ## Known Product Bugs (Do Not Fix Tests)
3591
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3592
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3593
-
3594
- ## Flaky Test Tracking
3595
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3596
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3597
-
3598
- ## Application Behavior Patterns
3599
- - **Auth Pages**: Redirect after 200ms delay
3600
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3601
- - **Forms**: Validation runs on blur + submit events
3602
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3603
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3604
- \`\`\`
3438
+ \`\`\`markdown
3439
+ # Test Debugger Fixer Memory
3440
+
3441
+ ## Last Updated: [timestamp]
3442
+
3443
+ ## Fixed Issues History
3444
+ - [Date] TC-001: Applied selector fix pattern
3445
+ - [Date] TC-003: Applied wait fix pattern for async validation
3446
+ - [Date] TC-005: Fixed race condition with explicit wait for data load
3447
+
3448
+ ## Failure Pattern Library
3449
+
3450
+ ### Pattern: Selector Timeout on Dynamic Content
3451
+ **Symptoms**: Element not found, element loads after timeout
3452
+ **Root Cause**: Selector runs before element rendered
3453
+ **Fix Strategy**: Add explicit visibility wait before interaction
3454
+ **Success Rate**: 95% (used 12 times)
3455
+
3456
+ ### Pattern: Race Condition on Form Submission
3457
+ **Symptoms**: Test interacts before validation completes
3458
+ **Root Cause**: Missing wait for validation state
3459
+ **Fix Strategy**: Wait for validation indicator before submit
3460
+ **Success Rate**: 100% (used 8 times)
3605
3461
 
3606
- 9. **Environment Configuration**:
3607
- - Tests use \`process.env.VAR_NAME\` for configuration
3608
- - Read \`.env.testdata\` to understand available variables
3609
- - NEVER read \`.env\` file (contains secrets only)
3610
- - If test needs new environment variable, update \`.env.testdata\`
3611
-
3612
- 9. **Using playwright-cli for Debugging**:
3613
- - You have direct access to playwright-cli via Bash
3614
- - Open browser: \`playwright-cli open <url>\`
3615
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3616
- - Navigate: \`playwright-cli navigate <url>\`
3617
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3618
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3619
- - Close browser: \`playwright-cli close\`
3620
-
3621
- 10. **Test Stability Best Practices**:
3622
- - Replace all \`waitForTimeout()\` with specific waits
3623
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3624
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3625
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3626
- - Handle dynamic content with proper waits
3627
-
3628
- 11. **Communication**:
3462
+ ## Known Stable Selectors
3463
+ [Selectors that reliably work for this application]
3464
+
3465
+ ## Known Product Bugs (Do Not Fix Tests)
3466
+ [Actual bugs discovered - tests should remain failing]
3467
+
3468
+ ## Flaky Test Tracking
3469
+ [Tests with intermittent failures and their root causes]
3470
+
3471
+ ## Application Behavior Patterns
3472
+ [Load times, async patterns, navigation flows discovered]
3473
+ \`\`\`
3474
+
3475
+ 11. **Environment Configuration**:
3476
+ - Tests use \`process.env.VAR_NAME\` for configuration
3477
+ - Read \`.env.testdata\` to understand available variables
3478
+ - NEVER read \`.env\` file (contains secrets only)
3479
+ - If test needs new environment variable, update \`.env.testdata\`
3480
+
3481
+ 12. **Using playwright-cli for Debugging**:
3482
+ - You have direct access to playwright-cli via Bash
3483
+ - Open browser: \`playwright-cli open <url>\`
3484
+ - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3485
+ - Navigate: \`playwright-cli navigate <url>\`
3486
+ - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3487
+ - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3488
+ - Close browser: \`playwright-cli close\`
3489
+
3490
+ 13. **Communication**:
3629
3491
  - Be clear about whether issue is product bug or test issue
3630
3492
  - Explain root cause of test failure
3631
3493
  - Describe fix applied in plain language
@@ -3636,31 +3498,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3636
3498
 
3637
3499
  | Failure Type | Root Cause | Action |
3638
3500
  |--------------|------------|--------|
3639
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3640
- | Timeout waiting | Missing wait condition | Add explicit wait |
3641
- | Flaky (timing) | Race condition | Add synchronization wait |
3501
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
3502
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
3503
+ | Flaky (timing) | Race condition | Apply synchronization fix from CLAUDE.md |
3642
3504
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3643
3505
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3644
3506
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3645
3507
 
3646
- **Anti-Patterns to Avoid:**
3647
-
3648
- \u274C **DO NOT**:
3649
- - Fix tests when the issue is a product bug
3650
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3651
- - Make tests pass by lowering expectations
3652
- - Introduce new test dependencies
3653
- - Skip proper verification of fixes
3654
- - Exceed 3 fix attempts (escalate instead)
3655
-
3656
- \u2705 **DO**:
3657
- - Thoroughly analyze before fixing
3658
- - Use semantic selectors when replacing brittle ones
3659
- - Add explicit waits for specific conditions
3660
- - Verify fixes by re-running tests
3661
- - Run flaky tests 10 times to confirm stability
3662
- - Report product bugs instead of making tests ignore them
3663
- - Follow testing best practices guide
3508
+ **Critical Rules:**
3509
+
3510
+ - **NEVER** fix tests when the issue is a product bug
3511
+ - **NEVER** make tests pass by lowering expectations
3512
+ - **NEVER** introduce new test dependencies
3513
+ - **NEVER** skip proper verification of fixes
3514
+ - **NEVER** exceed 3 fix attempts (escalate instead)
3515
+ - **ALWAYS** thoroughly analyze before fixing
3516
+ - **ALWAYS** follow fix patterns from \`./tests/CLAUDE.md\`
3517
+ - **ALWAYS** verify fixes by re-running tests
3518
+ - **ALWAYS** run flaky tests 10 times to confirm stability
3519
+ - **ALWAYS** report product bugs instead of making tests ignore them
3520
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3664
3521
 
3665
3522
  **Output Format**:
3666
3523
 
@@ -3679,12 +3536,12 @@ Verification:
3679
3536
  - Run 1: [passed/failed]
3680
3537
  - Run 2-10: [if flaky test]
3681
3538
 
3682
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
3539
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3683
3540
 
3684
3541
  Next Steps: [run tests / log bug / review manually]
3685
3542
  \`\`\`
3686
3543
 
3687
- 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.`;
3544
+ 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.`;
3688
3545
 
3689
3546
  // src/subagents/templates/team-communicator/local.ts
3690
3547
  init_esm_shims();
@@ -6231,7 +6088,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
6231
6088
 
6232
6089
  // src/subagents/templates/index.ts
6233
6090
  var TEMPLATES = {
6234
- "test-runner": {
6091
+ "browser-automation": {
6235
6092
  playwright: {
6236
6093
  frontmatter: FRONTMATTER,
6237
6094
  content: CONTENT
@@ -6388,9 +6245,13 @@ async function createRuntimeFiles() {
6388
6245
  const content = fs4.readFileSync(templatePath, "utf-8");
6389
6246
  fs4.writeFileSync(testPlanTemplatePath, content, "utf-8");
6390
6247
  }
6391
- const bestPracticesPath = path6.join(cwd, ".bugzy/runtime/testing-best-practices.md");
6248
+ const testsDocsDir = path6.join(cwd, "tests/docs");
6249
+ if (!fs4.existsSync(testsDocsDir)) {
6250
+ fs4.mkdirSync(testsDocsDir, { recursive: true });
6251
+ }
6252
+ const bestPracticesPath = path6.join(cwd, "tests/docs/testing-best-practices.md");
6392
6253
  if (!fs4.existsSync(bestPracticesPath)) {
6393
- const templatePath = path6.join(templatesDir, ".bugzy/runtime/testing-best-practices.md");
6254
+ const templatePath = path6.join(templatesDir, "tests/docs/testing-best-practices.md");
6394
6255
  const content = fs4.readFileSync(templatePath, "utf-8");
6395
6256
  fs4.writeFileSync(bestPracticesPath, content, "utf-8");
6396
6257
  }
@@ -6426,14 +6287,22 @@ async function createRuntimeFiles() {
6426
6287
  fs4.writeFileSync(subagentMemoryPath, content, "utf-8");
6427
6288
  }
6428
6289
  }
6429
- const testExecutionStrategyPath = path6.join(cwd, ".bugzy/runtime/test-execution-strategy.md");
6290
+ const testExecutionStrategyPath = path6.join(cwd, "tests/docs/test-execution-strategy.md");
6430
6291
  if (!fs4.existsSync(testExecutionStrategyPath)) {
6431
- const templatePath = path6.join(templatesDir, ".bugzy/runtime/test-execution-strategy.md");
6292
+ const templatePath = path6.join(templatesDir, "tests/docs/test-execution-strategy.md");
6432
6293
  if (fs4.existsSync(templatePath)) {
6433
6294
  const content = fs4.readFileSync(templatePath, "utf-8");
6434
6295
  fs4.writeFileSync(testExecutionStrategyPath, content, "utf-8");
6435
6296
  }
6436
6297
  }
6298
+ const testsClaudeMdPath = path6.join(cwd, "tests/CLAUDE.md");
6299
+ if (!fs4.existsSync(testsClaudeMdPath)) {
6300
+ const templatePath = path6.join(templatesDir, "tests/CLAUDE.md");
6301
+ if (fs4.existsSync(templatePath)) {
6302
+ const content = fs4.readFileSync(templatePath, "utf-8");
6303
+ fs4.writeFileSync(testsClaudeMdPath, content, "utf-8");
6304
+ }
6305
+ }
6437
6306
  const envTestdataPath = path6.join(cwd, ".env.testdata");
6438
6307
  if (!fs4.existsSync(envTestdataPath)) {
6439
6308
  const templatePath = path6.join(templatesDir, ".env.testdata");
@@ -6533,7 +6402,7 @@ var readTestStrategyStep = {
6533
6402
  category: "setup",
6534
6403
  content: `## Read Test Execution Strategy
6535
6404
 
6536
- **IMPORTANT**: Before selecting tests, read \`.bugzy/runtime/test-execution-strategy.md\` to understand:
6405
+ **IMPORTANT**: Before selecting tests, read \`./tests/docs/test-execution-strategy.md\` to understand:
6537
6406
  - Available test tiers (Smoke, Component, Full Regression)
6538
6407
  - When to use each tier (commit, PR, release, debug)
6539
6408
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6543,7 +6412,7 @@ var readTestStrategyStep = {
6543
6412
 
6544
6413
  Apply the strategy guidance when determining which tests to run.
6545
6414
 
6546
- **First**, consult \`.bugzy/runtime/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6415
+ **First**, consult \`./tests/docs/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6547
6416
  tags: ["setup", "test-execution", "strategy"]
6548
6417
  };
6549
6418
 
@@ -6567,7 +6436,7 @@ Check for existing project context to inform your work:
6567
6436
  - Environment details
6568
6437
 
6569
6438
  **2. Check Test Execution Strategy**
6570
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6439
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6571
6440
  - Understand available test tiers and when to use them
6572
6441
  - Note default behaviors and time/coverage trade-offs
6573
6442
 
@@ -7164,35 +7033,23 @@ When reporting test results, always include an "Ambiguities" section if clarific
7164
7033
  tags: ["clarification", "protocol", "ambiguity"]
7165
7034
  };
7166
7035
 
7167
- // src/tasks/steps/execution/run-playwright-tests.ts
7036
+ // src/tasks/steps/execution/run-tests.ts
7168
7037
  init_esm_shims();
7169
- var runPlaywrightTestsStep = {
7170
- id: "run-playwright-tests",
7171
- title: "Execute Playwright Tests",
7038
+ var runTestsStep = {
7039
+ id: "run-tests",
7040
+ title: "Execute Automated Tests",
7172
7041
  category: "execution",
7173
- content: `## Execute Playwright Tests
7174
-
7175
- Run automated Playwright tests and capture results.
7042
+ content: `## Execute Automated Tests
7176
7043
 
7177
- **Build Playwright Command** based on selector:
7044
+ Run automated tests and capture results.
7178
7045
 
7179
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
7180
- Use npm scripts to run tests - no manual env export needed.
7046
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
7181
7047
 
7182
- **For file pattern or specific file**:
7183
- \`\`\`bash
7184
- npm test -- [selector]
7185
- \`\`\`
7048
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
7186
7049
 
7187
- **For tag**:
7188
- \`\`\`bash
7189
- npm test -- --grep "[tag]"
7190
- \`\`\`
7191
-
7192
- **For all tests**:
7193
- \`\`\`bash
7194
- npm test
7195
- \`\`\`
7050
+ - **For file pattern or specific file**: Use the framework's file selection command
7051
+ - **For tag**: Use the framework's tag/grep filtering command
7052
+ - **For all tests**: Use the default run-all command
7196
7053
 
7197
7054
  Wait for execution to complete. This may take several minutes depending on test count.
7198
7055
 
@@ -7210,7 +7067,7 @@ Wait for execution to complete. This may take several minutes depending on test
7210
7067
  \`\`\`
7211
7068
 
7212
7069
  2. Store the timestamp for use in subsequent steps`,
7213
- invokesSubagents: ["test-runner"],
7070
+ invokesSubagents: ["browser-automation"],
7214
7071
  tags: ["execution", "tests"]
7215
7072
  };
7216
7073
 
@@ -7311,10 +7168,10 @@ For each failed test:
7311
7168
  | Classification | Indicators | Examples |
7312
7169
  |---------------|------------|----------|
7313
7170
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
7314
- | **Test Issue** | Test code needs fixing | Selector not found but element exists, \`expect(locator).toBeVisible()\` timeout on existing element, Race condition, Wrong assertion |
7171
+ | **Test Issue** | Test code needs fixing | Selector not found but element exists, Timeout on existing element, Race condition, Wrong assertion |
7315
7172
 
7316
- **Common Test Issues:**
7317
- - Brittle selectors (CSS path instead of data-testid or role)
7173
+ **Common Test Issues** (refer to \`./tests/CLAUDE.md\` "Common Fix Patterns" for framework-specific guidance):
7174
+ - Brittle selectors (not following selector priority from CLAUDE.md)
7318
7175
  - Missing waits for async operations
7319
7176
  - Race conditions with animations
7320
7177
  - Incorrect expected values
@@ -7362,7 +7219,7 @@ The agent will:
7362
7219
  1. Read the execution details from result.json
7363
7220
  2. Analyze the failure (error message, trace if available)
7364
7221
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
7365
- 4. Apply appropriate fix to the test code
7222
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
7366
7223
  5. Rerun the test
7367
7224
  6. The custom reporter will automatically create the next exec-N/ folder
7368
7225
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -7374,7 +7231,7 @@ The agent will:
7374
7231
 
7375
7232
  **Track Fixed Tests:**
7376
7233
  - Maintain list of tests fixed automatically
7377
- - Include fix description (e.g., "Updated selector from CSS to role-based")
7234
+ - Include fix description (e.g., "Applied selector fix pattern from CLAUDE.md")
7378
7235
  - Note verification status (test now passes)`,
7379
7236
  invokesSubagents: ["test-debugger-fixer"],
7380
7237
  tags: ["execution", "fixing", "automation"]
@@ -7418,7 +7275,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7418
7275
  - Trace file: [path if available]
7419
7276
  - Screenshots: [paths if available]
7420
7277
  - **Environment Details**:
7421
- - Browser and version (from Playwright config)
7278
+ - Browser and version (from test framework config)
7422
7279
  - Test environment URL (from .env.testdata BASE_URL)
7423
7280
  - Timestamp of failure
7424
7281
  - **Severity/Priority**: Based on:
@@ -7458,7 +7315,7 @@ var createExplorationTestCaseStep = {
7458
7315
  category: "execution",
7459
7316
  content: `## Create Exploration Test Case
7460
7317
 
7461
- Generate a temporary exploration test case for the test-runner.
7318
+ Generate a temporary exploration test case for the browser-automation agent.
7462
7319
 
7463
7320
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7464
7321
 
@@ -7498,7 +7355,7 @@ var runExplorationStep = {
7498
7355
  category: "execution",
7499
7356
  content: `## Run Exploration
7500
7357
 
7501
- {{INVOKE_TEST_RUNNER}}
7358
+ {{INVOKE_BROWSER_AUTOMATION}}
7502
7359
 
7503
7360
  Execute the exploration test case with the following focus:
7504
7361
 
@@ -7523,7 +7380,7 @@ Generate comprehensive findings report.
7523
7380
  - \`test-log.md\` - Detailed execution log
7524
7381
  - \`screenshots/\` - Visual documentation
7525
7382
  - \`summary.json\` - Execution summary`,
7526
- invokesSubagents: ["test-runner"],
7383
+ invokesSubagents: ["browser-automation"],
7527
7384
  tags: ["execution", "exploration"]
7528
7385
  };
7529
7386
 
@@ -7535,7 +7392,7 @@ var processExplorationResultsStep = {
7535
7392
  category: "execution",
7536
7393
  content: `## Process Exploration Results
7537
7394
 
7538
- Read and parse the test-runner output from exploration.
7395
+ Read and parse the browser-automation agent output from exploration.
7539
7396
 
7540
7397
  **Locate results:**
7541
7398
  \`\`\`bash
@@ -7675,23 +7532,22 @@ For each test case marked \`automated: true\`:
7675
7532
  - Exploration findings: ./exploration-reports/
7676
7533
 
7677
7534
  **The agent should:**
7678
- 1. Read manual test case files
7679
- 2. Explore the feature to gather selectors
7680
- 3. Create Page Objects and automated tests
7681
- 4. Run each test and iterate until passing (max 3 attempts)
7682
- 5. Update manual test case with automated_test reference
7683
- 6. Document any product bugs discovered
7535
+ 1. Read \`./tests/CLAUDE.md\` for framework conventions, directory structure, and commands
7536
+ 2. Read manual test case files
7537
+ 3. Explore the feature to gather selectors
7538
+ 4. Create page objects and automated tests following conventions from CLAUDE.md
7539
+ 5. Run each test using the command from CLAUDE.md and iterate until passing (max 3 attempts)
7540
+ 6. Update manual test case with automated_test reference
7541
+ 7. Document any product bugs discovered
7684
7542
 
7685
7543
  **For each test:**
7686
- - Run: \`npx playwright test [test-file]\`
7544
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7687
7545
  - If fails, classify as product bug or test issue
7688
- - If test issue: Apply fix patterns and retry
7546
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7689
7547
  - If product bug: Document and mark test as blocked
7690
7548
  - Continue until test passes or is blocked"
7691
7549
 
7692
- **Output Location:**
7693
- - Page Objects: \`./tests/pages/\`
7694
- - Test specs: \`./tests/specs/\`
7550
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7695
7551
 
7696
7552
  **Update Manual Test Cases:**
7697
7553
  After automation, update the manual test case frontmatter:
@@ -7954,30 +7810,29 @@ After test generation completes, verify all artifacts meet quality standards:
7954
7810
  - Contains human-readable steps and expected results
7955
7811
  - References environment variables for test data
7956
7812
 
7957
- **2. Automated Tests (in \`./tests/specs/\`):**
7813
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7958
7814
  - Organized by feature in subdirectories
7959
7815
  - Each test file references manual test case ID in comments
7960
- - Uses Page Object Model pattern
7961
- - Follows role-based selector priority
7816
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7817
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7962
7818
  - Uses environment variables for test data
7963
7819
  - Includes proper TypeScript typing
7964
7820
 
7965
- **3. Page Objects (in \`./tests/pages/\`):**
7966
- - Extend BasePage class
7967
- - Use semantic selectors (getByRole, getByLabel, getByText)
7821
+ **3. Page Objects** (in directory specified by \`./tests/CLAUDE.md\`):
7822
+ - Follow page object conventions from \`./tests/CLAUDE.md\`
7968
7823
  - Contain only actions, no assertions
7969
7824
  - Properly typed with TypeScript
7970
7825
 
7971
- **4. Supporting Files:**
7972
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7973
- - Helper functions for data generation (in \`./tests/helpers/\`)
7974
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7975
- - Types defined as needed (in \`./tests/types/\`)
7826
+ **4. Supporting Files** (in directories specified by \`./tests/CLAUDE.md\`):
7827
+ - Fixtures created for common setup
7828
+ - Helper functions for data generation
7829
+ - Component objects for reusable UI elements
7830
+ - Types defined as needed
7976
7831
 
7977
7832
  **Validation Checklist:**
7978
7833
  - [ ] All manual test cases have proper frontmatter
7979
7834
  - [ ] Automated tests reference their manual test case IDs
7980
- - [ ] Page Objects follow the BasePage pattern
7835
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7981
7836
  - [ ] No hardcoded test data (uses environment variables)
7982
7837
  - [ ] Tests are syntactically valid TypeScript`,
7983
7838
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -7997,7 +7852,7 @@ var STEP_LIBRARY = {
7997
7852
  // Clarification
7998
7853
  "clarification-protocol": clarificationProtocolStep,
7999
7854
  // Execution
8000
- "run-playwright-tests": runPlaywrightTestsStep,
7855
+ "run-tests": runTestsStep,
8001
7856
  "parse-test-results": parseTestResultsStep,
8002
7857
  "triage-failures": triageFailuresStep,
8003
7858
  "fix-test-issues": fixTestIssuesStep,
@@ -8122,9 +7977,9 @@ function buildComposedTaskDefinition(taskSlug, projectSubAgents) {
8122
7977
  init_esm_shims();
8123
7978
  var TOOL_STRINGS = {
8124
7979
  "claude-code": {
8125
- 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.',
7980
+ 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.',
8126
7981
  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.',
8127
- 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.',
7982
+ 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.',
8128
7983
  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.',
8129
7984
  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.",
8130
7985
  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.',
@@ -8132,7 +7987,7 @@ var TOOL_STRINGS = {
8132
7987
  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.'
8133
7988
  },
8134
7989
  "cursor": {
8135
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-runner.md)" --output-format text\n```',
7990
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/browser-automation.md)" --output-format text\n```',
8136
7991
  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```',
8137
7992
  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```',
8138
7993
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -8142,7 +7997,7 @@ var TOOL_STRINGS = {
8142
7997
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
8143
7998
  },
8144
7999
  "codex": {
8145
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncodex -p "$(cat .codex/agents/test-runner.md)"\n```',
8000
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncodex -p "$(cat .codex/agents/browser-automation.md)"\n```',
8146
8001
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
8147
8002
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
8148
8003
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -8166,7 +8021,7 @@ function getToolString(toolId, key) {
8166
8021
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
8167
8022
  let result = content;
8168
8023
  const keys = [
8169
- "INVOKE_TEST_RUNNER",
8024
+ "INVOKE_BROWSER_AUTOMATION",
8170
8025
  "INVOKE_TEST_DEBUGGER_FIXER",
8171
8026
  "INVOKE_TEST_CODE_GENERATOR",
8172
8027
  "INVOKE_TEAM_COMMUNICATOR",
@@ -9077,7 +8932,7 @@ async function firstTimeSetup(cliSubagents) {
9077
8932
  spinner = ora2("Updating .gitignore").start();
9078
8933
  await updateGitignore();
9079
8934
  spinner.succeed(chalk2.green("Updated .gitignore"));
9080
- if (subagents["test-runner"] && !isPlaywrightScaffolded(process.cwd())) {
8935
+ if (subagents["browser-automation"] && !isPlaywrightScaffolded(process.cwd())) {
9081
8936
  await scaffoldPlaywrightProject({
9082
8937
  projectName,
9083
8938
  targetDir: process.cwd(),
@@ -9093,7 +8948,7 @@ async function firstTimeSetup(cliSubagents) {
9093
8948
  console.log(chalk2.gray(" \u2022 Testing conventions\n"));
9094
8949
  console.log(chalk2.yellow("Next steps:"));
9095
8950
  console.log(chalk2.white("1. Edit .env and add your API tokens"));
9096
- if (subagents["test-runner"]) {
8951
+ if (subagents["browser-automation"]) {
9097
8952
  console.log(chalk2.white("2. npx playwright install (install browser binaries)"));
9098
8953
  console.log(chalk2.white("3. Edit .bugzy/runtime/project-context.md"));
9099
8954
  console.log(chalk2.white("4. Run:"), chalk2.cyan("bugzy"), chalk2.gray("(loads .env, then launches claude/codex/cursor)"));