testeiya 0.10.0 → 0.10.2

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 (241) hide show
  1. package/PIPELINES.md +3 -0
  2. package/README.md +10 -20
  3. package/dist/prompt/clis.d.ts +7 -0
  4. package/dist/prompt/pipeline-report.d.ts +1 -0
  5. package/dist/prompt/report.d.ts +10 -0
  6. package/dist/prompt/system-prompt.d.ts +22 -0
  7. package/dist/prompt/system-prompt.js +1 -1
  8. package/dist/prompt/system-prompt.js.map +1 -1
  9. package/dist/prompt/testomat.io.d.ts +19 -0
  10. package/dist/prompt/thread.d.ts +73 -0
  11. package/dist/src/args.d.ts +39 -0
  12. package/dist/src/attribution-extension.d.ts +3 -0
  13. package/dist/src/checkpoint.d.ts +30 -0
  14. package/dist/src/cli.d.ts +2 -0
  15. package/dist/src/cli.js +27 -32
  16. package/dist/src/cli.js.map +1 -1
  17. package/dist/src/doctor.d.ts +11 -0
  18. package/dist/src/env.d.ts +30 -0
  19. package/dist/src/exec.d.ts +11 -0
  20. package/dist/src/git.d.ts +41 -0
  21. package/dist/src/git.js +10 -0
  22. package/dist/src/git.js.map +1 -1
  23. package/dist/src/langfuse-extension.d.ts +7 -0
  24. package/dist/src/langfuse.d.ts +67 -0
  25. package/dist/src/mcp.d.ts +19 -0
  26. package/dist/src/model.d.ts +20 -0
  27. package/dist/src/model.js +2 -0
  28. package/dist/src/model.js.map +1 -1
  29. package/dist/src/models.d.ts +1 -0
  30. package/dist/src/output.d.ts +84 -0
  31. package/dist/src/pipeline/command-stage.d.ts +12 -0
  32. package/dist/src/pipeline/crash-guard.d.ts +12 -0
  33. package/dist/src/pipeline/crash-guard.js +21 -0
  34. package/dist/src/pipeline/crash-guard.js.map +1 -0
  35. package/dist/src/pipeline/diagram.d.ts +24 -0
  36. package/dist/src/pipeline/gate.d.ts +21 -0
  37. package/dist/src/pipeline/launcher.d.ts +33 -0
  38. package/dist/src/pipeline/launcher.js +16 -3
  39. package/dist/src/pipeline/launcher.js.map +1 -1
  40. package/dist/src/pipeline/log.d.ts +29 -0
  41. package/dist/src/pipeline/log.js +9 -0
  42. package/dist/src/pipeline/log.js.map +1 -1
  43. package/dist/src/pipeline/overlay.d.ts +29 -0
  44. package/dist/src/pipeline/pipeline-file.d.ts +44 -0
  45. package/dist/src/pipeline/pipeline-file.js +16 -8
  46. package/dist/src/pipeline/pipeline-file.js.map +1 -1
  47. package/dist/src/pipeline/pipeline.d.ts +78 -0
  48. package/dist/src/pipeline/pipeline.js +33 -7
  49. package/dist/src/pipeline/pipeline.js.map +1 -1
  50. package/dist/src/pipeline/report.d.ts +26 -0
  51. package/dist/src/pipeline/report.js +13 -0
  52. package/dist/src/pipeline/report.js.map +1 -1
  53. package/dist/src/pipeline/spec.d.ts +63 -0
  54. package/dist/src/pipeline/stage-env.d.ts +13 -0
  55. package/dist/src/pipeline/stage-env.js +31 -0
  56. package/dist/src/pipeline/stage-env.js.map +1 -0
  57. package/dist/src/pipeline/stage.d.ts +71 -0
  58. package/dist/src/pipeline/stage.js.map +1 -1
  59. package/dist/src/pipeline/state.d.ts +63 -0
  60. package/dist/src/pipeline/summary-stage.d.ts +24 -0
  61. package/dist/src/pipeline/task-stage.d.ts +24 -0
  62. package/dist/src/pipeline/task-stage.js +86 -2
  63. package/dist/src/pipeline/task-stage.js.map +1 -1
  64. package/dist/src/pipeline/variables.d.ts +20 -0
  65. package/dist/src/result.d.ts +6 -0
  66. package/dist/src/run.d.ts +69 -0
  67. package/dist/src/run.js +116 -60
  68. package/dist/src/run.js.map +1 -1
  69. package/dist/src/session.d.ts +43 -0
  70. package/dist/src/session.js +3 -1
  71. package/dist/src/session.js.map +1 -1
  72. package/dist/src/sessions.d.ts +23 -0
  73. package/dist/src/skills.d.ts +29 -0
  74. package/package.json +11 -2
  75. package/pipelines/api-testing.yml +16 -5
  76. package/pipelines/issue-test-cases.yml +3 -4
  77. package/pipelines/pr-review.yml +14 -5
  78. package/pipelines/regression.yml +1 -0
  79. package/pipelines/web-testing.yml +1 -0
  80. package/prompt/system-prompt.ts +1 -1
  81. package/scripts/vendor-skills.js +62 -0
  82. package/skills/codeceptjs/ci-fix-tests/SKILL.md +0 -119
  83. package/skills/codeceptjs/codeceptjs-auth/SKILL.md +0 -141
  84. package/skills/codeceptjs/codeceptjs-exploration/SKILL.md +0 -100
  85. package/skills/codeceptjs/codeceptjs-fundamentals/SKILL.md +0 -196
  86. package/skills/codeceptjs/codeceptjs-run-analysis/SKILL.md +0 -83
  87. package/skills/codeceptjs/debugging-codeceptjs-tests/SKILL.md +0 -126
  88. package/skills/codeceptjs/lint-codeceptjs-tests/SKILL.md +0 -104
  89. package/skills/codeceptjs/migrate-codeceptjs-4/SKILL.md +0 -109
  90. package/skills/codeceptjs/migrate-cypress-to-codeceptjs/SKILL.md +0 -295
  91. package/skills/codeceptjs/migrate-protractor-to-codeceptjs/SKILL.md +0 -339
  92. package/skills/codeceptjs/migrate-selenium-java-to-codeceptjs/SKILL.md +0 -459
  93. package/skills/codeceptjs/migrate-testcafe-to-codeceptjs/SKILL.md +0 -338
  94. package/skills/codeceptjs/refactoring-codeceptjs-tests/SKILL.md +0 -78
  95. package/skills/codeceptjs/writing-codeceptjs-tests/SKILL.md +0 -102
  96. package/skills/playwright/playwright-best-practices/SKILL.md +0 -303
  97. package/skills/playwright/playwright-best-practices/advanced/authentication-flows.md +0 -360
  98. package/skills/playwright/playwright-best-practices/advanced/authentication.md +0 -871
  99. package/skills/playwright/playwright-best-practices/advanced/clock-mocking.md +0 -364
  100. package/skills/playwright/playwright-best-practices/advanced/mobile-testing.md +0 -409
  101. package/skills/playwright/playwright-best-practices/advanced/multi-context.md +0 -288
  102. package/skills/playwright/playwright-best-practices/advanced/multi-user.md +0 -393
  103. package/skills/playwright/playwright-best-practices/advanced/network-advanced.md +0 -452
  104. package/skills/playwright/playwright-best-practices/advanced/third-party.md +0 -464
  105. package/skills/playwright/playwright-best-practices/architecture/pom-vs-fixtures.md +0 -363
  106. package/skills/playwright/playwright-best-practices/architecture/test-architecture.md +0 -369
  107. package/skills/playwright/playwright-best-practices/architecture/when-to-mock.md +0 -383
  108. package/skills/playwright/playwright-best-practices/browser-apis/browser-apis.md +0 -391
  109. package/skills/playwright/playwright-best-practices/browser-apis/iframes.md +0 -403
  110. package/skills/playwright/playwright-best-practices/browser-apis/service-workers.md +0 -504
  111. package/skills/playwright/playwright-best-practices/browser-apis/websockets.md +0 -403
  112. package/skills/playwright/playwright-best-practices/core/annotations.md +0 -424
  113. package/skills/playwright/playwright-best-practices/core/assertions-waiting.md +0 -361
  114. package/skills/playwright/playwright-best-practices/core/configuration.md +0 -452
  115. package/skills/playwright/playwright-best-practices/core/fixtures-hooks.md +0 -417
  116. package/skills/playwright/playwright-best-practices/core/global-setup.md +0 -434
  117. package/skills/playwright/playwright-best-practices/core/locators.md +0 -242
  118. package/skills/playwright/playwright-best-practices/core/page-object-model.md +0 -315
  119. package/skills/playwright/playwright-best-practices/core/projects-dependencies.md +0 -453
  120. package/skills/playwright/playwright-best-practices/core/test-data.md +0 -492
  121. package/skills/playwright/playwright-best-practices/core/test-suite-structure.md +0 -361
  122. package/skills/playwright/playwright-best-practices/core/test-tags.md +0 -298
  123. package/skills/playwright/playwright-best-practices/debugging/console-errors.md +0 -420
  124. package/skills/playwright/playwright-best-practices/debugging/debugging.md +0 -504
  125. package/skills/playwright/playwright-best-practices/debugging/error-testing.md +0 -360
  126. package/skills/playwright/playwright-best-practices/debugging/flaky-tests.md +0 -496
  127. package/skills/playwright/playwright-best-practices/frameworks/angular.md +0 -530
  128. package/skills/playwright/playwright-best-practices/frameworks/nextjs.md +0 -469
  129. package/skills/playwright/playwright-best-practices/frameworks/react.md +0 -531
  130. package/skills/playwright/playwright-best-practices/frameworks/vue.md +0 -574
  131. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/ci-cd.md +0 -468
  132. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/docker.md +0 -283
  133. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/github-actions.md +0 -546
  134. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/gitlab.md +0 -397
  135. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/other-providers.md +0 -521
  136. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/parallel-sharding.md +0 -371
  137. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/performance.md +0 -453
  138. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/reporting.md +0 -424
  139. package/skills/playwright/playwright-best-practices/infrastructure-ci-cd/test-coverage.md +0 -497
  140. package/skills/playwright/playwright-best-practices/testing-patterns/accessibility.md +0 -359
  141. package/skills/playwright/playwright-best-practices/testing-patterns/api-testing.md +0 -719
  142. package/skills/playwright/playwright-best-practices/testing-patterns/browser-extensions.md +0 -506
  143. package/skills/playwright/playwright-best-practices/testing-patterns/canvas-webgl.md +0 -493
  144. package/skills/playwright/playwright-best-practices/testing-patterns/component-testing.md +0 -500
  145. package/skills/playwright/playwright-best-practices/testing-patterns/drag-drop.md +0 -576
  146. package/skills/playwright/playwright-best-practices/testing-patterns/electron.md +0 -509
  147. package/skills/playwright/playwright-best-practices/testing-patterns/file-operations.md +0 -377
  148. package/skills/playwright/playwright-best-practices/testing-patterns/file-upload-download.md +0 -562
  149. package/skills/playwright/playwright-best-practices/testing-patterns/forms-validation.md +0 -561
  150. package/skills/playwright/playwright-best-practices/testing-patterns/graphql-testing.md +0 -331
  151. package/skills/playwright/playwright-best-practices/testing-patterns/i18n.md +0 -508
  152. package/skills/playwright/playwright-best-practices/testing-patterns/performance-testing.md +0 -476
  153. package/skills/playwright/playwright-best-practices/testing-patterns/security-testing.md +0 -430
  154. package/skills/playwright/playwright-best-practices/testing-patterns/visual-regression.md +0 -634
  155. package/skills/playwright/playwright-cli/SKILL.md +0 -489
  156. package/skills/playwright/playwright-cli/references/element-attributes.md +0 -23
  157. package/skills/playwright/playwright-cli/references/playwright-tests.md +0 -39
  158. package/skills/playwright/playwright-cli/references/pr-attachments.md +0 -60
  159. package/skills/playwright/playwright-cli/references/request-mocking.md +0 -87
  160. package/skills/playwright/playwright-cli/references/running-code.md +0 -245
  161. package/skills/playwright/playwright-cli/references/session-management.md +0 -227
  162. package/skills/playwright/playwright-cli/references/storage-state.md +0 -275
  163. package/skills/playwright/playwright-cli/references/test-generation.md +0 -433
  164. package/skills/playwright/playwright-cli/references/tracing.md +0 -139
  165. package/skills/playwright/playwright-cli/references/video-recording.md +0 -216
  166. package/skills/skills.lock.json +0 -89
  167. package/skills/skills.yaml +0 -35
  168. /package/skills/{testomatio/explorbot → explorbot}/explorbot-fundamentals/SKILL.md +0 -0
  169. /package/skills/{testomatio/explorbot → explorbot}/explorbot-fundamentals/references/no-install.md +0 -0
  170. /package/skills/{testomatio/explorbot → explorbot}/explorbot-plan/SKILL.md +0 -0
  171. /package/skills/{testomatio/explorbot → explorbot}/explorbot-setup/SKILL.md +0 -0
  172. /package/skills/{testomatio/explorbot → explorbot}/prima/SKILL.md +0 -0
  173. /package/skills/{testomatio/qa-process → qa-process}/qa-lead-strategy-advisor/SKILL.md +0 -0
  174. /package/skills/{testomatio/qa-process → qa-process}/qa-lead-strategy-advisor/references/output-format.md +0 -0
  175. /package/skills/{testomatio/qa-process → qa-process}/qa-review-pr/SKILL.md +0 -0
  176. /package/skills/{testomatio/qa-process → qa-process}/testing-workflow/SKILL.md +0 -0
  177. /package/skills/{testomatio/requirements → requirements}/catalog-features/SKILL.md +0 -0
  178. /package/skills/{testomatio/requirements → requirements}/catalog-features/references/layout.md +0 -0
  179. /package/skills/{testomatio/requirements → requirements}/detect-product-mismatches/SKILL.md +0 -0
  180. /package/skills/{testomatio/requirements → requirements}/detect-product-mismatches/references/features.md +0 -0
  181. /package/skills/{testomatio/requirements → requirements}/detect-product-mismatches/references/layout.md +0 -0
  182. /package/skills/{testomatio/requirements → requirements}/pull-request-diff-analyzer/SKILL.md +0 -0
  183. /package/skills/{testomatio/requirements → requirements}/qa-explain-behavior/SKILL.md +0 -0
  184. /package/skills/{testomatio/requirements → requirements}/qa-explain-behavior/references/answer-shapes.md +0 -0
  185. /package/skills/{testomatio/requirements → requirements}/qa-explain-behavior/references/examples.md +0 -0
  186. /package/skills/{testomatio/requirements → requirements}/qa-pr-requirements-analyzer/SKILL.md +0 -0
  187. /package/skills/{testomatio/requirements → requirements}/qa-pr-requirements-analyzer/references/summary-example.md +0 -0
  188. /package/skills/{testomatio/requirements → requirements}/qa-requirement-reviewer/SKILL.md +0 -0
  189. /package/skills/{testomatio/requirements → requirements}/qa-requirement-reviewer/references/requirements_reviewer_examples.md +0 -0
  190. /package/skills/{testomatio/requirements → requirements}/qa-thinking/SKILL.md +0 -0
  191. /package/skills/{testomatio/requirements → requirements}/wiki-from-code/SKILL.md +0 -0
  192. /package/skills/{testomatio/requirements → requirements}/wiki-from-code/references/behaviors.md +0 -0
  193. /package/skills/{testomatio/requirements → requirements}/wiki-from-code/references/layout.md +0 -0
  194. /package/skills/{testomatio/requirements → requirements}/write-user-story/SKILL.md +0 -0
  195. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/CLAUDE.md +0 -0
  196. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/SKILL.md +0 -0
  197. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/references/CODECEPTJS_BEST_PRACTICES.md +0 -0
  198. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/references/FINAL_SUMMARY_TEMPLATE.md +0 -0
  199. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/references/PLAYWRIGHT_BEST_PRACTICES.md +0 -0
  200. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/references/POM_BEST_PRACTICES.md +0 -0
  201. /package/skills/{testomatio/test-automation → test-automation}/automate-manual-test-cases/references/TEST_DATA_MANAGEMENT.md +0 -0
  202. /package/skills/{testomatio/test-automation → test-automation}/debug-fix-failed-flaky-autotests/SKILL.md +0 -0
  203. /package/skills/{testomatio/test-automation → test-automation}/debug-fix-failed-flaky-autotests/references/DEBUGGING_QUICK_REFERENCE.md +0 -0
  204. /package/skills/{testomatio/test-automation → test-automation}/epic-requirements-specification/SKILL.md +0 -0
  205. /package/skills/{testomatio/test-automation → test-automation}/qa-automation-test-consolidation/SKILL.md +0 -0
  206. /package/skills/{testomatio/test-automation → test-automation}/qa-data-seeder/SKILL.md +0 -0
  207. /package/skills/{testomatio/test-automation → test-automation}/run-tests-with-testomatio-reporter/SKILL.md +0 -0
  208. /package/skills/{testomatio/test-automation → test-automation}/setup-change-aware-pr-testing/SKILL.md +0 -0
  209. /package/skills/{testomatio/test-automation → test-automation}/setup-ci-automation/SKILL.md +0 -0
  210. /package/skills/{testomatio/test-automation → test-automation}/testomat-allure-adapter/SKILL.md +0 -0
  211. /package/skills/{testomatio/test-management → test-management}/detect-duplicate-test-cases/SKILL.md +0 -0
  212. /package/skills/{testomatio/test-management → test-management}/detect-duplicate-test-cases/references/DUPLICATE_INSTRUCTIONS.md +0 -0
  213. /package/skills/{testomatio/test-management → test-management}/detect-useless-tests/SKILL.md +0 -0
  214. /package/skills/{testomatio/test-management → test-management}/improve-test-cases/SKILL.md +0 -0
  215. /package/skills/{testomatio/test-management → test-management}/improve-test-cases/references/TESTOMAT_MARKDOWN_EXAMPLE.md +0 -0
  216. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/SKILL.md +0 -0
  217. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/references/CSV_MIGRATION.md +0 -0
  218. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/references/CUSTOM_MIGRATION.md +0 -0
  219. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/references/TESTMO_MIGRATION.md +0 -0
  220. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/references/TESTRAIL_MIGRATION.md +0 -0
  221. /package/skills/{testomatio/test-management → test-management}/migrate-to-testomatio/references/XRAY_MIGRATION.md +0 -0
  222. /package/skills/{testomatio/test-management → test-management}/qa-e2e-tests-reporting/SKILL.md +0 -0
  223. /package/skills/{testomatio/test-management → test-management}/qa-e2e-tests-reporting/references/TESTOMATIO_ARTIFACTS.md +0 -0
  224. /package/skills/{testomatio/test-management → test-management}/qa-e2e-tests-reporting/references/TESTOMATIO_HTML_REPORT.md +0 -0
  225. /package/skills/{testomatio/test-management → test-management}/qa-e2e-tests-reporting/references/TESTOMATIO_REPORTERS_CONFIG.md +0 -0
  226. /package/skills/{testomatio/test-management → test-management}/qa-split-testing-levels-pyramid/SKILL.md +0 -0
  227. /package/skills/{testomatio/test-management → test-management}/qa-sprint-report-by-testomatio/SKILL.md +0 -0
  228. /package/skills/{testomatio/test-management → test-management}/qa-sprint-report-by-testomatio/references/qa-sprint-report.md +0 -0
  229. /package/skills/{testomatio/test-management → test-management}/qa-test-code-coverage/SKILL.md +0 -0
  230. /package/skills/{testomatio/test-management → test-management}/qa-test-code-coverage/references/COVERAGE_FILE_FORMAT.md +0 -0
  231. /package/skills/{testomatio/test-management → test-management}/qa-test-code-coverage/references/E2E_FRAMEWORKS.md +0 -0
  232. /package/skills/{testomatio/test-management → test-management}/qa-test-code-coverage/scripts/check-coverage.mjs +0 -0
  233. /package/skills/{testomatio/test-management → test-management}/qa-write-test-cases/SKILL.md +0 -0
  234. /package/skills/{testomatio/test-management → test-management}/qa-write-test-cases/references/test-case-format.md +0 -0
  235. /package/skills/{testomatio/test-management → test-management}/qa-write-test-cases/references/testomat-tms-guide.md +0 -0
  236. /package/skills/{testomatio/test-management → test-management}/qa-write-test-cases/references/writing-rule.md +0 -0
  237. /package/skills/{testomatio/test-management → test-management}/scan-automation-project/SKILL.md +0 -0
  238. /package/skills/{testomatio/test-management → test-management}/sync-test-cases-with-tms/SKILL.md +0 -0
  239. /package/skills/{testomatio/test-management → test-management}/sync-test-cases-with-tms/references/TESTOMATIO_CLI.md +0 -0
  240. /package/skills/{testomatio/test-management → test-management}/testomatio-mcp/SKILL.md +0 -0
  241. /package/skills/{testomatio/test-management → test-management}/testomatio-mcp/references/MCP_SETUP.md +0 -0
@@ -1,371 +0,0 @@
1
- # Sharding and Parallel Execution
2
-
3
- ## Table of Contents
4
-
5
- 1. [CLI Commands](#cli-commands)
6
- 2. [Patterns](#patterns)
7
- 3. [Decision Guide](#decision-guide)
8
- 4. [Anti-Patterns](#anti-patterns)
9
- 5. [Troubleshooting](#troubleshooting)
10
-
11
- > **When to use**: Speeding up test suites by running tests concurrently on one machine (workers) or splitting across multiple CI jobs (sharding).
12
-
13
- ## CLI Commands
14
-
15
- ```bash
16
- # Parallelism within one machine
17
- npx playwright test --workers=4
18
- npx playwright test --workers=50%
19
-
20
- # Splitting across CI jobs
21
- npx playwright test --shard=1/4
22
- npx playwright test --shard=2/4
23
-
24
- # Merging shard outputs
25
- npx playwright merge-reports ./blob-report
26
- npx playwright merge-reports --reporter=html,json ./blob-report
27
-
28
- # Override config for single run
29
- npx playwright test --fully-parallel
30
- ```
31
-
32
- ## Patterns
33
-
34
- ### Worker Configuration
35
-
36
- **Use when**: Controlling concurrent test execution on a single machine.
37
-
38
- ```ts
39
- // playwright.config.ts
40
- import { defineConfig } from "@playwright/test";
41
-
42
- export default defineConfig({
43
- // Tests WITHIN a file also run in parallel
44
- fullyParallel: true,
45
-
46
- // Worker count options:
47
- // - undefined: auto-detect (half CPU cores)
48
- // - number: fixed count
49
- // - string: percentage of cores
50
- workers: process.env.CI ? "50%" : undefined,
51
- });
52
- ```
53
-
54
- **`fullyParallel` behavior:**
55
-
56
- | Setting | Files parallel | Tests in file parallel |
57
- | -------------------------------- | -------------- | ---------------------- |
58
- | `fullyParallel: false` (default) | Yes | No (serial) |
59
- | `fullyParallel: true` | Yes | Yes |
60
-
61
- **Serial execution for specific files:**
62
-
63
- ```ts
64
- // tests/checkout-flow.spec.ts
65
- import { test, expect } from "@playwright/test";
66
-
67
- test.describe.configure({ mode: "serial" });
68
-
69
- test("add items to cart", async ({ page }) => {
70
- // ...
71
- });
72
-
73
- test("complete payment", async ({ page }) => {
74
- // ...
75
- });
76
- ```
77
-
78
- ### Sharding Across CI Machines
79
-
80
- **Use when**: Suite exceeds 5 minutes even with maximum workers.
81
-
82
- ```bash
83
- # Job 1 Job 2 Job 3 Job 4
84
- --shard=1/4 --shard=2/4 --shard=3/4 --shard=4/4
85
- ```
86
-
87
- **Config for sharded runs:**
88
-
89
- ```ts
90
- // playwright.config.ts
91
- import { defineConfig } from "@playwright/test";
92
-
93
- export default defineConfig({
94
- fullyParallel: true,
95
- workers: process.env.CI ? "50%" : undefined,
96
-
97
- reporter: process.env.CI
98
- ? [["blob"], ["github"]]
99
- : [["html", { open: "on-failure" }]],
100
- });
101
- ```
102
-
103
- ### Merging Shard Reports
104
-
105
- **Use when**: Combining blob reports from multiple shards into a unified report.
106
-
107
- ```bash
108
- # Merge all blobs into HTML
109
- npx playwright merge-reports --reporter=html ./all-blob-reports
110
-
111
- # Multiple formats
112
- npx playwright merge-reports --reporter=html,json,junit ./all-blob-reports
113
-
114
- # Custom output location
115
- PLAYWRIGHT_HTML_REPORT=merged-report npx playwright merge-reports --reporter=html ./all-blob-reports
116
- ```
117
-
118
- **GitHub Actions merge job:**
119
-
120
- ```yaml
121
- merge-reports:
122
- if: ${{ !cancelled() }}
123
- needs: test
124
- runs-on: ubuntu-latest
125
- steps:
126
- - uses: actions/checkout@v4
127
- - run: npm ci
128
-
129
- - uses: actions/download-artifact@v4
130
- with:
131
- path: all-blob-reports
132
- pattern: blob-report-*
133
- merge-multiple: true
134
-
135
- - run: npx playwright merge-reports --reporter=html ./all-blob-reports
136
-
137
- - uses: actions/upload-artifact@v4
138
- with:
139
- name: playwright-report
140
- path: playwright-report/
141
- retention-days: 14
142
- ```
143
-
144
- ### Worker-Scoped Fixtures
145
-
146
- **Use when**: Expensive resources (DB connections, auth tokens) should be created once per worker, not per test.
147
-
148
- ```ts
149
- // fixtures.ts
150
- import { test as base } from "@playwright/test";
151
-
152
- type WorkerFixtures = {
153
- dbClient: DatabaseClient;
154
- apiToken: string;
155
- };
156
-
157
- export const test = base.extend<{}, WorkerFixtures>({
158
- dbClient: [
159
- async ({}, use) => {
160
- const client = await DatabaseClient.connect(process.env.DB_URL!);
161
- await use(client);
162
- await client.disconnect();
163
- },
164
- { scope: "worker" },
165
- ],
166
-
167
- apiToken: [
168
- async ({}, use, workerInfo) => {
169
- const res = await fetch(`${process.env.API_URL}/auth`, {
170
- method: "POST",
171
- headers: { "Content-Type": "application/json" },
172
- body: JSON.stringify({
173
- user: `test-user-${workerInfo.workerIndex}`,
174
- password: process.env.TEST_PASSWORD,
175
- }),
176
- });
177
- const { token } = await res.json();
178
- await use(token);
179
- },
180
- { scope: "worker" },
181
- ],
182
- });
183
-
184
- export { expect } from "@playwright/test";
185
- ```
186
-
187
- ### Test Isolation for Parallelism
188
-
189
- **Use when**: Preparing tests to run without interference.
190
-
191
- Each test must create its own state. No test should depend on or modify shared state.
192
-
193
- ```ts
194
- // BAD: Shared user causes race conditions
195
- test("edit settings", async ({ page }) => {
196
- await page.goto("/users/test-user/settings");
197
- await page.getByLabel("Email").fill("new@example.com");
198
- await page.getByRole("button", { name: "Save" }).click();
199
- });
200
-
201
- // GOOD: Unique user per test
202
- test("edit settings", async ({ page, request }) => {
203
- const res = await request.post("/api/users", {
204
- data: { name: `user-${Date.now()}`, email: `${Date.now()}@test.com` },
205
- });
206
- const user = await res.json();
207
-
208
- await page.goto(`/users/${user.id}/settings`);
209
- await page.getByLabel("Email").fill("updated@example.com");
210
- await page.getByRole("button", { name: "Save" }).click();
211
- await expect(page.getByLabel("Email")).toHaveValue("updated@example.com");
212
-
213
- await request.delete(`/api/users/${user.id}`);
214
- });
215
- ```
216
-
217
- **Using `testInfo` for unique identifiers:**
218
-
219
- ```ts
220
- import { test, expect } from "@playwright/test";
221
-
222
- test("submit order", async ({ page }, testInfo) => {
223
- const orderId = `order-${testInfo.workerIndex}-${Date.now()}`;
224
- await page.goto(`/orders/new?ref=${orderId}`);
225
- // ...
226
- });
227
- ```
228
-
229
- ### Dynamic Shard Count
230
-
231
- **Use when**: Automatically adjusting shards based on test count.
232
-
233
- ```yaml
234
- # .github/workflows/playwright.yml
235
- jobs:
236
- calculate-shards:
237
- runs-on: ubuntu-latest
238
- outputs:
239
- shard-count: ${{ steps.calc.outputs.count }}
240
- shard-matrix: ${{ steps.calc.outputs.matrix }}
241
- steps:
242
- - uses: actions/checkout@v4
243
- - run: npm ci
244
- - id: calc
245
- run: |
246
- TEST_COUNT=$(npx playwright test --list --reporter=json 2>/dev/null | node -e "
247
- const data = require('fs').readFileSync('/dev/stdin', 'utf8');
248
- const parsed = JSON.parse(data);
249
- console.log(parsed.suites?.reduce((acc, s) => acc + (s.specs?.length || 0), 0) || 0);
250
- ")
251
- # 1 shard per 20 tests, min 1, max 8
252
- SHARDS=$(( (TEST_COUNT + 19) / 20 ))
253
- SHARDS=$(( SHARDS > 8 ? 8 : SHARDS ))
254
- SHARDS=$(( SHARDS < 1 ? 1 : SHARDS ))
255
- MATRIX="["
256
- for i in $(seq 1 $SHARDS); do
257
- [ $i -gt 1 ] && MATRIX+=","
258
- MATRIX+="\"$i/$SHARDS\""
259
- done
260
- MATRIX+="]"
261
- echo "count=$SHARDS" >> $GITHUB_OUTPUT
262
- echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
263
-
264
- test:
265
- needs: calculate-shards
266
- runs-on: ubuntu-latest
267
- strategy:
268
- fail-fast: false
269
- matrix:
270
- shard: ${{ fromJson(needs.calculate-shards.outputs.shard-matrix) }}
271
- steps:
272
- - uses: actions/checkout@v4
273
- - run: npm ci
274
- - run: npx playwright install --with-deps
275
- - run: npx playwright test --shard=${{ matrix.shard }}
276
- ```
277
-
278
- ## Decision Guide
279
-
280
- | Scenario | Workers | Shards | Reason |
281
- | -------------------------------- | -------------- | ------ | --------------------------------------- |
282
- | < 50 tests, < 5 min | Auto (default) | None | No optimization needed |
283
- | 50-200 tests, 5-15 min | `'50%'` in CI | 2-4 | Balance speed and cost |
284
- | 200+ tests, > 15 min | `'50%'` in CI | 4-8 | Keep feedback under 10 min |
285
- | Flaky due to resource contention | Reduce to 2 | Keep | Less CPU/memory pressure |
286
- | Tests modify shared database | 1 or isolate | Useful | Sharding splits files; workers run them |
287
- | CI has limited resources | 1 or `'25%'` | More | Compensate with more machines |
288
-
289
- | Aspect | Workers (in-process) | Shards (across machines) |
290
- | -------------- | ------------------------- | -------------------------- |
291
- | What it splits | Tests across CPU cores | Test files across CI jobs |
292
- | Controlled by | Config or `--workers` CLI | `--shard=X/Y` CLI flag |
293
- | Shares memory | Yes | No |
294
- | Report merging | Not needed | Required (`merge-reports`) |
295
- | Cost | Free (same machine) | More CI minutes |
296
-
297
- ## Anti-Patterns
298
-
299
- | Anti-Pattern | Problem | Solution |
300
- | --------------------------------------- | ---------------------------------------- | ---------------------------------------------------- |
301
- | `fullyParallel: false` without reason | Tests in files run serially | Set `fullyParallel: true` unless tests need serial |
302
- | `workers: 1` in CI "for safety" | Negates parallelism | Fix isolation issues; use `workers: '50%'` |
303
- | Hardcoded shared user account | Race conditions in parallel runs | Each test creates unique data |
304
- | Sharding without blob reporter | Each shard produces separate HTML report | Configure `reporter: [['blob']]` for CI |
305
- | Sharding with 3 tests | Setup overhead exceeds time saved | Only shard when suite > 5 minutes |
306
- | `test.describe.serial()` everywhere | Kills parallelism, creates dependencies | Use only when tests genuinely need prior state |
307
- | Workers > CPU cores | Context switching overhead | Use `'50%'` or auto-detect |
308
- | Missing `fail-fast: false` in CI matrix | One shard failure cancels others | Always set `fail-fast: false` for sharded strategies |
309
-
310
- ## Troubleshooting
311
-
312
- ### Tests pass solo but fail together
313
-
314
- - **Shared state**. Make test data unique:
315
- ```ts
316
- test("create item", async ({ request }, ti) => {
317
- await request.post("/api/items", {
318
- data: { name: `Item-${ti.workerIndex}-${Date.now()}` },
319
- });
320
- });
321
- ```
322
-
323
- ### "No tests found" in some shards
324
-
325
- - **Too many shards**. Never exceed file count:
326
- ```bash
327
- npx playwright test --shard=1/10 # ok if 10 files
328
- npx playwright test --shard=1/20 # too many, some shards empty
329
- ```
330
-
331
- ### Merged report missing results
332
-
333
- - **Blob reports collide**. Use unique names:
334
- ```yaml
335
- # Each shard
336
- - uses: actions/upload-artifact@v4
337
- with:
338
- name: blob-report-${{ strategy.job-index }}
339
- path: blob-report/
340
- # Merge step
341
- - uses: actions/download-artifact@v4
342
- with:
343
- pattern: blob-report-*
344
- merge-multiple: true
345
- path: all-blob-reports
346
- ```
347
-
348
- ### Worker-scoped fixture not working
349
-
350
- - **Missing `{ scope: 'worker' }`**. Fix:
351
- ```ts
352
- export const test = base.extend({
353
- resource: [
354
- async ({}, use) => {
355
- const r = await Resource.create();
356
- await use(r);
357
- await r.destroy();
358
- },
359
- { scope: "worker" },
360
- ],
361
- });
362
- ```
363
-
364
- ### More workers = Slower
365
-
366
- - **Too many workers thrash**. Limit in CI:
367
- ```ts
368
- export default defineConfig({
369
- workers: process.env.CI ? 2 : undefined,
370
- });
371
- ```