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,100 +0,0 @@
1
- ---
2
- name: codeceptjs-exploration
3
- description: >
4
- Use when an agent needs to learn what's on a page in CodeceptJS — read the
5
- ARIA tree, inspect candidate elements, pick or disambiguate a stable locator.
6
- Drives the live browser via MCP `run_code` / `snapshot`. Invoked by
7
- writing-codeceptjs-tests, debugging-codeceptjs-tests, and
8
- refactoring-codeceptjs-tests whenever page inspection is needed.
9
- ---
10
-
11
- # CodeceptJS Page Exploration
12
-
13
- Authoring a test, debugging a failure, and refactoring a stale locator share one task: open a page, find the right element, pick a stable locator. This is that playbook.
14
-
15
- ## Tools
16
-
17
- - **`run_code`** — runs CodeceptJS code, returns produced values, captures `console.*`, saves a final-state snapshot. For *do something and look at the result*.
18
- - **`snapshot`** — captures state without acting (URL, cookies, localStorage, HTML, ARIA, screenshot, console). For "what's on the page right now".
19
-
20
- Artifact sources, in preference order:
21
-
22
- 1. **ARIA snapshot** — structured, no styling noise, easy duplicate/accessibility-name scanning
23
- 2. **Screenshot** — visual confirmation; catches layout breaks ARIA can't show
24
- 3. **HTML** — only when ARIA lacks context (custom widgets without accessible names, attribute-driven behaviour)
25
-
26
- ## Inspect an element
27
-
28
- `I.grabWebElement(locator)` → one WebElement; `I.grabWebElements(locator)` → array. Same cross-helper API on Playwright / Puppeteer / WebDriver.
29
-
30
- | You want to … | Method |
31
- |---|---|
32
- | Confirm rendered / visible / enabled | `exists()`, `isVisible()`, `isEnabled()` |
33
- | Read text / value / attribute / property | `getText()`, `getValue()`, `getAttribute(n)`, `getProperty(n)` |
34
- | Position on page | `getBoundingBox()` — flags offscreen / zero-sized |
35
- | Rendered markup | `toOuterHTML()`, `toSimplifiedHTML(300)` (truncated, MCP-friendly) |
36
- | Stable selector for a fix | `toAbsoluteXPath()` |
37
- | Inside an iframe | `inIframe(async (body) => { ... })` |
38
- | Drill into children | `$(loc)`, `$$(loc)` |
39
- | Browser-side function | `evaluate(fn, ...args)` |
40
-
41
- ## Discover candidates when the obvious locator misses
42
-
43
- When `Edit` matches nothing, the control may say "Change", carry `aria-label="Edit user"`, or live in `.btn-edit`. Cast a wide net with a permissive XPath via `I.grabWebElements`, then disambiguate.
44
-
45
- OR together in the XPath:
46
-
47
- - visible text — `text()` (or `.` for descendants)
48
- - attributes — `@class`, `@aria-label`, `@title`, `@data-action`, `@id`
49
- - **synonyms** — edit/change/modify; delete/remove/trash; submit/send/save
50
-
51
- Case-insensitive via `translate(...)`:
52
-
53
- ```
54
- //*[contains(translate(., 'EDIT', 'edit'), 'edit')
55
- or contains(translate(@class, 'EDIT', 'edit'), 'edit')
56
- or contains(translate(@aria-label, 'EDIT', 'edit'), 'edit')
57
- or contains(translate(., 'CHANGE', 'change'), 'change')]
58
- ```
59
-
60
- Then iterate `toSimplifiedHTML(150)` over the results, pick the right candidate, commit a stable locator from its discriminating attribute or text.
61
-
62
- ## Pick a stable locator
63
-
64
- Two decisions in order: **which region scopes the lookup** (context), **what identifies the element inside it**. Region first keeps the identifier short and semantic — the discriminator found during disambiguation belongs in the context argument:
65
-
66
- ```js
67
- I.click('Edit user', '.user-row') // ✅ region + what the user sees
68
- I.click('#user-row-42 button.edit') // ❌ same element, brittle, unreadable
69
- ```
70
-
71
- Stable regions: landmarks (`nav`, `main`, `{ role: 'dialog' }`), app-shell containers (`.sidebar`, `.toolbar`, `.modal`), rows/cards identified by data via `locate(...)`. Identifier priority (full rationale: `codeceptjs-fundamentals` § Locators):
72
-
73
- 1. Visible label / accessible name — plain string already matches `aria-label`; don't expand to `{ css: '[aria-label="..."]' }`
74
- 2. ARIA role when ambiguous within context or role is part of the check
75
- 3. `$name` via `customLocator` when team test attributes exist
76
- 4. Composed CSS, still scoped: `I.click('button.edit', '#user-row-42')`
77
- 5. `toAbsoluteXPath()` — last resort; flag the team to add a `data-testid`
78
-
79
- **Never commit an unverified locator** — confirm via `run_code` (`I.seeElement(loc, context)` or `grabWebElement(loc)`) that it matches exactly one element.
80
-
81
- ## Common patterns
82
-
83
- - Strict mode 2+ matches → `grabWebElements('Save')` + `toSimplifiedHTML(200)` each, find discriminator, pass as context: `I.click('Save', '.modal')`
84
- - Button rendered but doesn't act → `grabWebElement('Submit')` + `isEnabled()` + `getBoundingBox()` — disabled? offscreen? zero-sized?
85
- - Wrong row in a list → `grabWebElements('.user-row')`, `getText()` per row to identify, `getAttribute('data-id')` for stable hook
86
- - Inside iframe → `(await I.grabWebElement('iframe.editor')).inIframe(async (body) => body.$('button'))`
87
-
88
- ## Things to avoid
89
-
90
- - Choosing a locator without seeing candidates first.
91
- - Committing `toAbsoluteXPath()` when a semantic locator is available.
92
- - Committing unscoped locators where a context keeps them short.
93
- - Ignoring the screenshot — "exists in HTML" ≠ "user can see it".
94
- - `usePlaywrightTo` / `useWebDriverTo` when WebElement methods cover it.
95
-
96
- ## Related skills
97
-
98
- - `codeceptjs-fundamentals` — locator priority, await rule
99
- - `writing-codeceptjs-tests` — invokes this during Mode B exploration
100
- - `debugging-codeceptjs-tests` — invokes this for live inspection; offline variant via `codeceptq`
@@ -1,196 +0,0 @@
1
- ---
2
- name: codeceptjs-fundamentals
3
- description: >
4
- Run first when working with any CodeceptJS 4 project — before writing,
5
- debugging, refactoring, or migrating tests. Teaches the framework's
6
- non-obvious rules and runs four-step discovery (`check` → read config →
7
- `list` → `dry-run`) reporting which helpers, plugins, page objects, custom
8
- actions, and tests are active. Other CodeceptJS skills depend on this output.
9
- ---
10
-
11
- # CodeceptJS Fundamentals
12
-
13
- Two jobs, in order: learn the rules below, then discover what *this* project has configured.
14
-
15
- ## Gate
16
-
17
- - CodeceptJS 4 is **ESM/TypeScript only**; tests, configs, page objects, helpers use `import`/`export`.
18
- - No `"type": "module"` in package.json → add it before anything else.
19
- - TypeScript: config `codecept.conf.ts`, TS loader entry in `require: [...]`.
20
- - Project on 3.x or CommonJS (`require()`, removed plugins like `autoLogin`, helper `Nightmare`) → stop, recommend `migrate-codeceptjs-4`. Don't patch files piecemeal — migration is whole-project.
21
-
22
- ## Main rule
23
-
24
- - Tests are written from the user's perspective: a linear scenario of actions, readable as prose.
25
- - Good: `I.click('Login')`, `I.fillField('Email', ...)`, `I.see('Welcome')`
26
- - **Tests are declarative, helpers imperative — recommended layering:**
27
- - Scenario shows *what* the user does via `I.*`; implementation details live below
28
- - Low-level access (`this.helpers['Playwright'].page`, fetch, filesystem) works fine inside a Scenario, but it's recommended to push it into a helper and expose one `I.*` action instead
29
- - Keep tests short: repeated sequences → actor method, page object, or step object.
30
- - Prefer semantic locators over selectors so tests survive markup churn.
31
-
32
- ## Where things go (recommended placement)
33
-
34
- - Site-wide actions (`login`, dropdowns, rich text editors) → **actor file** (custom steps)
35
- - Page/screen actions + locators → **page object**; SPA screen = one page object
36
- - Site-wide widgets (nav, modals, datepickers) → **page fragments / component objects**
37
- - Low-level driver access (DB connections, email, filesystem, complex mouse) → **helper**
38
- - Data creation/cleanup via API → **data objects** (REST/GraphQL helper + `_after()` cleanup), or `ApiDataFactory` (`I.have(...)`)
39
- - Don't overengineer: no page object until an abstraction is reused across tests.
40
-
41
- ## Shortcuts
42
-
43
- - Login needed → `autoLogin` plugin or actor method, not inline steps per test
44
- - Test data → create via API before the test, not through the UI
45
- - Long test → break into several; long tests are fragile and hard to follow
46
- - Optional UI element / conditional flow → `await tryTo(...)` instead of `if (await I.grab...)` — keeps scenarios linear
47
-
48
- ## Architecture
49
-
50
- - **Config**: `codecept.conf.{js,ts,mjs,cjs}` at repo root; multiple files selected via `--config <file>`.
51
- - **Helpers execute; `I` delegates.** Every `I.<method>` is routed to whichever active helper implements it (Playwright, WebDriver, Puppeteer, Appium share one API surface). Active helpers = keys under `helpers`. Tests call the actor, never the engine — backends stay swappable.
52
- - **DI container** — why it exists:
53
- - Everything shared (actor, helpers, page objects, support objects) registers under one container; `include` maps names → modules
54
- - Classes are auto-instantiated by the container — no `new`, no manual wiring
55
- - **`inject()` returns lazy proxies**: destructuring at module top resolves at call time, so circular page-object references work where plain `import` would give `undefined`
56
- - Access: destructure in Scenario signature (`Scenario('...', ({ I, loginPage }) => ...)`) or `const { I } = inject()` once per file
57
- - **Custom helpers** extend `Helper`, register under `helpers`, add new `I.*` methods.
58
- - **`I` does not exist inside a helper.** Compose via `this.helpers['<HelperName>']` (e.g. `this.helpers['Playwright'].page`, `this.helpers['REST'].sendGetRequest(...)`).
59
- - **Plugins** are event listeners on lifecycle events (`suite.*`, `test.*`, `step.*`, `hook.*`, `multiple.*`). Full list: `node_modules/codeceptjs/lib/event.js`. Register under `plugins` with `enabled: true`.
60
-
61
- ## Config mutation trap
62
-
63
- - `@codeceptjs/configure` mutates resolved config at load time (`setHeadlessWhen`, `setBrowser`, ...). Static values can lie — grep for its import before trusting `show:` / `browser:` fields.
64
- - `setCommonPlugins()`: **enables** `retryFailedStep` + `screenshot`; **registers** (off until `-p`) `pause`, `browser`, `aiTrace`, `heal`.
65
-
66
- ## Plugins worth knowing
67
-
68
- - `retryFailedStep` — retries transient step failures
69
- - `screenshot` — screenshots on failure; `slides: true` → `output/records.html` slideshow
70
- - `pageInfo` — dumps URL/HTML/console on failure
71
- - `auth` — session reuse for login (see `codeceptjs-auth` skill)
72
- - `aiTrace` — per-step screenshots/HTML/ARIA/console for AI debugging
73
- - `pause` — interactive pause
74
- - `heal` — AI-suggested fixes for broken steps (off in `--debug`)
75
- - `screencast` — video of the run
76
- - `customLocator` — maps `$name` prefix to team's test attribute (`data-testid`, `data-qa`)
77
- - `browser` — CLI-only override of browser helper config (see below)
78
-
79
- Note: `tryTo`, `retryTo`, `eachElement` are not plugins in 4.x — import them from `codeceptjs/effects`.
80
-
81
- ## Plugins from CLI
82
-
83
- Any plugin can be enabled/reconfigured per-run with `-p <plugin>`, args chained with `:`:
84
-
85
- ```sh
86
- npx codeceptjs run -p aiTrace # enable for this run
87
- npx codeceptjs run -p screenshot:on=step # reconfigure inline
88
- npx codeceptjs run -p pause:on=file:path=tests/login_test.js;line=43
89
- ```
90
-
91
- - `screenshot`, `pause`, `aiTrace`, `heal` share an `on=` trigger: `fail` (default except aiTrace) | `step` | `test` | `file:path=...;line=N` | `url:pattern=<glob>`
92
- - `browser` plugin overrides without touching config — CI matrix legs, one-off env variants:
93
- - `-p browser:hide` / `-p browser:show` / `-p browser:browser=firefox` / `-p browser:windowSize=1280x800`
94
- - Requires `@codeceptjs/configure`
95
-
96
- ## Effects (`codeceptjs/effects`)
97
-
98
- Flow-control functions imported from `codeceptjs/effects`. In 4.x these are no longer plugins/globals.
99
-
100
- - **`tryTo(() => ...)`** — runs steps that may fail without stopping the test; returns `boolean`.
101
- - **Prefer `tryTo` over `if`:** scenarios should stay linear — instead of branching on a grabbed value to decide whether a UI state exists, attempt the optional steps and branch on the boolean result:
102
- ```js
103
- const banner = await tryTo(() => { I.see('Cookie banner'); I.click('Accept cookies') })
104
- if (!banner) I.say('No cookie banner')
105
- ```
106
- - Auto-retries are disabled inside `tryTo` blocks.
107
- - **`retryTo(() => ..., maxTries, pollInterval = 200)`** — retries a step block until it succeeds (flaky elements, animations); callback receives the current attempt count.
108
- - **`hopeThat(() => ...)`** — soft assertions (see Assertions); end with `hopeThat.noErrors()`.
109
- - **`within(locator | { frame }, fn)`** — scopes resolution to subtree or iframe; can return values (`await`). Prefer the context parameter of individual actions (`I.click('Save', '.toolbar')`) when possible — reserve `within` for genuinely scoped blocks.
110
-
111
- All effects return Promises — `await` them.
112
-
113
- ## Element-based API (`codeceptjs/els`)
114
-
115
- Hybrid style: mix `I.*` with direct element access. Import `{ element, eachElement, expectElement, expectAnyElement, expectAllElements } from 'codeceptjs/els'`.
116
-
117
- - `element(locator, async el => { ... })` — scoped access to one element; chain `el.$(locator)` into children without re-querying
118
- - `eachElement(locator, async (el, index) => ...)` — iterate collections
119
- - `expectElement` / `expectAnyElement` / `expectAllElements(locator, fn)` — custom conditions
120
- - Elements are `WebElement` wrappers — same API on all helpers: `getText()`, `getAttribute()`, `isVisible()`, `isEnabled()`, `getBoundingBox()`, `exists()`, `$$()`
121
- - Optional purpose string improves debug logs: `element('verify discount applied', '.price', ...)`
122
- - Use when built-ins don't cover it: collections, layout checks (`getBoundingBox`), per-element loops, chaining ops on one element. Prefer `I.*` for readability otherwise.
123
-
124
- ## Writing tests
125
-
126
- - Structure: one `Feature(...)` per file, one or more `Scenario(...)` inside. No nested suites, no multiple Features per file.
127
- - Hooks: `Before`, `After`, `BeforeSuite`, `AfterSuite`, `Fail(...)`.
128
- - Page object lifecycle hooks: `_before()` (lazy, once per test, on first use), `_after()` (skipped if unused), `_beforeSuite()`, `_afterSuite()`.
129
- - **`await` required for**: `grab*` methods, imported functions, page-object methods containing async ops (elsewhere: unhandled rejections). Never for plain action steps — the recorder chains them.
130
- - Secrets: `I.fillField('Password', secret(process.env.PASSWORD))` — masks logs, traces, AI prompts. Import from `codeceptjs`.
131
- - Sessions: `session(name, fn)` — parallel browser context for multi-user Scenarios (chat, multi-tenant).
132
-
133
- ## Locators
134
-
135
- - **ARIA locators are strongest** — resilient to CSS refactors, describe what the user sees:
136
- - `I.click({ role: 'button', name: 'Save' })`
137
- - Actions accept plain strings (visible text, label, placeholder, `name`, `aria-label`) or objects (`{ css }`, `{ xpath }`, `{ id }`).
138
- - Plain string already matches `aria-label` — no `'aria-label=...'` prefix needed.
139
- - **Pass context as last argument** — scoped semantic locator beats long unscoped one:
140
- - `I.click('Save', '.toolbar')` not `I.click('#toolbar .btn-save')`
141
- - Avoid style-based class names (`.bg-green`); prefer semantic ones (`.btn-save`).
142
- - `data-testid`/`data-qa` apps → enable `customLocator`, write `$name`.
143
- - No semantic name fits → `locate(...)` builder (`.withClass`, `.withText`, `.inside`, `.and`): `locate('.button').withText('Click me')`.
144
-
145
- ## Waiting
146
-
147
- - Action steps auto-wait for existence + interactability. Add explicit `waitFor*` only when the condition isn't tied to an interaction (modal after network call, spinner hiding).
148
- - Avoid `I.wait(N)` — last resort.
149
-
150
- ## Assertions
151
-
152
- Built-in browser assertions come first: `I.see`, `I.seeTextEquals`, `I.seeElement`, `I.seeInField`, `I.seeNumberOfElements`, `I.seeInCurrentUrl` (+ `dontSee*` counterparts). Clear failures, recorder-integrated. `see` matches *visible* text; hidden DOM content needs `seeInSource` / `seeElementInDOM`.
153
-
154
- For what built-ins don't cover, in order of preference:
155
-
156
- 1. **Reusable custom assertion** in a helper — `I.seeTableIsOrdered('Price', 'desc')`; name positives `see*`, negatives `dontSee*`; use `codeceptjs/assertions` inside, never raw `throw new Error()`
157
- 2. **ExpectHelper** (`@codeceptjs/expect-helper`) — chai matchers on `I`: `I.expectEqual`, `I.expectDeepEqualExcluding`, `I.expectMatchesPattern`, `I.expectJsonSchema`; appears in step log like other steps
158
- 3. **`codeceptjs/assertions`** directly — dependency-free factories: `equals(subject).assert(actual, expected)` / `.negate(...)`; failure messages match `I.see` formatting
159
- 4. **Any library** on grabbed data (`grab*` always needs `await`) — chai/jest/`node:assert`; fails the test but won't show as a step
160
-
161
- Soft assertions: `hopeThat(() => I.see(...))` from `codeceptjs/effects` — logs each failure and continues; end with `hopeThat.noErrors()` to fail if any were recorded.
162
-
163
- ## Parallel runs
164
-
165
- - `run-workers <N>` — splits Scenarios across worker threads
166
- - `run-multiple <profile>` — profiles via `multiple` block in config (browsers, viewports)
167
-
168
- ## Config organization (recommended)
169
-
170
- - Multiple config files per environment (`codecept.conf.js`, `codecept.ci.conf.js`, ...); share parts via modules in a `config/` dir
171
- - `.env` files + `dotenv` for secrets/env-specific values
172
- - Bulk-register page objects/components by spreading exported maps into `include`
173
- - Pass data from config/bootstrap into tests via `codeceptjs.container.append({ testUser })` — injectable by name
174
-
175
- ## Discover this project
176
-
177
- In order; skipping steps produces wrong guesses:
178
-
179
- 1. **Verify setup loads**: `npx codeceptjs check -c <config>` — validates everything; output doubles as inventory. Fix failures before continuing.
180
- 2. **Read the active config**: helpers (+ browser/baseURL/viewport/env-driven values), plugins (incl. anything `setCommonPlugins()` injects), AI provider + required env var, env selection mechanism, page objects from `include`, custom helpers.
181
- 3. **List actions**: `npx codeceptjs list -c <config>` (`--docs` adds JSDoc; `--action <name>` for one). The actual `I.*` surface differs from built-ins when custom helpers exist — always check before suggesting a method.
182
- 4. **List tests**: `npx codeceptjs dry-run -c <config>` — `--steps` shows queued actions, `--grep` filters, `--numbers` gives per-test step indices matching MCP `pauseAt`.
183
- - ⚠ `dry-run --grep` and `run --grep` do **not** select the same set (4.1.0): `run --grep` matches `Feature` + `Scenario`, `dry-run --grep` matches the Scenario title only. `dry-run --grep 'Dialogs'` lists 0 tests where `run --grep 'Dialogs'` executes all 11. Never size a run from a dry-run's grep, and target a whole Feature by file path (`run tests/foo_test.ts`) when the selection must be exact.
184
-
185
- Gherkin projects: `npx codeceptjs gherkin:steps -c <config>`.
186
-
187
- Reference docs live under `node_modules/codeceptjs/docs/` — read them instead of guessing APIs.
188
-
189
- ## Report
190
-
191
- Short prose summary. Must include:
192
-
193
- - Env-driven values flagged as env-driven (`process.env.BROWSER || 'chromium'`, not just `'chromium'`)
194
- - Conflicts flagged (static `show: true` vs `setHeadlessWhen(CI)`; `auth` configured but credential env vars missing)
195
- - No config at root and no `--config` referenced → recommend `npx codeceptjs init .`, stop
196
- - 3.x/CommonJS detected → recommend `migrate-codeceptjs-4`, stop
@@ -1,83 +0,0 @@
1
- ---
2
- name: codeceptjs-run-analysis
3
- description: >
4
- Use after running CodeceptJS tests with the `aiTrace` plugin enabled and the
5
- results need review — verify a fix held, investigate a single failure, cluster
6
- errors across a CI fail-storm, diagnose flakiness across reruns. Invoked by
7
- other CodeceptJS skills whenever a run has happened. Trigger on "what failed",
8
- "analyse the run", "cluster these errors", "is it flaky", "did the fix hold".
9
- ---
10
-
11
- # CodeceptJS Run Analysis
12
-
13
- After `npx codeceptjs run`, trace artifacts land in `output/`. This skill reads them efficiently — right step, right file, right slice of a giant HTML snapshot — via bash tools rather than re-running through MCP.
14
-
15
- No single end goal: pick the use case matching the situation. The foundations apply to all of them.
16
-
17
- ## Foundations
18
-
19
- - **aiTrace must be on.** Everything leans on `output/trace_<TestName>_<hash>/trace.md`. Confirm in the active config (run `codeceptjs-fundamentals` if unknown). Without it there are only screenshots and `pageInfo` dumps — suggest enabling and re-running before deep analysis.
20
- - `run_step_by_step` is interactive only; `aiTrace` is the sole source of per-step files. Ad-hoc `run_code` / `snapshot` still produce single-shot bundles under `output/trace_run_code_*` / `output/snapshot_*`.
21
- - **Locate traces**: reruns create new dirs — when unclear, most recent wins (`ls -dt output/trace_*`).
22
- - **Read trace.md first** — it's the index linking each step to its artifacts.
23
- - Focus on the failed step; none marked → last step in the trace.
24
- - Multiple failures marked → the **first** is usually the cause; the rest cascade.
25
-
26
- ### Artifact order for the focus step (`NNNN_<step>`)
27
-
28
- | Artifact | When |
29
- |---|---|
30
- | `NNNN_*_aria.txt` | First read — lean, structured, easy to scan for duplicates |
31
- | `NNNN_*_screenshot.png` | Visual confirmation — layout, animation, "rendered but wrong" |
32
- | `NNNN_*_console.json` | JS errors, 4xx/5xx, deprecation warnings explaining vanished elements |
33
- | `NNNN_*_storage.json` | Cookies + localStorage at this step — first stop when auth suspected |
34
- | `NNNN_*_page.html` | Last resort, and only via `grep` |
35
-
36
- ### Never read big files whole
37
-
38
- - HTML snapshots: search with `grep` (text, class, aria-label, `data-*`) — line numbers + context flags keep matches readable.
39
- - `console.json`: filter with `jq`, don't read every entry.
40
- - Scanning many files: `grep -l` for filenames only.
41
-
42
- ## Use cases
43
-
44
- ### Verify a fix held
45
- Locate latest trace → read trace.md → confirm no FAILED markers. Glance at `console.json` for warnings worth fixing while you're there.
46
-
47
- ### Cluster errors across a CI batch
48
- Extract failing-step lines from every `trace.md`, group by signature (`grep` + `sort` + `uniq -c`), rank by frequency.
49
- - Same error in many tests = **systemic** (env var, auth, base URL, deploy regression) — fix root cause once, rerun the batch.
50
- - Different errors per test = local — triage one at a time.
51
- Start with the most frequent root cause; rerun to see how many tests came back with it.
52
-
53
- ### Diagnose flakiness
54
- Rerun the same test 5–10 times; compare which step failed in each trace.
55
- - Different step each run → timing, environment, external service
56
- - Same step, different state → missing/wrong wait — `diff` the ARIA snapshots of that step between runs
57
- - `console.json` differs between runs → transient backend/network errors
58
- - Bounding box differs → layout reflow or late-loading content
59
-
60
- ### Investigate a single failure
61
- Failed-or-last step → ARIA + screenshot first, console second, HTML last (grep only). Form a hypothesis. Trace not enough / page needs live poking → hand off to `debugging-codeceptjs-tests`.
62
-
63
- ## After analysis
64
-
65
- - Systemic cause → fix root once (env, auth, deploy), not per test
66
- - Locator drift → `codeceptjs-exploration`
67
- - Timing/wait issue → Waiting guidance from fundamentals/writing skills; replace `I.wait(N)` with specific `waitFor*`
68
- - Resists static analysis → `debugging-codeceptjs-tests` (live MCP loop)
69
- - Clean pass → done, but glance at `console.json` anyway
70
-
71
- ## Things to avoid
72
-
73
- - Reading large HTML or `console.json` whole — `grep` / `jq`.
74
- - Stopping at the last marked failure instead of the first.
75
- - Triaging individual failures before clustering.
76
- - Flakiness conclusions from a single run — needs 5+ reruns.
77
- - Deleting `output/` mid-investigation.
78
-
79
- ## Related skills
80
-
81
- - `codeceptjs-fundamentals` — what's configured, aiTrace `-p` overrides
82
- - `codeceptjs-exploration` — locator drift fixes
83
- - `debugging-codeceptjs-tests` — live loop + offline locator resolution via `codeceptq`
@@ -1,126 +0,0 @@
1
- ---
2
- name: debugging-codeceptjs-tests
3
- description: >
4
- Use when a CodeceptJS 4 test fails, flakes, or behaves unexpectedly. Trigger
5
- on run errors and stack traces from `npx codeceptjs run`, intermittent
6
- failures, locator drift, timing issues, "works locally fails in CI", "why
7
- does this fail", trace/screenshot/console mentions, and breakpoint /
8
- step-through / "pause at step N" requests.
9
- ---
10
-
11
- # Debugging CodeceptJS 4 Tests
12
-
13
- Failures lie — the error usually points at a step that's a side effect of something earlier (auth expired, frame switch missed, network call pending). Reproduce, capture state, read it, then fix.
14
-
15
- ## Paths
16
-
17
- - **MCP-first (AI agents)**: `run_test` / in-test `pause()` yield control to the agent on the same `I` / browser the test uses. Inspect via `run_code` / `snapshot`; step through via `run_step_by_step` + `continue`.
18
- - **CLI fallback (humans / CI / framework internals)**: `--debug` → `--verbose` → `DEBUG="codeceptjs:*"`. The DEBUG escape hatch is only for framework-internal suspicion: recorder hangs, plugin races, event leaks, "step never ran". Namespaces: `codeceptjs:recorder`, `codeceptjs:pause`, `codeceptjs:ai`, `codeceptjs:plugin:<name>`.
19
-
20
- `pause()` adapts to who's driving: TTY → readline REPL; MCP → yields control to the agent; non-TTY non-MCP subprocess → prints a notice and resolves (no CI deadlock).
21
-
22
- ## Workflow
23
-
24
- 1. **Fundamentals** — run `codeceptjs-fundamentals`: helper, plugins (`aiTrace`, `screenshot`, `pageInfo`, `retryFailedStep`, `pause`, `auth`), env vars, MCP availability. If `aiTrace` isn't declared, add it once: `plugins: { aiTrace: { enabled: true } }` — most of this skill leans on its output.
25
- - **Declare once; never edit config to change its trigger.** Override per-run with `-p aiTrace:on=step|fail|test|file|url` (fundamentals § Plugins from CLI). `on=fail` for lean CI repros, `on=step` while diagnosing. Flipping `on:` in config churns the repo and leaks into other runs.
26
- 2. **Reproduce minimally**: `npx codeceptjs run --grep '<scenario>' --steps`. Add `-c codecept.ci.conf.js` if CI-specific. Confirm reproduction before instrumenting.
27
- 3. **Pick tools**:
28
- - MCP `run_test <test>` — runs in-process; returns reporter result or `{ status: 'paused', pausedAfter, page, suggestions }`
29
- - MCP `run_step_by_step` + `continue` — pause after every step; for watching the whole flow
30
- - MCP `run_code` — arbitrary code in the live session; works fresh *and* paused; returns produced values + console output + final-state snapshot
31
- - MCP `snapshot` — current browser state without acting (URL, cookies, storage, HTML, ARIA, screenshot, console)
32
- - MCP `list_actions` — sanity-check an `I.*` method exists
33
- - CLI `npx codeceptjs run --grep '<scenario>' --debug` — first move without MCP; `--verbose` adds promise-queue/retry/timeout logs
34
- 4. **Breakpoint**:
35
- - In-test `pause()` — best when already editing or breaking inside `within`/loop/hook
36
- - `pauseAt: N` on `run_test` — no test edit; pauses after the Nth leaf step
37
- - Find N: `npx codeceptjs dry-run --debug --grep '<scenario>' --numbers --no-ansi` (1-based, per-test; number of the line to stop *after*)
38
- - While paused: inspect with `run_code`, capture clean state with `snapshot`, walk prior steps in `output/trace_<TestName>_<hash>/trace.md`, release with `continue`
39
- 5. **Read the trace** — hand off to `codeceptjs-run-analysis`; focus on the **first** failed step — late failures are usually side effects of an earlier silent miss. It also covers grepping large HTML, clustering errors across traces, comparing reruns.
40
- 6. **Form a hypothesis**:
41
-
42
- | Symptom | Likely cause |
43
- |---|---|
44
- | Element missing, page is `/login` | Auth: stale session cache, missing env var |
45
- | Element in HTML but `display: none` | `waitForVisible`, not `waitForElement` |
46
- | Locator matches 2+ (strict mode) | Scope it: context arg, then ARIA role, then `step.opts({ elementIndex })` |
47
- | Element present in screenshot N+1, missing in N | Animation / lazy load → `waitForVisible(loc, t)` |
48
- | 401/403 in console.json | API token expired or env var missing |
49
- | Steps pass, next `I.see` fails | Frame switch missed → `within({ frame })` |
50
- | Different result CI vs local | `setHeadlessWhen(CI)`, viewport, timing, env vars |
51
- | Recorder hangs, step never fires | `DEBUG="codeceptjs:recorder"` |
52
- | Plugin misbehaves | `DEBUG="codeceptjs:plugin:<name>"` |
53
-
54
- 7. **Verify the fix on the live page** — try the candidate replacement step via `run_code` (works while paused, same `I`) **before editing the file**. Humans at a TTY get the same via in-test `pause()`.
55
- 8. **Apply and re-run**: edit, then `npx codeceptjs run --grep '<scenario>' --steps`; confirm via `codeceptjs-run-analysis` that the failure didn't shift steps. Leave a one-line `Why:` comment when the fix introduces `waitFor*` or `step.opts` — those comments are worth keeping.
56
-
57
- ## Query trace HTML with `codeceptq`
58
-
59
- `aiTrace` writes per-step `<NNNN>_<step>_page.html` snapshots (one element per line — line numbers map 1:1 to elements). `codeceptq` resolves any CodeceptJS locator against a saved snapshot.
60
-
61
- - **Never load page HTML into context manually** — snapshots are thousands of lines; `codeceptq` returns only matched elements with their line numbers.
62
- - Test candidate locators offline before applying via `run_code` — a hit is a green light to try live, not a guarantee (visibility, re-renders).
63
- - Multiple matches → don't write a brittler XPath; disambiguate with `step.opts({ elementIndex })` following the order `codeceptq` prints.
64
-
65
- ```bash
66
- npx codeceptq '#submit-btn' --file output/trace_*/0007_*_page.html # CSS
67
- npx codeceptq 'Email' --field --file output/trace_*/0003_*_page.html # semantic field
68
- npx codeceptq 'Save' '.modal' --click --file output/trace_*/0005_*_page.html # scoped clickable
69
- npx codeceptq 'Username' --field --json --file ... # machine-readable
70
- ```
71
-
72
- Key flags: `--field/--click/--checkable/--select` force semantic strategies; `--xpath`/`--css` override auto-detection (a bare tag name like `select.foo` is treated as fuzzy text); exit codes `0` match / `1` none / `2` invalid input.
73
-
74
- > ⚠ **The `[context]` second positional does not scope** (CodeceptJS 4.1.0). It prints `N matches within '<ctx>'` but returns page-wide results — `lib/command/query.js` evaluates an absolute XPath (`//…`) against the context node, and `//foo` re-roots at the document. It will report a match inside a container that does not hold the element. To check a scoped locator offline, pass one composed selector (`codeceptq '.modal button[aria-label="Save"]'`) and compare its count against the unscoped form; a context-dependent locator is only truly verified by running the step.
75
-
76
- ## Inspect deeper
77
-
78
- Hand off to `codeceptjs-exploration` when the trace says *what* failed but you need more page-state detail ("is this button actually disabled?", "are there really two Save buttons?"). Debug-specific reaches:
79
-
80
- - Button rendered but click had no effect → `grabWebElement('Submit')` + `isEnabled()` + `getBoundingBox()` (disabled? offscreen?)
81
- - Strict-mode multi-match → exploration's broad-XPath iterate-and-disambiguate pattern
82
- - Iframe content → wrap failing steps in `within({ frame })`
83
-
84
- Prefer this over `usePlaywrightTo`/`useWebDriverTo` for inspection — same code across helpers, less boilerplate.
85
-
86
- ## Native helper escape hatch
87
-
88
- Only when the `I.*` surface truly doesn't cover it (network interception, storage manipulation, helper-only APIs):
89
-
90
- - Playwright: `I.usePlaywrightTo('label', async ({ browser, browserContext, page }) => { ... })`
91
- - Puppeteer: `I.usePuppeteerTo('label', async ({ page }) => { ... })`
92
- - WebDriver: `I.useWebDriverTo('label', async ({ browser }) => { ... })`
93
-
94
- The label shows up in step output and traces. Works inside MCP `run_code` too. These couple tests to a specific helper — last resort.
95
-
96
- ## Helper gotchas
97
-
98
- - Playwright: `strict: true` throws on multi-match; prefer `'load'`/`'domcontentloaded'` over `'networkidle'`; `trace: 'on'` → `output/trace.zip` (`npx playwright show-trace`)
99
- - Puppeteer: `'networkidle0'` hangs on long-polling pages — use `'networkidle2'` or `'domcontentloaded'`
100
- - WebDriver: `smartWait` covers actions only, not assertions; `executeScript` args must be JSON-serializable
101
-
102
- ## Auth-related failures
103
-
104
- Redirect to `/login` mid-test or 401/403 in console → fix **auth**, not the failing step: check the plugin's `check`, credential env vars, and stale cached session under `output/<role>_session.json` (delete to force re-login). Full pattern in `codeceptjs-auth`.
105
-
106
- ## Flakiness and waits
107
-
108
- Most "intermittent" failures are missed waits. Use trace HTML/ARIA to find the actual gating element instead of adding generic delay (fundamentals § Waiting has the mapping). `I.wait(N)` confirms a timing hypothesis while debugging — replace with the specific `waitFor*` before committing.
109
-
110
- ## Things to avoid
111
-
112
- - Fixing from the error message without reading the trace.
113
- - Editing the test before verifying the fix via `run_code`.
114
- - Committing `pause()` calls — debugging tool only.
115
- - Blind `waitFor*` instead of identifying the real gating element.
116
- - Leaving `I.wait(N)` in committed tests.
117
- - Editing `aiTrace`'s `on:` in config between runs — declare once, override per-run.
118
- - Skipping the config check — `setHeadlessWhen(CI)` / env-driven URLs explain many "works locally fails in CI".
119
- - Hiding failures with `retries` instead of fixing the cause.
120
-
121
- ## Related skills
122
-
123
- - `codeceptjs-fundamentals` — effects, plugins-from-CLI, waiting rules
124
- - `codeceptjs-exploration` — WebElement inspection, broad-XPath disambiguation
125
- - `codeceptjs-run-analysis` — trace.md walking, error clustering, rerun comparison
126
- - `codeceptjs-auth` — auth failure patterns
@@ -1,104 +0,0 @@
1
- ---
2
- name: lint-codeceptjs-tests
3
- description: >
4
- Use when a CodeceptJS 4 suite needs a static quality gate — before committing
5
- tests, reviewing a PR that touches tests, hardening CI, or on direct asks:
6
- "lint the tests", "find I.wait / setTimeout sleeps", "leftover .only or
7
- pause()", "missing await on grab", "passwords printed in logs", "why are
8
- tests slow/flaky". Runs `@codeceptjs/lint` — an AST-based linter that needs
9
- no CodeceptJS install and no browser.
10
- ---
11
-
12
- # Lint CodeceptJS 4 Tests
13
-
14
- `@codeceptjs/lint` reads tests, page objects and helpers as an AST and reports the smells that make suites slow, flaky or leaky — fixed sleeps, `if` branching, raw `fetch`, missing `await` on grabbers, plain-text credentials, leftover `.only`/`pause()`. One finding per line; exit codes `0` / `1` (errors found) / `2` (bad input, unparsable file) drop straight into CI.
15
-
16
- ## Commands
17
-
18
- ```bash
19
- npx @codeceptjs/lint # files from codecept.conf.js in cwd
20
- npx @codeceptjs/lint tests/ pages/login.js # explicit paths (no config needed)
21
- npx @codeceptjs/lint -r no-pause -r no-only # only these rules (or --rules a,b)
22
- npx @codeceptjs/lint rules # list rules + defaults
23
- npx @codeceptjs/lint --json # file, line, column, rule, level, message, source
24
- npx @codeceptjs/lint -c e2e/codecept.conf.js # config in another directory
25
- ```
26
-
27
- Without paths it reads `codecept.conf.js|ts|cjs|mjs` and lints everything matched by `tests`, local `include` files (page objects, steps file) and helpers loaded via `require`. TypeScript is parsed with Node's type stripping (Node 22.13+); `enum`/`namespace` report as parse errors. A TS config importing `./x.js` for an `x.ts` file (tsx convention) loads when the project has `tsx` installed.
28
-
29
- ## Rules and the fix for each
30
-
31
- | Rule | Default | Detects → fix |
32
- |---|---|---|
33
- | `no-fixed-wait` | error | `I.wait(5)` → `I.waitForElement` / `I.waitForText` / `I.see` |
34
- | `no-sleep` | error | bare and `window.`/`globalThis.` `setTimeout`, incl. `await new Promise(r => setTimeout(r, ms))` and `timers/promises`, outside helpers → condition wait |
35
- | `no-if-in-test` | error | `if` inside a Scenario/hook → `tryTo()` from `codeceptjs/effects` |
36
- | `no-fetch` | error | `fetch()` (incl. `window.fetch`, `globalThis.fetch`) outside helpers → REST helper `I.sendGetRequest` / `I.sendPostRequest` |
37
- | `no-console` | warn | `console.*` outside helpers → `I.say()` (lands in the report) |
38
- | `no-only` | error on CI, warn locally | `Scenario.only`, `Feature.only`, `Data(...).only` → remove before commit |
39
- | `no-pause` | error on CI, warn locally | `pause()`, `this.pause()` → remove before commit |
40
- | `no-skip` | warn | `Scenario.skip`, `Feature.skip`, `xScenario`, `xFeature` → intentional? suppress with a comment explaining why |
41
- | `secret-credentials` | error | credential-ish `process.env.X` / `process.env['X']` or a password/token/secret/api-key locator passed to `I.*` → wrap with `secret()` |
42
- | `await-grab` | error | `I.grab*()` assigned, destructured or passed without `await` (`await Promise.all([...])` and `.then()` chains are fine) → add `await` |
43
- | `no-actor-in-helper` | error | `I` inside a class extending `Helper` → `this.helpers['Name']` |
44
- | `raw-browser-in-test` | warn | `I.use*To`, `I.executeScript` in a Scenario → move into a helper or page object |
45
-
46
- "On CI" = the `CI` env var is set — local debugging stubs (`pause()`, `.only`) stay warnings so they don't fail the lint while investigating.
47
-
48
- ## Configuring per project
49
-
50
- Levels live in the config, next to the tests they govern:
51
-
52
- ```js
53
- export const config = {
54
- tests: './*_test.js',
55
- lint: {
56
- rules: { 'no-if-in-test': 'warn', 'raw-browser-in-test': 'off' },
57
- },
58
- }
59
- ```
60
-
61
- Levels: `error`, `warn`, `off`. For a single deliberate case, suppress inline — rule id required, never disable a rule project-wide for one line:
62
-
63
- ```js
64
- I.wait(1) // codeceptjs-lint-disable-line no-fixed-wait
65
- ```
66
-
67
- ## Workflow
68
-
69
- 1. Run `npx @codeceptjs/lint` at the project root; if no config loads (secrets, tsx-less TS config), pass paths explicitly.
70
- 2. Fix errors first (they fail CI), warnings by judgment. Triage by cost: sleeps and missing `await` are the flakiness drivers; `secret()` fixes are one-line.
71
- 3. For bulk cleanup, feed `--json` output to drive file-by-file edits — the `source` field holds the offending line (truncated to 120 chars).
72
- 4. Add the gate so it stays clean:
73
-
74
- ```yaml
75
- # CI, before codeceptjs run
76
- - run: npx @codeceptjs/lint
77
- ```
78
-
79
- For agent-driven work, a Claude Code `PreToolUse` hook blocks edits that *add* a new error (pre-existing errors and warnings never block; a failing hook allows the edit):
80
-
81
- ```json
82
- {
83
- "hooks": {
84
- "PreToolUse": [
85
- { "matcher": "Write|Edit|MultiEdit", "hooks": [{ "type": "command", "command": "npx @codeceptjs/lint --hook claude" }] }
86
- ]
87
- }
88
- }
89
- ```
90
-
91
- ## Things to avoid
92
-
93
- - "Fixing" `await-grab` by deleting the `await` usage — the grab result is a promise, the fix is `await`, not removal.
94
- - Replacing `I.wait` with a longer `I.wait`.
95
- - Suppressing `no-if-in-test` when the branch is load-bearing — that's `tryTo()` or a helper's job.
96
- - Adding the CI step before triaging existing findings — the suite goes red on day one.
97
- - Skipping the hook's config scope check — it only lints files the config covers.
98
-
99
- ## Related skills
100
-
101
- - `debugging-codeceptjs-tests` — `I.wait(N)` as a timing probe is fine mid-debug, lint-clean it before committing
102
- - `refactoring-codeceptjs-tests` — bulk cleanup of a lint-red suite (extract helpers, tame locators)
103
- - `writing-codeceptjs-tests` — write clean tests from the start
104
- - `ci-fix-tests` — run the lint gate first so CI fixes don't reintroduce smells