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,74 @@
1
+ # Test Plan — {Project/Release Name}
2
+
3
+ **Document ID:** {TP-XXX}
4
+ **Version:** {1.0}
5
+ **Date:** {YYYY-MM-DD}
6
+ **Author:** {name}
7
+
8
+ ---
9
+
10
+ ## 1. Introduction
11
+
12
+ ### 1.1 Purpose
13
+ {Purpose of this test plan and intended audience}
14
+
15
+ ### 1.2 Scope
16
+ {In-scope and out-of-scope items}
17
+
18
+ ### 1.3 References
19
+ - {Standard or document reference}
20
+ - {Requirements document}
21
+ - {Design specification}
22
+
23
+ ---
24
+
25
+ ## 2. Test Items
26
+ {List of software items/features under test}
27
+
28
+ ## 3. Features to Test
29
+ {Features and functionality included in test scope}
30
+
31
+ ## 4. Features NOT to Test
32
+ {Explicitly excluded features with rationale}
33
+
34
+ ## 5. Test Approach
35
+ {Test strategy, techniques, tools, and coverage approach}
36
+
37
+ ## 6. Entry Criteria
38
+ - {Criterion 1}
39
+ - {Criterion 2}
40
+
41
+ ## 7. Exit Criteria
42
+ - {Criterion 1}
43
+ - {Criterion 2}
44
+
45
+ ## 8. Test Environment
46
+ {Environment description, hardware, software, test data}
47
+
48
+ ## 9. Schedule
49
+ | Phase | Start | End | Deliverable |
50
+ |-------|-------|-----|-------------|
51
+ | {Phase 1} | {date} | {date} | {deliverable} |
52
+ | {Phase 2} | {date} | {date} | {deliverable} |
53
+
54
+ *Gantt: [Insert Gantt diagram placeholder]*
55
+
56
+ ## 10. Resources
57
+ | Role | Name | Responsibility |
58
+ |------|------|----------------|
59
+ | {Role} | {Name} | {Responsibility} |
60
+
61
+ ## 11. Risks and Mitigations
62
+ | Risk | Impact | Mitigation |
63
+ |------|--------|------------|
64
+ | {Risk} | {High/Med/Low} | {Mitigation} |
65
+
66
+ ## 12. Deliverables
67
+ - {Test specifications}
68
+ - {Test execution logs}
69
+ - {Test completion report}
70
+
71
+ ## 13. Approval
72
+ | Role | Name | Date | Signature |
73
+ |------|------|------|-----------|
74
+ | {Approver} | {Name} | {date} | |
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: qa-playwright-py-writer
3
+ description: Generate Playwright E2E tests for Python with async/sync API, pytest-playwright integration, POM pattern, and live browser record mode via Playwright MCP.
4
+ output_dir: tests/e2e
5
+ ---
6
+
7
+ # QA Playwright Python Writer
8
+
9
+ ## Purpose
10
+
11
+ Write Playwright E2E tests for Python from test case specifications. Transform structured test cases into executable Playwright Python test files with pytest-playwright, Page Object Model, auto-waiting, multi-browser support, and optional live browser record mode.
12
+
13
+ ## Trigger Phrases
14
+
15
+ - "Write Playwright Python tests for [feature/flow]"
16
+ - "Generate Playwright E2E tests in Python"
17
+ - "Create pytest-playwright tests"
18
+ - "Add Playwright tests with record mode (Python)"
19
+ - "Playwright Python tests for [URL/flow]"
20
+ - "POM-based Playwright tests in Python"
21
+ - "pytest-playwright tests for [page]"
22
+ - "Heal my failing Playwright Python tests"
23
+
24
+ ## Three Modes
25
+
26
+ | Mode | When to Use | Behavior |
27
+ |------|-------------|----------|
28
+ | **Record Mode** | User wants live browser capture | Use Playwright MCP (e.g., cursor-ide-browser) → navigate, interact, capture interactions → generate Python test code from recorded steps |
29
+ | **Generate Mode** | Default; from test case specs | Read test cases (from qa-testcase-from-docs, qa-testcase-from-ui, qa-manual-test-designer) → generate Playwright Python code |
30
+ | **Heal Mode** | Tests fail after changes | Delegate to **qa-test-healer** to auto-fix broken selectors, assertions, waits; mark unfixable as `pytest.mark.skip` |
31
+
32
+ ## Key Features
33
+
34
+ | Feature | Description |
35
+ |---------|-------------|
36
+ | **Sync/Async API** | Default sync API; async via `playwright_pytest_asyncio = True` in pytest config |
37
+ | **pytest-playwright** | Fixtures: `page`, `browser`, `context`, `playwright`; integrates with pytest |
38
+ | **POM pattern** | Base page classes, page-specific classes, component objects |
39
+ | **Auto-wait** | Playwright auto-waits for elements; avoid `page.wait_for_timeout` |
40
+ | **Multi-browser** | Chromium, Firefox, WebKit via pytest-playwright browser options |
41
+ | **Network interception** | `page.route` for API mocking, request/response handling |
42
+
43
+ ## Workflow
44
+
45
+ 1. **Read test cases** — From specs, requirements, or manual test designs
46
+ 2. **Analyze app** — Inspect pages, flows, selectors (or use Record Mode)
47
+ 3. **Generate tests** — Produce `test_{feature}.py` with POM where appropriate
48
+ 4. **Configure** — Add/update `conftest.py`, `pytest.ini` or `pyproject.toml`
49
+ 5. **Run** — User runs `pytest` to execute tests
50
+
51
+ ## E2E Testing
52
+
53
+ - **Navigation:** `page.goto()`, `page.go_back()`, `page.reload()`
54
+ - **Interactions:** `click()`, `fill()`, `select_option()`, `check()`, `hover()`, `press()`
55
+ - **Assertions:** `expect(locator).to_be_visible()`, `to_have_text()`, `to_have_url()`, etc.
56
+ - **Network:** `page.route()` for API mocking, request/response interception
57
+ - **Auto-wait:** Playwright auto-waits; avoid `page.wait_for_timeout()`
58
+
59
+ See `references/patterns.md` for navigation, forms, auth, file upload, drag-drop, iframes, multi-tab, API mocking, visual comparison.
60
+
61
+ ## Page Object Model (POM)
62
+
63
+ - **Base page:** Shared selectors, navigation helpers, common actions
64
+ - **Page-specific:** Extend base; encapsulate page-specific locators and methods
65
+ - **Component objects:** Reusable components (header, modal, form) as classes
66
+
67
+ See `references/best-practices.md` for POM structure.
68
+
69
+ ## Key Patterns
70
+
71
+ - **Structure:** `def test_*()` functions; `pytest.mark` for grouping; `conftest.py` for fixtures
72
+ - **Locators:** `get_by_role` > `get_by_test_id` > `get_by_text` > `get_by_label` > CSS selector
73
+ - **Assertions:** `expect(locator).to_be_visible()`, `to_have_text()`, `to_have_url()`, `to_have_count()`, etc.
74
+ - **Network:** `page.route(url, handler)` for mocking; `page.unroute()` to clear
75
+ - **Fixtures:** `page`, `browser`, `context`, `playwright` from pytest-playwright; custom fixtures in conftest.py
76
+
77
+ See `references/patterns.md` for full pattern reference.
78
+
79
+ ## Locator Priority
80
+
81
+ 1. **get_by_role** — Accessibility-based; most resilient
82
+ 2. **get_by_test_id** — `data-testid`; explicit, stable
83
+ 3. **get_by_text** — Visible text; use for unique labels
84
+ 4. **get_by_label** — Form labels; good for inputs
85
+ 5. **CSS selector** — Last resort; brittle for dynamic content
86
+
87
+ ## File Naming
88
+
89
+ - **Tests:** `test_{feature}.py` (e.g., `test_login.py`, `test_checkout.py`)
90
+ - **Fixtures:** `conftest.py` in test directory or package root
91
+ - **Page objects:** `pages/` or `page_objects/` directory
92
+
93
+ ## Configuration
94
+
95
+ - **pytest.ini** / **pyproject.toml** — pytest options, markers, playwright settings
96
+ - **conftest.py** — Shared fixtures, base URL, browser options
97
+ - **pytest-playwright** — Provides `page`, `browser`, `context` fixtures
98
+
99
+ See `references/config.md` for full config guide.
100
+
101
+ ## MCP Integration
102
+
103
+ - **Context7 MCP** — Fetch Playwright Python documentation when needed
104
+ - **Playwright MCP** (cursor-ide-browser, @playwright/mcp) — Record mode: navigate, snapshot, click, type; capture interactions → generate Python test code
105
+
106
+ ## Scope
107
+
108
+ **Can do (autonomous):**
109
+ - Generate Playwright E2E tests in Python from test case specs
110
+ - Use Record Mode with Playwright MCP to capture and generate tests
111
+ - Apply POM pattern, stable locators, auto-wait
112
+ - Configure conftest.py, pytest.ini, pyproject.toml for pytest-playwright
113
+ - Use `page.route()` for API mocking
114
+ - Delegate to qa-test-healer when tests fail (Heal Mode)
115
+ - Use Context7 MCP for Playwright Python docs
116
+
117
+ **Cannot do (requires confirmation):**
118
+ - Change production code structure
119
+ - Add dependencies not in requirements.txt / pyproject.toml
120
+ - Override project pytest/playwright config without approval
121
+ - Navigate to URLs not provided (Record Mode)
122
+
123
+ **Will not do (out of scope):**
124
+ - Execute tests (user runs `pytest`)
125
+ - Write pytest unit tests without Playwright (use qa-pytest-writer)
126
+ - Modify CI/CD pipelines
127
+ - Bypass security or access restricted areas
128
+
129
+ ## References
130
+
131
+ - `references/patterns.md` — Sync vs async, pytest fixtures, POM, network mocking
132
+ - `references/config.md` — pytest-playwright, conftest.py, pytest.ini, browser config
133
+ - `references/best-practices.md` — POM, locators, async patterns, test isolation
134
+
135
+ ## Quality Checklist
136
+
137
+ - [ ] Auto-wait used; no `page.wait_for_timeout` (use `expect` with timeout or `wait_for`)
138
+ - [ ] No hardcoded waits; prefer `expect` auto-retry
139
+ - [ ] POM pattern applied for page-specific logic
140
+ - [ ] Stable locators (get_by_role, get_by_test_id preferred)
141
+ - [ ] Tests independent (no shared state, order-independent)
142
+ - [ ] Proper teardown (fixtures, conftest if needed)
143
+ - [ ] Traceability to test case IDs where applicable
144
+ - [ ] No hardcoded secrets (use env vars)
145
+
146
+ ## Troubleshooting
147
+
148
+ | Symptom | Likely Cause | Fix |
149
+ |---------|--------------|-----|
150
+ | Element not found | Selector too specific, dynamic content | Use get_by_role/get_by_test_id; add data-testid if needed |
151
+ | Timeout | Element not ready, slow network | Increase expect timeout; use wait_for; check for overlays |
152
+ | Flaky tests | Race conditions, shared state | Ensure test isolation; use auto-wait; avoid fixed delays |
153
+ | Record mode empty | MCP not capturing steps | Verify Playwright MCP active; lock browser before actions |
154
+ | Sync/async conflict | Mixing sync and async fixtures | Use one mode per file; set playwright_pytest_asyncio consistently |
155
+ | API mock not applied | Route registered after request | Call page.route before page.goto |
156
+ | Fixture not found | conftest.py not in path | Ensure conftest.py in test directory or parent |
@@ -0,0 +1,194 @@
1
+ # Playwright Python Best Practices
2
+
3
+ Guidelines for maintainable, stable Playwright tests in Python.
4
+
5
+ ## Page Object Model (POM)
6
+
7
+ ### Structure
8
+
9
+ ```
10
+ pages/
11
+ __init__.py
12
+ base_page.py # Shared navigation, common helpers
13
+ login_page.py # Login-specific locators and methods
14
+ dashboard_page.py # Dashboard-specific
15
+ components/
16
+ __init__.py
17
+ header.py # Reusable header component
18
+ modal.py # Reusable modal
19
+ ```
20
+
21
+ ### Base Page
22
+
23
+ ```python
24
+ # pages/base_page.py
25
+ from playwright.sync_api import Page
26
+
27
+ class BasePage:
28
+ def __init__(self, page: Page, base_url: str):
29
+ self.page = page
30
+ self.base_url = base_url
31
+
32
+ def goto(self, path: str):
33
+ self.page.goto(f"{self.base_url}{path}")
34
+
35
+ def get_by_test_id(self, test_id: str):
36
+ return self.page.get_by_test_id(test_id)
37
+ ```
38
+
39
+ ### Page-Specific Class
40
+
41
+ ```python
42
+ # pages/login_page.py
43
+ from playwright.sync_api import Page
44
+ from .base_page import BasePage
45
+
46
+ class LoginPage(BasePage):
47
+ def __init__(self, page: Page, base_url: str):
48
+ super().__init__(page, base_url)
49
+
50
+ def login(self, email: str, password: str):
51
+ self.page.get_by_label("Email").fill(email)
52
+ self.page.get_by_label("Password").fill(password)
53
+ self.page.get_by_role("button", name="Sign in").click()
54
+
55
+ @property
56
+ def error_message(self):
57
+ return self.page.get_by_role("alert")
58
+ ```
59
+
60
+ ### Usage in Tests
61
+
62
+ ```python
63
+ # tests/e2e/test_login.py
64
+ def test_login_flow(page: Page, base_url: str):
65
+ login_page = LoginPage(page, base_url)
66
+ login_page.goto("/login")
67
+ login_page.login("user@example.com", "secret")
68
+ expect(login_page.error_message).not_to_be_visible()
69
+ ```
70
+
71
+ ## Locator Priority
72
+
73
+ 1. **get_by_role** — Accessibility-based; most resilient
74
+ 2. **get_by_test_id** — `data-testid`; explicit, stable
75
+ 3. **get_by_text** — Visible text; use for unique labels
76
+ 4. **get_by_label** — Form labels; good for inputs
77
+ 5. **locator** / CSS — Last resort; brittle for dynamic content
78
+
79
+ ### Examples
80
+
81
+ ```python
82
+ # Prefer
83
+ page.get_by_role("button", name="Submit")
84
+ page.get_by_test_id("submit-btn")
85
+ page.get_by_label("Email address")
86
+ page.get_by_text("Welcome back")
87
+
88
+ # Avoid when possible
89
+ page.locator(".btn-primary")
90
+ page.locator("#submit")
91
+ page.locator("div > span:nth-child(2)")
92
+ ```
93
+
94
+ ## Async Patterns
95
+
96
+ When using async mode (`playwright_pytest_asyncio = True`):
97
+
98
+ - Use `async def` for test functions
99
+ - Use `await` for all Playwright calls
100
+ - Do not mix sync and async in the same file
101
+ - Use `@pytest.mark.asyncio` if not using `asyncio_mode = "auto"`
102
+
103
+ ```python
104
+ @pytest.mark.asyncio
105
+ async def test_async_login(page: Page):
106
+ await page.goto("/login")
107
+ await page.get_by_label("Email").fill("user@example.com")
108
+ await page.get_by_role("button", name="Sign in").click()
109
+ await expect(page).to_have_url(re.compile(r".*dashboard"))
110
+ ```
111
+
112
+ ## Test Isolation
113
+
114
+ - Each test gets a fresh `page` and `context` (function scope)
115
+ - No shared cookies, localStorage, or session between tests
116
+ - Use `storage_state` for auth when needed (via project or fixture)
117
+ - Clean up test data in `teardown` if tests create DB records
118
+
119
+ ## Avoiding Flakiness
120
+
121
+ | Practice | Description |
122
+ |----------|-------------|
123
+ | **Auto-wait** | Playwright auto-waits; avoid `page.wait_for_timeout()` |
124
+ | **Assert before act** | Use `expect` to wait for readiness before clicking |
125
+ | **Stable selectors** | Prefer role/testid over CSS |
126
+ | **Isolation** | Each test gets fresh context |
127
+ | **Deterministic data** | Use fixtures, mocks; avoid time-dependent data |
128
+ | **No fixed delays** | Use `expect` with timeout or `wait_for_*` instead |
129
+
130
+ ### Anti-Patterns
131
+
132
+ ```python
133
+ # BAD: Fixed delay
134
+ page.wait_for_timeout(3000)
135
+
136
+ # GOOD: Wait for element
137
+ expect(page.get_by_role("heading")).to_be_visible()
138
+
139
+ # BAD: Brittle CSS
140
+ page.locator("div.container > div:nth-child(2) button").click()
141
+
142
+ # GOOD: Role or testid
143
+ page.get_by_role("button", name="Save").click()
144
+ ```
145
+
146
+ ## File Naming
147
+
148
+ | Convention | Example |
149
+ |------------|---------|
150
+ | Test files | `test_{feature}.py` (e.g., `test_login.py`, `test_dashboard.py`) |
151
+ | Page objects | `{page_name}_page.py` (e.g., `login_page.py`) |
152
+ | Fixtures | `conftest.py` (pytest discovers automatically) |
153
+
154
+ ## Debugging
155
+
156
+ | Tool | Use |
157
+ |------|-----|
158
+ | `--headed` | Run with visible browser |
159
+ | `--slowmo 1000` | Slow down actions (ms) |
160
+ | `page.pause()` | Breakpoint; opens Playwright Inspector |
161
+ | `PWDEBUG=1 pytest` | Run in debug mode |
162
+ | `--screenshot=on-failure` | Capture screenshot on failure (via plugin options) |
163
+
164
+ ## Fixtures for Common Setup
165
+
166
+ ```python
167
+ # conftest.py
168
+ @pytest.fixture
169
+ def login_page(page: Page, base_url: str):
170
+ from pages.login_page import LoginPage
171
+ return LoginPage(page, base_url)
172
+
173
+ @pytest.fixture
174
+ def logged_in_user(page: Page, base_url: str):
175
+ """Navigate to app and log in; return page."""
176
+ page.goto(f"{base_url}/login")
177
+ page.get_by_label("Email").fill("test@example.com")
178
+ page.get_by_label("Password").fill("secret")
179
+ page.get_by_role("button", name="Sign in").click()
180
+ page.wait_for_url(re.compile(r".*dashboard"))
181
+ return page
182
+ ```
183
+
184
+ ## Traceability
185
+
186
+ Link tests to test case IDs when applicable:
187
+
188
+ ```python
189
+ @pytest.mark.tc_id("TC-001")
190
+ def test_login_with_valid_credentials(page: Page):
191
+ ...
192
+ ```
193
+
194
+ Use markers or docstrings for traceability to requirements/specs.
@@ -0,0 +1,195 @@
1
+ # Playwright Python Configuration
2
+
3
+ Setup for pytest-playwright and Playwright Python.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install pytest-playwright
9
+ playwright install
10
+ ```
11
+
12
+ Optional: install only specific browsers:
13
+
14
+ ```bash
15
+ playwright install chromium
16
+ playwright install chromium firefox webkit
17
+ ```
18
+
19
+ ## pytest-playwright Plugin
20
+
21
+ The plugin provides fixtures automatically when installed. No explicit registration needed.
22
+
23
+ | Fixture | Description |
24
+ |---------|-------------|
25
+ | `playwright` | Playwright instance (session scope) |
26
+ | `browser_type` | Browser type launcher |
27
+ | `browser` | Browser instance |
28
+ | `context` | Browser context |
29
+ | `page` | Page (tab) |
30
+
31
+ ## conftest.py
32
+
33
+ Use `conftest.py` for shared fixtures and Playwright configuration.
34
+
35
+ ```python
36
+ # conftest.py
37
+ import pytest
38
+ from playwright.sync_api import Page
39
+
40
+ @pytest.fixture(scope="session")
41
+ def base_url():
42
+ return "http://localhost:3000"
43
+
44
+ @pytest.fixture
45
+ def authenticated_page(page: Page, base_url: str):
46
+ """Page with pre-authenticated session."""
47
+ page.goto(f"{base_url}/login")
48
+ page.get_by_label("Email").fill("test@example.com")
49
+ page.get_by_label("Password").fill("secret")
50
+ page.get_by_role("button", name="Sign in").click()
51
+ page.wait_for_url(re.compile(r".*dashboard"))
52
+ return page
53
+ ```
54
+
55
+ ## pytest.ini / pyproject.toml
56
+
57
+ ### Basic pytest.ini
58
+
59
+ ```ini
60
+ [pytest]
61
+ testpaths = tests
62
+ addopts = -v --tb=short
63
+ markers =
64
+ e2e: end-to-end browser tests
65
+ slow: slow tests
66
+ ```
67
+
68
+ ### pyproject.toml (Preferred)
69
+
70
+ ```toml
71
+ [tool.pytest.ini_options]
72
+ testpaths = ["tests", "e2e"]
73
+ addopts = "-v --tb=short"
74
+ markers = [
75
+ "e2e: end-to-end browser tests",
76
+ "slow: marks tests as slow",
77
+ ]
78
+ ```
79
+
80
+ ### Async Mode (Optional)
81
+
82
+ To use async Playwright API with pytest-playwright:
83
+
84
+ ```ini
85
+ # pytest.ini
86
+ [pytest]
87
+ playwright_pytest_asyncio = True
88
+ ```
89
+
90
+ Or in pyproject.toml:
91
+
92
+ ```toml
93
+ [tool.pytest.ini_options]
94
+ playwright_pytest_asyncio = true
95
+ ```
96
+
97
+ Note: Sync and async fixtures cannot be mixed in the same test file.
98
+
99
+ ## Browser Configuration
100
+
101
+ ### Run Specific Browsers
102
+
103
+ ```bash
104
+ pytest --browser chromium
105
+ pytest --browser firefox
106
+ pytest --browser webkit
107
+ pytest --browser chromium --browser firefox
108
+ ```
109
+
110
+ ### Headed Mode (Visible Browser)
111
+
112
+ ```bash
113
+ pytest --headed
114
+ ```
115
+
116
+ ### Slow Motion
117
+
118
+ ```bash
119
+ pytest --slowmo 1000
120
+ ```
121
+
122
+ ### Video / Screenshot
123
+
124
+ Configure via `browser_context_args` fixture:
125
+
126
+ ```python
127
+ # conftest.py
128
+ @pytest.fixture(scope="session")
129
+ def browser_context_args(browser_context_args):
130
+ return {
131
+ **browser_context_args,
132
+ "record_video_dir": "videos/",
133
+ "record_video_size": {"width": 1280, "height": 720},
134
+ }
135
+ ```
136
+
137
+ ## Base URL
138
+
139
+ ```python
140
+ # conftest.py
141
+ @pytest.fixture(scope="session")
142
+ def base_url():
143
+ import os
144
+ return os.environ.get("BASE_URL", "http://localhost:3000")
145
+
146
+ # In tests
147
+ def test_homepage(page: Page, base_url: str):
148
+ page.goto(base_url)
149
+ ```
150
+
151
+ ## Environment Variables
152
+
153
+ | Variable | Description |
154
+ |----------|-------------|
155
+ | `BASE_URL` | Application under test |
156
+ | `HEADED` | Set to `1` for visible browser |
157
+ | `SLOWMO` | Milliseconds delay between actions |
158
+ | `BROWSER` | `chromium`, `firefox`, or `webkit` |
159
+
160
+ ## Project Structure
161
+
162
+ ```
163
+ project/
164
+ ├── conftest.py # Shared fixtures
165
+ ├── pytest.ini # or pyproject.toml
166
+ ├── tests/
167
+ │ ├── e2e/
168
+ │ │ ├── test_login.py
169
+ │ │ ├── test_dashboard.py
170
+ │ │ └── conftest.py # E2E-specific fixtures
171
+ │ └── ...
172
+ ├── pages/ # Page Object Model
173
+ │ ├── base_page.py
174
+ │ ├── login_page.py
175
+ │ └── dashboard_page.py
176
+ └── fixtures/ # Test data, upload files
177
+ └── sample.pdf
178
+ ```
179
+
180
+ ## Playwright Config (Optional)
181
+
182
+ For advanced configuration, create `playwright.config.py`:
183
+
184
+ ```python
185
+ # playwright.config.py
186
+ from playwright.sync_api import sync_playwright
187
+
188
+ def get_browser_context_args():
189
+ return {
190
+ "viewport": {"width": 1280, "height": 720},
191
+ "ignore_https_errors": True,
192
+ }
193
+ ```
194
+
195
+ pytest-playwright uses its own defaults; override via `browser_context_args` fixture in conftest.py.