@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.
@@ -104,9 +104,9 @@ var init_generate_test_cases = __esm({
104
104
  generateTestCasesTask = {
105
105
  slug: TASK_SLUGS.GENERATE_TEST_CASES,
106
106
  name: "Generate Test Cases",
107
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
107
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
108
108
  frontmatter: {
109
- description: "Generate manual test case documentation AND automated Playwright test scripts from test plan",
109
+ description: "Generate manual test case documentation AND automated test scripts from test plan",
110
110
  "argument-hint": "--type [exploratory|functional|regression|smoke] --focus [optional-feature]"
111
111
  },
112
112
  steps: [
@@ -114,12 +114,12 @@ var init_generate_test_cases = __esm({
114
114
  {
115
115
  inline: true,
116
116
  title: "Generate Test Cases Overview",
117
- content: `Generate comprehensive test artifacts including BOTH manual test case documentation AND automated Playwright test scripts.
117
+ 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.
118
118
 
119
119
  This command generates:
120
120
  1. **Manual Test Case Documentation** (in \`./test-cases/\`) - Human-readable test cases in markdown format
121
- 2. **Automated Playwright Tests** (in \`./tests/specs/\`) - Executable TypeScript test scripts
122
- 3. **Page Object Models** (in \`./tests/pages/\`) - Reusable page classes for automated tests
121
+ 2. **Automated Test Scripts** (in directory from \`./tests/CLAUDE.md\`) - Executable test scripts
122
+ 3. **Page Objects** (in directory from \`./tests/CLAUDE.md\`) - Reusable page classes for automated tests
123
123
  4. **Supporting Files** (fixtures, helpers, components) - As needed for test automation`
124
124
  },
125
125
  // Step 2: Security Notice (library)
@@ -154,9 +154,9 @@ Read the test plan from \`test-plan.md\` to understand:
154
154
 
155
155
  **1.2 Check Existing Test Cases and Tests**
156
156
  - List all files in \`./test-cases/\` to understand existing manual test coverage
157
- - List all files in \`./tests/specs/\` to understand existing automated tests
157
+ - List existing automated tests in the test directory (see \`./tests/CLAUDE.md\` for structure)
158
158
  - Determine next test case ID (TC-XXX format)
159
- - Identify existing Page Objects in \`./tests/pages/\`
159
+ - Identify existing page objects (see \`./tests/CLAUDE.md\` for directory)
160
160
  - Avoid creating overlapping test cases or duplicate automation`
161
161
  },
162
162
  // Step 6: Documentation Researcher (conditional library step)
@@ -265,8 +265,8 @@ Before invoking the agent, identify the test cases for the current area:
265
265
  - Test type: {type}
266
266
  - Test plan: test-plan.md
267
267
  - Manual test cases directory: ./test-cases/
268
- - Existing automated tests: ./tests/specs/
269
- - Existing Page Objects: ./tests/pages/
268
+ - Existing automated tests: [directory from ./tests/CLAUDE.md]
269
+ - Existing page objects: [directory from ./tests/CLAUDE.md]
270
270
 
271
271
  **Knowledge Base Patterns (MUST APPLY):**
272
272
  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.
@@ -277,7 +277,7 @@ Include ALL relevant testing patterns from the knowledge base that apply to this
277
277
  3. Explore the feature area to understand implementation (gather selectors, URLs, flows)
278
278
  4. Build missing Page Objects and supporting code
279
279
  5. For each test case marked \`automated: true\`:
280
- - Create automated Playwright test in ./tests/specs/
280
+ - Create automated test in the test directory (from ./tests/CLAUDE.md)
281
281
  - Update the manual test case file to reference the automated test path
282
282
  - Apply ALL knowledge base patterns listed above (timing, selectors, assertions)
283
283
  6. Run and iterate on each test until it passes or fails with a product bug
@@ -308,15 +308,7 @@ Move to the next area and repeat until all areas are complete.
308
308
  {
309
309
  inline: true,
310
310
  title: "Create Directories if Needed",
311
- content: `Ensure required directories exist:
312
- \`\`\`bash
313
- mkdir -p ./test-cases
314
- mkdir -p ./tests/specs
315
- mkdir -p ./tests/pages
316
- mkdir -p ./tests/components
317
- mkdir -p ./tests/fixtures
318
- mkdir -p ./tests/helpers
319
- \`\`\``
311
+ 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).`
320
312
  },
321
313
  // Step 14: Extract Env Variables (library)
322
314
  "extract-env-variables",
@@ -336,7 +328,7 @@ mkdir -p ./tests/helpers
336
328
  - Features covered by automation
337
329
  - Areas kept manual-only (and why)
338
330
  3. Highlight key automated test scenarios
339
- 4. Share command to run automated tests: npx playwright test
331
+ 4. Share command to run automated tests (from \`./tests/CLAUDE.md\`)
340
332
  5. Ask for team review and validation
341
333
  6. Mention any areas needing exploration or clarification
342
334
  7. Use appropriate channel and threading for the update
@@ -381,8 +373,8 @@ The team communication should include:
381
373
  - Areas kept manual-only (and why)
382
374
 
383
375
  **Next Steps:**
384
- - Command to run automated tests: \`npx playwright test\`
385
- - Instructions to run specific test file
376
+ - Command to run automated tests (from \`./tests/CLAUDE.md\`)
377
+ - Instructions to run specific test file (from \`./tests/CLAUDE.md\`)
386
378
  - Note about copying .env.testdata to .env
387
379
  - Mention any exploration needed for edge cases
388
380
 
@@ -398,7 +390,7 @@ The team communication should include:
398
390
  - **Test Independence**: Each test must be runnable in isolation and in parallel`
399
391
  }
400
392
  ],
401
- requiredSubagents: ["test-runner", "test-code-generator"],
393
+ requiredSubagents: ["browser-automation", "test-code-generator"],
402
394
  optionalSubagents: ["documentation-researcher", "team-communicator"],
403
395
  dependentTasks: []
404
396
  };
@@ -605,7 +597,7 @@ The team communication should include:
605
597
  - Instructions for the user to fill in actual values in .env.testdata before running tests`
606
598
  }
607
599
  ],
608
- requiredSubagents: ["test-runner"],
600
+ requiredSubagents: ["browser-automation"],
609
601
  optionalSubagents: ["documentation-researcher", "team-communicator"],
610
602
  dependentTasks: []
611
603
  };
@@ -697,7 +689,28 @@ The handler file contains all necessary processing logic for the detected intent
697
689
  - Response guidelines
698
690
  - Memory update instructions`
699
691
  },
700
- // Step 6: Clarification Protocol (for ambiguous intents)
692
+ // Step 6: Post Response via Team Communicator
693
+ {
694
+ inline: true,
695
+ title: "Post Response to Team",
696
+ content: `## Post Response to the Team
697
+
698
+ After processing the message through the handler and composing your response:
699
+
700
+ {{INVOKE_TEAM_COMMUNICATOR}} to post the response back to the team.
701
+
702
+ **Context to include in the delegation:**
703
+ - The original message/question from the team member
704
+ - Your composed response with all gathered data
705
+ - Whether this should be a thread reply (if the original message was in a thread) or a new message
706
+ - The relevant channel (from project-context.md)
707
+
708
+ **Do NOT:**
709
+ - Skip posting and just display the response as text output
710
+ - Ask the user whether to post \u2014 the message came from the team, the response goes back to the team
711
+ - Compose a draft without sending it`
712
+ },
713
+ // Step 7: Clarification Protocol (for ambiguous intents)
701
714
  "clarification-protocol",
702
715
  // Step 8: Knowledge Base Update (library)
703
716
  "update-knowledge-base",
@@ -1122,7 +1135,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1122
1135
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1123
1136
  - Wait for team response (messaging infrastructure handles that)
1124
1137
  - Create or modify test files
1125
- - Run Playwright tests
1138
+ - Run automated tests
1126
1139
 
1127
1140
  #### 5.6 Update Event Processor Memory
1128
1141
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1237,10 +1250,10 @@ var init_run_tests = __esm({
1237
1250
  runTestsTask = {
1238
1251
  slug: TASK_SLUGS.RUN_TESTS,
1239
1252
  name: "Run Tests",
1240
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1253
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1241
1254
  frontmatter: {
1242
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1243
- "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", "tests/specs/login.spec.ts")'
1255
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1256
+ "argument-hint": '[file-pattern|tag|all] (e.g., "auth", "@smoke", or a specific test file path)'
1244
1257
  },
1245
1258
  steps: [
1246
1259
  // Step 1: Overview (inline)
@@ -1249,7 +1262,7 @@ var init_run_tests = __esm({
1249
1262
  title: "Run Tests Overview",
1250
1263
  content: `# Run Tests Command
1251
1264
 
1252
- Execute automated Playwright tests, analyze failures using JSON reports, automatically fix test issues, and log product bugs.`
1265
+ 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.`
1253
1266
  },
1254
1267
  // Step 2: Security Notice (library)
1255
1268
  "security-notice",
@@ -1262,9 +1275,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1262
1275
  **Parse Arguments:**
1263
1276
  Extract the following from arguments:
1264
1277
  - **selector**: Test selection criteria
1265
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1266
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1267
- - Specific file: "tests/specs/login.spec.ts"
1278
+ - File pattern: "auth" \u2192 find matching test files (see \`./tests/CLAUDE.md\` for directory structure)
1279
+ - Tag: "@smoke" \u2192 runs tests with tag annotation
1280
+ - Specific file: path to a specific test file
1268
1281
  - All tests: "all" or "" \u2192 runs entire test suite`
1269
1282
  },
1270
1283
  // Step 4: Load Project Context (library)
@@ -1280,34 +1293,26 @@ Extract the following from arguments:
1280
1293
  inline: true,
1281
1294
  title: "Identify Automated Tests to Run",
1282
1295
  content: `#### Understand Test Selection
1296
+
1297
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1298
+
1283
1299
  Parse the selector argument to determine which tests to run:
1284
1300
 
1285
1301
  **File Pattern** (e.g., "auth", "login"):
1286
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1302
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1287
1303
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1288
1304
 
1289
1305
  **Tag** (e.g., "@smoke", "@regression"):
1290
- - Run tests with specific Playwright tag annotation
1291
- - Use Playwright's \`--grep\` option
1306
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1292
1307
 
1293
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1294
- - Run that specific test file
1308
+ **Specific File**:
1309
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1295
1310
 
1296
1311
  **All Tests** ("all" or no selector):
1297
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1312
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1298
1313
 
1299
1314
  #### Find Matching Test Files
1300
- Use glob patterns to find test files:
1301
- \`\`\`bash
1302
- # For file pattern
1303
- ls tests/specs/**/*[pattern]*.spec.ts
1304
-
1305
- # For specific file
1306
- ls tests/specs/auth/login.spec.ts
1307
-
1308
- # For all tests
1309
- ls tests/specs/**/*.spec.ts
1310
- \`\`\`
1315
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1311
1316
 
1312
1317
  #### Validate Test Files Exist
1313
1318
  Check that at least one test file was found:
@@ -1321,7 +1326,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1321
1326
  - **No selector** (all tests): Confirm running full suite before executing`
1322
1327
  },
1323
1328
  // Step 7-10: Test Execution (library steps)
1324
- "run-playwright-tests",
1329
+ "run-tests",
1325
1330
  "parse-test-results",
1326
1331
  "triage-failures",
1327
1332
  "fix-test-issues",
@@ -1347,8 +1352,8 @@ If no test cases match the selection criteria:
1347
1352
  2. List available test cases or suggest running \`/generate-test-cases\` first
1348
1353
  3. Provide examples of valid selection criteria
1349
1354
 
1350
- #### If Test Runner Agent Fails
1351
- If the test-runner agent encounters issues:
1355
+ #### If Browser Automation Agent Fails
1356
+ If the browser-automation agent encounters issues:
1352
1357
  1. Report the specific error
1353
1358
  2. Suggest troubleshooting steps
1354
1359
  3. Offer to run tests individually if batch execution failed
@@ -1362,18 +1367,18 @@ If selected test cases have formatting issues:
1362
1367
  ### Important Notes
1363
1368
 
1364
1369
  **Test Selection Strategy**:
1365
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1370
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1366
1371
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1367
1372
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1368
1373
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1369
1374
  - Use context keywords from user request to choose appropriate tier
1370
1375
 
1371
1376
  **Test Execution**:
1372
- - Automated Playwright tests are executed via bash command, not through agents
1377
+ - Automated tests are executed via bash command, not through agents
1373
1378
  - Test execution time varies by tier (see strategy document for details)
1374
1379
  - JSON reports provide structured test results for analysis
1375
- - Playwright automatically captures traces, screenshots, and videos on failures
1376
- - Test artifacts are stored in test-results/ directory
1380
+ - Test framework may capture traces, screenshots, and videos on failures (see \`./tests/CLAUDE.md\`)
1381
+ - Test artifacts are stored as defined in \`./tests/CLAUDE.md\`
1377
1382
 
1378
1383
  **Failure Handling**:
1379
1384
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1383,11 +1388,11 @@ If selected test cases have formatting issues:
1383
1388
  - Critical failures trigger immediate team notification
1384
1389
 
1385
1390
  **Related Documentation**:
1386
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1387
- - \`.bugzy/runtime/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1391
+ - \`./tests/docs/test-execution-strategy.md\` - When and why to run specific tests
1392
+ - \`./tests/docs/testing-best-practices.md\` - How to write tests (patterns and anti-patterns)`
1388
1393
  }
1389
1394
  ],
1390
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1395
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1391
1396
  optionalSubagents: ["issue-tracker", "team-communicator"],
1392
1397
  dependentTasks: []
1393
1398
  };
@@ -1419,7 +1424,7 @@ var init_verify_changes = __esm({
1419
1424
  ## Overview
1420
1425
 
1421
1426
  This task performs comprehensive change verification with:
1422
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1427
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1423
1428
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1424
1429
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1425
1430
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1650,11 +1655,11 @@ Analyze the change description to identify affected feature areas:
1650
1655
 
1651
1656
  | Description Keywords | Inferred Test Scope | Example |
1652
1657
  |---------------------|-------------------|---------|
1653
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1654
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1655
- | "cart", "shopping cart", "add to cart" | \`tests/specs/cart/\` | "Update cart calculations" -> Cart tests |
1658
+ | "login", "authentication", "sign in/up" | Auth test suite | "Fix login page validation" -> Auth tests |
1659
+ | "checkout", "payment", "purchase" | Checkout test suite | "Optimize checkout flow" -> Checkout tests |
1660
+ | "cart", "shopping cart", "add to cart" | Cart test suite | "Update cart calculations" -> Cart tests |
1656
1661
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1657
- | "profile", "account", "settings" | \`tests/specs/profile/\` or \`tests/specs/settings/\` | "Profile page redesign" -> Profile tests |
1662
+ | "profile", "account", "settings" | Profile/settings test suite | "Profile page redesign" -> Profile tests |
1658
1663
 
1659
1664
  **Inference strategy:**
1660
1665
  1. **Extract feature keywords** from PR title and description
@@ -1729,13 +1734,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1729
1734
 
1730
1735
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1731
1736
 
1732
- ### Generate Playwright Specs
1737
+ ### Generate Automated Test Specs
1733
1738
 
1734
1739
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1735
1740
  - Read the manual test cases you just created
1736
1741
  - Explore the feature in the browser to discover selectors and flows
1737
- - Create Page Objects in \`./tests/pages/\` if needed
1738
- - Create test specs in \`./tests/specs/\` matching the test cases
1742
+ - Create page objects in the directory specified by \`./tests/CLAUDE.md\`
1743
+ - Create test specs in the directory specified by \`./tests/CLAUDE.md\`
1739
1744
  - Run each new test to verify it passes
1740
1745
  - Update the manual test case with \`automated_test\` reference
1741
1746
 
@@ -1745,7 +1750,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1745
1750
  conditionalOnSubagent: "test-code-generator"
1746
1751
  },
1747
1752
  // Step 8-11: Test Execution (library steps)
1748
- "run-playwright-tests",
1753
+ "run-tests",
1749
1754
  "parse-test-results",
1750
1755
  "triage-failures",
1751
1756
  "fix-test-issues",
@@ -1934,7 +1939,7 @@ Post PR comment if GitHub context available.`,
1934
1939
  - Recommend: Check test configuration and prerequisites
1935
1940
 
1936
1941
  **If test execution fails:**
1937
- - Report specific error (Playwright not installed, env vars missing)
1942
+ - Report specific error (test framework not installed, env vars missing)
1938
1943
  - Suggest troubleshooting steps
1939
1944
  - Don't proceed with triage if tests didn't run
1940
1945
 
@@ -1964,7 +1969,7 @@ A successful verification includes:
1964
1969
  10. Clear recommendation provided (merge / review / block)`
1965
1970
  }
1966
1971
  ],
1967
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1972
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1968
1973
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
1969
1974
  dependentTasks: []
1970
1975
  };
@@ -2021,7 +2026,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2021
2026
  },
2022
2027
  // Phase 2: Exploration Protocol
2023
2028
  "exploration-protocol",
2024
- // Execute exploration via test-runner
2029
+ // Execute exploration via browser-automation
2025
2030
  "create-exploration-test-case",
2026
2031
  "run-exploration",
2027
2032
  "process-exploration-results",
@@ -2032,7 +2037,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2032
2037
  "generate-test-cases",
2033
2038
  "automate-test-cases",
2034
2039
  // Phase 5: Test Execution
2035
- "run-playwright-tests",
2040
+ "run-tests",
2036
2041
  "parse-test-results",
2037
2042
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2038
2043
  "triage-failures",
@@ -2049,7 +2054,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2049
2054
  },
2050
2055
  "generate-final-report"
2051
2056
  ],
2052
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2057
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2053
2058
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2054
2059
  dependentTasks: ["run-tests", "generate-test-cases"]
2055
2060
  };
@@ -2076,7 +2081,7 @@ var init_explore_application = __esm({
2076
2081
  {
2077
2082
  inline: true,
2078
2083
  title: "Explore Application Overview",
2079
- content: `Discover actual UI elements, workflows, and behaviors using the test-runner agent. Updates test plan and project documentation with findings.`
2084
+ content: `Discover actual UI elements, workflows, and behaviors using the browser-automation agent. Updates test plan and project documentation with findings.`
2080
2085
  },
2081
2086
  // Step 2: Security Notice (from library)
2082
2087
  "security-notice",
@@ -2123,7 +2128,7 @@ var init_explore_application = __esm({
2123
2128
  "cleanup-temp-files",
2124
2129
  "update-knowledge-base"
2125
2130
  ],
2126
- requiredSubagents: ["test-runner"],
2131
+ requiredSubagents: ["browser-automation"],
2127
2132
  optionalSubagents: ["team-communicator"],
2128
2133
  dependentTasks: []
2129
2134
  };
@@ -2494,9 +2499,9 @@ var INTEGRATIONS = {
2494
2499
  }
2495
2500
  };
2496
2501
  var SUBAGENTS = {
2497
- "test-runner": {
2498
- role: "test-runner",
2499
- name: "Test Runner",
2502
+ "browser-automation": {
2503
+ role: "browser-automation",
2504
+ name: "Browser Automation",
2500
2505
  description: "Execute automated browser tests (always included)",
2501
2506
  icon: "play",
2502
2507
  integrations: [INTEGRATIONS.playwright],
@@ -2553,7 +2558,7 @@ var SUBAGENTS = {
2553
2558
  "test-code-generator": {
2554
2559
  role: "test-code-generator",
2555
2560
  name: "Test Code Generator",
2556
- description: "Generate automated Playwright test scripts and Page Objects",
2561
+ description: "Generate automated test scripts and page objects",
2557
2562
  icon: "code",
2558
2563
  integrations: [INTEGRATIONS.playwright],
2559
2564
  model: "sonnet",
@@ -2768,7 +2773,7 @@ init_cjs_shims();
2768
2773
  // src/subagents/templates/index.ts
2769
2774
  init_cjs_shims();
2770
2775
 
2771
- // src/subagents/templates/test-runner/playwright.ts
2776
+ // src/subagents/templates/browser-automation/playwright.ts
2772
2777
  init_cjs_shims();
2773
2778
 
2774
2779
  // src/subagents/templates/memory-template.ts
@@ -2815,16 +2820,16 @@ After completing your work, update your memory file with relevant insights.
2815
2820
  **Remember:** Every entry should answer "How does this change what I do?"
2816
2821
  `;
2817
2822
 
2818
- // src/subagents/templates/test-runner/playwright.ts
2823
+ // src/subagents/templates/browser-automation/playwright.ts
2819
2824
  var FRONTMATTER = {
2820
- name: "test-runner",
2821
- 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.
2825
+ name: "browser-automation",
2826
+ 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.
2822
2827
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2823
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2824
- <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.
2828
+ assistant: "I'll use the browser-automation agent to execute this test case and capture all the results with video evidence."
2829
+ <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.
2825
2830
  user: "Execute the smoke test for the checkout flow"
2826
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2827
- <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>`,
2831
+ assistant: "Let me use the browser-automation agent to execute the checkout smoke test and record all findings with video."
2832
+ <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>`,
2828
2833
  model: "sonnet",
2829
2834
  color: "green"
2830
2835
  };
@@ -2837,9 +2842,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2837
2842
  - Structure of \`steps.json\` with timestamps and video synchronization
2838
2843
  - Field descriptions and data types
2839
2844
 
2840
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2845
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2841
2846
 
2842
- **Memory Sections for Test Runner**:
2847
+ **Memory Sections for Browser Automation**:
2843
2848
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2844
2849
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2845
2850
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2905,7 +2910,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2905
2910
  **Execution Workflow:**
2906
2911
 
2907
2912
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2908
- - Read \`.bugzy/runtime/memory/test-runner.md\` to access your working knowledge
2913
+ - Read \`.bugzy/runtime/memory/browser-automation.md\` to access your working knowledge
2909
2914
  - Check if this test is known to be flaky (apply extra waits if so)
2910
2915
  - Review timing requirements for pages this test will visit
2911
2916
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2957,9 +2962,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2957
2962
  - Video filename reference (just basename, not full path)
2958
2963
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2959
2964
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2960
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2965
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2961
2966
 
2962
- Specifically for test-runner, consider updating:
2967
+ Specifically for browser-automation, consider updating:
2963
2968
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2964
2969
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2965
2970
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -3033,49 +3038,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
3033
3038
  init_cjs_shims();
3034
3039
  var FRONTMATTER2 = {
3035
3040
  name: "test-code-generator",
3036
- 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.
3041
+ 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.
3037
3042
  user: "Generate test cases for the login feature based on the test plan"
3038
- assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated Playwright test scripts with Page Objects."
3043
+ assistant: "I'll use the test-code-generator agent to create both manual test case documentation and automated test scripts with page objects."
3039
3044
  <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.
3040
3045
  user: "Create automated tests for the checkout flow"
3041
- assistant: "Let me use the test-code-generator agent to generate test scripts, Page Objects, and test case documentation for the checkout flow."
3046
+ assistant: "Let me use the test-code-generator agent to generate test scripts, page objects, and test case documentation for the checkout flow."
3042
3047
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
3043
3048
  model: "sonnet",
3044
3049
  color: "purple"
3045
3050
  };
3046
- var CONTENT2 = `You are an expert Playwright test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
3051
+ var CONTENT2 = `You are an expert test automation engineer specializing in generating high-quality automated test code and comprehensive test case documentation.
3052
+
3053
+ **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.
3047
3054
 
3048
3055
  **Core Responsibilities:**
3049
3056
 
3050
- 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.
3057
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
3058
+ - The test framework and language used
3059
+ - Directory structure (where to put test specs, page objects, fixtures, helpers)
3060
+ - Test structure conventions (how to organize test steps, tagging, etc.)
3061
+ - Selector priority and strategies
3062
+ - How to run tests
3063
+ - Common fix patterns
3064
+
3065
+ 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.
3051
3066
 
3052
- 2. **Environment Configuration**:
3067
+ 3. **Environment Configuration**:
3053
3068
  - Read \`.env.testdata\` for available environment variables
3054
3069
  - Reference variables using \`process.env.VAR_NAME\` in tests
3055
3070
  - Add new required variables to \`.env.testdata\`
3056
3071
  - NEVER read \`.env\` file (secrets only)
3057
3072
  - **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.
3058
3073
 
3059
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3074
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3060
3075
 
3061
3076
  **Memory Sections for Test Code Generator**:
3062
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
3077
+ - Generated artifacts (page objects, tests, fixtures, helpers)
3063
3078
  - Test cases automated
3064
3079
  - Selector strategies that work for this application
3065
3080
  - Application architecture patterns learned
3066
3081
  - Environment variables used
3067
3082
  - Test creation history and outcomes
3068
3083
 
3069
- 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:
3084
+ 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:
3070
3085
  - Read the manual test case files
3071
- - For test cases marked \`automated: true\`, generate automated Playwright tests
3086
+ - For test cases marked \`automated: true\`, generate automated tests
3072
3087
  - Update the manual test case file with the automated_test reference
3073
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
3088
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
3074
3089
 
3075
- 5. **Mandatory Application Exploration**: NEVER generate Page Objects without exploring the live application first using playwright-cli:
3090
+ 6. **Mandatory Application Exploration**: NEVER generate page objects without exploring the live application first using playwright-cli:
3076
3091
  - Navigate to pages, authenticate, inspect elements
3077
3092
  - Capture screenshots for documentation
3078
- - Document exact role names, labels, text, URLs
3093
+ - Document exact element identifiers, labels, text, URLs
3079
3094
  - Test navigation flows manually
3080
3095
  - **NEVER assume selectors** - verify in browser or tests will fail
3081
3096
 
@@ -3083,7 +3098,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3083
3098
 
3084
3099
  1. **Load Memory**:
3085
3100
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
3086
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
3101
+ - Check existing page objects, automated tests, selector strategies, naming conventions
3087
3102
  - Avoid duplication by reusing established patterns
3088
3103
 
3089
3104
  2. **Read Manual Test Cases**:
@@ -3097,20 +3112,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3097
3112
 
3098
3113
  **STEP 1: Check Existing Infrastructure**
3099
3114
 
3100
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
3101
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
3102
- - **Identify gaps**: Determine what POMs or helpers are missing for this test
3115
+ - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing page objects
3116
+ - **Scan codebase**: Look for relevant page objects in the directory specified by \`./tests/CLAUDE.md\`
3117
+ - **Identify gaps**: Determine what page objects or helpers are missing for this test
3103
3118
 
3104
3119
  **STEP 2: Build Missing Infrastructure** (if needed)
3105
3120
 
3106
3121
  - **Explore feature under test**: Use playwright-cli to:
3107
3122
  * Navigate to the feature's pages
3108
- * Inspect elements and gather selectors (role, label, text)
3123
+ * Inspect elements and gather selectors
3109
3124
  * Document actual URLs from the browser
3110
3125
  * Capture screenshots for documentation
3111
3126
  * Test navigation flows manually
3112
3127
  * NEVER assume selectors - verify everything in browser
3113
- - **Create Page Objects**: Build POMs for new pages/components using verified selectors
3128
+ - **Create page objects**: Build page objects for new pages/components using verified selectors, following conventions from \`./tests/CLAUDE.md\`
3114
3129
  - **Create supporting code**: Add any needed fixtures, helpers, or types
3115
3130
 
3116
3131
  **STEP 3: Create Automated Test**
@@ -3118,20 +3133,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3118
3133
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
3119
3134
  * Understand the test objective and steps
3120
3135
  * Note any preconditions or test data requirements
3121
- - **Generate automated test** (./tests/specs/*.spec.ts):
3136
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
3122
3137
  * Use the manual test case steps as the basis
3123
- * Create executable Playwright test using Page Objects
3124
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
3125
- * Each test.step() should directly correspond to a numbered step in the manual test case
3138
+ * Follow the test structure conventions from \`./tests/CLAUDE.md\`
3126
3139
  * Reference manual test case ID in comments
3127
- * Tag critical tests with @smoke
3140
+ * Tag critical tests appropriately (e.g., @smoke)
3128
3141
  - **Update manual test case file**:
3129
3142
  * Set \`automated_test:\` field to the path of the automated test file
3130
3143
  * Link manual \u2194 automated test bidirectionally
3131
3144
 
3132
3145
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
3133
3146
 
3134
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
3147
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
3135
3148
  - **Analyze results**:
3136
3149
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
3137
3150
  * Fail \u2192 Proceed to failure analysis below
@@ -3145,60 +3158,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3145
3158
  | **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 |
3146
3159
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
3147
3160
 
3148
- **4b. Fix Patterns** (apply based on root cause):
3149
-
3150
- **Fix Type 1: Brittle Selectors**
3151
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3152
- - **Fix**: Replace with role-based selectors
3153
- \`\`\`typescript
3154
- // BEFORE (brittle)
3155
- await page.locator('.btn-primary').click();
3156
- // AFTER (semantic)
3157
- await page.getByRole('button', { name: 'Sign In' }).click();
3158
- \`\`\`
3159
-
3160
- **Fix Type 2: Missing Wait Conditions**
3161
- - **Problem**: Test doesn't wait for elements or actions to complete
3162
- - **Fix**: Add explicit wait for expected state
3163
- \`\`\`typescript
3164
- // BEFORE (race condition)
3165
- await page.goto('/dashboard');
3166
- const items = await page.locator('.item').count();
3167
- // AFTER (explicit wait)
3168
- await page.goto('/dashboard');
3169
- await expect(page.locator('.item')).toHaveCount(5);
3170
- \`\`\`
3171
-
3172
- **Fix Type 3: Race Conditions**
3173
- - **Problem**: Test executes actions before application is ready
3174
- - **Fix**: Wait for specific application state
3175
- \`\`\`typescript
3176
- // BEFORE
3177
- await saveButton.click();
3178
- await expect(successMessage).toBeVisible();
3179
- // AFTER
3180
- await page.locator('.validation-complete').waitFor();
3181
- await saveButton.click();
3182
- await expect(successMessage).toBeVisible();
3183
- \`\`\`
3184
-
3185
- **Fix Type 4: Wrong Assertions**
3186
- - **Problem**: Assertion expects incorrect value or state
3187
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
3188
-
3189
- **Fix Type 5: Test Isolation Issues**
3190
- - **Problem**: Test depends on state from previous tests
3191
- - **Fix**: Add proper setup/teardown or use fixtures
3192
-
3193
- **Fix Type 6: Flaky Tests**
3194
- - **Problem**: Test passes inconsistently
3195
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
3196
- - Run test 10 times to confirm stability after fix
3161
+ **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.
3197
3162
 
3198
3163
  **4c. Fix Workflow**:
3199
3164
  1. Read failure report and classify (product bug vs test issue)
3200
3165
  2. If product bug: Document and mark test as blocked, move to next test
3201
- 3. If test issue: Apply appropriate fix from patterns above
3166
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
3202
3167
  4. Re-run test to verify fix
3203
3168
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
3204
3169
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -3207,9 +3172,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3207
3172
 
3208
3173
  | Failure Type | Root Cause | Action |
3209
3174
  |--------------|------------|--------|
3210
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3211
- | Timeout waiting | Missing wait condition | Add explicit wait |
3212
- | Flaky (timing) | Race condition | Add synchronization wait |
3175
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
3176
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
3177
+ | Flaky (timing) | Race condition | Apply synchronization fix pattern from CLAUDE.md |
3213
3178
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3214
3179
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3215
3180
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -3217,13 +3182,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3217
3182
  **STEP 5: Move to Next Test Case**
3218
3183
 
3219
3184
  - Repeat process for each test case in the plan
3220
- - Reuse existing POMs and infrastructure wherever possible
3185
+ - Reuse existing page objects and infrastructure wherever possible
3221
3186
  - Continuously update memory with new patterns and learnings
3222
3187
 
3223
3188
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3224
3189
 
3225
3190
  Specifically for test-code-generator, consider updating:
3226
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
3191
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
3227
3192
  - **Test Cases Automated**: Record which test cases were automated with references
3228
3193
  - **Selector Strategies**: Note what selector strategies work well for this application
3229
3194
  - **Application Patterns**: Document architecture patterns learned
@@ -3233,7 +3198,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3233
3198
  - Test automation results (tests created, pass/fail status, issues found)
3234
3199
  - Manual test cases automated (count, IDs, titles)
3235
3200
  - Automated tests created (count, smoke vs functional)
3236
- - Page Objects, fixtures, helpers added
3201
+ - Page objects, fixtures, helpers added
3237
3202
  - Next steps (commands to run tests)
3238
3203
 
3239
3204
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -3244,7 +3209,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3244
3209
  ## Last Updated: [timestamp]
3245
3210
 
3246
3211
  ## Generated Test Artifacts
3247
- [Page Objects created with locators and methods]
3212
+ [Page objects created with locators and methods]
3248
3213
  [Test cases automated with manual TC references and file paths]
3249
3214
  [Fixtures, helpers, components created]
3250
3215
 
@@ -3253,26 +3218,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3253
3218
  [Tests passing vs failing with product bugs]
3254
3219
 
3255
3220
  ## Fixed Issues History
3256
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
3257
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState for async validation
3221
+ - [Date] TC-001: Applied selector fix pattern
3222
+ - [Date] TC-003: Applied wait fix pattern for async validation
3258
3223
 
3259
3224
  ## Failure Pattern Library
3260
3225
 
3261
3226
  ### Pattern: Selector Timeout on Dynamic Content
3262
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3227
+ **Symptoms**: Element not found, element loads after timeout
3263
3228
  **Root Cause**: Selector runs before element rendered
3264
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3229
+ **Fix Strategy**: Add explicit visibility wait before interaction
3265
3230
  **Success Rate**: [track over time]
3266
3231
 
3267
3232
  ### Pattern: Race Condition on Form Submission
3268
- **Symptoms**: Test clicks submit before validation completes
3233
+ **Symptoms**: Test interacts before validation completes
3269
3234
  **Root Cause**: Missing wait for validation state
3270
3235
  **Fix Strategy**: Wait for validation indicator before submit
3271
3236
 
3272
3237
  ## Known Stable Selectors
3273
3238
  [Selectors that reliably work for this application]
3274
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3275
- - Email field: \`getByLabel('Email')\`
3276
3239
 
3277
3240
  ## Known Product Bugs (Do Not Fix Tests)
3278
3241
  [Actual bugs discovered - tests should remain failing]
@@ -3283,9 +3246,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3283
3246
 
3284
3247
  ## Application Behavior Patterns
3285
3248
  [Load times, async patterns, navigation flows discovered]
3286
- - Auth pages: redirect timing
3287
- - Dashboard: lazy loading patterns
3288
- - Forms: validation timing
3289
3249
 
3290
3250
  ## Selector Strategy Library
3291
3251
  [Successful selector patterns and their success rates]
@@ -3300,33 +3260,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3300
3260
 
3301
3261
  **Critical Rules:**
3302
3262
 
3303
- \u274C **NEVER**:
3304
- - Generate selectors without exploring the live application - causes 100% test failure
3305
- - Assume URLs, selectors, or navigation patterns - verify in browser
3306
- - Skip exploration even if documentation seems detailed
3307
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
3308
- - Put assertions in Page Objects - only in test files
3309
- - Read .env file - only .env.testdata
3310
- - Create test interdependencies - tests must be independent
3311
-
3312
- \u2705 **ALWAYS**:
3313
- - Explore application using playwright-cli before generating code
3314
- - Verify selectors in live browser using playwright-cli snapshot
3315
- - Document actual URLs from browser address bar
3316
- - Take screenshots for documentation
3317
- - Use role-based selectors as first priority
3318
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
3319
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
3320
- - Follow .bugzy/runtime/testing-best-practices.md
3321
- - Read existing manual test cases and automate those marked automated: true
3322
-
3323
- Follow .bugzy/runtime/testing-best-practices.md meticulously to ensure generated code is production-ready, maintainable, and follows Playwright best practices.`;
3263
+ - **NEVER** generate selectors without exploring the live application - causes 100% test failure
3264
+ - **NEVER** assume URLs, selectors, or navigation patterns - verify in browser
3265
+ - **NEVER** skip exploration even if documentation seems detailed
3266
+ - **NEVER** read .env file - only .env.testdata
3267
+ - **NEVER** create test interdependencies - tests must be independent
3268
+ - **ALWAYS** explore application using playwright-cli before generating code
3269
+ - **ALWAYS** verify selectors in live browser using playwright-cli snapshot
3270
+ - **ALWAYS** document actual URLs from browser address bar
3271
+ - **ALWAYS** follow conventions defined in \`./tests/CLAUDE.md\`
3272
+ - **ALWAYS** link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
3273
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3274
+ - **ALWAYS** read existing manual test cases and automate those marked automated: true`;
3324
3275
 
3325
3276
  // src/subagents/templates/test-debugger-fixer/playwright.ts
3326
3277
  init_cjs_shims();
3327
3278
  var FRONTMATTER3 = {
3328
3279
  name: "test-debugger-fixer",
3329
- 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".
3280
+ 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.
3330
3281
  user: "Fix the failing login test"
3331
3282
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
3332
3283
  <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.
@@ -3336,18 +3287,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
3336
3287
  model: "sonnet",
3337
3288
  color: "yellow"
3338
3289
  };
3339
- 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.
3290
+ 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.
3291
+
3292
+ **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.
3340
3293
 
3341
3294
  **Core Responsibilities:**
3342
3295
 
3343
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
3344
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
3345
- - Correct waiting and synchronization patterns
3346
- - Test isolation principles
3347
- - Common anti-patterns to avoid
3348
- - Debugging workflow and techniques
3296
+ 1. **Framework Conventions**: Read \`./tests/CLAUDE.md\` to understand:
3297
+ - The test framework and language used
3298
+ - Selector strategies and priorities
3299
+ - Waiting and synchronization patterns
3300
+ - Common fix patterns for this framework
3301
+ - How to run tests
3302
+ - Test result artifacts format
3303
+
3304
+ 2. **Best Practices Reference**: Read \`./tests/docs/testing-best-practices.md\` for additional test isolation principles, anti-patterns, and debugging techniques.
3349
3305
 
3350
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3306
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3351
3307
 
3352
3308
  **Memory Sections for Test Debugger Fixer**:
3353
3309
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -3357,7 +3313,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3357
3313
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
3358
3314
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
3359
3315
 
3360
- 3. **Failure Analysis**: When a test fails, you must:
3316
+ 4. **Failure Analysis**: When a test fails, you must:
3361
3317
  - Read the failing test file to understand what it's trying to do
3362
3318
  - Read the failure details from the JSON test report
3363
3319
  - Examine error messages, stack traces, and failure context
@@ -3366,7 +3322,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3366
3322
  - **Product bug**: Correct test code, but application behaves unexpectedly
3367
3323
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
3368
3324
 
3369
- 3. **Triage Decision**: Determine if this is a product bug or test issue:
3325
+ 5. **Triage Decision**: Determine if this is a product bug or test issue:
3370
3326
 
3371
3327
  **Product Bug Indicators**:
3372
3328
  - Selectors are correct and elements exist
@@ -3381,9 +3337,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3381
3337
  - Flaky behavior (passes sometimes, fails other times)
3382
3338
  - Wrong assertions (expecting incorrect values)
3383
3339
  - Test isolation problems (depends on other tests)
3384
- - Brittle selectors (CSS classes, IDs that change)
3340
+ - Brittle selectors that change between builds
3385
3341
 
3386
- 4. **Debug Using Browser**: When needed, explore the application manually:
3342
+ 6. **Debug Using Browser**: When needed, explore the application manually:
3387
3343
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
3388
3344
  - Navigate to the relevant page
3389
3345
  - Inspect elements to find correct selectors
@@ -3392,87 +3348,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3392
3348
  - Verify application state matches test expectations
3393
3349
  - Take notes on differences between expected and actual behavior
3394
3350
 
3395
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
3396
-
3397
- **Fix Type 1: Brittle Selectors**
3398
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3399
- - **Fix**: Replace with role-based selectors
3400
- - **Example**:
3401
- \`\`\`typescript
3402
- // BEFORE (brittle)
3403
- await page.locator('.btn-primary').click();
3404
-
3405
- // AFTER (semantic)
3406
- await page.getByRole('button', { name: 'Sign In' }).click();
3407
- \`\`\`
3408
-
3409
- **Fix Type 2: Missing Wait Conditions**
3410
- - **Problem**: Test doesn't wait for elements or actions to complete
3411
- - **Fix**: Add explicit wait for expected state
3412
- - **Example**:
3413
- \`\`\`typescript
3414
- // BEFORE (race condition)
3415
- await page.goto('/dashboard');
3416
- const items = await page.locator('.item').count();
3417
-
3418
- // AFTER (explicit wait)
3419
- await page.goto('/dashboard');
3420
- await expect(page.locator('.item')).toHaveCount(5);
3421
- \`\`\`
3422
-
3423
- **Fix Type 3: Race Conditions**
3424
- - **Problem**: Test executes actions before application is ready
3425
- - **Fix**: Wait for specific application state
3426
- - **Example**:
3427
- \`\`\`typescript
3428
- // BEFORE (race condition)
3429
- await saveButton.click();
3430
- await expect(successMessage).toBeVisible();
3431
-
3432
- // AFTER (wait for ready state)
3433
- await page.locator('.validation-complete').waitFor();
3434
- await saveButton.click();
3435
- await expect(successMessage).toBeVisible();
3436
- \`\`\`
3437
-
3438
- **Fix Type 4: Wrong Assertions**
3439
- - **Problem**: Assertion expects incorrect value or state
3440
- - **Fix**: Update assertion to match actual application behavior (if correct)
3441
- - **Example**:
3442
- \`\`\`typescript
3443
- // BEFORE (wrong expectation)
3444
- await expect(heading).toHaveText('Welcome John');
3445
-
3446
- // AFTER (corrected)
3447
- await expect(heading).toHaveText('Welcome, John!');
3448
- \`\`\`
3449
-
3450
- **Fix Type 5: Test Isolation Issues**
3451
- - **Problem**: Test depends on state from previous tests
3452
- - **Fix**: Add proper setup/teardown or use fixtures
3453
- - **Example**:
3454
- \`\`\`typescript
3455
- // BEFORE (depends on previous test)
3456
- test('should logout', async ({ page }) => {
3457
- await page.goto('/dashboard');
3458
- // Assumes user is already logged in
3459
- });
3460
-
3461
- // AFTER (isolated with fixture)
3462
- test('should logout', async ({ page, authenticatedUser }) => {
3463
- await page.goto('/dashboard');
3464
- // Uses fixture for clean state
3465
- });
3466
- \`\`\`
3467
-
3468
- **Fix Type 6: Flaky Tests**
3469
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
3470
- - **Fix**: Identify and eliminate non-determinism
3471
- - Common causes: timing issues, race conditions, animation delays, network timing
3472
- - Run test multiple times to reproduce flakiness
3473
- - Add proper waits for stable state
3474
-
3475
- 6. **Fixing Workflow**:
3351
+ 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.
3352
+
3353
+ 8. **Fixing Workflow**:
3476
3354
 
3477
3355
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
3478
3356
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -3485,7 +3363,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3485
3363
  **Step 1: Read Test File**
3486
3364
  - Understand test intent and logic
3487
3365
  - Identify what the test is trying to verify
3488
- - Note test structure and Page Objects used
3366
+ - Note test structure and page objects used
3489
3367
 
3490
3368
  **Step 2: Read Failure Report**
3491
3369
  - Parse JSON test report for failure details
@@ -3504,14 +3382,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3504
3382
  - **If test issue**: Proceed to fix
3505
3383
 
3506
3384
  **Step 5: Apply Fix**
3507
- - Edit test file with appropriate fix
3385
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
3508
3386
  - Update selectors, waits, assertions, or logic
3509
- - Follow best practices from testing guide
3387
+ - Follow conventions from \`./tests/CLAUDE.md\`
3510
3388
  - Add comments explaining the fix if complex
3511
3389
 
3512
3390
  **Step 6: Verify Fix**
3513
- - Run the fixed test: \`npx playwright test [test-file]\`
3514
- - **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
3391
+ - Run the fixed test using the command from \`./tests/CLAUDE.md\`
3392
+ - **IMPORTANT: Do NOT use \`--reporter\` flag** - the custom bugzy-reporter must run to create the hierarchical test-runs output needed for analysis
3515
3393
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
3516
3394
  - Read manifest.json to confirm test passes in latest execution
3517
3395
  - For flaky tests: Run 10 times to ensure stability
@@ -3532,7 +3410,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3532
3410
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
3533
3411
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
3534
3412
 
3535
- 7. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3413
+ 9. **Test Result Format**: The custom Bugzy reporter produces hierarchical test-runs structure:
3536
3414
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3537
3415
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3538
3416
  \`\`\`json
@@ -3563,77 +3441,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3563
3441
  \`\`\`
3564
3442
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3565
3443
 
3566
- 8. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3444
+ 10. **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-debugger-fixer.md\`) follows this structure:
3567
3445
 
3568
- \`\`\`markdown
3569
- # Test Debugger Fixer Memory
3570
-
3571
- ## Last Updated: [timestamp]
3572
-
3573
- ## Fixed Issues History
3574
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3575
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3576
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3577
-
3578
- ## Failure Pattern Library
3579
-
3580
- ### Pattern: Selector Timeout on Dynamic Content
3581
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3582
- **Root Cause**: Selector runs before element rendered
3583
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3584
- **Success Rate**: 95% (used 12 times)
3585
-
3586
- ### Pattern: Race Condition on Form Submission
3587
- **Symptoms**: Test clicks submit before validation completes
3588
- **Root Cause**: Missing wait for validation state
3589
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3590
- **Success Rate**: 100% (used 8 times)
3591
-
3592
- ## Known Stable Selectors
3593
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3594
- - Email field: \`getByLabel('Email')\`
3595
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3596
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3597
-
3598
- ## Known Product Bugs (Do Not Fix Tests)
3599
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3600
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3601
-
3602
- ## Flaky Test Tracking
3603
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3604
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3605
-
3606
- ## Application Behavior Patterns
3607
- - **Auth Pages**: Redirect after 200ms delay
3608
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3609
- - **Forms**: Validation runs on blur + submit events
3610
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3611
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3612
- \`\`\`
3446
+ \`\`\`markdown
3447
+ # Test Debugger Fixer Memory
3448
+
3449
+ ## Last Updated: [timestamp]
3450
+
3451
+ ## Fixed Issues History
3452
+ - [Date] TC-001: Applied selector fix pattern
3453
+ - [Date] TC-003: Applied wait fix pattern for async validation
3454
+ - [Date] TC-005: Fixed race condition with explicit wait for data load
3455
+
3456
+ ## Failure Pattern Library
3457
+
3458
+ ### Pattern: Selector Timeout on Dynamic Content
3459
+ **Symptoms**: Element not found, element loads after timeout
3460
+ **Root Cause**: Selector runs before element rendered
3461
+ **Fix Strategy**: Add explicit visibility wait before interaction
3462
+ **Success Rate**: 95% (used 12 times)
3463
+
3464
+ ### Pattern: Race Condition on Form Submission
3465
+ **Symptoms**: Test interacts before validation completes
3466
+ **Root Cause**: Missing wait for validation state
3467
+ **Fix Strategy**: Wait for validation indicator before submit
3468
+ **Success Rate**: 100% (used 8 times)
3613
3469
 
3614
- 9. **Environment Configuration**:
3615
- - Tests use \`process.env.VAR_NAME\` for configuration
3616
- - Read \`.env.testdata\` to understand available variables
3617
- - NEVER read \`.env\` file (contains secrets only)
3618
- - If test needs new environment variable, update \`.env.testdata\`
3619
-
3620
- 9. **Using playwright-cli for Debugging**:
3621
- - You have direct access to playwright-cli via Bash
3622
- - Open browser: \`playwright-cli open <url>\`
3623
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3624
- - Navigate: \`playwright-cli navigate <url>\`
3625
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3626
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3627
- - Close browser: \`playwright-cli close\`
3628
-
3629
- 10. **Test Stability Best Practices**:
3630
- - Replace all \`waitForTimeout()\` with specific waits
3631
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3632
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3633
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3634
- - Handle dynamic content with proper waits
3635
-
3636
- 11. **Communication**:
3470
+ ## Known Stable Selectors
3471
+ [Selectors that reliably work for this application]
3472
+
3473
+ ## Known Product Bugs (Do Not Fix Tests)
3474
+ [Actual bugs discovered - tests should remain failing]
3475
+
3476
+ ## Flaky Test Tracking
3477
+ [Tests with intermittent failures and their root causes]
3478
+
3479
+ ## Application Behavior Patterns
3480
+ [Load times, async patterns, navigation flows discovered]
3481
+ \`\`\`
3482
+
3483
+ 11. **Environment Configuration**:
3484
+ - Tests use \`process.env.VAR_NAME\` for configuration
3485
+ - Read \`.env.testdata\` to understand available variables
3486
+ - NEVER read \`.env\` file (contains secrets only)
3487
+ - If test needs new environment variable, update \`.env.testdata\`
3488
+
3489
+ 12. **Using playwright-cli for Debugging**:
3490
+ - You have direct access to playwright-cli via Bash
3491
+ - Open browser: \`playwright-cli open <url>\`
3492
+ - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3493
+ - Navigate: \`playwright-cli navigate <url>\`
3494
+ - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3495
+ - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3496
+ - Close browser: \`playwright-cli close\`
3497
+
3498
+ 13. **Communication**:
3637
3499
  - Be clear about whether issue is product bug or test issue
3638
3500
  - Explain root cause of test failure
3639
3501
  - Describe fix applied in plain language
@@ -3644,31 +3506,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3644
3506
 
3645
3507
  | Failure Type | Root Cause | Action |
3646
3508
  |--------------|------------|--------|
3647
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3648
- | Timeout waiting | Missing wait condition | Add explicit wait |
3649
- | Flaky (timing) | Race condition | Add synchronization wait |
3509
+ | Selector not found | Element exists, wrong selector | Apply selector fix pattern from CLAUDE.md |
3510
+ | Timeout waiting | Missing wait condition | Apply wait fix pattern from CLAUDE.md |
3511
+ | Flaky (timing) | Race condition | Apply synchronization fix from CLAUDE.md |
3650
3512
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3651
3513
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3652
3514
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3653
3515
 
3654
- **Anti-Patterns to Avoid:**
3655
-
3656
- \u274C **DO NOT**:
3657
- - Fix tests when the issue is a product bug
3658
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3659
- - Make tests pass by lowering expectations
3660
- - Introduce new test dependencies
3661
- - Skip proper verification of fixes
3662
- - Exceed 3 fix attempts (escalate instead)
3663
-
3664
- \u2705 **DO**:
3665
- - Thoroughly analyze before fixing
3666
- - Use semantic selectors when replacing brittle ones
3667
- - Add explicit waits for specific conditions
3668
- - Verify fixes by re-running tests
3669
- - Run flaky tests 10 times to confirm stability
3670
- - Report product bugs instead of making tests ignore them
3671
- - Follow testing best practices guide
3516
+ **Critical Rules:**
3517
+
3518
+ - **NEVER** fix tests when the issue is a product bug
3519
+ - **NEVER** make tests pass by lowering expectations
3520
+ - **NEVER** introduce new test dependencies
3521
+ - **NEVER** skip proper verification of fixes
3522
+ - **NEVER** exceed 3 fix attempts (escalate instead)
3523
+ - **ALWAYS** thoroughly analyze before fixing
3524
+ - **ALWAYS** follow fix patterns from \`./tests/CLAUDE.md\`
3525
+ - **ALWAYS** verify fixes by re-running tests
3526
+ - **ALWAYS** run flaky tests 10 times to confirm stability
3527
+ - **ALWAYS** report product bugs instead of making tests ignore them
3528
+ - **ALWAYS** follow ./tests/docs/testing-best-practices.md
3672
3529
 
3673
3530
  **Output Format**:
3674
3531
 
@@ -3687,12 +3544,12 @@ Verification:
3687
3544
  - Run 1: [passed/failed]
3688
3545
  - Run 2-10: [if flaky test]
3689
3546
 
3690
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
3547
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3691
3548
 
3692
3549
  Next Steps: [run tests / log bug / review manually]
3693
3550
  \`\`\`
3694
3551
 
3695
- 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.`;
3552
+ 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.`;
3696
3553
 
3697
3554
  // src/subagents/templates/team-communicator/local.ts
3698
3555
  init_cjs_shims();
@@ -6239,7 +6096,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
6239
6096
 
6240
6097
  // src/subagents/templates/index.ts
6241
6098
  var TEMPLATES = {
6242
- "test-runner": {
6099
+ "browser-automation": {
6243
6100
  playwright: {
6244
6101
  frontmatter: FRONTMATTER,
6245
6102
  content: CONTENT
@@ -6396,9 +6253,13 @@ async function createRuntimeFiles() {
6396
6253
  const content = fs4.readFileSync(templatePath, "utf-8");
6397
6254
  fs4.writeFileSync(testPlanTemplatePath, content, "utf-8");
6398
6255
  }
6399
- const bestPracticesPath = path5.join(cwd, ".bugzy/runtime/testing-best-practices.md");
6256
+ const testsDocsDir = path5.join(cwd, "tests/docs");
6257
+ if (!fs4.existsSync(testsDocsDir)) {
6258
+ fs4.mkdirSync(testsDocsDir, { recursive: true });
6259
+ }
6260
+ const bestPracticesPath = path5.join(cwd, "tests/docs/testing-best-practices.md");
6400
6261
  if (!fs4.existsSync(bestPracticesPath)) {
6401
- const templatePath = path5.join(templatesDir, ".bugzy/runtime/testing-best-practices.md");
6262
+ const templatePath = path5.join(templatesDir, "tests/docs/testing-best-practices.md");
6402
6263
  const content = fs4.readFileSync(templatePath, "utf-8");
6403
6264
  fs4.writeFileSync(bestPracticesPath, content, "utf-8");
6404
6265
  }
@@ -6434,14 +6295,22 @@ async function createRuntimeFiles() {
6434
6295
  fs4.writeFileSync(subagentMemoryPath, content, "utf-8");
6435
6296
  }
6436
6297
  }
6437
- const testExecutionStrategyPath = path5.join(cwd, ".bugzy/runtime/test-execution-strategy.md");
6298
+ const testExecutionStrategyPath = path5.join(cwd, "tests/docs/test-execution-strategy.md");
6438
6299
  if (!fs4.existsSync(testExecutionStrategyPath)) {
6439
- const templatePath = path5.join(templatesDir, ".bugzy/runtime/test-execution-strategy.md");
6300
+ const templatePath = path5.join(templatesDir, "tests/docs/test-execution-strategy.md");
6440
6301
  if (fs4.existsSync(templatePath)) {
6441
6302
  const content = fs4.readFileSync(templatePath, "utf-8");
6442
6303
  fs4.writeFileSync(testExecutionStrategyPath, content, "utf-8");
6443
6304
  }
6444
6305
  }
6306
+ const testsClaudeMdPath = path5.join(cwd, "tests/CLAUDE.md");
6307
+ if (!fs4.existsSync(testsClaudeMdPath)) {
6308
+ const templatePath = path5.join(templatesDir, "tests/CLAUDE.md");
6309
+ if (fs4.existsSync(templatePath)) {
6310
+ const content = fs4.readFileSync(templatePath, "utf-8");
6311
+ fs4.writeFileSync(testsClaudeMdPath, content, "utf-8");
6312
+ }
6313
+ }
6445
6314
  const envTestdataPath = path5.join(cwd, ".env.testdata");
6446
6315
  if (!fs4.existsSync(envTestdataPath)) {
6447
6316
  const templatePath = path5.join(templatesDir, ".env.testdata");
@@ -6541,7 +6410,7 @@ var readTestStrategyStep = {
6541
6410
  category: "setup",
6542
6411
  content: `## Read Test Execution Strategy
6543
6412
 
6544
- **IMPORTANT**: Before selecting tests, read \`.bugzy/runtime/test-execution-strategy.md\` to understand:
6413
+ **IMPORTANT**: Before selecting tests, read \`./tests/docs/test-execution-strategy.md\` to understand:
6545
6414
  - Available test tiers (Smoke, Component, Full Regression)
6546
6415
  - When to use each tier (commit, PR, release, debug)
6547
6416
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6551,7 +6420,7 @@ var readTestStrategyStep = {
6551
6420
 
6552
6421
  Apply the strategy guidance when determining which tests to run.
6553
6422
 
6554
- **First**, consult \`.bugzy/runtime/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6423
+ **First**, consult \`./tests/docs/test-execution-strategy.md\` decision tree to determine appropriate test tier based on user's selector and context.`,
6555
6424
  tags: ["setup", "test-execution", "strategy"]
6556
6425
  };
6557
6426
 
@@ -6575,7 +6444,7 @@ Check for existing project context to inform your work:
6575
6444
  - Environment details
6576
6445
 
6577
6446
  **2. Check Test Execution Strategy**
6578
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6447
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6579
6448
  - Understand available test tiers and when to use them
6580
6449
  - Note default behaviors and time/coverage trade-offs
6581
6450
 
@@ -7172,35 +7041,23 @@ When reporting test results, always include an "Ambiguities" section if clarific
7172
7041
  tags: ["clarification", "protocol", "ambiguity"]
7173
7042
  };
7174
7043
 
7175
- // src/tasks/steps/execution/run-playwright-tests.ts
7044
+ // src/tasks/steps/execution/run-tests.ts
7176
7045
  init_cjs_shims();
7177
- var runPlaywrightTestsStep = {
7178
- id: "run-playwright-tests",
7179
- title: "Execute Playwright Tests",
7046
+ var runTestsStep = {
7047
+ id: "run-tests",
7048
+ title: "Execute Automated Tests",
7180
7049
  category: "execution",
7181
- content: `## Execute Playwright Tests
7182
-
7183
- Run automated Playwright tests and capture results.
7050
+ content: `## Execute Automated Tests
7184
7051
 
7185
- **Build Playwright Command** based on selector:
7052
+ Run automated tests and capture results.
7186
7053
 
7187
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
7188
- Use npm scripts to run tests - no manual env export needed.
7054
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
7189
7055
 
7190
- **For file pattern or specific file**:
7191
- \`\`\`bash
7192
- npm test -- [selector]
7193
- \`\`\`
7056
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
7194
7057
 
7195
- **For tag**:
7196
- \`\`\`bash
7197
- npm test -- --grep "[tag]"
7198
- \`\`\`
7199
-
7200
- **For all tests**:
7201
- \`\`\`bash
7202
- npm test
7203
- \`\`\`
7058
+ - **For file pattern or specific file**: Use the framework's file selection command
7059
+ - **For tag**: Use the framework's tag/grep filtering command
7060
+ - **For all tests**: Use the default run-all command
7204
7061
 
7205
7062
  Wait for execution to complete. This may take several minutes depending on test count.
7206
7063
 
@@ -7218,7 +7075,7 @@ Wait for execution to complete. This may take several minutes depending on test
7218
7075
  \`\`\`
7219
7076
 
7220
7077
  2. Store the timestamp for use in subsequent steps`,
7221
- invokesSubagents: ["test-runner"],
7078
+ invokesSubagents: ["browser-automation"],
7222
7079
  tags: ["execution", "tests"]
7223
7080
  };
7224
7081
 
@@ -7319,10 +7176,10 @@ For each failed test:
7319
7176
  | Classification | Indicators | Examples |
7320
7177
  |---------------|------------|----------|
7321
7178
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
7322
- | **Test Issue** | Test code needs fixing | Selector not found but element exists, \`expect(locator).toBeVisible()\` timeout on existing element, Race condition, Wrong assertion |
7179
+ | **Test Issue** | Test code needs fixing | Selector not found but element exists, Timeout on existing element, Race condition, Wrong assertion |
7323
7180
 
7324
- **Common Test Issues:**
7325
- - Brittle selectors (CSS path instead of data-testid or role)
7181
+ **Common Test Issues** (refer to \`./tests/CLAUDE.md\` "Common Fix Patterns" for framework-specific guidance):
7182
+ - Brittle selectors (not following selector priority from CLAUDE.md)
7326
7183
  - Missing waits for async operations
7327
7184
  - Race conditions with animations
7328
7185
  - Incorrect expected values
@@ -7370,7 +7227,7 @@ The agent will:
7370
7227
  1. Read the execution details from result.json
7371
7228
  2. Analyze the failure (error message, trace if available)
7372
7229
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
7373
- 4. Apply appropriate fix to the test code
7230
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
7374
7231
  5. Rerun the test
7375
7232
  6. The custom reporter will automatically create the next exec-N/ folder
7376
7233
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -7382,7 +7239,7 @@ The agent will:
7382
7239
 
7383
7240
  **Track Fixed Tests:**
7384
7241
  - Maintain list of tests fixed automatically
7385
- - Include fix description (e.g., "Updated selector from CSS to role-based")
7242
+ - Include fix description (e.g., "Applied selector fix pattern from CLAUDE.md")
7386
7243
  - Note verification status (test now passes)`,
7387
7244
  invokesSubagents: ["test-debugger-fixer"],
7388
7245
  tags: ["execution", "fixing", "automation"]
@@ -7426,7 +7283,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7426
7283
  - Trace file: [path if available]
7427
7284
  - Screenshots: [paths if available]
7428
7285
  - **Environment Details**:
7429
- - Browser and version (from Playwright config)
7286
+ - Browser and version (from test framework config)
7430
7287
  - Test environment URL (from .env.testdata BASE_URL)
7431
7288
  - Timestamp of failure
7432
7289
  - **Severity/Priority**: Based on:
@@ -7466,7 +7323,7 @@ var createExplorationTestCaseStep = {
7466
7323
  category: "execution",
7467
7324
  content: `## Create Exploration Test Case
7468
7325
 
7469
- Generate a temporary exploration test case for the test-runner.
7326
+ Generate a temporary exploration test case for the browser-automation agent.
7470
7327
 
7471
7328
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7472
7329
 
@@ -7506,7 +7363,7 @@ var runExplorationStep = {
7506
7363
  category: "execution",
7507
7364
  content: `## Run Exploration
7508
7365
 
7509
- {{INVOKE_TEST_RUNNER}}
7366
+ {{INVOKE_BROWSER_AUTOMATION}}
7510
7367
 
7511
7368
  Execute the exploration test case with the following focus:
7512
7369
 
@@ -7531,7 +7388,7 @@ Generate comprehensive findings report.
7531
7388
  - \`test-log.md\` - Detailed execution log
7532
7389
  - \`screenshots/\` - Visual documentation
7533
7390
  - \`summary.json\` - Execution summary`,
7534
- invokesSubagents: ["test-runner"],
7391
+ invokesSubagents: ["browser-automation"],
7535
7392
  tags: ["execution", "exploration"]
7536
7393
  };
7537
7394
 
@@ -7543,7 +7400,7 @@ var processExplorationResultsStep = {
7543
7400
  category: "execution",
7544
7401
  content: `## Process Exploration Results
7545
7402
 
7546
- Read and parse the test-runner output from exploration.
7403
+ Read and parse the browser-automation agent output from exploration.
7547
7404
 
7548
7405
  **Locate results:**
7549
7406
  \`\`\`bash
@@ -7683,23 +7540,22 @@ For each test case marked \`automated: true\`:
7683
7540
  - Exploration findings: ./exploration-reports/
7684
7541
 
7685
7542
  **The agent should:**
7686
- 1. Read manual test case files
7687
- 2. Explore the feature to gather selectors
7688
- 3. Create Page Objects and automated tests
7689
- 4. Run each test and iterate until passing (max 3 attempts)
7690
- 5. Update manual test case with automated_test reference
7691
- 6. Document any product bugs discovered
7543
+ 1. Read \`./tests/CLAUDE.md\` for framework conventions, directory structure, and commands
7544
+ 2. Read manual test case files
7545
+ 3. Explore the feature to gather selectors
7546
+ 4. Create page objects and automated tests following conventions from CLAUDE.md
7547
+ 5. Run each test using the command from CLAUDE.md and iterate until passing (max 3 attempts)
7548
+ 6. Update manual test case with automated_test reference
7549
+ 7. Document any product bugs discovered
7692
7550
 
7693
7551
  **For each test:**
7694
- - Run: \`npx playwright test [test-file]\`
7552
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7695
7553
  - If fails, classify as product bug or test issue
7696
- - If test issue: Apply fix patterns and retry
7554
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7697
7555
  - If product bug: Document and mark test as blocked
7698
7556
  - Continue until test passes or is blocked"
7699
7557
 
7700
- **Output Location:**
7701
- - Page Objects: \`./tests/pages/\`
7702
- - Test specs: \`./tests/specs/\`
7558
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7703
7559
 
7704
7560
  **Update Manual Test Cases:**
7705
7561
  After automation, update the manual test case frontmatter:
@@ -7962,30 +7818,29 @@ After test generation completes, verify all artifacts meet quality standards:
7962
7818
  - Contains human-readable steps and expected results
7963
7819
  - References environment variables for test data
7964
7820
 
7965
- **2. Automated Tests (in \`./tests/specs/\`):**
7821
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7966
7822
  - Organized by feature in subdirectories
7967
7823
  - Each test file references manual test case ID in comments
7968
- - Uses Page Object Model pattern
7969
- - Follows role-based selector priority
7824
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7825
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7970
7826
  - Uses environment variables for test data
7971
7827
  - Includes proper TypeScript typing
7972
7828
 
7973
- **3. Page Objects (in \`./tests/pages/\`):**
7974
- - Extend BasePage class
7975
- - Use semantic selectors (getByRole, getByLabel, getByText)
7829
+ **3. Page Objects** (in directory specified by \`./tests/CLAUDE.md\`):
7830
+ - Follow page object conventions from \`./tests/CLAUDE.md\`
7976
7831
  - Contain only actions, no assertions
7977
7832
  - Properly typed with TypeScript
7978
7833
 
7979
- **4. Supporting Files:**
7980
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
7981
- - Helper functions for data generation (in \`./tests/helpers/\`)
7982
- - Component objects for reusable UI elements (in \`./tests/components/\`)
7983
- - Types defined as needed (in \`./tests/types/\`)
7834
+ **4. Supporting Files** (in directories specified by \`./tests/CLAUDE.md\`):
7835
+ - Fixtures created for common setup
7836
+ - Helper functions for data generation
7837
+ - Component objects for reusable UI elements
7838
+ - Types defined as needed
7984
7839
 
7985
7840
  **Validation Checklist:**
7986
7841
  - [ ] All manual test cases have proper frontmatter
7987
7842
  - [ ] Automated tests reference their manual test case IDs
7988
- - [ ] Page Objects follow the BasePage pattern
7843
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
7989
7844
  - [ ] No hardcoded test data (uses environment variables)
7990
7845
  - [ ] Tests are syntactically valid TypeScript`,
7991
7846
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -8005,7 +7860,7 @@ var STEP_LIBRARY = {
8005
7860
  // Clarification
8006
7861
  "clarification-protocol": clarificationProtocolStep,
8007
7862
  // Execution
8008
- "run-playwright-tests": runPlaywrightTestsStep,
7863
+ "run-tests": runTestsStep,
8009
7864
  "parse-test-results": parseTestResultsStep,
8010
7865
  "triage-failures": triageFailuresStep,
8011
7866
  "fix-test-issues": fixTestIssuesStep,
@@ -8130,9 +7985,9 @@ function buildComposedTaskDefinition(taskSlug, projectSubAgents) {
8130
7985
  init_cjs_shims();
8131
7986
  var TOOL_STRINGS = {
8132
7987
  "claude-code": {
8133
- 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.',
7988
+ 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.',
8134
7989
  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.',
8135
- 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.',
7990
+ 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.',
8136
7991
  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.',
8137
7992
  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.",
8138
7993
  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.',
@@ -8140,7 +7995,7 @@ var TOOL_STRINGS = {
8140
7995
  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.'
8141
7996
  },
8142
7997
  "cursor": {
8143
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/test-runner.md)" --output-format text\n```',
7998
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/browser-automation.md)" --output-format text\n```',
8144
7999
  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```',
8145
8000
  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```',
8146
8001
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -8150,7 +8005,7 @@ var TOOL_STRINGS = {
8150
8005
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
8151
8006
  },
8152
8007
  "codex": {
8153
- INVOKE_TEST_RUNNER: 'Run the test-runner agent:\n```bash\ncodex -p "$(cat .codex/agents/test-runner.md)"\n```',
8008
+ INVOKE_BROWSER_AUTOMATION: 'Run the browser-automation agent:\n```bash\ncodex -p "$(cat .codex/agents/browser-automation.md)"\n```',
8154
8009
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
8155
8010
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
8156
8011
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -8174,7 +8029,7 @@ function getToolString(toolId, key) {
8174
8029
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
8175
8030
  let result = content;
8176
8031
  const keys = [
8177
- "INVOKE_TEST_RUNNER",
8032
+ "INVOKE_BROWSER_AUTOMATION",
8178
8033
  "INVOKE_TEST_DEBUGGER_FIXER",
8179
8034
  "INVOKE_TEST_CODE_GENERATOR",
8180
8035
  "INVOKE_TEAM_COMMUNICATOR",
@@ -9085,7 +8940,7 @@ async function firstTimeSetup(cliSubagents) {
9085
8940
  spinner = (0, import_ora2.default)("Updating .gitignore").start();
9086
8941
  await updateGitignore();
9087
8942
  spinner.succeed(import_chalk2.default.green("Updated .gitignore"));
9088
- if (subagents["test-runner"] && !isPlaywrightScaffolded(process.cwd())) {
8943
+ if (subagents["browser-automation"] && !isPlaywrightScaffolded(process.cwd())) {
9089
8944
  await scaffoldPlaywrightProject({
9090
8945
  projectName,
9091
8946
  targetDir: process.cwd(),
@@ -9101,7 +8956,7 @@ async function firstTimeSetup(cliSubagents) {
9101
8956
  console.log(import_chalk2.default.gray(" \u2022 Testing conventions\n"));
9102
8957
  console.log(import_chalk2.default.yellow("Next steps:"));
9103
8958
  console.log(import_chalk2.default.white("1. Edit .env and add your API tokens"));
9104
- if (subagents["test-runner"]) {
8959
+ if (subagents["browser-automation"]) {
9105
8960
  console.log(import_chalk2.default.white("2. npx playwright install (install browser binaries)"));
9106
8961
  console.log(import_chalk2.default.white("3. Edit .bugzy/runtime/project-context.md"));
9107
8962
  console.log(import_chalk2.default.white("4. Run:"), import_chalk2.default.cyan("bugzy"), import_chalk2.default.gray("(loads .env, then launches claude/codex/cursor)"));