qa-skills 3.0.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.
Files changed (262) hide show
  1. package/README.md +168 -0
  2. package/bin/cli.js +42 -0
  3. package/dist/agents/registry.d.ts +5 -0
  4. package/dist/agents/registry.d.ts.map +1 -0
  5. package/dist/agents/registry.js +101 -0
  6. package/dist/agents/registry.js.map +1 -0
  7. package/dist/agents/types.d.ts +9 -0
  8. package/dist/agents/types.d.ts.map +1 -0
  9. package/dist/agents/types.js +2 -0
  10. package/dist/agents/types.js.map +1 -0
  11. package/dist/dependencies.d.ts +21 -0
  12. package/dist/dependencies.d.ts.map +1 -0
  13. package/dist/dependencies.js +125 -0
  14. package/dist/dependencies.js.map +1 -0
  15. package/dist/installer.d.ts +25 -0
  16. package/dist/installer.d.ts.map +1 -0
  17. package/dist/installer.js +437 -0
  18. package/dist/installer.js.map +1 -0
  19. package/dist/scaffold.d.ts +27 -0
  20. package/dist/scaffold.d.ts.map +1 -0
  21. package/dist/scaffold.js +182 -0
  22. package/dist/scaffold.js.map +1 -0
  23. package/package.json +40 -0
  24. package/skills/qa-accessibility-test-writer/SKILL.md +127 -0
  25. package/skills/qa-accessibility-test-writer/references/axe-core-patterns.md +349 -0
  26. package/skills/qa-accessibility-test-writer/references/best-practices.md +184 -0
  27. package/skills/qa-accessibility-test-writer/references/wcag-tests.md +331 -0
  28. package/skills/qa-api-contract-curator/SKILL.md +104 -0
  29. package/skills/qa-api-contract-curator/references/breaking-changes.md +363 -0
  30. package/skills/qa-api-contract-curator/references/openapi-structure.md +404 -0
  31. package/skills/qa-browser-data-collector/SKILL.md +132 -0
  32. package/skills/qa-browser-data-collector/references/data-collection-checklist.md +91 -0
  33. package/skills/qa-browser-data-collector/references/playwright-mcp-patterns.md +113 -0
  34. package/skills/qa-bug-ticket-creator/SKILL.md +148 -0
  35. package/skills/qa-bug-ticket-creator/references/bug-report-format.md +149 -0
  36. package/skills/qa-bug-ticket-creator/references/severity-guide.md +81 -0
  37. package/skills/qa-bug-ticket-creator/templates/bug-ticket-template.md +39 -0
  38. package/skills/qa-changelog-analyzer/SKILL.md +134 -0
  39. package/skills/qa-changelog-analyzer/references/git-analysis-patterns.md +138 -0
  40. package/skills/qa-changelog-analyzer/references/impact-mapping.md +120 -0
  41. package/skills/qa-clickup-integration/SKILL.md +166 -0
  42. package/skills/qa-clickup-integration/references/api-patterns.md +102 -0
  43. package/skills/qa-clickup-integration/references/field-mapping.md +71 -0
  44. package/skills/qa-codeceptjs-writer/SKILL.md +136 -0
  45. package/skills/qa-codeceptjs-writer/references/best-practices.md +207 -0
  46. package/skills/qa-codeceptjs-writer/references/config.md +255 -0
  47. package/skills/qa-codeceptjs-writer/references/patterns.md +285 -0
  48. package/skills/qa-coverage-analyzer/SKILL.md +166 -0
  49. package/skills/qa-coverage-analyzer/references/best-practices.md +142 -0
  50. package/skills/qa-coverage-analyzer/references/coverage-dimensions.md +155 -0
  51. package/skills/qa-coverage-analyzer/references/tools.md +204 -0
  52. package/skills/qa-cypress-writer/SKILL.md +134 -0
  53. package/skills/qa-cypress-writer/references/assertions.md +121 -0
  54. package/skills/qa-cypress-writer/references/best-practices.md +82 -0
  55. package/skills/qa-cypress-writer/references/config.md +121 -0
  56. package/skills/qa-cypress-writer/references/patterns.md +170 -0
  57. package/skills/qa-data-factory/SKILL.md +126 -0
  58. package/skills/qa-data-factory/references/factory-patterns.md +164 -0
  59. package/skills/qa-data-factory/references/faker-guide.md +131 -0
  60. package/skills/qa-diagram-generator/SKILL.md +125 -0
  61. package/skills/qa-diagram-generator/references/c4-model.md +53 -0
  62. package/skills/qa-diagram-generator/references/charts.md +58 -0
  63. package/skills/qa-diagram-generator/references/class-diagram.md +85 -0
  64. package/skills/qa-diagram-generator/references/er-diagram.md +69 -0
  65. package/skills/qa-diagram-generator/references/flowchart.md +92 -0
  66. package/skills/qa-diagram-generator/references/from-screenshot.md +45 -0
  67. package/skills/qa-diagram-generator/references/gantt.md +49 -0
  68. package/skills/qa-diagram-generator/references/journey.md +50 -0
  69. package/skills/qa-diagram-generator/references/mindmap.md +75 -0
  70. package/skills/qa-diagram-generator/references/sequence.md +69 -0
  71. package/skills/qa-diagram-generator/references/state-diagram.md +56 -0
  72. package/skills/qa-discovery-interview/SKILL.md +182 -0
  73. package/skills/qa-discovery-interview/references/completeness-checklist.md +53 -0
  74. package/skills/qa-discovery-interview/references/conflict-patterns.md +101 -0
  75. package/skills/qa-discovery-interview/references/qa-categories.md +147 -0
  76. package/skills/qa-discovery-interview/templates/qa-brief-template.md +168 -0
  77. package/skills/qa-environment-checker/SKILL.md +142 -0
  78. package/skills/qa-environment-checker/references/dependency-matrix.md +101 -0
  79. package/skills/qa-environment-checker/references/health-checks.md +209 -0
  80. package/skills/qa-environment-checker/templates/env-readiness-template.md +64 -0
  81. package/skills/qa-flaky-detector/SKILL.md +153 -0
  82. package/skills/qa-flaky-detector/references/ci-analysis.md +140 -0
  83. package/skills/qa-flaky-detector/references/flaky-patterns.md +247 -0
  84. package/skills/qa-github-issues-enhanced/SKILL.md +175 -0
  85. package/skills/qa-github-issues-enhanced/references/issue-templates.md +425 -0
  86. package/skills/qa-github-issues-enhanced/references/label-taxonomy.md +130 -0
  87. package/skills/qa-github-issues-enhanced/references/workflow-patterns.md +188 -0
  88. package/skills/qa-httpx-writer/SKILL.md +138 -0
  89. package/skills/qa-httpx-writer/references/assertions.md +195 -0
  90. package/skills/qa-httpx-writer/references/best-practices.md +140 -0
  91. package/skills/qa-httpx-writer/references/config.md +212 -0
  92. package/skills/qa-httpx-writer/references/patterns.md +262 -0
  93. package/skills/qa-jest-writer/SKILL.md +131 -0
  94. package/skills/qa-jest-writer/references/assertions.md +125 -0
  95. package/skills/qa-jest-writer/references/best-practices.md +136 -0
  96. package/skills/qa-jest-writer/references/config.md +134 -0
  97. package/skills/qa-jest-writer/references/patterns.md +172 -0
  98. package/skills/qa-jira-integration/SKILL.md +135 -0
  99. package/skills/qa-jira-integration/references/api-patterns.md +143 -0
  100. package/skills/qa-jira-integration/references/field-mapping.md +79 -0
  101. package/skills/qa-jira-integration/references/xray-integration.md +85 -0
  102. package/skills/qa-jmeter-writer/SKILL.md +171 -0
  103. package/skills/qa-jmeter-writer/references/best-practices.md +157 -0
  104. package/skills/qa-jmeter-writer/references/config.md +204 -0
  105. package/skills/qa-jmeter-writer/references/patterns.md +242 -0
  106. package/skills/qa-junit5-writer/SKILL.md +157 -0
  107. package/skills/qa-junit5-writer/references/assertions.md +118 -0
  108. package/skills/qa-junit5-writer/references/config.md +97 -0
  109. package/skills/qa-junit5-writer/references/patterns.md +162 -0
  110. package/skills/qa-k6-writer/SKILL.md +155 -0
  111. package/skills/qa-k6-writer/references/best-practices.md +236 -0
  112. package/skills/qa-k6-writer/references/config.md +219 -0
  113. package/skills/qa-k6-writer/references/patterns.md +304 -0
  114. package/skills/qa-linear-integration/SKILL.md +137 -0
  115. package/skills/qa-linear-integration/references/api-patterns.md +249 -0
  116. package/skills/qa-linear-integration/references/field-mapping.md +121 -0
  117. package/skills/qa-locust-writer/SKILL.md +151 -0
  118. package/skills/qa-locust-writer/references/best-practices.md +126 -0
  119. package/skills/qa-locust-writer/references/config.md +170 -0
  120. package/skills/qa-locust-writer/references/patterns.md +235 -0
  121. package/skills/qa-manual-test-designer/SKILL.md +145 -0
  122. package/skills/qa-manual-test-designer/references/exploratory-charters.md +138 -0
  123. package/skills/qa-manual-test-designer/references/personas.md +146 -0
  124. package/skills/qa-manual-test-designer/templates/exploratory-charter-template.md +47 -0
  125. package/skills/qa-manual-test-designer/templates/test-case-template.md +31 -0
  126. package/skills/qa-mobile-test-writer/SKILL.md +144 -0
  127. package/skills/qa-mobile-test-writer/references/best-practices.md +214 -0
  128. package/skills/qa-mobile-test-writer/references/config.md +309 -0
  129. package/skills/qa-mobile-test-writer/references/patterns.md +304 -0
  130. package/skills/qa-nfr-analyst/SKILL.md +177 -0
  131. package/skills/qa-nfr-analyst/references/iso-25010-model.md +159 -0
  132. package/skills/qa-nfr-analyst/references/owasp-wstg-baseline.md +202 -0
  133. package/skills/qa-nfr-analyst/references/wcag-checklist.md +184 -0
  134. package/skills/qa-nfr-analyst/templates/owasp-checklist-template.md +89 -0
  135. package/skills/qa-nfr-analyst/templates/wcag-checklist-template.md +48 -0
  136. package/skills/qa-orchestrator/SKILL.md +132 -0
  137. package/skills/qa-orchestrator/references/handoff-chains.md +105 -0
  138. package/skills/qa-orchestrator/references/pipeline-modes.md +115 -0
  139. package/skills/qa-orchestrator/references/scheduler-rules.md +84 -0
  140. package/skills/qa-pact-writer/SKILL.md +133 -0
  141. package/skills/qa-pact-writer/references/best-practices.md +100 -0
  142. package/skills/qa-pact-writer/references/config.md +135 -0
  143. package/skills/qa-pact-writer/references/patterns.md +161 -0
  144. package/skills/qa-plan-creator/SKILL.md +139 -0
  145. package/skills/qa-plan-creator/references/introduction-plan.md +43 -0
  146. package/skills/qa-plan-creator/references/migration-plan.md +44 -0
  147. package/skills/qa-plan-creator/references/onboarding-plan.md +46 -0
  148. package/skills/qa-plan-creator/references/performance-plan.md +44 -0
  149. package/skills/qa-plan-creator/references/regression-plan.md +45 -0
  150. package/skills/qa-plan-creator/references/release-plan.md +45 -0
  151. package/skills/qa-plan-creator/references/sprint-plan.md +44 -0
  152. package/skills/qa-plan-creator/references/test-plan.md +59 -0
  153. package/skills/qa-plan-creator/references/uat-plan.md +43 -0
  154. package/skills/qa-plan-creator/templates/checklist-template.md +36 -0
  155. package/skills/qa-plan-creator/templates/regression-checklist-template.md +49 -0
  156. package/skills/qa-plan-creator/templates/release-checklist-template.md +46 -0
  157. package/skills/qa-plan-creator/templates/test-plan-template.md +74 -0
  158. package/skills/qa-playwright-py-writer/SKILL.md +156 -0
  159. package/skills/qa-playwright-py-writer/references/best-practices.md +194 -0
  160. package/skills/qa-playwright-py-writer/references/config.md +195 -0
  161. package/skills/qa-playwright-py-writer/references/patterns.md +212 -0
  162. package/skills/qa-playwright-ts-writer/SKILL.md +151 -0
  163. package/skills/qa-playwright-ts-writer/references/assertions.md +109 -0
  164. package/skills/qa-playwright-ts-writer/references/best-practices.md +191 -0
  165. package/skills/qa-playwright-ts-writer/references/config.md +144 -0
  166. package/skills/qa-playwright-ts-writer/references/patterns.md +171 -0
  167. package/skills/qa-pytest-writer/SKILL.md +145 -0
  168. package/skills/qa-pytest-writer/references/assertions.md +149 -0
  169. package/skills/qa-pytest-writer/references/best-practices.md +97 -0
  170. package/skills/qa-pytest-writer/references/config.md +176 -0
  171. package/skills/qa-pytest-writer/references/patterns.md +251 -0
  172. package/skills/qa-qase-integration/SKILL.md +149 -0
  173. package/skills/qa-qase-integration/references/api-reference.md +354 -0
  174. package/skills/qa-qase-integration/references/ci-integration.md +196 -0
  175. package/skills/qa-qase-integration/references/field-mapping.md +157 -0
  176. package/skills/qa-requirements-generator/SKILL.md +152 -0
  177. package/skills/qa-requirements-generator/references/iso-29148-structure.md +153 -0
  178. package/skills/qa-requirements-generator/references/requirement-patterns.md +278 -0
  179. package/skills/qa-rest-assured-writer/SKILL.md +137 -0
  180. package/skills/qa-rest-assured-writer/references/best-practices.md +50 -0
  181. package/skills/qa-rest-assured-writer/references/config.md +124 -0
  182. package/skills/qa-rest-assured-writer/references/patterns.md +192 -0
  183. package/skills/qa-risk-analyzer/SKILL.md +158 -0
  184. package/skills/qa-risk-analyzer/references/impact-analysis.md +133 -0
  185. package/skills/qa-risk-analyzer/references/risk-factors.md +123 -0
  186. package/skills/qa-robot-framework-writer/SKILL.md +147 -0
  187. package/skills/qa-robot-framework-writer/references/best-practices.md +249 -0
  188. package/skills/qa-robot-framework-writer/references/config.md +204 -0
  189. package/skills/qa-robot-framework-writer/references/libraries.md +273 -0
  190. package/skills/qa-robot-framework-writer/references/patterns.md +216 -0
  191. package/skills/qa-security-test-writer/SKILL.md +123 -0
  192. package/skills/qa-security-test-writer/references/best-practices.md +155 -0
  193. package/skills/qa-security-test-writer/references/owasp-top10.md +331 -0
  194. package/skills/qa-security-test-writer/references/zap-config.md +258 -0
  195. package/skills/qa-selenium-java-writer/SKILL.md +143 -0
  196. package/skills/qa-selenium-java-writer/references/best-practices.md +59 -0
  197. package/skills/qa-selenium-java-writer/references/config.md +143 -0
  198. package/skills/qa-selenium-java-writer/references/patterns.md +170 -0
  199. package/skills/qa-selenium-py-writer/SKILL.md +150 -0
  200. package/skills/qa-selenium-py-writer/references/best-practices.md +175 -0
  201. package/skills/qa-selenium-py-writer/references/config.md +224 -0
  202. package/skills/qa-selenium-py-writer/references/patterns.md +255 -0
  203. package/skills/qa-shortcut-integration/SKILL.md +143 -0
  204. package/skills/qa-shortcut-integration/references/api-patterns.md +126 -0
  205. package/skills/qa-shortcut-integration/references/field-mapping.md +66 -0
  206. package/skills/qa-spec-auditor/SKILL.md +162 -0
  207. package/skills/qa-spec-auditor/references/audit-checklist.md +144 -0
  208. package/skills/qa-spec-auditor/references/drift-patterns.md +207 -0
  209. package/skills/qa-spec-writer/SKILL.md +143 -0
  210. package/skills/qa-spec-writer/references/gherkin-guide.md +253 -0
  211. package/skills/qa-spec-writer/references/specification-patterns.md +274 -0
  212. package/skills/qa-spring-test-writer/SKILL.md +170 -0
  213. package/skills/qa-spring-test-writer/references/best-practices.md +57 -0
  214. package/skills/qa-spring-test-writer/references/config.md +179 -0
  215. package/skills/qa-spring-test-writer/references/patterns.md +235 -0
  216. package/skills/qa-supertest-writer/SKILL.md +150 -0
  217. package/skills/qa-supertest-writer/references/assertions.md +192 -0
  218. package/skills/qa-supertest-writer/references/best-practices.md +102 -0
  219. package/skills/qa-supertest-writer/references/config.md +166 -0
  220. package/skills/qa-supertest-writer/references/patterns.md +242 -0
  221. package/skills/qa-task-creator/SKILL.md +142 -0
  222. package/skills/qa-task-creator/references/linking-patterns.md +127 -0
  223. package/skills/qa-task-creator/references/task-types.md +169 -0
  224. package/skills/qa-task-creator/templates/task-template.md +24 -0
  225. package/skills/qa-test-doc-compiler/SKILL.md +114 -0
  226. package/skills/qa-test-doc-compiler/references/agile-tailoring.md +220 -0
  227. package/skills/qa-test-doc-compiler/references/iso-29119-3-documents.md +302 -0
  228. package/skills/qa-test-healer/SKILL.md +101 -0
  229. package/skills/qa-test-healer/references/diagnosis-patterns.md +142 -0
  230. package/skills/qa-test-healer/references/fix-strategies.md +177 -0
  231. package/skills/qa-test-reporter/SKILL.md +130 -0
  232. package/skills/qa-test-reporter/references/best-practices.md +162 -0
  233. package/skills/qa-test-reporter/references/iso-29119-reports.md +236 -0
  234. package/skills/qa-test-reporter/references/report-formats.md +287 -0
  235. package/skills/qa-test-reviewer/SKILL.md +142 -0
  236. package/skills/qa-test-reviewer/references/anti-patterns.md +268 -0
  237. package/skills/qa-test-reviewer/references/review-checklist.md +93 -0
  238. package/skills/qa-test-strategy/SKILL.md +133 -0
  239. package/skills/qa-test-strategy/references/entry-exit-criteria.md +176 -0
  240. package/skills/qa-test-strategy/references/risk-matrix.md +102 -0
  241. package/skills/qa-test-strategy/references/testing-types.md +143 -0
  242. package/skills/qa-testcase-from-docs/SKILL.md +161 -0
  243. package/skills/qa-testcase-from-docs/references/test-case-format.md +196 -0
  244. package/skills/qa-testcase-from-docs/references/test-design-techniques.md +126 -0
  245. package/skills/qa-testcase-from-docs/templates/test-case-template.md +31 -0
  246. package/skills/qa-testcase-from-ui/SKILL.md +109 -0
  247. package/skills/qa-testcase-from-ui/references/ui-element-patterns.md +126 -0
  248. package/skills/qa-testcase-from-ui/references/visual-analysis-guide.md +146 -0
  249. package/skills/qa-testcase-from-ui/templates/test-case-template.md +31 -0
  250. package/skills/qa-visual-regression-writer/SKILL.md +175 -0
  251. package/skills/qa-visual-regression-writer/references/best-practices.md +154 -0
  252. package/skills/qa-visual-regression-writer/references/config.md +220 -0
  253. package/skills/qa-visual-regression-writer/references/patterns.md +213 -0
  254. package/skills/qa-vitest-writer/SKILL.md +141 -0
  255. package/skills/qa-vitest-writer/references/assertions.md +105 -0
  256. package/skills/qa-vitest-writer/references/best-practices.md +62 -0
  257. package/skills/qa-vitest-writer/references/config.md +127 -0
  258. package/skills/qa-vitest-writer/references/patterns.md +141 -0
  259. package/skills/qa-webdriverio-writer/SKILL.md +145 -0
  260. package/skills/qa-webdriverio-writer/references/best-practices.md +176 -0
  261. package/skills/qa-webdriverio-writer/references/config.md +240 -0
  262. package/skills/qa-webdriverio-writer/references/patterns.md +269 -0
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: qa-flaky-detector
3
+ description: Analyze CI history and test execution data to identify flaky tests using 4-pattern classification -- race conditions, shared state, time-dependency, external dependencies -- with suggested fixes.
4
+ output_dir: reports/flaky
5
+ dependencies:
6
+ recommended:
7
+ - qa-test-healer
8
+ ---
9
+
10
+ # QA Flaky Detector
11
+
12
+ ## Purpose
13
+
14
+ Identify and classify flaky tests from CI history and test execution data. Flaky tests pass and fail intermittently for the same code, wasting CI time and masking real failures. This skill detects flakiness, classifies root causes into four patterns, and suggests targeted fixes.
15
+
16
+ ## Trigger Phrases
17
+
18
+ - "Find flaky tests" / "Identify flaky tests"
19
+ - "Analyze CI history for flakiness" / "Flaky test report"
20
+ - "Why does this test fail sometimes?" / "Intermittent test failures"
21
+ - "Classify flaky test [name]" / "Flaky test patterns"
22
+ - "Suggested fixes for flaky tests" / "Fix flaky [test name]"
23
+
24
+ ## 4-Pattern Classification
25
+
26
+ | Pattern | Description | Typical Causes | Suggested Fixes |
27
+ |---------|-------------|----------------|-----------------|
28
+ | **1. Race conditions** | Async timing, DOM not ready, API response order | Missing awaits, no explicit waits, parallel execution | Add explicit waits, `await` chains, `waitForSelector` |
29
+ | **2. Shared state** | Test order dependency, global state mutation, DB leftover | Global vars, singletons, uncleared DB/cache | Isolate tests, `beforeEach` cleanup, transactional rollback |
30
+ | **3. Time-dependency** | Timezone, date/time mocking, daylight saving | `new Date()`, `Date.now()`, hardcoded dates | Mock time (Jest `useFakeTimers`, `freezegun`), use fixed dates |
31
+ | **4. External dependencies** | Network calls, third-party APIs, file system | Live HTTP, external services, temp files | Mock/stub APIs, use fixtures, deterministic file paths |
32
+
33
+ See `references/flaky-patterns.md` for detailed patterns with code examples and fixes.
34
+
35
+ ## Detection Methods
36
+
37
+ ### 1. CI History Analysis
38
+
39
+ - Same test, different results across runs (pass/fail flip)
40
+ - Compare JUnit XML, Allure, or CI job logs over N runs
41
+ - Threshold: pass rate < 100% over 10+ runs → flag as flaky
42
+
43
+ ### 2. Statistical Analysis
44
+
45
+ - Pass rate per test: `passes / (passes + failures)` over recent runs
46
+ - Confidence: more runs → higher confidence in flakiness
47
+ - Minimum runs: recommend 10+ for reliable detection
48
+
49
+ ### 3. Pattern Matching (Code-Based)
50
+
51
+ - Scan test code for known flaky signatures:
52
+ - No `await` on async operations
53
+ - `setTimeout`/`setInterval` without cleanup
54
+ - `new Date()` or `Date.now()` without mocking
55
+ - Direct HTTP calls, file I/O
56
+ - Shared globals, singletons
57
+ - Missing `beforeEach`/`afterEach` cleanup
58
+
59
+ See `references/ci-analysis.md` for CI history analysis methods.
60
+
61
+ ## Workflow
62
+
63
+ 1. **Input** — CI artifacts (JUnit XML, Allure, GitHub Actions logs), test execution history, or test file paths
64
+ 2. **Collect** — Parse results from N runs; build pass/fail matrix per test
65
+ 3. **Detect** — Identify tests with pass rate < 100%
66
+ 4. **Classify** — Map each flaky test to one or more of the 4 patterns (code scan + heuristics)
67
+ 5. **Suggest** — Generate fix recommendations per pattern
68
+ 6. **Output** — Flaky test report, prioritized fix list
69
+
70
+ ## Output Deliverables
71
+
72
+ ### Flaky Test Report
73
+
74
+ ```markdown
75
+ # Flaky Test Report — [Project/Branch]
76
+
77
+ ## Summary
78
+ | Test | Failure Rate | Runs | Classification | Priority |
79
+ |------|--------------|------|----------------|----------|
80
+ | auth.login.spec.ts:42 | 23% | 26 | Race condition | High |
81
+ | checkout.flow.spec.ts:15 | 12% | 18 | Shared state | High |
82
+ | utils.date.spec.ts:8 | 8% | 12 | Time-dependency | Medium |
83
+
84
+ ## Detailed Findings
85
+
86
+ ### auth.login.spec.ts:42 — "should redirect after login"
87
+ - **Failure rate:** 6/26 (23%)
88
+ - **Classification:** Race condition
89
+ - **Likely cause:** DOM not ready before assertion
90
+ - **Suggested fix:** Add `await page.waitForSelector('#dashboard')` before assertion
91
+ ```
92
+
93
+ ### Prioritized Fix List
94
+
95
+ 1. **High** — High failure rate, critical path, or easy fix
96
+ 2. **Medium** — Moderate rate, non-critical
97
+ 3. **Low** — Low rate, edge cases
98
+
99
+ ## Integration with Other Skills
100
+
101
+ | Need | Skill | Usage |
102
+ |------|-------|-------|
103
+ | Parse JUnit/Allure | qa-test-reporter | Aggregate results from multiple runs |
104
+ | Fix broken selectors | qa-test-healer | Apply suggested waits/selectors |
105
+ | Create fix tasks | qa-task-creator | Generate tasks for flaky test fixes |
106
+ | Test strategy | qa-test-strategy | Document flaky mitigation in strategy |
107
+
108
+ ## Scope
109
+
110
+ **Can do (autonomous):**
111
+ - Parse CI/test results (JUnit XML, Allure, common formats)
112
+ - Compute pass rate per test over N runs
113
+ - Classify flaky tests into 4 patterns
114
+ - Scan test code for flaky signatures
115
+ - Produce flaky report and prioritized fix list
116
+ - Suggest fixes per pattern (from reference patterns)
117
+
118
+ **Cannot do (requires confirmation):**
119
+ - Modify test code directly (suggest only; qa-test-healer can apply)
120
+ - Access private CI systems without credentials
121
+ - Override classification without evidence
122
+
123
+ **Will not do (out of scope):**
124
+ - Execute tests or run CI
125
+ - Deploy or change production
126
+ - Guarantee fix effectiveness (suggestions are heuristic-based)
127
+
128
+ ## Quality Checklist
129
+
130
+ - [ ] Pass rate calculated over sufficient runs (≥10 recommended)
131
+ - [ ] Each flaky test classified into at least one pattern
132
+ - [ ] Suggested fixes match pattern and reference examples
133
+ - [ ] Report includes test name, file:line, failure rate, classification
134
+ - [ ] Prioritized fix list ordered by impact
135
+ - [ ] No hardcoded credentials; CI access from user/env
136
+
137
+ ## Troubleshooting
138
+
139
+ | Symptom | Likely Cause | Fix |
140
+ |---------|--------------|-----|
141
+ | No flaky tests found | Too few runs, or tests truly stable | Increase run count; verify CI artifacts parsed |
142
+ | All tests flagged | Threshold too strict | Raise pass-rate threshold; exclude known-broken tests |
143
+ | Wrong classification | Heuristics insufficient | Review code manually; add custom pattern to references |
144
+ | Missing CI data | Format not supported | Check qa-test-reporter; add parser for format |
145
+ | Fix doesn't work | Root cause different | Re-classify; try alternative pattern fixes |
146
+ | Pass rate 0% | Test always fails | Exclude from flaky report; treat as broken |
147
+
148
+ ## Reference Files
149
+
150
+ | Topic | Reference |
151
+ |-------|-----------|
152
+ | Flaky patterns with code examples and fixes | `references/flaky-patterns.md` |
153
+ | CI history analysis methods | `references/ci-analysis.md` |
@@ -0,0 +1,140 @@
1
+ # CI History Analysis for Flaky Detection
2
+
3
+ ## Overview
4
+
5
+ Flaky tests are identified by analyzing test execution history across multiple CI runs. Same test, different results (pass/fail flip) indicates flakiness.
6
+
7
+ ---
8
+
9
+ ## 1. Data Sources
10
+
11
+ ### JUnit XML
12
+
13
+ - **Location:** `test-results/*.xml`, `junit.xml`, `report.xml`
14
+ - **Parse:** `testsuites` → `testsuite` → `testcase`; attribute `name`, status (pass/fail)
15
+ - **Aggregate:** Collect XML from N runs (e.g., last 20 builds)
16
+
17
+ ### Allure
18
+
19
+ - **Location:** `allure-results/`, `allure-report/`
20
+ - **Parse:** `*-result.json` or `*-container.json`; extract test name, status, history
21
+ - **History:** Allure can store history across runs for trend analysis
22
+
23
+ ### GitHub Actions
24
+
25
+ - **Artifacts:** Test results uploaded as artifacts
26
+ - **Logs:** Parse job logs for test output (e.g., Jest, pytest summary)
27
+ - **API:** `GET /repos/{owner}/{repo}/actions/runs` to list runs; fetch artifacts
28
+
29
+ ### Other CI Systems
30
+
31
+ - **GitLab CI:** JUnit reports, `junit: report.xml`
32
+ - **Jenkins:** JUnit plugin, `**/junit/*.xml`
33
+ - **CircleCI:** Store test results, `store_test_results`
34
+ - **Azure Pipelines:** Publish test results task
35
+
36
+ ---
37
+
38
+ ## 2. Pass Rate Calculation
39
+
40
+ ### Formula
41
+
42
+ ```
43
+ pass_rate = passes / (passes + failures)
44
+ ```
45
+
46
+ - **Flaky threshold:** `pass_rate < 1.0` and `pass_rate > 0` (i.e., at least one pass and one fail)
47
+ - **Always failing:** `pass_rate = 0` → exclude from flaky report (treat as broken)
48
+ - **Always passing:** `pass_rate = 1.0` → stable, not flaky
49
+
50
+ ### Minimum Runs
51
+
52
+ - **Recommended:** 10+ runs for reliable detection
53
+ - **Low runs:** High variance; flag as "uncertain" or "needs more data"
54
+
55
+ ### Example
56
+
57
+ | Test | Run 1 | Run 2 | Run 3 | ... | Run 10 | Pass Rate |
58
+ |------|-------|-------|-------|-----|--------|------------|
59
+ | login.spec.ts:42 | P | F | P | ... | P | 7/10 = 70% |
60
+
61
+ ---
62
+
63
+ ## 3. Aggregation Workflow
64
+
65
+ 1. **Collect** — Fetch test results from last N CI runs (e.g., 20)
66
+ 2. **Normalize** — Map test names to canonical form (file:line or full name)
67
+ 3. **Build matrix** — Rows = tests, columns = runs, cells = pass/fail
68
+ 4. **Compute** — Pass rate per test
69
+ 5. **Filter** — Keep tests with `0 < pass_rate < 1`
70
+ 6. **Sort** — By failure rate (high first) or by critical path
71
+
72
+ ---
73
+
74
+ ## 4. Test Name Normalization
75
+
76
+ Different frameworks report names differently:
77
+
78
+ | Framework | Example | Normalized |
79
+ |-----------|---------|------------|
80
+ | Jest | `auth › login › should redirect` | `auth/login.spec.ts` or full name |
81
+ | pytest | `tests/test_auth.py::test_login` | `tests/test_auth.py::test_login` |
82
+ | Playwright | `auth/login.spec.ts:42` | `auth/login.spec.ts:42` |
83
+ | Mocha | `Login should redirect` | Match by file + describe + it |
84
+
85
+ Use consistent normalization to merge results across runs.
86
+
87
+ ---
88
+
89
+ ## 5. CI-Specific Parsing
90
+
91
+ ### GitHub Actions
92
+
93
+ ```yaml
94
+ # In workflow, ensure test results are published
95
+ - uses: actions/upload-artifact@v4
96
+ with:
97
+ name: test-results
98
+ path: test-results/
99
+ ```
100
+
101
+ Parse artifact `test-results/*.xml` from each run.
102
+
103
+ ### GitLab CI
104
+
105
+ ```yaml
106
+ junit: report.xml
107
+ ```
108
+
109
+ Download `report.xml` from job artifacts via API.
110
+
111
+ ### Local Script
112
+
113
+ ```bash
114
+ # Collect last N runs (conceptual)
115
+ for run in $(gh run list --limit 20 --json databaseId -q '.[].databaseId'); do
116
+ gh run download $run -n test-results -D results/run-$run
117
+ done
118
+ ```
119
+
120
+ ---
121
+
122
+ ## 6. Output for qa-flaky-detector
123
+
124
+ Feed aggregated data into the skill:
125
+
126
+ ```json
127
+ {
128
+ "runs": 20,
129
+ "tests": [
130
+ {
131
+ "name": "auth/login.spec.ts:42",
132
+ "passes": 14,
133
+ "failures": 6,
134
+ "pass_rate": 0.7
135
+ }
136
+ ]
137
+ }
138
+ ```
139
+
140
+ The skill then classifies each flaky test and suggests fixes.
@@ -0,0 +1,247 @@
1
+ # Flaky Test Patterns — Code Examples and Fixes
2
+
3
+ ## Overview
4
+
5
+ Flaky tests pass and fail intermittently. This reference documents four root-cause patterns with code examples and recommended fixes.
6
+
7
+ ---
8
+
9
+ ## 1. Race Conditions
10
+
11
+ ### Description
12
+
13
+ Tests fail when async operations complete in unpredictable order or when the UI/API is not ready before assertions.
14
+
15
+ ### Signatures in Code
16
+
17
+ - `click()` without `waitFor` before assertion
18
+ - `fetch()` / `axios` without `await`
19
+ - `setTimeout` with fixed delay (fragile)
20
+ - Parallel `Promise.all` with order-dependent assertions
21
+ - No `waitForSelector` / `waitForLoadState` before DOM checks
22
+
23
+ ### Example (Playwright — Flaky)
24
+
25
+ ```typescript
26
+ test('should show dashboard after login', async ({ page }) => {
27
+ await page.fill('#email', 'user@test.com');
28
+ await page.fill('#password', 'secret');
29
+ await page.click('button[type="submit"]');
30
+ // Race: redirect may not have completed
31
+ expect(await page.textContent('h1')).toBe('Dashboard'); // Fails sometimes
32
+ });
33
+ ```
34
+
35
+ ### Fix
36
+
37
+ ```typescript
38
+ test('should show dashboard after login', async ({ page }) => {
39
+ await page.fill('#email', 'user@test.com');
40
+ await page.fill('#password', 'secret');
41
+ await page.click('button[type="submit"]');
42
+ await page.waitForSelector('h1:has-text("Dashboard")', { timeout: 5000 });
43
+ expect(await page.textContent('h1')).toBe('Dashboard');
44
+ });
45
+ ```
46
+
47
+ ### Example (Jest — Flaky)
48
+
49
+ ```typescript
50
+ it('fetches user', async () => {
51
+ fetchUser().then(data => expect(data.name).toBe('Alice')); // No await
52
+ });
53
+ ```
54
+
55
+ ### Fix
56
+
57
+ ```typescript
58
+ it('fetches user', async () => {
59
+ const data = await fetchUser();
60
+ expect(data.name).toBe('Alice');
61
+ });
62
+ ```
63
+
64
+ ---
65
+
66
+ ## 2. Shared State
67
+
68
+ ### Description
69
+
70
+ Tests affect each other via global state, singletons, database, or file system. Order of execution changes outcomes.
71
+
72
+ ### Signatures in Code
73
+
74
+ - Global variables, module-level caches
75
+ - Singleton instances
76
+ - Database records not cleaned between tests
77
+ - File system writes (temp files, config)
78
+ - Browser `localStorage` / `sessionStorage` not cleared
79
+
80
+ ### Example (Flaky)
81
+
82
+ ```typescript
83
+ let currentUser; // Shared across tests
84
+
85
+ beforeEach(() => {
86
+ currentUser = null; // Missing in some suites
87
+ });
88
+
89
+ it('sets user', () => {
90
+ currentUser = { id: 1, name: 'Alice' };
91
+ expect(getUserName()).toBe('Alice');
92
+ });
93
+
94
+ it('gets user', () => {
95
+ expect(getUserName()).toBeNull(); // Fails if previous test ran first
96
+ });
97
+ ```
98
+
99
+ ### Fix
100
+
101
+ ```typescript
102
+ beforeEach(() => {
103
+ currentUser = null;
104
+ // Or: reset module, use dependency injection
105
+ });
106
+ ```
107
+
108
+ ### Example (DB — Flaky)
109
+
110
+ ```python
111
+ def test_create_order():
112
+ order = create_order(user_id=1, total=100)
113
+ assert order.id is not None
114
+
115
+ def test_list_orders():
116
+ orders = list_orders(user_id=1)
117
+ assert len(orders) == 0 # Fails if test_create_order ran first
118
+ ```
119
+
120
+ ### Fix
121
+
122
+ ```python
123
+ @pytest.fixture(autouse=True)
124
+ def clean_orders(db):
125
+ yield
126
+ db.execute("DELETE FROM orders WHERE user_id = 1")
127
+ ```
128
+
129
+ ---
130
+
131
+ ## 3. Time-Dependency
132
+
133
+ ### Description
134
+
135
+ Tests depend on current date/time, timezone, or system clock. Failures occur at certain times or in different environments.
136
+
137
+ ### Signatures in Code
138
+
139
+ - `new Date()`, `Date.now()`
140
+ - `new Date().toISOString()`
141
+ - Timezone-dependent logic
142
+ - `setTimeout` with real delays
143
+ - Daylight saving transitions
144
+
145
+ ### Example (Flaky)
146
+
147
+ ```typescript
148
+ it('formats expiry date', () => {
149
+ const card = { expiry: '12/25' };
150
+ expect(formatExpiry(card)).toContain('2025'); // Assumes current year
151
+ });
152
+ ```
153
+
154
+ ### Fix
155
+
156
+ ```typescript
157
+ beforeEach(() => {
158
+ jest.useFakeTimers();
159
+ jest.setSystemTime(new Date('2024-06-15'));
160
+ });
161
+ afterEach(() => jest.useRealTimers());
162
+ ```
163
+
164
+ ### Example (Python — Flaky)
165
+
166
+ ```python
167
+ def test_is_expired():
168
+ obj = create_obj(expires_at=datetime.now() - timedelta(days=1))
169
+ assert obj.is_expired() # Fails near midnight
170
+ ```
171
+
172
+ ### Fix
173
+
174
+ ```python
175
+ from freezegun import freeze_time
176
+
177
+ @freeze_time('2024-06-15 12:00:00')
178
+ def test_is_expired():
179
+ obj = create_obj(expires_at=datetime(2024, 6, 14))
180
+ assert obj.is_expired()
181
+ ```
182
+
183
+ ---
184
+
185
+ ## 4. External Dependencies
186
+
187
+ ### Description
188
+
189
+ Tests call real networks, APIs, file system, or third-party services. Variability in response time, availability, or data causes flakiness.
190
+
191
+ ### Signatures in Code
192
+
193
+ - `fetch()`, `axios`, `http.get` without mocking
194
+ - File system reads/writes (`fs`, `path`)
195
+ - Environment variables that change by environment
196
+ - Third-party SDKs (Stripe, SendGrid, etc.)
197
+
198
+ ### Example (Flaky)
199
+
200
+ ```typescript
201
+ it('fetches weather', async () => {
202
+ const res = await fetch('https://api.weather.com/current');
203
+ const data = await res.json();
204
+ expect(data.temp).toBeGreaterThan(-50); // Network may fail or timeout
205
+ });
206
+ ```
207
+
208
+ ### Fix
209
+
210
+ ```typescript
211
+ it('fetches weather', async () => {
212
+ const res = await fetch('/api/weather'); // Mocked in test env
213
+ const data = await res.json();
214
+ expect(data.temp).toBe(22); // Deterministic mock response
215
+ });
216
+ // Or: use MSW, nock, or jest.mock
217
+ ```
218
+
219
+ ### Example (File System — Flaky)
220
+
221
+ ```python
222
+ def test_read_config():
223
+ with open('/tmp/app-config.json') as f: # May not exist or differ
224
+ config = json.load(f)
225
+ assert config['env'] == 'test'
226
+ ```
227
+
228
+ ### Fix
229
+
230
+ ```python
231
+ def test_read_config(tmp_path):
232
+ config_file = tmp_path / 'config.json'
233
+ config_file.write_text('{"env": "test"}')
234
+ config = read_config(config_file)
235
+ assert config['env'] == 'test'
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Quick Reference
241
+
242
+ | Pattern | Detection | Fix Strategy |
243
+ |---------|-----------|--------------|
244
+ | Race condition | Async without await, no explicit wait | Add `await`, `waitForSelector`, `waitFor` |
245
+ | Shared state | Globals, DB, files | `beforeEach` cleanup, isolate, transactional rollback |
246
+ | Time-dependency | `Date`, `setTimeout` | `useFakeTimers`, `freezegun`, fixed dates |
247
+ | External deps | HTTP, files, env | Mock, stub, fixtures, `tmp_path` |