Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. ---
  2. name: 'step-02-load-context'
  3. description: 'Load documents, configuration, and knowledge fragments for the chosen mode'
  4. nextStepFile: '{skill-root}/steps-c/step-03-risk-and-testability.md'
  5. knowledgeIndex: './resources/tea-index.csv'
  6. outputFile: '{test_artifacts}/test-design-progress.md'
  7. ---
  8. # Step 2: Load Context & Knowledge Base
  9. ## STEP GOAL
  10. Load the required documents, config flags, and knowledge fragments needed to produce accurate test design outputs.
  11. ## MANDATORY EXECUTION RULES
  12. - 📖 Read the entire step file before acting
  13. - ✅ Speak in `{communication_language}`
  14. - 🎯 Only load artifacts required for the selected mode
  15. ---
  16. ## EXECUTION PROTOCOLS:
  17. - 🎯 Follow the MANDATORY SEQUENCE exactly
  18. - 💾 Record outputs before proceeding
  19. - 📖 Load the next step only when instructed
  20. ## CONTEXT BOUNDARIES:
  21. - Available context: config, loaded artifacts, and knowledge fragments
  22. - Focus: this step's goal only
  23. - Limits: do not execute future steps
  24. - Dependencies: prior steps' outputs (if any)
  25. ## MANDATORY SEQUENCE
  26. **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
  27. ## 1. Load Configuration
  28. From `{config_source}`:
  29. - Read `tea_use_playwright_utils`
  30. - Read `tea_use_pactjs_utils`
  31. - Read `tea_pact_mcp`
  32. - Read `tea_browser_automation`
  33. - Read `test_stack_type` (if not set, default to `"auto"`)
  34. - Note `test_artifacts`
  35. **Stack Detection** (for context-aware loading):
  36. If `test_stack_type` is `"auto"` or not configured, infer `{detected_stack}` by scanning `{project-root}`:
  37. - **Frontend indicators**: `playwright.config.*`, `cypress.config.*`, `package.json` with react/vue/angular
  38. - **Backend indicators**: `pyproject.toml`, `pom.xml`/`build.gradle`, `go.mod`, `*.csproj`, `Gemfile`, `Cargo.toml`
  39. - **Both present** → `fullstack`; only frontend → `frontend`; only backend → `backend`
  40. - Explicit `test_stack_type` overrides auto-detection
  41. ---
  42. ## 2. Load Project Artifacts (Mode-Specific)
  43. ### System-Level Mode (Phase 3)
  44. Load:
  45. - PRD (FRs + NFRs)
  46. - ADRs or architecture decisions
  47. - Architecture / tech-spec document
  48. - Epics (for scope)
  49. Extract:
  50. - Tech stack & dependencies
  51. - Integration points
  52. - NFRs (performance, security, reliability, compliance)
  53. - NFR thresholds and missing threshold questions
  54. ### Epic-Level Mode (Phase 4)
  55. Load:
  56. - Epic and story docs with acceptance criteria
  57. - PRD (if available)
  58. - Architecture / tech-spec (if available)
  59. - Prior system-level test-design outputs (if available)
  60. Extract:
  61. - Testable requirements
  62. - Integration points
  63. - Known coverage gaps
  64. ---
  65. ## 3. Analyze Existing Test Coverage (Epic-Level)
  66. If epic-level:
  67. - Scan the repository for existing tests (search for `tests/`, `spec`, `e2e`, `api` folders)
  68. - Identify coverage gaps and flaky areas
  69. - Note existing fixture and test patterns
  70. ### Browser Exploration (if `tea_browser_automation` is `cli` or `auto`)
  71. > **Fallback:** If CLI is not installed, fall back to MCP (if available) or skip browser exploration and rely on code/doc analysis.
  72. **CLI Exploration Steps:**
  73. All commands use the same named session to target the correct browser:
  74. 1. `playwright-cli -s=tea-explore open <target_url>`
  75. 2. `playwright-cli -s=tea-explore snapshot` → capture page structure and element refs
  76. 3. `playwright-cli -s=tea-explore screenshot --filename={test_artifacts}/exploration/explore-<page>.png`
  77. 4. Analyze snapshot output to identify testable elements and flows
  78. 5. `playwright-cli -s=tea-explore close`
  79. Store artifacts under `{test_artifacts}/exploration/`
  80. > **Session Hygiene:** Always close sessions using `playwright-cli -s=tea-explore close`. Do NOT use `close-all` — it kills every session on the machine and breaks parallel execution.
  81. ---
  82. ### Tiered Knowledge Loading
  83. Load fragments based on their `tier` classification in `tea-index.csv`:
  84. 1. **Core tier** (always load): Foundational fragments required for this workflow
  85. 2. **Extended tier** (load on-demand): Load when deeper analysis is needed or when the user's context requires it
  86. 3. **Specialized tier** (load only when relevant): Load only when the specific use case matches (e.g., contract-testing only for microservices, email-auth only for email flows)
  87. > **Context Efficiency**: Loading only core fragments reduces context usage by 40-50% compared to loading all fragments.
  88. ### Playwright Utils Loading Profiles
  89. **If `tea_use_playwright_utils` is enabled**, select the appropriate loading profile:
  90. - **API-only profile** (when `{detected_stack}` is `backend` or no `page.goto`/`page.locator` found in test files):
  91. Load: `overview`, `api-request`, `auth-session`, `recurse` (~1,800 lines)
  92. - **Full UI+API profile** (when `{detected_stack}` is `frontend`/`fullstack` or browser tests detected):
  93. Load: all Playwright Utils core fragments (~4,500 lines)
  94. **Detection**: Scan `{test_dir}` for files containing `page.goto` or `page.locator`. If none found, use API-only profile.
  95. ### Pact.js Utils Loading
  96. **If `tea_use_pactjs_utils` is enabled** (and `{detected_stack}` is `backend` or `fullstack`, or microservices indicators detected):
  97. Load: `pactjs-utils-overview.md`, `pactjs-utils-consumer-helpers.md`, `pactjs-utils-provider-verifier.md`, `pactjs-utils-request-filter.md`
  98. **If `tea_use_pactjs_utils` is disabled** but contract testing is relevant:
  99. Load: `contract-testing.md`
  100. ### Pact MCP Loading
  101. **If `tea_pact_mcp` is `"mcp"`:**
  102. Load: `pact-mcp.md` — enables agent to use SmartBear MCP "Fetch Provider States" and "Matrix" tools to understand existing contract landscape during test design.
  103. ## 4. Load Knowledge Base Fragments
  104. Use `{knowledgeIndex}` to select and load only relevant fragments.
  105. ### System-Level Mode (Required)
  106. - `adr-quality-readiness-checklist.md`
  107. - `nfr-criteria.md`
  108. - `test-levels-framework.md`
  109. - `risk-governance.md`
  110. - `test-quality.md`
  111. ### Epic-Level Mode (Required)
  112. - `risk-governance.md`
  113. - `probability-impact.md`
  114. - `test-levels-framework.md`
  115. - `test-priorities-matrix.md`
  116. **Epic-Level NFR Loading:**
  117. - Load `nfr-criteria.md` when the epic/story includes security, performance, reliability, scalability, compliance, maintainability, or operational requirements.
  118. - Use prior system-level NFR planning from `test-design-architecture.md` or `test-design-qa.md` if present.
  119. **Playwright CLI (if `tea_browser_automation` is "cli" or "auto"):**
  120. - `playwright-cli.md`
  121. **MCP Patterns (if `tea_browser_automation` is "mcp" or "auto"):**
  122. - (existing MCP-related fragments, if any are added in future)
  123. **Pact.js Utils (if enabled — both System-Level and Epic-Level):**
  124. - `pactjs-utils-overview.md`, `pactjs-utils-consumer-helpers.md`, `pactjs-utils-provider-verifier.md`, `pactjs-utils-request-filter.md`
  125. **Contract Testing (if pactjs-utils disabled but relevant):**
  126. - `contract-testing.md`
  127. **Pact MCP (if tea_pact_mcp is "mcp"):**
  128. - `pact-mcp.md`
  129. ---
  130. ## 5. Confirm Loaded Inputs
  131. Summarize what was loaded and confirm with the user if anything is missing.
  132. ---
  133. ### 6. Save Progress
  134. **Save this step's accumulated work to `{outputFile}`.**
  135. - **If `{outputFile}` does not exist** (first save), create it with YAML frontmatter:
  136. ```yaml
  137. ---
  138. workflowStatus: 'in-progress'
  139. totalSteps: 5
  140. stepsCompleted: ['step-02-load-context']
  141. lastStep: 'step-02-load-context'
  142. nextStep: '{nextStepFile}'
  143. lastSaved: '{date}'
  144. ---
  145. ```
  146. Then write this step's output below the frontmatter.
  147. - **If `{outputFile}` already exists**, update:
  148. - Set `workflowStatus: 'in-progress'`
  149. - Set `totalSteps: 5`
  150. - Add `'step-02-load-context'` to `stepsCompleted` array (only if not already present)
  151. - Set `lastStep: 'step-02-load-context'`
  152. - Set `nextStep: '{nextStepFile}'`
  153. - Set `lastSaved: '{date}'`
  154. - Append this step's output to the appropriate section of the document.
  155. **Update `inputDocuments`**: Set `inputDocuments` in the output template frontmatter to the list of artifact paths loaded in this step (e.g., knowledge fragments, test design documents, configuration files).
  156. Load next step: `{nextStepFile}`
  157. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS:
  158. ### ✅ SUCCESS:
  159. - Step completed in full with required outputs
  160. ### ❌ SYSTEM FAILURE:
  161. - Skipped sequence steps or missing outputs
  162. **Master Rule:** Skipping steps is FORBIDDEN.