@bugzy-ai/bugzy 1.14.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  };
@@ -1143,7 +1135,7 @@ After queuing and notifying, the task is DONE. Do NOT:
1143
1135
  - Execute /verify-changes, /run-tests, /generate-test-cases directly
1144
1136
  - Wait for team response (messaging infrastructure handles that)
1145
1137
  - Create or modify test files
1146
- - Run Playwright tests
1138
+ - Run automated tests
1147
1139
 
1148
1140
  #### 5.6 Update Event Processor Memory
1149
1141
  If new patterns discovered, append to \`.bugzy/runtime/memory/event-processor.md\`:
@@ -1258,10 +1250,10 @@ var init_run_tests = __esm({
1258
1250
  runTestsTask = {
1259
1251
  slug: TASK_SLUGS.RUN_TESTS,
1260
1252
  name: "Run Tests",
1261
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1253
+ description: "Execute automated tests, analyze failures, and fix test issues automatically",
1262
1254
  frontmatter: {
1263
- description: "Execute automated Playwright tests, analyze failures, and fix test issues automatically",
1264
- "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)'
1265
1257
  },
1266
1258
  steps: [
1267
1259
  // Step 1: Overview (inline)
@@ -1270,7 +1262,7 @@ var init_run_tests = __esm({
1270
1262
  title: "Run Tests Overview",
1271
1263
  content: `# Run Tests Command
1272
1264
 
1273
- 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.`
1274
1266
  },
1275
1267
  // Step 2: Security Notice (library)
1276
1268
  "security-notice",
@@ -1283,9 +1275,9 @@ Execute automated Playwright tests, analyze failures using JSON reports, automat
1283
1275
  **Parse Arguments:**
1284
1276
  Extract the following from arguments:
1285
1277
  - **selector**: Test selection criteria
1286
- - File pattern: "auth" \u2192 finds tests/specs/**/*auth*.spec.ts
1287
- - Tag: "@smoke" \u2192 runs tests with @smoke annotation
1288
- - 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
1289
1281
  - All tests: "all" or "" \u2192 runs entire test suite`
1290
1282
  },
1291
1283
  // Step 4: Load Project Context (library)
@@ -1301,34 +1293,26 @@ Extract the following from arguments:
1301
1293
  inline: true,
1302
1294
  title: "Identify Automated Tests to Run",
1303
1295
  content: `#### Understand Test Selection
1296
+
1297
+ Read \`./tests/CLAUDE.md\` for the test directory structure, file patterns, and execution commands.
1298
+
1304
1299
  Parse the selector argument to determine which tests to run:
1305
1300
 
1306
1301
  **File Pattern** (e.g., "auth", "login"):
1307
- - Find matching test files: \`tests/specs/**/*[pattern]*.spec.ts\`
1302
+ - Find matching test files in the test directory specified by \`./tests/CLAUDE.md\`
1308
1303
  - Example: "auth" \u2192 finds all test files with "auth" in the name
1309
1304
 
1310
1305
  **Tag** (e.g., "@smoke", "@regression"):
1311
- - Run tests with specific Playwright tag annotation
1312
- - Use Playwright's \`--grep\` option
1306
+ - Run tests with specific tag annotation using the tag command from \`./tests/CLAUDE.md\`
1313
1307
 
1314
- **Specific File** (e.g., "tests/specs/auth/login.spec.ts"):
1315
- - Run that specific test file
1308
+ **Specific File**:
1309
+ - Run that specific test file using the single-file command from \`./tests/CLAUDE.md\`
1316
1310
 
1317
1311
  **All Tests** ("all" or no selector):
1318
- - Run entire test suite: \`tests/specs/**/*.spec.ts\`
1312
+ - Run entire test suite using the run-all command from \`./tests/CLAUDE.md\`
1319
1313
 
1320
1314
  #### Find Matching Test Files
1321
- Use glob patterns to find test files:
1322
- \`\`\`bash
1323
- # For file pattern
1324
- ls tests/specs/**/*[pattern]*.spec.ts
1325
-
1326
- # For specific file
1327
- ls tests/specs/auth/login.spec.ts
1328
-
1329
- # For all tests
1330
- ls tests/specs/**/*.spec.ts
1331
- \`\`\`
1315
+ Use glob patterns to find test files in the directory structure defined by \`./tests/CLAUDE.md\`.
1332
1316
 
1333
1317
  #### Validate Test Files Exist
1334
1318
  Check that at least one test file was found:
@@ -1342,7 +1326,7 @@ Before running tests, confirm the selection with the user if ambiguous:
1342
1326
  - **No selector** (all tests): Confirm running full suite before executing`
1343
1327
  },
1344
1328
  // Step 7-10: Test Execution (library steps)
1345
- "run-playwright-tests",
1329
+ "run-tests",
1346
1330
  "parse-test-results",
1347
1331
  "triage-failures",
1348
1332
  "fix-test-issues",
@@ -1368,8 +1352,8 @@ If no test cases match the selection criteria:
1368
1352
  2. List available test cases or suggest running \`/generate-test-cases\` first
1369
1353
  3. Provide examples of valid selection criteria
1370
1354
 
1371
- #### If Test Runner Agent Fails
1372
- If the test-runner agent encounters issues:
1355
+ #### If Browser Automation Agent Fails
1356
+ If the browser-automation agent encounters issues:
1373
1357
  1. Report the specific error
1374
1358
  2. Suggest troubleshooting steps
1375
1359
  3. Offer to run tests individually if batch execution failed
@@ -1383,18 +1367,18 @@ If selected test cases have formatting issues:
1383
1367
  ### Important Notes
1384
1368
 
1385
1369
  **Test Selection Strategy**:
1386
- - **Always read** \`.bugzy/runtime/test-execution-strategy.md\` before selecting tests
1370
+ - **Always read** \`./tests/docs/test-execution-strategy.md\` before selecting tests
1387
1371
  - Default to \`@smoke\` tests for fast validation unless user explicitly requests otherwise
1388
1372
  - Smoke tests provide 100% manual test case coverage with zero redundancy (~2-5 min)
1389
1373
  - Full regression includes intentional redundancy for diagnostic value (~10-15 min)
1390
1374
  - Use context keywords from user request to choose appropriate tier
1391
1375
 
1392
1376
  **Test Execution**:
1393
- - Automated Playwright tests are executed via bash command, not through agents
1377
+ - Automated tests are executed via bash command, not through agents
1394
1378
  - Test execution time varies by tier (see strategy document for details)
1395
1379
  - JSON reports provide structured test results for analysis
1396
- - Playwright automatically captures traces, screenshots, and videos on failures
1397
- - 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\`
1398
1382
 
1399
1383
  **Failure Handling**:
1400
1384
  - Test failures are automatically triaged (product bugs vs test issues)
@@ -1404,11 +1388,11 @@ If selected test cases have formatting issues:
1404
1388
  - Critical failures trigger immediate team notification
1405
1389
 
1406
1390
  **Related Documentation**:
1407
- - \`.bugzy/runtime/test-execution-strategy.md\` - When and why to run specific tests
1408
- - \`.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)`
1409
1393
  }
1410
1394
  ],
1411
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1395
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1412
1396
  optionalSubagents: ["issue-tracker", "team-communicator"],
1413
1397
  dependentTasks: []
1414
1398
  };
@@ -1440,7 +1424,7 @@ var init_verify_changes = __esm({
1440
1424
  ## Overview
1441
1425
 
1442
1426
  This task performs comprehensive change verification with:
1443
- - **Automated testing**: Execute Playwright tests with automatic triage and fixing
1427
+ - **Automated testing**: Execute automated tests with automatic triage and fixing
1444
1428
  - **Manual verification checklists**: Generate role-specific checklists for non-automatable scenarios
1445
1429
  - **Multi-trigger support**: Works from manual CLI, Slack messages, GitHub PRs, and CI/CD
1446
1430
  - **Smart output routing**: Results formatted and delivered to the appropriate channel`
@@ -1671,11 +1655,11 @@ Analyze the change description to identify affected feature areas:
1671
1655
 
1672
1656
  | Description Keywords | Inferred Test Scope | Example |
1673
1657
  |---------------------|-------------------|---------|
1674
- | "login", "authentication", "sign in/up" | \`tests/specs/auth/\` | "Fix login page validation" -> Auth tests |
1675
- | "checkout", "payment", "purchase" | \`tests/specs/checkout/\` | "Optimize checkout flow" -> Checkout tests |
1676
- | "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 |
1677
1661
  | "API", "endpoint", "backend" | API test suites | "Add new user API endpoint" -> User API tests |
1678
- | "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 |
1679
1663
 
1680
1664
  **Inference strategy:**
1681
1665
  1. **Extract feature keywords** from PR title and description
@@ -1750,13 +1734,13 @@ If the Jira issue or PR references test accounts/data (e.g., TEST_PREMIUM_USER,
1750
1734
 
1751
1735
  **CRITICAL**: Never conclude "manual verification required" or "BLOCKED" solely because test data is missing. Always create the test artifacts first.
1752
1736
 
1753
- ### Generate Playwright Specs
1737
+ ### Generate Automated Test Specs
1754
1738
 
1755
1739
  {{INVOKE_TEST_CODE_GENERATOR}} to create automated test specs:
1756
1740
  - Read the manual test cases you just created
1757
1741
  - Explore the feature in the browser to discover selectors and flows
1758
- - Create Page Objects in \`./tests/pages/\` if needed
1759
- - 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\`
1760
1744
  - Run each new test to verify it passes
1761
1745
  - Update the manual test case with \`automated_test\` reference
1762
1746
 
@@ -1766,7 +1750,7 @@ Skip this step \u2014 proceed directly to running existing tests.`,
1766
1750
  conditionalOnSubagent: "test-code-generator"
1767
1751
  },
1768
1752
  // Step 8-11: Test Execution (library steps)
1769
- "run-playwright-tests",
1753
+ "run-tests",
1770
1754
  "parse-test-results",
1771
1755
  "triage-failures",
1772
1756
  "fix-test-issues",
@@ -1955,7 +1939,7 @@ Post PR comment if GitHub context available.`,
1955
1939
  - Recommend: Check test configuration and prerequisites
1956
1940
 
1957
1941
  **If test execution fails:**
1958
- - Report specific error (Playwright not installed, env vars missing)
1942
+ - Report specific error (test framework not installed, env vars missing)
1959
1943
  - Suggest troubleshooting steps
1960
1944
  - Don't proceed with triage if tests didn't run
1961
1945
 
@@ -1985,7 +1969,7 @@ A successful verification includes:
1985
1969
  10. Clear recommendation provided (merge / review / block)`
1986
1970
  }
1987
1971
  ],
1988
- requiredSubagents: ["test-runner", "test-debugger-fixer"],
1972
+ requiredSubagents: ["browser-automation", "test-debugger-fixer"],
1989
1973
  optionalSubagents: ["documentation-researcher", "issue-tracker", "team-communicator", "changelog-historian", "test-code-generator"],
1990
1974
  dependentTasks: []
1991
1975
  };
@@ -2042,7 +2026,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2042
2026
  },
2043
2027
  // Phase 2: Exploration Protocol
2044
2028
  "exploration-protocol",
2045
- // Execute exploration via test-runner
2029
+ // Execute exploration via browser-automation
2046
2030
  "create-exploration-test-case",
2047
2031
  "run-exploration",
2048
2032
  "process-exploration-results",
@@ -2053,7 +2037,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2053
2037
  "generate-test-cases",
2054
2038
  "automate-test-cases",
2055
2039
  // Phase 5: Test Execution
2056
- "run-playwright-tests",
2040
+ "run-tests",
2057
2041
  "parse-test-results",
2058
2042
  // Phase 6: Triage and Fix (NEW - was missing from full-test-coverage)
2059
2043
  "triage-failures",
@@ -2070,7 +2054,7 @@ This command orchestrates the complete test coverage workflow in a single execut
2070
2054
  },
2071
2055
  "generate-final-report"
2072
2056
  ],
2073
- requiredSubagents: ["test-runner", "test-code-generator", "test-debugger-fixer"],
2057
+ requiredSubagents: ["browser-automation", "test-code-generator", "test-debugger-fixer"],
2074
2058
  optionalSubagents: ["documentation-researcher", "team-communicator", "issue-tracker"],
2075
2059
  dependentTasks: ["run-tests", "generate-test-cases"]
2076
2060
  };
@@ -2097,7 +2081,7 @@ var init_explore_application = __esm({
2097
2081
  {
2098
2082
  inline: true,
2099
2083
  title: "Explore Application Overview",
2100
- 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.`
2101
2085
  },
2102
2086
  // Step 2: Security Notice (from library)
2103
2087
  "security-notice",
@@ -2144,7 +2128,7 @@ var init_explore_application = __esm({
2144
2128
  "cleanup-temp-files",
2145
2129
  "update-knowledge-base"
2146
2130
  ],
2147
- requiredSubagents: ["test-runner"],
2131
+ requiredSubagents: ["browser-automation"],
2148
2132
  optionalSubagents: ["team-communicator"],
2149
2133
  dependentTasks: []
2150
2134
  };
@@ -2515,9 +2499,9 @@ var INTEGRATIONS = {
2515
2499
  }
2516
2500
  };
2517
2501
  var SUBAGENTS = {
2518
- "test-runner": {
2519
- role: "test-runner",
2520
- name: "Test Runner",
2502
+ "browser-automation": {
2503
+ role: "browser-automation",
2504
+ name: "Browser Automation",
2521
2505
  description: "Execute automated browser tests (always included)",
2522
2506
  icon: "play",
2523
2507
  integrations: [INTEGRATIONS.playwright],
@@ -2574,7 +2558,7 @@ var SUBAGENTS = {
2574
2558
  "test-code-generator": {
2575
2559
  role: "test-code-generator",
2576
2560
  name: "Test Code Generator",
2577
- description: "Generate automated Playwright test scripts and Page Objects",
2561
+ description: "Generate automated test scripts and page objects",
2578
2562
  icon: "code",
2579
2563
  integrations: [INTEGRATIONS.playwright],
2580
2564
  model: "sonnet",
@@ -2789,7 +2773,7 @@ init_cjs_shims();
2789
2773
  // src/subagents/templates/index.ts
2790
2774
  init_cjs_shims();
2791
2775
 
2792
- // src/subagents/templates/test-runner/playwright.ts
2776
+ // src/subagents/templates/browser-automation/playwright.ts
2793
2777
  init_cjs_shims();
2794
2778
 
2795
2779
  // src/subagents/templates/memory-template.ts
@@ -2836,16 +2820,16 @@ After completing your work, update your memory file with relevant insights.
2836
2820
  **Remember:** Every entry should answer "How does this change what I do?"
2837
2821
  `;
2838
2822
 
2839
- // src/subagents/templates/test-runner/playwright.ts
2823
+ // src/subagents/templates/browser-automation/playwright.ts
2840
2824
  var FRONTMATTER = {
2841
- name: "test-runner",
2842
- 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.
2843
2827
  user: "Run the login test case located at ./test-cases/TC-001-login.md"
2844
- assistant: "I'll use the test-runner agent to execute this test case and capture all the results with video evidence."
2845
- <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.
2846
2830
  user: "Execute the smoke test for the checkout flow"
2847
- assistant: "Let me use the test-runner agent to execute the checkout smoke test and record all findings with video."
2848
- <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>`,
2849
2833
  model: "sonnet",
2850
2834
  color: "green"
2851
2835
  };
@@ -2858,9 +2842,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2858
2842
  - Structure of \`steps.json\` with timestamps and video synchronization
2859
2843
  - Field descriptions and data types
2860
2844
 
2861
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2845
+ 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2862
2846
 
2863
- **Memory Sections for Test Runner**:
2847
+ **Memory Sections for Browser Automation**:
2864
2848
  - **Test Execution History**: Pass/fail rates, execution times, flaky test patterns
2865
2849
  - **Flaky Test Tracking**: Tests that pass inconsistently with root cause analysis
2866
2850
  - **Environment-Specific Patterns**: Timing differences across staging/production/local
@@ -2926,7 +2910,7 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2926
2910
  **Execution Workflow:**
2927
2911
 
2928
2912
  1. **Load Memory** (ALWAYS DO THIS FIRST):
2929
- - 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
2930
2914
  - Check if this test is known to be flaky (apply extra waits if so)
2931
2915
  - Review timing requirements for pages this test will visit
2932
2916
  - Note environment-specific patterns for current TEST_BASE_URL
@@ -2978,9 +2962,9 @@ var CONTENT = `You are an expert automated test execution specialist with deep e
2978
2962
  - Video filename reference (just basename, not full path)
2979
2963
  - Execution ID in metadata.executionId (from BUGZY_EXECUTION_ID environment variable)
2980
2964
  - All other fields following the schema in \`.bugzy/runtime/templates/test-result-schema.md\`
2981
- 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-runner")}
2965
+ 15. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "browser-automation")}
2982
2966
 
2983
- Specifically for test-runner, consider updating:
2967
+ Specifically for browser-automation, consider updating:
2984
2968
  - **Test Execution History**: Add test case ID, status, execution time, browser, environment, date
2985
2969
  - **Flaky Test Tracking**: If test failed multiple times, add symptoms and patterns
2986
2970
  - **Timing Requirements by Page**: Document new timing patterns observed
@@ -3054,49 +3038,59 @@ When you encounter ambiguous test steps, make intelligent decisions based on com
3054
3038
  init_cjs_shims();
3055
3039
  var FRONTMATTER2 = {
3056
3040
  name: "test-code-generator",
3057
- 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.
3058
3042
  user: "Generate test cases for the login feature based on the test plan"
3059
- 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."
3060
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.
3061
3045
  user: "Create automated tests for the checkout flow"
3062
- 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."
3063
3047
  <commentary>The user needs automated test generation, so launch the test-code-generator agent to create all necessary test artifacts.</commentary></example>`,
3064
3048
  model: "sonnet",
3065
3049
  color: "purple"
3066
3050
  };
3067
- 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.
3068
3054
 
3069
3055
  **Core Responsibilities:**
3070
3056
 
3071
- 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.
3072
3066
 
3073
- 2. **Environment Configuration**:
3067
+ 3. **Environment Configuration**:
3074
3068
  - Read \`.env.testdata\` for available environment variables
3075
3069
  - Reference variables using \`process.env.VAR_NAME\` in tests
3076
3070
  - Add new required variables to \`.env.testdata\`
3077
3071
  - NEVER read \`.env\` file (secrets only)
3078
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.
3079
3073
 
3080
- 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3074
+ 4. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3081
3075
 
3082
3076
  **Memory Sections for Test Code Generator**:
3083
- - Generated artifacts (Page Objects, tests, fixtures, helpers)
3077
+ - Generated artifacts (page objects, tests, fixtures, helpers)
3084
3078
  - Test cases automated
3085
3079
  - Selector strategies that work for this application
3086
3080
  - Application architecture patterns learned
3087
3081
  - Environment variables used
3088
3082
  - Test creation history and outcomes
3089
3083
 
3090
- 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:
3091
3085
  - Read the manual test case files
3092
- - For test cases marked \`automated: true\`, generate automated Playwright tests
3086
+ - For test cases marked \`automated: true\`, generate automated tests
3093
3087
  - Update the manual test case file with the automated_test reference
3094
- - Create supporting artifacts: Page Objects, fixtures, helpers, components, types
3088
+ - Create supporting artifacts: page objects, fixtures, helpers, components, types
3095
3089
 
3096
- 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:
3097
3091
  - Navigate to pages, authenticate, inspect elements
3098
3092
  - Capture screenshots for documentation
3099
- - Document exact role names, labels, text, URLs
3093
+ - Document exact element identifiers, labels, text, URLs
3100
3094
  - Test navigation flows manually
3101
3095
  - **NEVER assume selectors** - verify in browser or tests will fail
3102
3096
 
@@ -3104,7 +3098,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3104
3098
 
3105
3099
  1. **Load Memory**:
3106
3100
  - Read \`.bugzy/runtime/memory/test-code-generator.md\`
3107
- - Check existing Page Objects, automated tests, selector strategies, naming conventions
3101
+ - Check existing page objects, automated tests, selector strategies, naming conventions
3108
3102
  - Avoid duplication by reusing established patterns
3109
3103
 
3110
3104
  2. **Read Manual Test Cases**:
@@ -3118,20 +3112,20 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3118
3112
 
3119
3113
  **STEP 1: Check Existing Infrastructure**
3120
3114
 
3121
- - **Review memory**: Check \`.bugzy/runtime/memory/test-code-generator.md\` for existing POMs
3122
- - **Scan codebase**: Look for relevant Page Objects in \`./tests/pages/\`
3123
- - **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
3124
3118
 
3125
3119
  **STEP 2: Build Missing Infrastructure** (if needed)
3126
3120
 
3127
3121
  - **Explore feature under test**: Use playwright-cli to:
3128
3122
  * Navigate to the feature's pages
3129
- * Inspect elements and gather selectors (role, label, text)
3123
+ * Inspect elements and gather selectors
3130
3124
  * Document actual URLs from the browser
3131
3125
  * Capture screenshots for documentation
3132
3126
  * Test navigation flows manually
3133
3127
  * NEVER assume selectors - verify everything in browser
3134
- - **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\`
3135
3129
  - **Create supporting code**: Add any needed fixtures, helpers, or types
3136
3130
 
3137
3131
  **STEP 3: Create Automated Test**
@@ -3139,20 +3133,18 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3139
3133
  - **Read the manual test case** (./test-cases/TC-XXX-*.md):
3140
3134
  * Understand the test objective and steps
3141
3135
  * Note any preconditions or test data requirements
3142
- - **Generate automated test** (./tests/specs/*.spec.ts):
3136
+ - **Generate automated test** in the directory specified by \`./tests/CLAUDE.md\`:
3143
3137
  * Use the manual test case steps as the basis
3144
- * Create executable Playwright test using Page Objects
3145
- * **REQUIRED**: Structure test with \`test.step()\` calls matching the manual test case steps one-to-one
3146
- * 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\`
3147
3139
  * Reference manual test case ID in comments
3148
- * Tag critical tests with @smoke
3140
+ * Tag critical tests appropriately (e.g., @smoke)
3149
3141
  - **Update manual test case file**:
3150
3142
  * Set \`automated_test:\` field to the path of the automated test file
3151
3143
  * Link manual \u2194 automated test bidirectionally
3152
3144
 
3153
3145
  **STEP 4: Verify and Fix Until Working** (CRITICAL - up to 3 attempts)
3154
3146
 
3155
- - **Run test**: Execute \`npx playwright test [test-file]\` using Bash tool
3147
+ - **Run test**: Execute the test using the command from \`./tests/CLAUDE.md\`
3156
3148
  - **Analyze results**:
3157
3149
  * Pass \u2192 Run 2-3 more times to verify stability, then proceed to STEP 5
3158
3150
  * Fail \u2192 Proceed to failure analysis below
@@ -3166,60 +3158,12 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3166
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 |
3167
3159
  | **Test Issue** | Selector not found (but element exists), timeout errors, flaky behavior, wrong assertions | Proceed to fix |
3168
3160
 
3169
- **4b. Fix Patterns** (apply based on root cause):
3170
-
3171
- **Fix Type 1: Brittle Selectors**
3172
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3173
- - **Fix**: Replace with role-based selectors
3174
- \`\`\`typescript
3175
- // BEFORE (brittle)
3176
- await page.locator('.btn-primary').click();
3177
- // AFTER (semantic)
3178
- await page.getByRole('button', { name: 'Sign In' }).click();
3179
- \`\`\`
3180
-
3181
- **Fix Type 2: Missing Wait Conditions**
3182
- - **Problem**: Test doesn't wait for elements or actions to complete
3183
- - **Fix**: Add explicit wait for expected state
3184
- \`\`\`typescript
3185
- // BEFORE (race condition)
3186
- await page.goto('/dashboard');
3187
- const items = await page.locator('.item').count();
3188
- // AFTER (explicit wait)
3189
- await page.goto('/dashboard');
3190
- await expect(page.locator('.item')).toHaveCount(5);
3191
- \`\`\`
3192
-
3193
- **Fix Type 3: Race Conditions**
3194
- - **Problem**: Test executes actions before application is ready
3195
- - **Fix**: Wait for specific application state
3196
- \`\`\`typescript
3197
- // BEFORE
3198
- await saveButton.click();
3199
- await expect(successMessage).toBeVisible();
3200
- // AFTER
3201
- await page.locator('.validation-complete').waitFor();
3202
- await saveButton.click();
3203
- await expect(successMessage).toBeVisible();
3204
- \`\`\`
3205
-
3206
- **Fix Type 4: Wrong Assertions**
3207
- - **Problem**: Assertion expects incorrect value or state
3208
- - **Fix**: Update assertion to match actual app behavior (if app is correct)
3209
-
3210
- **Fix Type 5: Test Isolation Issues**
3211
- - **Problem**: Test depends on state from previous tests
3212
- - **Fix**: Add proper setup/teardown or use fixtures
3213
-
3214
- **Fix Type 6: Flaky Tests**
3215
- - **Problem**: Test passes inconsistently
3216
- - **Fix**: Identify non-determinism source (timing, race conditions, animation delays)
3217
- - 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.
3218
3162
 
3219
3163
  **4c. Fix Workflow**:
3220
3164
  1. Read failure report and classify (product bug vs test issue)
3221
3165
  2. If product bug: Document and mark test as blocked, move to next test
3222
- 3. If test issue: Apply appropriate fix from patterns above
3166
+ 3. If test issue: Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
3223
3167
  4. Re-run test to verify fix
3224
3168
  5. If still failing: Repeat (max 3 total attempts: exec-1, exec-2, exec-3)
3225
3169
  6. After 3 failed attempts: Reclassify as likely product bug and document
@@ -3228,9 +3172,9 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3228
3172
 
3229
3173
  | Failure Type | Root Cause | Action |
3230
3174
  |--------------|------------|--------|
3231
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3232
- | Timeout waiting | Missing wait condition | Add explicit wait |
3233
- | 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 |
3234
3178
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3235
3179
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3236
3180
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
@@ -3238,13 +3182,13 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3238
3182
  **STEP 5: Move to Next Test Case**
3239
3183
 
3240
3184
  - Repeat process for each test case in the plan
3241
- - Reuse existing POMs and infrastructure wherever possible
3185
+ - Reuse existing page objects and infrastructure wherever possible
3242
3186
  - Continuously update memory with new patterns and learnings
3243
3187
 
3244
3188
  4. ${MEMORY_UPDATE_INSTRUCTIONS.replace(/{ROLE}/g, "test-code-generator")}
3245
3189
 
3246
3190
  Specifically for test-code-generator, consider updating:
3247
- - **Generated Artifacts**: Document Page Objects, tests, fixtures created with details
3191
+ - **Generated Artifacts**: Document page objects, tests, fixtures created with details
3248
3192
  - **Test Cases Automated**: Record which test cases were automated with references
3249
3193
  - **Selector Strategies**: Note what selector strategies work well for this application
3250
3194
  - **Application Patterns**: Document architecture patterns learned
@@ -3254,7 +3198,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3254
3198
  - Test automation results (tests created, pass/fail status, issues found)
3255
3199
  - Manual test cases automated (count, IDs, titles)
3256
3200
  - Automated tests created (count, smoke vs functional)
3257
- - Page Objects, fixtures, helpers added
3201
+ - Page objects, fixtures, helpers added
3258
3202
  - Next steps (commands to run tests)
3259
3203
 
3260
3204
  **Memory File Structure**: Your memory file (\`.bugzy/runtime/memory/test-code-generator.md\`) should follow this structure:
@@ -3265,7 +3209,7 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3265
3209
  ## Last Updated: [timestamp]
3266
3210
 
3267
3211
  ## Generated Test Artifacts
3268
- [Page Objects created with locators and methods]
3212
+ [Page objects created with locators and methods]
3269
3213
  [Test cases automated with manual TC references and file paths]
3270
3214
  [Fixtures, helpers, components created]
3271
3215
 
@@ -3274,26 +3218,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3274
3218
  [Tests passing vs failing with product bugs]
3275
3219
 
3276
3220
  ## Fixed Issues History
3277
- - [Date] TC-001 login.spec.ts: Replaced CSS selector with getByRole('button', { name: 'Submit' })
3278
- - [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
3279
3223
 
3280
3224
  ## Failure Pattern Library
3281
3225
 
3282
3226
  ### Pattern: Selector Timeout on Dynamic Content
3283
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3227
+ **Symptoms**: Element not found, element loads after timeout
3284
3228
  **Root Cause**: Selector runs before element rendered
3285
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3229
+ **Fix Strategy**: Add explicit visibility wait before interaction
3286
3230
  **Success Rate**: [track over time]
3287
3231
 
3288
3232
  ### Pattern: Race Condition on Form Submission
3289
- **Symptoms**: Test clicks submit before validation completes
3233
+ **Symptoms**: Test interacts before validation completes
3290
3234
  **Root Cause**: Missing wait for validation state
3291
3235
  **Fix Strategy**: Wait for validation indicator before submit
3292
3236
 
3293
3237
  ## Known Stable Selectors
3294
3238
  [Selectors that reliably work for this application]
3295
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3296
- - Email field: \`getByLabel('Email')\`
3297
3239
 
3298
3240
  ## Known Product Bugs (Do Not Fix Tests)
3299
3241
  [Actual bugs discovered - tests should remain failing]
@@ -3304,9 +3246,6 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3304
3246
 
3305
3247
  ## Application Behavior Patterns
3306
3248
  [Load times, async patterns, navigation flows discovered]
3307
- - Auth pages: redirect timing
3308
- - Dashboard: lazy loading patterns
3309
- - Forms: validation timing
3310
3249
 
3311
3250
  ## Selector Strategy Library
3312
3251
  [Successful selector patterns and their success rates]
@@ -3321,33 +3260,24 @@ var CONTENT2 = `You are an expert Playwright test automation engineer specializi
3321
3260
 
3322
3261
  **Critical Rules:**
3323
3262
 
3324
- \u274C **NEVER**:
3325
- - Generate selectors without exploring the live application - causes 100% test failure
3326
- - Assume URLs, selectors, or navigation patterns - verify in browser
3327
- - Skip exploration even if documentation seems detailed
3328
- - Use \`waitForTimeout()\` - rely on Playwright's auto-waiting
3329
- - Put assertions in Page Objects - only in test files
3330
- - Read .env file - only .env.testdata
3331
- - Create test interdependencies - tests must be independent
3332
-
3333
- \u2705 **ALWAYS**:
3334
- - Explore application using playwright-cli before generating code
3335
- - Verify selectors in live browser using playwright-cli snapshot
3336
- - Document actual URLs from browser address bar
3337
- - Take screenshots for documentation
3338
- - Use role-based selectors as first priority
3339
- - **Structure ALL tests with \`test.step()\` calls matching manual test case steps one-to-one**
3340
- - Link manual \u2194 automated tests bidirectionally (update manual test case with automated_test reference)
3341
- - Follow .bugzy/runtime/testing-best-practices.md
3342
- - Read existing manual test cases and automate those marked automated: true
3343
-
3344
- 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`;
3345
3275
 
3346
3276
  // src/subagents/templates/test-debugger-fixer/playwright.ts
3347
3277
  init_cjs_shims();
3348
3278
  var FRONTMATTER3 = {
3349
3279
  name: "test-debugger-fixer",
3350
- 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.
3351
3281
  user: "Fix the failing login test"
3352
3282
  assistant: "I'll use the test-debugger-fixer agent to analyze the failure, debug the issue, and fix the test code."
3353
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.
@@ -3357,18 +3287,23 @@ assistant: "Let me use the test-debugger-fixer agent to identify and fix the rac
3357
3287
  model: "sonnet",
3358
3288
  color: "yellow"
3359
3289
  };
3360
- 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.
3361
3293
 
3362
3294
  **Core Responsibilities:**
3363
3295
 
3364
- 1. **Best Practices Reference**: ALWAYS start by reading \`.bugzy/runtime/testing-best-practices.md\` to understand:
3365
- - Proper selector strategies (role-based \u2192 test IDs \u2192 CSS)
3366
- - Correct waiting and synchronization patterns
3367
- - Test isolation principles
3368
- - Common anti-patterns to avoid
3369
- - 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.
3370
3305
 
3371
- 2. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3306
+ 3. ${MEMORY_READ_INSTRUCTIONS.replace(/{ROLE}/g, "test-debugger-fixer")}
3372
3307
 
3373
3308
  **Memory Sections for Test Debugger Fixer**:
3374
3309
  - **Fixed Issues History**: Record of all tests fixed with root causes and solutions
@@ -3378,7 +3313,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3378
3313
  - **Flaky Test Tracking**: Tests with intermittent failures and their causes
3379
3314
  - **Application Behavior Patterns**: Load times, async patterns, navigation flows
3380
3315
 
3381
- 3. **Failure Analysis**: When a test fails, you must:
3316
+ 4. **Failure Analysis**: When a test fails, you must:
3382
3317
  - Read the failing test file to understand what it's trying to do
3383
3318
  - Read the failure details from the JSON test report
3384
3319
  - Examine error messages, stack traces, and failure context
@@ -3387,7 +3322,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3387
3322
  - **Product bug**: Correct test code, but application behaves unexpectedly
3388
3323
  - **Test issue**: Problem with test code itself (selector, timing, logic, isolation)
3389
3324
 
3390
- 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:
3391
3326
 
3392
3327
  **Product Bug Indicators**:
3393
3328
  - Selectors are correct and elements exist
@@ -3402,9 +3337,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3402
3337
  - Flaky behavior (passes sometimes, fails other times)
3403
3338
  - Wrong assertions (expecting incorrect values)
3404
3339
  - Test isolation problems (depends on other tests)
3405
- - Brittle selectors (CSS classes, IDs that change)
3340
+ - Brittle selectors that change between builds
3406
3341
 
3407
- 4. **Debug Using Browser**: When needed, explore the application manually:
3342
+ 6. **Debug Using Browser**: When needed, explore the application manually:
3408
3343
  - Use playwright-cli to open browser (\`playwright-cli open <url>\`)
3409
3344
  - Navigate to the relevant page
3410
3345
  - Inspect elements to find correct selectors
@@ -3413,87 +3348,9 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3413
3348
  - Verify application state matches test expectations
3414
3349
  - Take notes on differences between expected and actual behavior
3415
3350
 
3416
- 5. **Fix Test Issues**: Apply appropriate fixes based on root cause:
3417
-
3418
- **Fix Type 1: Brittle Selectors**
3419
- - **Problem**: CSS selectors or fragile XPath that breaks when UI changes
3420
- - **Fix**: Replace with role-based selectors
3421
- - **Example**:
3422
- \`\`\`typescript
3423
- // BEFORE (brittle)
3424
- await page.locator('.btn-primary').click();
3425
-
3426
- // AFTER (semantic)
3427
- await page.getByRole('button', { name: 'Sign In' }).click();
3428
- \`\`\`
3429
-
3430
- **Fix Type 2: Missing Wait Conditions**
3431
- - **Problem**: Test doesn't wait for elements or actions to complete
3432
- - **Fix**: Add explicit wait for expected state
3433
- - **Example**:
3434
- \`\`\`typescript
3435
- // BEFORE (race condition)
3436
- await page.goto('/dashboard');
3437
- const items = await page.locator('.item').count();
3438
-
3439
- // AFTER (explicit wait)
3440
- await page.goto('/dashboard');
3441
- await expect(page.locator('.item')).toHaveCount(5);
3442
- \`\`\`
3443
-
3444
- **Fix Type 3: Race Conditions**
3445
- - **Problem**: Test executes actions before application is ready
3446
- - **Fix**: Wait for specific application state
3447
- - **Example**:
3448
- \`\`\`typescript
3449
- // BEFORE (race condition)
3450
- await saveButton.click();
3451
- await expect(successMessage).toBeVisible();
3452
-
3453
- // AFTER (wait for ready state)
3454
- await page.locator('.validation-complete').waitFor();
3455
- await saveButton.click();
3456
- await expect(successMessage).toBeVisible();
3457
- \`\`\`
3458
-
3459
- **Fix Type 4: Wrong Assertions**
3460
- - **Problem**: Assertion expects incorrect value or state
3461
- - **Fix**: Update assertion to match actual application behavior (if correct)
3462
- - **Example**:
3463
- \`\`\`typescript
3464
- // BEFORE (wrong expectation)
3465
- await expect(heading).toHaveText('Welcome John');
3466
-
3467
- // AFTER (corrected)
3468
- await expect(heading).toHaveText('Welcome, John!');
3469
- \`\`\`
3470
-
3471
- **Fix Type 5: Test Isolation Issues**
3472
- - **Problem**: Test depends on state from previous tests
3473
- - **Fix**: Add proper setup/teardown or use fixtures
3474
- - **Example**:
3475
- \`\`\`typescript
3476
- // BEFORE (depends on previous test)
3477
- test('should logout', async ({ page }) => {
3478
- await page.goto('/dashboard');
3479
- // Assumes user is already logged in
3480
- });
3481
-
3482
- // AFTER (isolated with fixture)
3483
- test('should logout', async ({ page, authenticatedUser }) => {
3484
- await page.goto('/dashboard');
3485
- // Uses fixture for clean state
3486
- });
3487
- \`\`\`
3488
-
3489
- **Fix Type 6: Flaky Tests**
3490
- - **Problem**: Test passes inconsistently (e.g., 7/10 times)
3491
- - **Fix**: Identify and eliminate non-determinism
3492
- - Common causes: timing issues, race conditions, animation delays, network timing
3493
- - Run test multiple times to reproduce flakiness
3494
- - Add proper waits for stable state
3495
-
3496
- 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**:
3497
3354
 
3498
3355
  **Step 0: Load Memory** (ALWAYS DO THIS FIRST)
3499
3356
  - Read \`.bugzy/runtime/memory/test-debugger-fixer.md\`
@@ -3506,7 +3363,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3506
3363
  **Step 1: Read Test File**
3507
3364
  - Understand test intent and logic
3508
3365
  - Identify what the test is trying to verify
3509
- - Note test structure and Page Objects used
3366
+ - Note test structure and page objects used
3510
3367
 
3511
3368
  **Step 2: Read Failure Report**
3512
3369
  - Parse JSON test report for failure details
@@ -3525,14 +3382,14 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3525
3382
  - **If test issue**: Proceed to fix
3526
3383
 
3527
3384
  **Step 5: Apply Fix**
3528
- - Edit test file with appropriate fix
3385
+ - Edit test file with appropriate fix from \`./tests/CLAUDE.md\` fix patterns
3529
3386
  - Update selectors, waits, assertions, or logic
3530
- - Follow best practices from testing guide
3387
+ - Follow conventions from \`./tests/CLAUDE.md\`
3531
3388
  - Add comments explaining the fix if complex
3532
3389
 
3533
3390
  **Step 6: Verify Fix**
3534
- - Run the fixed test: \`npx playwright test [test-file]\`
3535
- - **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
3536
3393
  - The reporter auto-detects and creates the next exec-N/ folder in test-runs/{timestamp}/{testCaseId}/
3537
3394
  - Read manifest.json to confirm test passes in latest execution
3538
3395
  - For flaky tests: Run 10 times to ensure stability
@@ -3553,7 +3410,7 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3553
3410
  - **Flaky Test Tracking**: Track tests requiring multiple attempts with root causes
3554
3411
  - **Application Behavior Patterns**: Document load times, async patterns, navigation flows discovered
3555
3412
 
3556
- 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:
3557
3414
  - **Manifest** (test-runs/{timestamp}/manifest.json): Overall run summary with all test cases
3558
3415
  - **Per-execution results** (test-runs/{timestamp}/{testCaseId}/exec-{num}/result.json):
3559
3416
  \`\`\`json
@@ -3584,77 +3441,61 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3584
3441
  \`\`\`
3585
3442
  Read result.json from the execution path to understand failure context. Video, trace, and screenshots are in the same exec-{num}/ folder.
3586
3443
 
3587
- 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:
3588
3445
 
3589
- \`\`\`markdown
3590
- # Test Debugger Fixer Memory
3591
-
3592
- ## Last Updated: [timestamp]
3593
-
3594
- ## Fixed Issues History
3595
- - [Date] TC-001 login.spec.ts: Replaced CSS selector .btn-submit with getByRole('button', { name: 'Submit' })
3596
- - [Date] TC-003 checkout.spec.ts: Added waitForLoadState('networkidle') for async validation
3597
- - [Date] TC-005 dashboard.spec.ts: Fixed race condition with explicit wait for data load
3598
-
3599
- ## Failure Pattern Library
3600
-
3601
- ### Pattern: Selector Timeout on Dynamic Content
3602
- **Symptoms**: "Timeout waiting for selector", element loads after timeout
3603
- **Root Cause**: Selector runs before element rendered
3604
- **Fix Strategy**: Add \`await expect(locator).toBeVisible()\` before interaction
3605
- **Success Rate**: 95% (used 12 times)
3606
-
3607
- ### Pattern: Race Condition on Form Submission
3608
- **Symptoms**: Test clicks submit before validation completes
3609
- **Root Cause**: Missing wait for validation state
3610
- **Fix Strategy**: \`await page.locator('[data-validation-complete]').waitFor()\`
3611
- **Success Rate**: 100% (used 8 times)
3612
-
3613
- ## Known Stable Selectors
3614
- - Login button: \`getByRole('button', { name: 'Sign In' })\`
3615
- - Email field: \`getByLabel('Email')\`
3616
- - Submit buttons: \`getByRole('button', { name: /submit|save|continue/i })\`
3617
- - Navigation links: \`getByRole('link', { name: /^exact text$/i })\`
3618
-
3619
- ## Known Product Bugs (Do Not Fix Tests)
3620
- - [Date] Dashboard shows stale data after logout (BUG-123) - affects TC-008
3621
- - [Date] Cart total miscalculates tax (BUG-456) - affects TC-012, TC-014
3622
-
3623
- ## Flaky Test Tracking
3624
- - TC-003: Passes 87% - race condition on payment validation (needs waitFor spinner)
3625
- - TC-007: Passes 60% - timing issue on avatar upload (wait for progress complete)
3626
-
3627
- ## Application Behavior Patterns
3628
- - **Auth Pages**: Redirect after 200ms delay
3629
- - **Dashboard**: Uses lazy loading, wait for skeleton \u2192 content transition
3630
- - **Forms**: Validation runs on blur + submit events
3631
- - **Modals**: Animate in over 300ms, wait for \`aria-hidden="false"\`
3632
- - **Toasts**: Auto-dismiss after 5s, check \`aria-live\` region
3633
- \`\`\`
3446
+ \`\`\`markdown
3447
+ # Test Debugger Fixer Memory
3448
+
3449
+ ## Last Updated: [timestamp]
3634
3450
 
3635
- 9. **Environment Configuration**:
3636
- - Tests use \`process.env.VAR_NAME\` for configuration
3637
- - Read \`.env.testdata\` to understand available variables
3638
- - NEVER read \`.env\` file (contains secrets only)
3639
- - If test needs new environment variable, update \`.env.testdata\`
3640
-
3641
- 9. **Using playwright-cli for Debugging**:
3642
- - You have direct access to playwright-cli via Bash
3643
- - Open browser: \`playwright-cli open <url>\`
3644
- - Take snapshot: \`playwright-cli snapshot\` to get element refs (@e1, @e2, etc.)
3645
- - Navigate: \`playwright-cli navigate <url>\`
3646
- - Inspect elements: Use \`snapshot\` to find correct selectors and element refs
3647
- - Execute test steps manually: Use \`click\`, \`fill\`, \`select\` commands
3648
- - Close browser: \`playwright-cli close\`
3649
-
3650
- 10. **Test Stability Best Practices**:
3651
- - Replace all \`waitForTimeout()\` with specific waits
3652
- - Use \`toBeVisible()\`, \`toHaveCount()\`, \`toHaveText()\` assertions
3653
- - Prefer \`waitFor({ state: 'visible' })\` over arbitrary delays
3654
- - Use \`page.waitForLoadState('networkidle')\` after navigation
3655
- - Handle dynamic content with proper waits
3656
-
3657
- 11. **Communication**:
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)
3469
+
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**:
3658
3499
  - Be clear about whether issue is product bug or test issue
3659
3500
  - Explain root cause of test failure
3660
3501
  - Describe fix applied in plain language
@@ -3665,31 +3506,26 @@ var CONTENT3 = `You are an expert Playwright test debugger and fixer with deep e
3665
3506
 
3666
3507
  | Failure Type | Root Cause | Action |
3667
3508
  |--------------|------------|--------|
3668
- | Selector not found | Element exists, wrong selector | Replace with semantic selector |
3669
- | Timeout waiting | Missing wait condition | Add explicit wait |
3670
- | 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 |
3671
3512
  | Wrong assertion | Incorrect expected value | Update assertion (if app is correct) |
3672
3513
  | Test isolation | Depends on other tests | Add setup/teardown or fixtures |
3673
3514
  | Product bug | App behaves incorrectly | STOP - Report as bug, don't fix test |
3674
3515
 
3675
- **Anti-Patterns to Avoid:**
3676
-
3677
- \u274C **DO NOT**:
3678
- - Fix tests when the issue is a product bug
3679
- - Add \`waitForTimeout()\` as a fix (masks real issues)
3680
- - Make tests pass by lowering expectations
3681
- - Introduce new test dependencies
3682
- - Skip proper verification of fixes
3683
- - Exceed 3 fix attempts (escalate instead)
3684
-
3685
- \u2705 **DO**:
3686
- - Thoroughly analyze before fixing
3687
- - Use semantic selectors when replacing brittle ones
3688
- - Add explicit waits for specific conditions
3689
- - Verify fixes by re-running tests
3690
- - Run flaky tests 10 times to confirm stability
3691
- - Report product bugs instead of making tests ignore them
3692
- - 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
3693
3529
 
3694
3530
  **Output Format**:
3695
3531
 
@@ -3708,12 +3544,12 @@ Verification:
3708
3544
  - Run 1: [passed/failed]
3709
3545
  - Run 2-10: [if flaky test]
3710
3546
 
3711
- Result: [\u2705 Fixed and verified | \u274C Likely product bug | \u26A0\uFE0F Needs escalation]
3547
+ Result: [fixed-and-verified | likely-product-bug | needs-escalation]
3712
3548
 
3713
3549
  Next Steps: [run tests / log bug / review manually]
3714
3550
  \`\`\`
3715
3551
 
3716
- 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.`;
3717
3553
 
3718
3554
  // src/subagents/templates/team-communicator/local.ts
3719
3555
  init_cjs_shims();
@@ -6260,7 +6096,7 @@ You are meticulous about correlating code changes with observed behavior, helpin
6260
6096
 
6261
6097
  // src/subagents/templates/index.ts
6262
6098
  var TEMPLATES = {
6263
- "test-runner": {
6099
+ "browser-automation": {
6264
6100
  playwright: {
6265
6101
  frontmatter: FRONTMATTER,
6266
6102
  content: CONTENT
@@ -6417,9 +6253,13 @@ async function createRuntimeFiles() {
6417
6253
  const content = fs4.readFileSync(templatePath, "utf-8");
6418
6254
  fs4.writeFileSync(testPlanTemplatePath, content, "utf-8");
6419
6255
  }
6420
- 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");
6421
6261
  if (!fs4.existsSync(bestPracticesPath)) {
6422
- const templatePath = path5.join(templatesDir, ".bugzy/runtime/testing-best-practices.md");
6262
+ const templatePath = path5.join(templatesDir, "tests/docs/testing-best-practices.md");
6423
6263
  const content = fs4.readFileSync(templatePath, "utf-8");
6424
6264
  fs4.writeFileSync(bestPracticesPath, content, "utf-8");
6425
6265
  }
@@ -6455,14 +6295,22 @@ async function createRuntimeFiles() {
6455
6295
  fs4.writeFileSync(subagentMemoryPath, content, "utf-8");
6456
6296
  }
6457
6297
  }
6458
- const testExecutionStrategyPath = path5.join(cwd, ".bugzy/runtime/test-execution-strategy.md");
6298
+ const testExecutionStrategyPath = path5.join(cwd, "tests/docs/test-execution-strategy.md");
6459
6299
  if (!fs4.existsSync(testExecutionStrategyPath)) {
6460
- const templatePath = path5.join(templatesDir, ".bugzy/runtime/test-execution-strategy.md");
6300
+ const templatePath = path5.join(templatesDir, "tests/docs/test-execution-strategy.md");
6461
6301
  if (fs4.existsSync(templatePath)) {
6462
6302
  const content = fs4.readFileSync(templatePath, "utf-8");
6463
6303
  fs4.writeFileSync(testExecutionStrategyPath, content, "utf-8");
6464
6304
  }
6465
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
+ }
6466
6314
  const envTestdataPath = path5.join(cwd, ".env.testdata");
6467
6315
  if (!fs4.existsSync(envTestdataPath)) {
6468
6316
  const templatePath = path5.join(templatesDir, ".env.testdata");
@@ -6562,7 +6410,7 @@ var readTestStrategyStep = {
6562
6410
  category: "setup",
6563
6411
  content: `## Read Test Execution Strategy
6564
6412
 
6565
- **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:
6566
6414
  - Available test tiers (Smoke, Component, Full Regression)
6567
6415
  - When to use each tier (commit, PR, release, debug)
6568
6416
  - Default behavior (default to @smoke unless user specifies otherwise)
@@ -6572,7 +6420,7 @@ var readTestStrategyStep = {
6572
6420
 
6573
6421
  Apply the strategy guidance when determining which tests to run.
6574
6422
 
6575
- **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.`,
6576
6424
  tags: ["setup", "test-execution", "strategy"]
6577
6425
  };
6578
6426
 
@@ -6596,7 +6444,7 @@ Check for existing project context to inform your work:
6596
6444
  - Environment details
6597
6445
 
6598
6446
  **2. Check Test Execution Strategy**
6599
- - Read \`.bugzy/runtime/test-execution-strategy.md\` if it exists
6447
+ - Read \`./tests/docs/test-execution-strategy.md\` if it exists
6600
6448
  - Understand available test tiers and when to use them
6601
6449
  - Note default behaviors and time/coverage trade-offs
6602
6450
 
@@ -7193,35 +7041,23 @@ When reporting test results, always include an "Ambiguities" section if clarific
7193
7041
  tags: ["clarification", "protocol", "ambiguity"]
7194
7042
  };
7195
7043
 
7196
- // src/tasks/steps/execution/run-playwright-tests.ts
7044
+ // src/tasks/steps/execution/run-tests.ts
7197
7045
  init_cjs_shims();
7198
- var runPlaywrightTestsStep = {
7199
- id: "run-playwright-tests",
7200
- title: "Execute Playwright Tests",
7046
+ var runTestsStep = {
7047
+ id: "run-tests",
7048
+ title: "Execute Automated Tests",
7201
7049
  category: "execution",
7202
- content: `## Execute Playwright Tests
7203
-
7204
- Run automated Playwright tests and capture results.
7205
-
7206
- **Build Playwright Command** based on selector:
7050
+ content: `## Execute Automated Tests
7207
7051
 
7208
- The playwright.config.ts automatically loads environment variables from .env.testdata and .env files.
7209
- Use npm scripts to run tests - no manual env export needed.
7052
+ Run automated tests and capture results.
7210
7053
 
7211
- **For file pattern or specific file**:
7212
- \`\`\`bash
7213
- npm test -- [selector]
7214
- \`\`\`
7054
+ **Read \`./tests/CLAUDE.md\`** for the test execution commands specific to this project's test framework.
7215
7055
 
7216
- **For tag**:
7217
- \`\`\`bash
7218
- npm test -- --grep "[tag]"
7219
- \`\`\`
7056
+ Use the commands defined in \`./tests/CLAUDE.md\` to run tests based on selector:
7220
7057
 
7221
- **For all tests**:
7222
- \`\`\`bash
7223
- npm test
7224
- \`\`\`
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
7225
7061
 
7226
7062
  Wait for execution to complete. This may take several minutes depending on test count.
7227
7063
 
@@ -7239,7 +7075,7 @@ Wait for execution to complete. This may take several minutes depending on test
7239
7075
  \`\`\`
7240
7076
 
7241
7077
  2. Store the timestamp for use in subsequent steps`,
7242
- invokesSubagents: ["test-runner"],
7078
+ invokesSubagents: ["browser-automation"],
7243
7079
  tags: ["execution", "tests"]
7244
7080
  };
7245
7081
 
@@ -7340,10 +7176,10 @@ For each failed test:
7340
7176
  | Classification | Indicators | Examples |
7341
7177
  |---------------|------------|----------|
7342
7178
  | **Product Bug** | Correct test code, unexpected application behavior | Button click leads to wrong page, Form submission returns 500 error, Feature missing or broken |
7343
- | **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 |
7344
7180
 
7345
- **Common Test Issues:**
7346
- - 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)
7347
7183
  - Missing waits for async operations
7348
7184
  - Race conditions with animations
7349
7185
  - Incorrect expected values
@@ -7391,7 +7227,7 @@ The agent will:
7391
7227
  1. Read the execution details from result.json
7392
7228
  2. Analyze the failure (error message, trace if available)
7393
7229
  3. Identify the root cause (brittle selector, missing wait, race condition, etc.)
7394
- 4. Apply appropriate fix to the test code
7230
+ 4. Apply appropriate fix pattern from \`./tests/CLAUDE.md\`
7395
7231
  5. Rerun the test
7396
7232
  6. The custom reporter will automatically create the next exec-N/ folder
7397
7233
  7. Repeat up to 3 times if needed (exec-1, exec-2, exec-3)
@@ -7403,7 +7239,7 @@ The agent will:
7403
7239
 
7404
7240
  **Track Fixed Tests:**
7405
7241
  - Maintain list of tests fixed automatically
7406
- - 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")
7407
7243
  - Note verification status (test now passes)`,
7408
7244
  invokesSubagents: ["test-debugger-fixer"],
7409
7245
  tags: ["execution", "fixing", "automation"]
@@ -7447,7 +7283,7 @@ After triage, for tests classified as **[PRODUCT BUG]**, use the issue-tracker a
7447
7283
  - Trace file: [path if available]
7448
7284
  - Screenshots: [paths if available]
7449
7285
  - **Environment Details**:
7450
- - Browser and version (from Playwright config)
7286
+ - Browser and version (from test framework config)
7451
7287
  - Test environment URL (from .env.testdata BASE_URL)
7452
7288
  - Timestamp of failure
7453
7289
  - **Severity/Priority**: Based on:
@@ -7487,7 +7323,7 @@ var createExplorationTestCaseStep = {
7487
7323
  category: "execution",
7488
7324
  content: `## Create Exploration Test Case
7489
7325
 
7490
- Generate a temporary exploration test case for the test-runner.
7326
+ Generate a temporary exploration test case for the browser-automation agent.
7491
7327
 
7492
7328
  **Create file:** \`./test-cases/EXPLORATION-TEMP.md\`
7493
7329
 
@@ -7527,7 +7363,7 @@ var runExplorationStep = {
7527
7363
  category: "execution",
7528
7364
  content: `## Run Exploration
7529
7365
 
7530
- {{INVOKE_TEST_RUNNER}}
7366
+ {{INVOKE_BROWSER_AUTOMATION}}
7531
7367
 
7532
7368
  Execute the exploration test case with the following focus:
7533
7369
 
@@ -7552,7 +7388,7 @@ Generate comprehensive findings report.
7552
7388
  - \`test-log.md\` - Detailed execution log
7553
7389
  - \`screenshots/\` - Visual documentation
7554
7390
  - \`summary.json\` - Execution summary`,
7555
- invokesSubagents: ["test-runner"],
7391
+ invokesSubagents: ["browser-automation"],
7556
7392
  tags: ["execution", "exploration"]
7557
7393
  };
7558
7394
 
@@ -7564,7 +7400,7 @@ var processExplorationResultsStep = {
7564
7400
  category: "execution",
7565
7401
  content: `## Process Exploration Results
7566
7402
 
7567
- Read and parse the test-runner output from exploration.
7403
+ Read and parse the browser-automation agent output from exploration.
7568
7404
 
7569
7405
  **Locate results:**
7570
7406
  \`\`\`bash
@@ -7704,23 +7540,22 @@ For each test case marked \`automated: true\`:
7704
7540
  - Exploration findings: ./exploration-reports/
7705
7541
 
7706
7542
  **The agent should:**
7707
- 1. Read manual test case files
7708
- 2. Explore the feature to gather selectors
7709
- 3. Create Page Objects and automated tests
7710
- 4. Run each test and iterate until passing (max 3 attempts)
7711
- 5. Update manual test case with automated_test reference
7712
- 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
7713
7550
 
7714
7551
  **For each test:**
7715
- - Run: \`npx playwright test [test-file]\`
7552
+ - Run using the test execution command from \`./tests/CLAUDE.md\`
7716
7553
  - If fails, classify as product bug or test issue
7717
- - If test issue: Apply fix patterns and retry
7554
+ - If test issue: Apply fix patterns from CLAUDE.md and retry
7718
7555
  - If product bug: Document and mark test as blocked
7719
7556
  - Continue until test passes or is blocked"
7720
7557
 
7721
- **Output Location:**
7722
- - Page Objects: \`./tests/pages/\`
7723
- - Test specs: \`./tests/specs/\`
7558
+ **Output Location:** As specified in \`./tests/CLAUDE.md\` Directory Structure section.
7724
7559
 
7725
7560
  **Update Manual Test Cases:**
7726
7561
  After automation, update the manual test case frontmatter:
@@ -7983,30 +7818,29 @@ After test generation completes, verify all artifacts meet quality standards:
7983
7818
  - Contains human-readable steps and expected results
7984
7819
  - References environment variables for test data
7985
7820
 
7986
- **2. Automated Tests (in \`./tests/specs/\`):**
7821
+ **2. Automated Tests** (in directory specified by \`./tests/CLAUDE.md\`):
7987
7822
  - Organized by feature in subdirectories
7988
7823
  - Each test file references manual test case ID in comments
7989
- - Uses Page Object Model pattern
7990
- - Follows role-based selector priority
7824
+ - Follows conventions defined in \`./tests/CLAUDE.md\`
7825
+ - Follows selector priority from \`./tests/CLAUDE.md\`
7991
7826
  - Uses environment variables for test data
7992
7827
  - Includes proper TypeScript typing
7993
7828
 
7994
- **3. Page Objects (in \`./tests/pages/\`):**
7995
- - Extend BasePage class
7996
- - 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\`
7997
7831
  - Contain only actions, no assertions
7998
7832
  - Properly typed with TypeScript
7999
7833
 
8000
- **4. Supporting Files:**
8001
- - Fixtures created for common setup (in \`./tests/fixtures/\`)
8002
- - Helper functions for data generation (in \`./tests/helpers/\`)
8003
- - Component objects for reusable UI elements (in \`./tests/components/\`)
8004
- - 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
8005
7839
 
8006
7840
  **Validation Checklist:**
8007
7841
  - [ ] All manual test cases have proper frontmatter
8008
7842
  - [ ] Automated tests reference their manual test case IDs
8009
- - [ ] Page Objects follow the BasePage pattern
7843
+ - [ ] Test artifacts follow conventions from \`./tests/CLAUDE.md\`
8010
7844
  - [ ] No hardcoded test data (uses environment variables)
8011
7845
  - [ ] Tests are syntactically valid TypeScript`,
8012
7846
  tags: ["maintenance", "validation", "test-artifacts"]
@@ -8026,7 +7860,7 @@ var STEP_LIBRARY = {
8026
7860
  // Clarification
8027
7861
  "clarification-protocol": clarificationProtocolStep,
8028
7862
  // Execution
8029
- "run-playwright-tests": runPlaywrightTestsStep,
7863
+ "run-tests": runTestsStep,
8030
7864
  "parse-test-results": parseTestResultsStep,
8031
7865
  "triage-failures": triageFailuresStep,
8032
7866
  "fix-test-issues": fixTestIssuesStep,
@@ -8151,9 +7985,9 @@ function buildComposedTaskDefinition(taskSlug, projectSubAgents) {
8151
7985
  init_cjs_shims();
8152
7986
  var TOOL_STRINGS = {
8153
7987
  "claude-code": {
8154
- 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.',
8155
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.',
8156
- 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.',
8157
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.',
8158
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.",
8159
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.',
@@ -8161,7 +7995,7 @@ var TOOL_STRINGS = {
8161
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.'
8162
7996
  },
8163
7997
  "cursor": {
8164
- 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```',
8165
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```',
8166
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```',
8167
8001
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/team-communicator.md)" --output-format text\n```',
@@ -8171,7 +8005,7 @@ var TOOL_STRINGS = {
8171
8005
  INVOKE_CHANGELOG_HISTORIAN: 'Run the changelog-historian agent:\n```bash\ncursor-agent -p "$(cat .cursor/agents/changelog-historian.md)" --output-format text\n```'
8172
8006
  },
8173
8007
  "codex": {
8174
- 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```',
8175
8009
  INVOKE_TEST_DEBUGGER_FIXER: 'Run the test-debugger-fixer agent:\n```bash\ncodex -p "$(cat .codex/agents/test-debugger-fixer.md)"\n```',
8176
8010
  INVOKE_TEST_CODE_GENERATOR: 'Run the test-code-generator agent:\n```bash\ncodex -p "$(cat .codex/agents/test-code-generator.md)"\n```',
8177
8011
  INVOKE_TEAM_COMMUNICATOR: 'Run the team-communicator agent:\n```bash\ncodex -p "$(cat .codex/agents/team-communicator.md)"\n```',
@@ -8195,7 +8029,7 @@ function getToolString(toolId, key) {
8195
8029
  function replaceInvocationPlaceholders(content, toolId, isLocal = false) {
8196
8030
  let result = content;
8197
8031
  const keys = [
8198
- "INVOKE_TEST_RUNNER",
8032
+ "INVOKE_BROWSER_AUTOMATION",
8199
8033
  "INVOKE_TEST_DEBUGGER_FIXER",
8200
8034
  "INVOKE_TEST_CODE_GENERATOR",
8201
8035
  "INVOKE_TEAM_COMMUNICATOR",
@@ -9106,7 +8940,7 @@ async function firstTimeSetup(cliSubagents) {
9106
8940
  spinner = (0, import_ora2.default)("Updating .gitignore").start();
9107
8941
  await updateGitignore();
9108
8942
  spinner.succeed(import_chalk2.default.green("Updated .gitignore"));
9109
- if (subagents["test-runner"] && !isPlaywrightScaffolded(process.cwd())) {
8943
+ if (subagents["browser-automation"] && !isPlaywrightScaffolded(process.cwd())) {
9110
8944
  await scaffoldPlaywrightProject({
9111
8945
  projectName,
9112
8946
  targetDir: process.cwd(),
@@ -9122,7 +8956,7 @@ async function firstTimeSetup(cliSubagents) {
9122
8956
  console.log(import_chalk2.default.gray(" \u2022 Testing conventions\n"));
9123
8957
  console.log(import_chalk2.default.yellow("Next steps:"));
9124
8958
  console.log(import_chalk2.default.white("1. Edit .env and add your API tokens"));
9125
- if (subagents["test-runner"]) {
8959
+ if (subagents["browser-automation"]) {
9126
8960
  console.log(import_chalk2.default.white("2. npx playwright install (install browser binaries)"));
9127
8961
  console.log(import_chalk2.default.white("3. Edit .bugzy/runtime/project-context.md"));
9128
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)"));