Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

checklist.md 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. # Automate Workflow Validation Checklist
  2. Use this checklist to validate that the automate workflow has been executed correctly and all deliverables meet quality standards.
  3. ## Prerequisites
  4. Before starting this workflow, verify:
  5. - [ ] Framework scaffolding configured (playwright.config.ts or cypress.config.ts exists)
  6. - [ ] Test directory structure exists (tests/ folder with subdirectories)
  7. - [ ] Package.json has test framework dependencies installed
  8. **Halt only if:** Framework scaffolding is completely missing (run `framework` workflow first)
  9. **Note:** BMad artifacts (story, tech-spec, PRD) are OPTIONAL - workflow can run without them
  10. **Note:** `automate` generates tests; it does not run `*atdd` or `*test-review`. If ATDD outputs exist, use them as input and avoid duplicate coverage.
  11. ---
  12. ## Step 1: Execution Mode Determination and Context Loading
  13. ### Mode Detection
  14. - [ ] Execution mode correctly determined:
  15. - [ ] BMad-Integrated Mode (story_file variable set) OR
  16. - [ ] Standalone Mode (target_feature or target_files set) OR
  17. - [ ] Auto-discover Mode (no targets specified)
  18. ### BMad Artifacts (If Available - OPTIONAL)
  19. - [ ] Story markdown loaded (if `{story_file}` provided)
  20. - [ ] Acceptance criteria extracted from story (if available)
  21. - [ ] Tech-spec.md loaded (if `{use_tech_spec}` true and file exists)
  22. - [ ] Test-design.md loaded (if `{use_test_design}` true and file exists)
  23. - [ ] PRD.md loaded (if `{use_prd}` true and file exists)
  24. - [ ] **Note**: Absence of BMad artifacts does NOT halt workflow
  25. ### Framework Configuration
  26. - [ ] Test framework config loaded (playwright.config.ts or cypress.config.ts)
  27. - [ ] Test directory structure identified from `{test_dir}`
  28. - [ ] Existing test patterns reviewed
  29. - [ ] Test runner capabilities noted (parallel execution, fixtures, etc.)
  30. ### Coverage Analysis
  31. - [ ] Existing test files searched in `{test_dir}` (if `{analyze_coverage}` true)
  32. - [ ] Tested features vs untested features identified
  33. - [ ] Coverage gaps mapped (tests to source files)
  34. - [ ] Existing fixture and factory patterns checked
  35. ### Knowledge Base Fragments Loaded
  36. - [ ] `test-levels-framework.md` - Test level selection
  37. - [ ] `test-priorities.md` - Priority classification (P0-P3)
  38. - [ ] `fixture-architecture.md` - Fixture patterns with auto-cleanup
  39. - [ ] `data-factories.md` - Factory patterns using faker
  40. - [ ] `selective-testing.md` - Targeted test execution strategies
  41. - [ ] `ci-burn-in.md` - Flaky test detection patterns
  42. - [ ] `test-quality.md` - Test design principles
  43. ---
  44. ## Step 2: Automation Targets Identification
  45. ### Target Determination
  46. **BMad-Integrated Mode (if story available):**
  47. - [ ] Acceptance criteria mapped to test scenarios
  48. - [ ] Features implemented in story identified
  49. - [ ] Existing ATDD tests checked (if any)
  50. - [ ] Expansion beyond ATDD planned (edge cases, negative paths)
  51. **Standalone Mode (if no story):**
  52. - [ ] Specific feature analyzed (if `{target_feature}` specified)
  53. - [ ] Specific files analyzed (if `{target_files}` specified)
  54. - [ ] Features auto-discovered (if `{auto_discover_features}` true)
  55. - [ ] Features prioritized by:
  56. - [ ] No test coverage (highest priority)
  57. - [ ] Complex business logic
  58. - [ ] External integrations (API, database, auth)
  59. - [ ] Critical user paths (login, checkout, etc.)
  60. ### Test Level Selection
  61. - [ ] Test level selection framework applied (from `test-levels-framework.md`)
  62. - [ ] E2E tests identified: Critical user journeys, multi-system integration
  63. - [ ] API tests identified: Business logic, service contracts, data transformations
  64. - [ ] Component tests identified: UI behavior, interactions, state management
  65. - [ ] Unit tests identified: Pure logic, edge cases, error handling
  66. ### Duplicate Coverage Avoidance
  67. - [ ] Same behavior NOT tested at multiple levels unnecessarily
  68. - [ ] E2E used for critical happy path only
  69. - [ ] API tests used for business logic variations
  70. - [ ] Component tests used for UI interaction edge cases
  71. - [ ] Unit tests used for pure logic edge cases
  72. ### Priority Assignment
  73. - [ ] Test priorities assigned using `test-priorities.md` framework
  74. - [ ] P0 tests: Critical paths, security-critical, data integrity
  75. - [ ] P1 tests: Important features, integration points, error handling
  76. - [ ] P2 tests: Edge cases, less-critical variations, performance
  77. - [ ] P3 tests: Nice-to-have, rarely-used features, exploratory
  78. - [ ] Priority variables respected:
  79. - [ ] `{include_p0}` = true (always include)
  80. - [ ] `{include_p1}` = true (high priority)
  81. - [ ] `{include_p2}` = true (medium priority)
  82. - [ ] `{include_p3}` = false (low priority, skip by default)
  83. ### Coverage Plan Created
  84. - [ ] Test coverage plan documented
  85. - [ ] What will be tested at each level listed
  86. - [ ] Priorities assigned to each test
  87. - [ ] Coverage strategy clear (critical-paths, comprehensive, or selective)
  88. ---
  89. ## Step 3: Test Infrastructure Generated
  90. ### Fixture Architecture
  91. - [ ] Existing fixtures checked in `tests/support/fixtures/`
  92. - [ ] Fixture architecture created/enhanced (if `{generate_fixtures}` true)
  93. - [ ] All fixtures use Playwright's `test.extend()` pattern
  94. - [ ] All fixtures have auto-cleanup in teardown
  95. - [ ] Common fixtures created/enhanced:
  96. - [ ] authenticatedUser (with auto-delete)
  97. - [ ] apiRequest (authenticated client)
  98. - [ ] mockNetwork (external service mocking)
  99. - [ ] testDatabase (with auto-cleanup)
  100. ### Data Factories
  101. - [ ] Existing factories checked in `tests/support/factories/`
  102. - [ ] Factory architecture created/enhanced (if `{generate_factories}` true)
  103. - [ ] All factories use `@faker-js/faker` for random data (no hardcoded values)
  104. - [ ] All factories support overrides for specific scenarios
  105. - [ ] Common factories created/enhanced:
  106. - [ ] User factory (email, password, name, role)
  107. - [ ] Product factory (name, price, SKU)
  108. - [ ] Order factory (items, total, status)
  109. - [ ] Cleanup helpers provided (e.g., deleteUser(), deleteProduct())
  110. ### Helper Utilities
  111. - [ ] Existing helpers checked in `tests/support/helpers/` (if `{update_helpers}` true)
  112. - [ ] Common utilities created/enhanced:
  113. - [ ] waitFor (polling for complex conditions)
  114. - [ ] retry (retry helper for flaky operations)
  115. - [ ] testData (test data generation)
  116. - [ ] assertions (custom assertion helpers)
  117. ---
  118. ## Step 4: Test Files Generated
  119. ### Test File Structure
  120. - [ ] Test files organized correctly:
  121. - [ ] `tests/e2e/` for E2E tests
  122. - [ ] `tests/api/` for API tests
  123. - [ ] `tests/component/` for component tests
  124. - [ ] `tests/unit/` for unit tests
  125. - [ ] `tests/support/` for fixtures/factories/helpers
  126. ### E2E Tests (If Applicable)
  127. - [ ] E2E test files created in `tests/e2e/`
  128. - [ ] All tests follow Given-When-Then format
  129. - [ ] All tests have priority tags ([P0], [P1], [P2], [P3]) in test name
  130. - [ ] All tests use data-testid selectors (not CSS classes)
  131. - [ ] One assertion per test (atomic design)
  132. - [ ] No hard waits or sleeps (explicit waits only)
  133. - [ ] Network-first pattern applied (route interception BEFORE navigation)
  134. - [ ] Clear Given-When-Then comments in test code
  135. ### API Tests (If Applicable)
  136. - [ ] API test files created in `tests/api/`
  137. - [ ] All tests follow Given-When-Then format
  138. - [ ] All tests have priority tags in test name
  139. - [ ] API contracts validated (request/response structure)
  140. - [ ] HTTP status codes verified
  141. - [ ] Response body validation includes required fields
  142. - [ ] Error cases tested (400, 401, 403, 404, 500)
  143. - [ ] JWT token format validated (if auth tests)
  144. ### Consumer Contract Tests / CDC (If `use_pactjs_utils` Enabled)
  145. **Provider Endpoint Comments:**
  146. - [ ] Every Pact interaction has `// Provider endpoint:` comment
  147. - [ ] Comment includes exact file path to provider route handler, OR uses the TODO form when provider is inaccessible
  148. - [ ] Comment follows format: `// Provider endpoint: <path> -> <METHOD> <route>` or `// Provider endpoint: TODO — provider source not accessible, verify manually`
  149. **Provider Source Scrutiny:**
  150. - [ ] Provider route handlers and/or OpenAPI spec read before generating each interaction
  151. - [ ] Status codes verified against provider source (e.g., 201 not assumed 200)
  152. - [ ] Field names cross-referenced with provider type/DTO definitions
  153. - [ ] Data types verified (string ID vs number ID, date formats)
  154. - [ ] Enum/union values extracted from provider validation schemas
  155. - [ ] Required request fields and headers checked against provider validation
  156. - [ ] Nested response structures match provider's actual response construction
  157. - [ ] Scrutiny evidence documented as block comment in each test file
  158. **CDC Quality Gates:**
  159. - [ ] Postel's Law enforced: exact values in `withRequest`, matchers in `willRespondWith`
  160. - [ ] Response matchers (`like`, `eachLike`, `string`, `integer`) used only in `willRespondWith`
  161. - [ ] Provider state names are consistent with provider's state handler naming
  162. - [ ] DI pattern used for consumer function imports (actual consumer code, not raw `fetch()`)
  163. - [ ] One logical endpoint per Pact interaction (no multi-endpoint interactions)
  164. ### Component Tests (If Applicable)
  165. - [ ] Component test files created in `tests/component/`
  166. - [ ] All tests follow Given-When-Then format
  167. - [ ] All tests have priority tags in test name
  168. - [ ] Component mounting works correctly
  169. - [ ] Interaction testing covers user actions (click, hover, keyboard)
  170. - [ ] State management validated
  171. - [ ] Props and events tested
  172. ### Unit Tests (If Applicable)
  173. - [ ] Unit test files created in `tests/unit/`
  174. - [ ] All tests follow Given-When-Then format
  175. - [ ] All tests have priority tags in test name
  176. - [ ] Pure logic tested (no dependencies)
  177. - [ ] Edge cases covered
  178. - [ ] Error handling tested
  179. ### Quality Standards Enforced
  180. - [ ] All tests use Given-When-Then format with clear comments
  181. - [ ] All tests have descriptive names with priority tags
  182. - [ ] No duplicate tests (same behavior tested multiple times)
  183. - [ ] No flaky patterns (race conditions, timing issues)
  184. - [ ] No test interdependencies (tests can run in any order)
  185. - [ ] Tests are deterministic (same input always produces same result)
  186. - [ ] All tests use data-testid selectors (E2E tests)
  187. - [ ] No hard waits: `await page.waitForTimeout()` (forbidden)
  188. - [ ] No conditional flow: `if (await element.isVisible())` (forbidden)
  189. - [ ] No try-catch for test logic (only for cleanup)
  190. - [ ] No hardcoded test data (use factories with faker)
  191. - [ ] No page object classes (tests are direct and simple)
  192. - [ ] No shared state between tests
  193. ### Network-First Pattern Applied
  194. - [ ] Route interception set up BEFORE navigation (E2E tests with network requests)
  195. - [ ] `page.route()` called before `page.goto()` to prevent race conditions
  196. - [ ] Network-first pattern verified in all E2E tests that make API calls
  197. ---
  198. ## Step 5: Test Validation and Healing (NEW - Phase 2.5)
  199. ### Healing Configuration
  200. - [ ] Healing configuration checked:
  201. - [ ] `{auto_validate}` setting noted (default: true)
  202. - [ ] `{auto_heal_failures}` setting noted (default: false)
  203. - [ ] `{max_healing_iterations}` setting noted (default: 3)
  204. - [ ] `{use_mcp_healing}` setting noted (default: true)
  205. ### Healing Knowledge Fragments Loaded (If Healing Enabled)
  206. - [ ] `test-healing-patterns.md` loaded (common failure patterns and fixes)
  207. - [ ] `selector-resilience.md` loaded (selector refactoring guide)
  208. - [ ] `timing-debugging.md` loaded (race condition fixes)
  209. ### Test Execution and Validation
  210. - [ ] Generated tests executed (if `{auto_validate}` true)
  211. - [ ] Test results captured:
  212. - [ ] Total tests run
  213. - [ ] Passing tests count
  214. - [ ] Failing tests count
  215. - [ ] Error messages and stack traces captured
  216. ### Healing Loop (If Enabled and Tests Failed)
  217. - [ ] Healing loop entered (if `{auto_heal_failures}` true AND tests failed)
  218. - [ ] For each failing test:
  219. - [ ] Failure pattern identified (selector, timing, data, network, hard wait)
  220. - [ ] Appropriate healing strategy applied:
  221. - [ ] Stale selector → Replaced with data-testid or ARIA role
  222. - [ ] Race condition → Added network-first interception or state waits
  223. - [ ] Dynamic data → Replaced hardcoded values with regex/dynamic generation
  224. - [ ] Network error → Added route mocking
  225. - [ ] Hard wait → Replaced with event-based wait
  226. - [ ] Healed test re-run to validate fix
  227. - [ ] Iteration count tracked (max 3 attempts)
  228. ### Unfixable Tests Handling
  229. - [ ] Tests that couldn't be healed after 3 iterations marked with `test.fixme()` (if `{mark_unhealable_as_fixme}` true)
  230. - [ ] Detailed comment added to test.fixme() tests:
  231. - [ ] What failure occurred
  232. - [ ] What healing was attempted (3 iterations)
  233. - [ ] Why healing failed
  234. - [ ] Manual investigation steps needed
  235. - [ ] Original test logic preserved in comments
  236. ### Healing Report Generated
  237. - [ ] Healing report generated (if healing attempted)
  238. - [ ] Report includes:
  239. - [ ] Auto-heal enabled status
  240. - [ ] Healing mode (MCP-assisted or Pattern-based)
  241. - [ ] Iterations allowed (max_healing_iterations)
  242. - [ ] Validation results (total, passing, failing)
  243. - [ ] Successfully healed tests (count, file:line, fix applied)
  244. - [ ] Unable to heal tests (count, file:line, reason)
  245. - [ ] Healing patterns applied (selector fixes, timing fixes, data fixes)
  246. - [ ] Knowledge base references used
  247. ---
  248. ## Step 6: Documentation and Scripts Updated
  249. ### Test README Updated
  250. - [ ] `tests/README.md` created or updated (if `{update_readme}` true)
  251. - [ ] Test suite structure overview included
  252. - [ ] Test execution instructions provided (all, specific files, by priority)
  253. - [ ] Fixture usage examples provided
  254. - [ ] Factory usage examples provided
  255. - [ ] Priority tagging convention explained ([P0], [P1], [P2], [P3])
  256. - [ ] How to write new tests documented
  257. - [ ] Common patterns documented
  258. - [ ] Anti-patterns documented (what to avoid)
  259. ### package.json Scripts Updated
  260. - [ ] package.json scripts added/updated (if `{update_package_scripts}` true)
  261. - [ ] `test:e2e` script for all E2E tests
  262. - [ ] `test:e2e:p0` script for P0 tests only
  263. - [ ] `test:e2e:p1` script for P0 + P1 tests
  264. - [ ] `test:api` script for API tests
  265. - [ ] `test:component` script for component tests
  266. - [ ] `test:unit` script for unit tests (if applicable)
  267. ### Test Suite Executed
  268. - [ ] Test suite run locally (if `{run_tests_after_generation}` true)
  269. - [ ] Test results captured (passing/failing counts)
  270. - [ ] No flaky patterns detected (tests are deterministic)
  271. - [ ] Setup requirements documented (if any)
  272. - [ ] Known issues documented (if any)
  273. ---
  274. ## Step 6: Automation Summary Generated
  275. ### Automation Summary Document
  276. - [ ] Output file created at `{output_summary}`
  277. - [ ] Document includes execution mode (BMad-Integrated, Standalone, Auto-discover)
  278. - [ ] Feature analysis included (source files, coverage gaps) - Standalone mode
  279. - [ ] Tests created listed (E2E, API, Component, Unit) with counts and paths
  280. - [ ] Infrastructure created listed (fixtures, factories, helpers)
  281. - [ ] Test execution instructions provided
  282. - [ ] Coverage analysis included:
  283. - [ ] Total test count
  284. - [ ] Priority breakdown (P0, P1, P2, P3 counts)
  285. - [ ] Test level breakdown (E2E, API, Component, Unit counts)
  286. - [ ] Coverage percentage (if calculated)
  287. - [ ] Coverage status (acceptance criteria covered, gaps identified)
  288. - [ ] Definition of Done checklist included
  289. - [ ] Next steps provided
  290. - [ ] Recommendations included (if Standalone mode)
  291. ### Summary Provided to User
  292. - [ ] Concise summary output provided
  293. - [ ] Total tests created across test levels
  294. - [ ] Priority breakdown (P0, P1, P2, P3 counts)
  295. - [ ] Infrastructure counts (fixtures, factories, helpers)
  296. - [ ] Test execution command provided
  297. - [ ] Output file path provided
  298. - [ ] Next steps listed
  299. ---
  300. ## Quality Checks
  301. ### Test Design Quality
  302. - [ ] Tests are readable (clear Given-When-Then structure)
  303. - [ ] Tests are maintainable (use factories/fixtures, not hardcoded data)
  304. - [ ] Tests are isolated (no shared state between tests)
  305. - [ ] Tests are deterministic (no race conditions or flaky patterns)
  306. - [ ] Tests are atomic (one assertion per test)
  307. - [ ] Tests are fast (no unnecessary waits or delays)
  308. - [ ] Tests are lean (files under {max_file_lines} lines)
  309. ### Knowledge Base Integration
  310. - [ ] Test level selection framework applied (from `test-levels-framework.md`)
  311. - [ ] Priority classification applied (from `test-priorities.md`)
  312. - [ ] Fixture architecture patterns applied (from `fixture-architecture.md`)
  313. - [ ] Data factory patterns applied (from `data-factories.md`)
  314. - [ ] Selective testing strategies considered (from `selective-testing.md`)
  315. - [ ] Flaky test detection patterns considered (from `ci-burn-in.md`)
  316. - [ ] Test quality principles applied (from `test-quality.md`)
  317. ### Code Quality
  318. - [ ] All TypeScript types are correct and complete
  319. - [ ] No linting errors in generated test files
  320. - [ ] Consistent naming conventions followed
  321. - [ ] Imports are organized and correct
  322. - [ ] Code follows project style guide
  323. - [ ] No console.log or debug statements in test code
  324. ---
  325. ## Integration Points
  326. ### With Framework Workflow
  327. - [ ] Test framework configuration detected and used
  328. - [ ] Directory structure matches framework setup
  329. - [ ] Fixtures and helpers follow established patterns
  330. - [ ] Naming conventions consistent with framework standards
  331. ### With BMad Workflows (If Available - OPTIONAL)
  332. **With Story Workflow:**
  333. - [ ] Story ID correctly referenced in output (if story available)
  334. - [ ] Acceptance criteria from story reflected in tests (if story available)
  335. - [ ] Technical constraints from story considered (if story available)
  336. **With test-design Workflow:**
  337. - [ ] P0 scenarios from test-design prioritized (if test-design available)
  338. - [ ] Risk assessment from test-design considered (if test-design available)
  339. - [ ] Coverage strategy aligned with test-design (if test-design available)
  340. **With atdd Workflow:**
  341. - [ ] ATDD artifacts provided or located (manual handoff; `atdd` not auto-run)
  342. - [ ] Existing ATDD tests checked (if story had ATDD workflow run)
  343. - [ ] Expansion beyond ATDD planned (edge cases, negative paths)
  344. - [ ] No duplicate coverage with ATDD tests
  345. ### With CI Pipeline
  346. - [ ] Tests can run in CI environment
  347. - [ ] Tests are parallelizable (no shared state)
  348. - [ ] Tests have appropriate timeouts
  349. - [ ] Tests clean up their data (no CI environment pollution)
  350. ---
  351. ## Completion Criteria
  352. All of the following must be true before marking this workflow as complete:
  353. - [ ] **Execution mode determined** (BMad-Integrated, Standalone, or Auto-discover)
  354. - [ ] **Framework configuration loaded** and validated
  355. - [ ] **Coverage analysis completed** (gaps identified if analyze_coverage true)
  356. - [ ] **Automation targets identified** (what needs testing)
  357. - [ ] **Test levels selected** appropriately (E2E, API, Component, Unit)
  358. - [ ] **Duplicate coverage avoided** (same behavior not tested at multiple levels)
  359. - [ ] **Test priorities assigned** (P0, P1, P2, P3)
  360. - [ ] **Fixture architecture created/enhanced** with auto-cleanup
  361. - [ ] **Data factories created/enhanced** using faker (no hardcoded data)
  362. - [ ] **Helper utilities created/enhanced** (if needed)
  363. - [ ] **Test files generated** at appropriate levels (E2E, API, Component, Unit)
  364. - [ ] **Given-When-Then format used** consistently across all tests
  365. - [ ] **Priority tags added** to all test names ([P0], [P1], [P2], [P3])
  366. - [ ] **data-testid selectors used** in E2E tests (not CSS classes)
  367. - [ ] **Network-first pattern applied** (route interception before navigation)
  368. - [ ] **Quality standards enforced** (no hard waits, no flaky patterns, self-cleaning, deterministic)
  369. - [ ] **Test README updated** with execution instructions and patterns
  370. - [ ] **package.json scripts updated** with test execution commands
  371. - [ ] **Test suite run locally** (if run_tests_after_generation true)
  372. - [ ] **Tests validated** (if auto_validate enabled)
  373. - [ ] **Failures healed** (if auto_heal_failures enabled and tests failed)
  374. - [ ] **Healing report generated** (if healing attempted)
  375. - [ ] **Unfixable tests marked** with test.fixme() and detailed comments (if any)
  376. - [ ] **Automation summary created** and saved to correct location
  377. - [ ] **Output file formatted correctly**
  378. - [ ] **Knowledge base references applied** and documented (including healing fragments if used)
  379. - [ ] **No test quality issues** (flaky patterns, race conditions, hardcoded data, page objects)
  380. - [ ] **Provider scrutiny completed or gracefully degraded** for all CDC interactions — each interaction either has scrutiny evidence or a TODO marker (if `use_pactjs_utils` enabled)
  381. - [ ] **Provider endpoint comments present** on every Pact interaction (if `use_pactjs_utils` enabled)
  382. ---
  383. ## Common Issues and Resolutions
  384. ### Issue: BMad artifacts not found
  385. **Problem:** Story, tech-spec, or PRD files not found when variables are set.
  386. **Resolution:**
  387. - **automate does NOT require BMad artifacts** - they are OPTIONAL enhancements
  388. - If files not found, switch to Standalone Mode automatically
  389. - Analyze source code directly without BMad context
  390. - Continue workflow without halting
  391. ### Issue: Framework configuration not found
  392. **Problem:** No playwright.config.ts or cypress.config.ts found.
  393. **Resolution:**
  394. - **HALT workflow** - framework is required
  395. - Message: "Framework scaffolding required. Run `bmad tea *framework` first."
  396. - User must run framework workflow before automate
  397. ### Issue: No automation targets identified
  398. **Problem:** Neither story, target_feature, nor target_files specified, and auto-discover finds nothing.
  399. **Resolution:**
  400. - Check if source_dir variable is correct
  401. - Verify source code exists in project
  402. - Ask user to specify target_feature or target_files explicitly
  403. - Provide examples: `target_feature: "src/auth/"` or `target_files: "src/auth/login.ts,src/auth/session.ts"`
  404. ### Issue: Duplicate coverage detected
  405. **Problem:** Same behavior tested at multiple levels (E2E + API + Component).
  406. **Resolution:**
  407. - Review test level selection framework (test-levels-framework.md)
  408. - Use E2E for critical happy path ONLY
  409. - Use API for business logic variations
  410. - Use Component for UI edge cases
  411. - Remove redundant tests that duplicate coverage
  412. ### Issue: Tests have hardcoded data
  413. **Problem:** Tests use hardcoded email addresses, passwords, or other data.
  414. **Resolution:**
  415. - Replace all hardcoded data with factory function calls
  416. - Use faker for all random data generation
  417. - Update data-factories to support all required test scenarios
  418. - Example: `createUser({ email: faker.internet.email() })`
  419. ### Issue: Tests are flaky
  420. **Problem:** Tests fail intermittently, pass on retry.
  421. **Resolution:**
  422. - Remove all hard waits (`page.waitForTimeout()`)
  423. - Use explicit waits (`page.waitForSelector()`)
  424. - Apply network-first pattern (route interception before navigation)
  425. - Remove conditional flow (`if (await element.isVisible())`)
  426. - Ensure tests are deterministic (no race conditions)
  427. - Run burn-in loop (10 iterations) to detect flakiness
  428. ### Issue: Fixtures don't clean up data
  429. **Problem:** Test data persists after test run, causing test pollution.
  430. **Resolution:**
  431. - Ensure all fixtures have cleanup in teardown phase
  432. - Cleanup happens AFTER `await use(data)`
  433. - Call deletion/cleanup functions (deleteUser, deleteProduct, etc.)
  434. - Verify cleanup works by checking database/storage after test run
  435. ### Issue: Tests too slow
  436. **Problem:** Tests take longer than 90 seconds (max_test_duration).
  437. **Resolution:**
  438. - Remove unnecessary waits and delays
  439. - Use parallel execution where possible
  440. - Mock external services (don't make real API calls)
  441. - Use API tests instead of E2E for business logic
  442. - Optimize test data creation (use in-memory database, etc.)
  443. ---
  444. ## Notes for TEA Agent
  445. - **automate is flexible:** Can work with or without BMad artifacts (story, tech-spec, PRD are OPTIONAL)
  446. - **Standalone mode is powerful:** Analyze any codebase and generate tests independently
  447. - **Auto-discover mode:** Scan codebase for features needing tests when no targets specified
  448. - **Framework is the ONLY hard requirement:** HALT if framework config missing, otherwise proceed
  449. - **Avoid duplicate coverage:** E2E for critical paths only, API/Component for variations
  450. - **Priority tagging enables selective execution:** P0 tests run on every commit, P1 on PR, P2 nightly
  451. - **Network-first pattern prevents race conditions:** Route interception BEFORE navigation
  452. - **No page objects:** Keep tests simple, direct, and maintainable
  453. - **Use knowledge base:** Load relevant fragments (test-levels, test-priorities, fixture-architecture, data-factories, healing patterns) for guidance
  454. - **Deterministic tests only:** No hard waits, no conditional flow, no flaky patterns allowed
  455. - **Optional healing:** auto_heal_failures disabled by default (opt-in for automatic test healing)
  456. - **Graceful degradation:** Healing works without Playwright MCP (pattern-based fallback)
  457. - **Unfixable tests handled:** Mark with test.fixme() and detailed comments (not silently broken)