codeceptjs 4.2.1 → 4.2.3

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 (74) hide show
  1. package/README.md +5 -3
  2. package/docs/ai.md +1 -1
  3. package/docs/alternative-browsers.md +59 -4
  4. package/docs/api.md +13 -13
  5. package/docs/assertions.md +6 -6
  6. package/docs/best.md +1 -1
  7. package/docs/bootstrap.md +1 -1
  8. package/docs/data.md +8 -8
  9. package/docs/helpers/ApiDataFactory.md +2 -2
  10. package/docs/helpers/Appium.md +2 -2
  11. package/docs/helpers/Decision.md +1 -1
  12. package/docs/helpers/Detox.md +1 -1
  13. package/docs/helpers/ExpectHelper.md +1 -1
  14. package/docs/helpers/FileSystem.md +1 -1
  15. package/docs/helpers/GraphQL.md +1 -1
  16. package/docs/helpers/GraphQLDataFactory.md +2 -2
  17. package/docs/helpers/JSONResponse.md +1 -1
  18. package/docs/helpers/Kitesurf.md +1 -1
  19. package/docs/helpers/Lightpanda.md +1837 -9
  20. package/docs/helpers/MockRequest.md +1 -1
  21. package/docs/helpers/Moli.md +1956 -0
  22. package/docs/helpers/Obscura.md +1 -1
  23. package/docs/helpers/Playwright.md +2 -2
  24. package/docs/helpers/Puppeteer.md +3 -3
  25. package/docs/helpers/REST.md +1 -1
  26. package/docs/helpers/WebDriver.md +1 -1
  27. package/docs/installation.md +19 -1
  28. package/docs/lint.md +111 -0
  29. package/docs/mobile.md +3 -2
  30. package/docs/mobilewright.md +166 -0
  31. package/docs/parallel.md +1 -1
  32. package/docs/playwright.md +5 -5
  33. package/docs/plugins/aiTrace.md +1 -1
  34. package/docs/plugins/autoDelay.md +1 -1
  35. package/docs/plugins/customLocator.md +1 -1
  36. package/docs/plugins/customReporter.md +1 -1
  37. package/docs/plugins/junitReporter.md +2 -2
  38. package/docs/plugins/pageInfo.md +1 -1
  39. package/docs/plugins/pauseOnFail.md +1 -1
  40. package/docs/plugins/retryFailedStep.md +1 -1
  41. package/docs/plugins/screenshotOnFail.md +1 -1
  42. package/docs/plugins/stepTimeout.md +1 -1
  43. package/docs/plugins.md +10 -10
  44. package/docs/puppeteer.md +4 -4
  45. package/docs/timeouts.md +5 -5
  46. package/docs/webdriver.md +8 -8
  47. package/lib/aria.js +1 -0
  48. package/lib/codecept.js +1 -1
  49. package/lib/command/run-multiple.js +7 -2
  50. package/lib/container.js +1 -1
  51. package/lib/helper/ApiDataFactory.js +1 -1
  52. package/lib/helper/Appium.js +1 -1
  53. package/lib/helper/Decision.js +1 -1
  54. package/lib/helper/GraphQLDataFactory.js +1 -1
  55. package/lib/helper/Moli.js +125 -0
  56. package/lib/helper/Playwright.js +1 -1
  57. package/lib/helper/Puppeteer.js +3 -3
  58. package/lib/helper/WebDriver.js +3 -6
  59. package/lib/mocha/asyncWrapper.js +14 -3
  60. package/lib/mocha/cli.js +2 -2
  61. package/lib/mocha/index.js +1 -2
  62. package/lib/mocha/suite.js +1 -1
  63. package/lib/mocha/test.js +2 -2
  64. package/lib/mocha/ui.js +3 -3
  65. package/lib/plugin/auth.js +3 -0
  66. package/lib/plugin/junitReporter.js +21 -12
  67. package/lib/plugin/pause.js +1 -1
  68. package/lib/recorder.js +20 -2
  69. package/lib/step/func.js +1 -1
  70. package/lib/step/helper.js +1 -1
  71. package/lib/workers.js +15 -0
  72. package/package.json +31 -34
  73. package/typings/promiseBasedTypes.d.ts +112 -6
  74. package/typings/types.d.ts +112 -6
package/lib/recorder.js CHANGED
@@ -89,6 +89,8 @@ export default {
89
89
  */
90
90
  reset() {
91
91
  if (promise && running) this.catch()
92
+ else swallow(promise)
93
+ oldPromises.forEach(swallow)
92
94
  queueId++
93
95
  sessionId = null
94
96
  sessionStack = [] // Clear the session stack
@@ -125,6 +127,16 @@ export default {
125
127
  * @inner
126
128
  */
127
129
  start(name) {
130
+ if (sessionId === name) {
131
+ // re-starting the same session abandons the current (broken) chain
132
+ // without polluting the session stack
133
+ debug(`${currentQueue()}Session <${name}> already started, abandoning its chain`)
134
+ tasks.push('--->')
135
+ this.running = true
136
+ swallow(promise)
137
+ promise = Promise.resolve()
138
+ return
139
+ }
128
140
  if (sessionId) {
129
141
  debug(`${currentQueue()}Session already started as ${sessionId}, nesting session ${name}`)
130
142
  // Push current session to stack instead of restoring it
@@ -136,7 +148,7 @@ export default {
136
148
  }
137
149
  debug(`${currentQueue()}Starting <${name}> session`)
138
150
  tasks.push('--->')
139
- oldPromises.push(promise)
151
+ oldPromises.push(swallow(promise))
140
152
  this.running = true
141
153
  sessionId = name
142
154
  promise = Promise.resolve()
@@ -151,7 +163,8 @@ export default {
151
163
  debug(`${currentQueue()}Finalize <${name}> session`)
152
164
  this.running = false
153
165
  this.catch(errFn)
154
- promise = promise.then(() => oldPromises.pop())
166
+ const restored = oldPromises.pop()
167
+ if (restored && restored !== promise) promise = promise.then(() => restored)
155
168
 
156
169
  // Restore parent session from stack if available
157
170
  if (sessionStack.length > 0) {
@@ -426,6 +439,11 @@ export default {
426
439
  },
427
440
  }
428
441
 
442
+ function swallow(p) {
443
+ if (p) p.catch(() => {})
444
+ return p
445
+ }
446
+
429
447
  function getTimeoutPromise(timeoutMs, taskName) {
430
448
  let timer
431
449
  if (timeoutMs) debug(`Timing out in ${timeoutMs}ms`)
package/lib/step/func.js CHANGED
@@ -21,7 +21,7 @@ class FuncStep extends BaseStep {
21
21
  // we wrap that function to track time and status
22
22
  // and disable it in dry run mode
23
23
  this.args = Array.prototype.slice.call(arguments)
24
- this.startTime = +Date.now()
24
+ if (!this.startTime) this.startTime = +Date.now()
25
25
 
26
26
  if (store.dryRun) {
27
27
  this.setStatus('success')
@@ -16,7 +16,7 @@ class HelperStep extends Step {
16
16
  */
17
17
  run() {
18
18
  this.args = Array.prototype.slice.call(arguments)
19
- this.startTime = +Date.now()
19
+ if (!this.startTime) this.startTime = +Date.now()
20
20
 
21
21
  if (store.dryRun) {
22
22
  this.setStatus('success')
package/lib/workers.js CHANGED
@@ -104,9 +104,22 @@ const createWorker = (workerObject, isPoolMode = false, skipTests = []) => {
104
104
  })
105
105
 
106
106
  WorkerStorage.addWorker(worker)
107
+ worker.runOutputDir = workerObject.runOutputDir
107
108
  return worker
108
109
  }
109
110
 
111
+ const tagWithRun = (message, runOutputDir) => {
112
+ if (!message.event || !message.data || typeof message.data !== 'object') return
113
+ const runName = path.basename(runOutputDir)
114
+ const tag = obj => {
115
+ if (!obj || typeof obj !== 'object' || obj.outputDir) return
116
+ obj.outputDir = runOutputDir
117
+ if (obj.uid) obj.uid = `${obj.uid}@${runName}`
118
+ }
119
+ tag(message.data)
120
+ if (Array.isArray(message.data.tests)) message.data.tests.forEach(tag)
121
+ }
122
+
110
123
  const simplifyObject = object => {
111
124
  return Object.keys(object)
112
125
  .filter(k => k.indexOf('_') !== 0)
@@ -169,6 +182,7 @@ const createWorkerObjects = (testGroups, config, testRoot, options, selectedRuns
169
182
  workerObj.addTests(tests)
170
183
  workerObj.setTestRoot(testRoot)
171
184
  workerObj.addOptions(options)
185
+ workerObj.runOutputDir = path.resolve(testRoot, finalConfig.output)
172
186
  testWorkerArray.push(workerObj)
173
187
  })
174
188
  workers.push(...testWorkerArray)
@@ -659,6 +673,7 @@ class Workers extends EventEmitter {
659
673
 
660
674
  worker.on('message', message => {
661
675
  lastActivity = Date.now() // Update activity timestamp
676
+ if (worker.runOutputDir) tagWithRun(message, worker.runOutputDir)
662
677
 
663
678
  // Track current test
664
679
  if (message.event === event.test.started && message.data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "type": "module",
5
5
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
6
6
  "keywords": [
@@ -59,39 +59,37 @@
59
59
  "mock-server:stop": "kill -9 $(lsof -t -i:3001)",
60
60
  "test:with-mock-server": "npm run mock-server:start && npm test",
61
61
  "json-server:graphql": "node test/data/graphql/index.js",
62
- "lint": "eslint bin/ examples/ lib/ test/ translations/ runok.cjs",
63
- "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runok.cjs --fix",
64
- "prettier": "prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js runok.cjs",
65
- "docs": "./runok.cjs docs",
66
- "test:unit": "mocha test/unit --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
67
- "test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
68
- "test:rest": "mocha test/rest --recursive --timeout 20000 --reporter @testomatio/reporter/mocha",
69
- "test:runner": "mocha test/runner --recursive --timeout 10000 --reporter @testomatio/reporter/mocha",
62
+ "lint": "eslint bin/ examples/ lib/ test/ translations/ Bunoshfile.js",
63
+ "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ Bunoshfile.js --fix",
64
+ "prettier": "prettier --config prettier.config.js --write bin/**/*.js lib/**/*.js test/**/*.js translations/**/*.js Bunoshfile.js",
65
+ "docs": "bunosh docs",
66
+ "test:unit": "mocha test/unit --recursive --timeout 10000",
67
+ "test:unit:windows": "mocha test/unit/container_test.js --recursive --timeout 10000",
68
+ "test:rest": "mocha test/rest --recursive --timeout 20000",
69
+ "test:runner": "mocha test/runner --recursive --timeout 10000",
70
70
  "test": "npm run test:unit && npm run test:rest && npm run test:runner",
71
- "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick' --reporter @testomatio/reporter/mocha",
72
- "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second' --reporter @testomatio/reporter/mocha",
73
- "test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick' --reporter @testomatio/reporter/mocha",
74
- "test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second' --reporter @testomatio/reporter/mocha",
71
+ "test:appium-quick": "mocha test/helper/Appium_test.js --grep 'quick'",
72
+ "test:appium-other": "mocha test/helper/Appium_test.js --grep 'second'",
73
+ "test:ios:appium-quick": "mocha test/helper/Appium_ios_test.js --grep 'quick'",
74
+ "test:ios:appium-other": "mocha test/helper/Appium_ios_test.js --grep 'second'",
75
75
  "test-app:start": "php -S 127.0.0.1:8000 -t test/data/app",
76
76
  "test-app:stop": "kill -9 $(lsof -t -i:8000)",
77
- "test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js --reporter @testomatio/reporter/mocha",
78
- "test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js --reporter @testomatio/reporter/mocha",
79
- "test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000 --reporter @testomatio/reporter/mocha",
80
- "test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000 --reporter @testomatio/reporter/mocha",
81
- "test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
82
- "test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
83
- "test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000 --reporter @testomatio/reporter/mocha",
84
- "test:unit:expect": "mocha test/helper/Expect_test.js --reporter @testomatio/reporter/mocha",
85
- "test:plugin": "mocha test/plugin/plugin_test.js --reporter @testomatio/reporter/mocha",
86
- "def": "./runok.cjs def",
77
+ "test:unit:webbapi:playwright": "mocha test/helper/Playwright_test.js",
78
+ "test:unit:webbapi:puppeteer": "mocha test/helper/Puppeteer_test.js",
79
+ "test:unit:webbapi:webDriver": "mocha test/helper/WebDriver_test.js --timeout 10000",
80
+ "test:unit:webbapi:webDriver:noSeleniumServer": "mocha test/helper/WebDriver.noSeleniumServer_test.js --timeout 10000",
81
+ "test:unit:webbapi:cdpbrowser": "mocha test/helper/CDPBrowser_chrome_test.js --timeout 30000",
82
+ "test:unit:webbapi:obscura": "mocha test/helper/CDPBrowser_obscura_test.js --timeout 30000",
83
+ "test:unit:webbapi:lightpanda": "mocha test/helper/CDPBrowser_lightpanda_test.js --timeout 30000",
84
+ "test:unit:webbapi:moli": "mocha test/helper/CDPBrowser_moli_test.js --timeout 30000",
85
+ "test:unit:expect": "mocha test/helper/Expect_test.js",
86
+ "test:plugin": "mocha test/plugin/plugin_test.js",
87
+ "def": "bunosh def",
87
88
  "dev:graphql": "node test/data/graphql/index.js",
88
- "publish:site": "./runok.cjs publish:site",
89
- "update-contributor-faces": "./runok.cjs contributor:faces",
89
+ "update-contributor-faces": "bunosh contributor:faces",
90
90
  "types-fix": "node typings/fixDefFiles.js",
91
91
  "dtslint": "npm run types-fix && tsd",
92
- "prepare": "husky install",
93
- "prepare-release": "./runok.cjs versioning && ./runok.cjs get:commit-log",
94
- "publish-beta": "./runok.cjs publish:next-beta-version"
92
+ "prepare": "husky install"
95
93
  },
96
94
  "dependencies": {
97
95
  "@codeceptjs/configure": "^4.0.0-beta.4",
@@ -100,11 +98,11 @@
100
98
  "@cucumber/gherkin": "38.0.0",
101
99
  "@cucumber/messages": "32.3.1",
102
100
  "@modelcontextprotocol/sdk": "^1.26.0",
103
- "@xmldom/xmldom": "0.9.10",
101
+ "@xmldom/xmldom": "^0.9.12",
104
102
  "acorn": "8.15.0",
105
103
  "ai": "7.0.132",
106
104
  "arrify": "3.0.0",
107
- "axios": "1.16.1",
105
+ "axios": "^1.20.0",
108
106
  "chalk": "4.1.2",
109
107
  "cheerio": "^1.0.0",
110
108
  "chokidar": "^5.0.0",
@@ -127,7 +125,7 @@
127
125
  "lodash.merge": "4.6.2",
128
126
  "lodash.shuffle": "4.2.0",
129
127
  "mkdirp": "3.0.1",
130
- "mocha": "11.7.5",
128
+ "mocha": "^12.0.3",
131
129
  "monocart-coverage-reports": "2.12.12",
132
130
  "ms": "2.1.3",
133
131
  "multer": "^2.0.2",
@@ -160,8 +158,8 @@
160
158
  "@wdio/sauce-service": "9.12.5",
161
159
  "@wdio/selenium-standalone-service": "8.15.0",
162
160
  "@wdio/utils": "9.23.3",
163
- "@xmldom/xmldom": "0.9.10",
164
- "bunosh": "latest",
161
+ "@xmldom/xmldom": "^0.9.12",
162
+ "bunosh": "^0.6.0",
165
163
  "chai": "^6.2.1",
166
164
  "chai-as-promised": "^8.0.2",
167
165
  "chai-subset": "1.6.0",
@@ -184,7 +182,6 @@
184
182
  "puppeteer": "24.36.0",
185
183
  "qrcode-terminal": "0.12.0",
186
184
  "rosie": "2.1.1",
187
- "runok": "^0.9.3",
188
185
  "semver": "7.7.3",
189
186
  "sinon": "22.0.0",
190
187
  "sinon-chai": "^4.0.1",
@@ -92,7 +92,7 @@ declare namespace CodeceptJS {
92
92
  * It is required to set REST API `endpoint` which is the baseURL for all API requests.
93
93
  * Factory file is expected to be passed via `factory` option.
94
94
  *
95
- * This Helper uses [REST](http://codecept.io/helpers/REST/) helper and accepts its configuration in "REST" section.
95
+ * This Helper uses [REST](http://codecept.io/helpers/rest/) helper and accepts its configuration in "REST" section.
96
96
  * For instance, to set timeout you should add:
97
97
  *
98
98
  * ```js
@@ -3016,7 +3016,7 @@ declare namespace CodeceptJS {
3016
3016
  * It is required to set GraphQL `endpoint` which is the URL to which all the queries go to.
3017
3017
  * Factory file is expected to be passed via `factory` option.
3018
3018
  *
3019
- * This Helper uses [GraphQL](http://codecept.io/helpers/GraphQL/) helper and accepts its configuration in "GraphQL" section.
3019
+ * This Helper uses [GraphQL](http://codecept.io/helpers/graph-ql/) helper and accepts its configuration in "GraphQL" section.
3020
3020
  * For instance, to set timeout you should add:
3021
3021
  *
3022
3022
  * ```js
@@ -3495,6 +3495,112 @@ declare namespace CodeceptJS {
3495
3495
  class LightpandaTs {
3496
3496
  constructor(config: LightpandaConfig);
3497
3497
  }
3498
+ /**
3499
+ * ## Configuration
3500
+ *
3501
+ * This helper should be configured in codecept.conf.js
3502
+ * @property [endpoint] - explicit CDP endpoint. Setting this switches the helper to ATTACH
3503
+ * mode: it only connects, and never spawns or kills a process, no matter what else is configured.
3504
+ * Leave it unset for SELF-MANAGED mode (see below).
3505
+ * @property [binaryPath] - path to the `moli` executable, used in SELF-MANAGED mode
3506
+ * (`endpoint` unset). Checked before `MOLI_PATH` and `PATH`.
3507
+ * @property [port] - port `moli serve` listens on, in SELF-MANAGED mode. When unset, a free
3508
+ * port is picked automatically, which is what makes `run-workers` collision-free — every worker
3509
+ * gets its own instance on its own port with zero config.
3510
+ * @property [serverStartTimeout = 15000] - milliseconds to wait for a spawned `moli serve` to
3511
+ * answer `/json/version` before `_connect` gives up.
3512
+ */
3513
+ type MoliConfig = {
3514
+ endpoint?: string;
3515
+ binaryPath?: string;
3516
+ port?: number;
3517
+ serverStartTimeout?: number;
3518
+ };
3519
+ /**
3520
+ * Moli drives [Moli](https://github.com/lexmount/moli), an open-source headless browser written
3521
+ * in Rust for automation, exposed over the Chrome DevTools Protocol. It runs real JavaScript in V8
3522
+ * and computes styles with Servo's Stylo, but by default skips layout and painting: element boxes
3523
+ * use deterministic placeholder geometry, so there are no screenshots and no coordinate input.
3524
+ *
3525
+ * This helper is a thin `CDPBrowser` subclass: it changes nothing about how locating or acting on
3526
+ * elements works, it only pins the config presets Moli requires and manages the `moli serve`
3527
+ * process lifecycle, the same way Playwright manages its own browser process.
3528
+ *
3529
+ * > Moli support is experimental. Pin the browser version in CI and keep a
3530
+ * > Playwright/WebDriver job for browser-compatibility coverage.
3531
+ *
3532
+ * ## Modes
3533
+ *
3534
+ * - **ATTACH** — `endpoint` is set explicitly in the config. The helper only connects to it; it
3535
+ * never spawns or kills anything, no matter what `binaryPath`/`port` are set to.
3536
+ * - **SELF-LAUNCH** — `endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
3537
+ * the config, then the `MOLI_PATH` environment variable, then `moli` on `PATH`. The helper
3538
+ * spawns `moli serve --host 127.0.0.1 --port <port>` (`port` from the config, or a free port
3539
+ * picked automatically), waits for it to answer, connects, and kills it in `_finishTest`.
3540
+ * - **COURTESY-ATTACH** — `endpoint` is unset and no binary can be resolved, but something already
3541
+ * answers `http://127.0.0.1:9222/json/version` (e.g. `moli serve` started by hand). The helper
3542
+ * attaches to it and never kills it. If neither a binary nor a running server on :9222 can be
3543
+ * found, the helper throws a loud, actionable error.
3544
+ *
3545
+ * ## Install
3546
+ *
3547
+ * Follow the [official installation instructions](https://github.com/lexmount/moli#direct-installation),
3548
+ * then put `moli` on your `PATH`, or point `binaryPath`/`MOLI_PATH` at it. The helper then
3549
+ * launches and tears it down automatically.
3550
+ *
3551
+ * ## Config presets
3552
+ *
3553
+ * These are set automatically and only need overriding for unusual setups:
3554
+ *
3555
+ * | option | value | why |
3556
+ * | --- | --- | --- |
3557
+ * | `input` | `synthetic` | without layout Moli rejects coordinate mouse input, so `click` always takes the `forceClick` path |
3558
+ * | `xpathPolyfill` | `auto` | probed per binary/page |
3559
+ * | `capabilities.layout` | `real` | Moli computes real styles and gives displayed elements a non-empty placeholder box, which is enough for `seeElement` and the `waitForVisible` family; it is pinned because the runtime probe would also enable coordinate input |
3560
+ * | `capabilities.screenshot` | `false` | screenshots require `moli serve --layout`, which this helper does not use: its layout is a snapshot that goes stale when the page changes |
3561
+ *
3562
+ * ## Limitations
3563
+ *
3564
+ * - No screenshots and no screencast: `saveScreenshot` and `saveElementScreenshot` do nothing (a debug message is printed).
3565
+ * - No coordinate-based input (`clickXY`).
3566
+ * - No frames or popups.
3567
+ * - Uploaded files are sent as `application/octet-stream` regardless of their extension.
3568
+ * - The default stylesheet does not color links: `a` computes `color: rgb(0, 0, 0)`.
3569
+ *
3570
+ * <!-- configuration -->
3571
+ *
3572
+ * ## Example
3573
+ *
3574
+ * ```js
3575
+ * // inside codecept.conf.js — SELF-LAUNCH mode (recommended): the helper finds/starts/stops
3576
+ * // moli serve on its own, on a free port. Ideal for run-workers: every worker gets its own
3577
+ * // instance with no config.
3578
+ * {
3579
+ * helpers: {
3580
+ * Moli: {
3581
+ * url: 'http://localhost',
3582
+ * }
3583
+ * }
3584
+ * }
3585
+ * ```
3586
+ *
3587
+ * ```js
3588
+ * // ATTACH mode — connect to a Moli instance you manage yourself (remote host, container, etc.)
3589
+ * {
3590
+ * helpers: {
3591
+ * Moli: {
3592
+ * url: 'http://localhost',
3593
+ * endpoint: 'http://127.0.0.1:9222',
3594
+ * }
3595
+ * }
3596
+ * }
3597
+ * ```
3598
+ *
3599
+ * ## Methods
3600
+ */
3601
+ class MoliTs {
3602
+ constructor(config: MoliConfig);
3603
+ }
3498
3604
  /**
3499
3605
  * ## Configuration
3500
3606
  *
@@ -4423,7 +4529,7 @@ declare namespace CodeceptJS {
4423
4529
  * Handles a file download. A file name is required to save the file on disk.
4424
4530
  * Files are saved to "output" directory.
4425
4531
  *
4426
- * Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
4532
+ * Should be used with [FileSystem helper](https://codecept.io/helpers/file-system) to check that file were downloaded correctly.
4427
4533
  *
4428
4534
  * ```js
4429
4535
  * I.handleDownloads('downloads/avatar.jpg');
@@ -5987,7 +6093,7 @@ declare namespace CodeceptJS {
5987
6093
  * @property [windowSize] - default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
5988
6094
  * @property [userAgent] - user-agent string.
5989
6095
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
5990
- * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
6096
+ * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/puppeteer-firefox).
5991
6097
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
5992
6098
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
5993
6099
  */
@@ -6030,7 +6136,7 @@ declare namespace CodeceptJS {
6030
6136
  * ```
6031
6137
  * Using `puppeteer-core` package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
6032
6138
  *
6033
- * > Experimental Firefox support [can be activated](https://codecept.io/helpers/Puppeteer-firefox).
6139
+ * > Experimental Firefox support [can be activated](https://codecept.io/helpers/puppeteer-firefox).
6034
6140
  *
6035
6141
  * <!-- configuration -->
6036
6142
  *
@@ -6650,7 +6756,7 @@ declare namespace CodeceptJS {
6650
6756
  clickLink(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
6651
6757
  /**
6652
6758
  * Sets a directory to where save files. Allows to test file downloads.
6653
- * Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
6759
+ * Should be used with [FileSystem helper](https://codecept.io/helpers/file-system) to check that file were downloaded correctly.
6654
6760
  *
6655
6761
  * By default, files are saved to `output/downloads`.
6656
6762
  * This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
@@ -92,7 +92,7 @@ declare namespace CodeceptJS {
92
92
  * It is required to set REST API `endpoint` which is the baseURL for all API requests.
93
93
  * Factory file is expected to be passed via `factory` option.
94
94
  *
95
- * This Helper uses [REST](http://codecept.io/helpers/REST/) helper and accepts its configuration in "REST" section.
95
+ * This Helper uses [REST](http://codecept.io/helpers/rest/) helper and accepts its configuration in "REST" section.
96
96
  * For instance, to set timeout you should add:
97
97
  *
98
98
  * ```js
@@ -3119,7 +3119,7 @@ declare namespace CodeceptJS {
3119
3119
  * It is required to set GraphQL `endpoint` which is the URL to which all the queries go to.
3120
3120
  * Factory file is expected to be passed via `factory` option.
3121
3121
  *
3122
- * This Helper uses [GraphQL](http://codecept.io/helpers/GraphQL/) helper and accepts its configuration in "GraphQL" section.
3122
+ * This Helper uses [GraphQL](http://codecept.io/helpers/graph-ql/) helper and accepts its configuration in "GraphQL" section.
3123
3123
  * For instance, to set timeout you should add:
3124
3124
  *
3125
3125
  * ```js
@@ -3598,6 +3598,112 @@ declare namespace CodeceptJS {
3598
3598
  class Lightpanda {
3599
3599
  constructor(config: LightpandaConfig);
3600
3600
  }
3601
+ /**
3602
+ * ## Configuration
3603
+ *
3604
+ * This helper should be configured in codecept.conf.js
3605
+ * @property [endpoint] - explicit CDP endpoint. Setting this switches the helper to ATTACH
3606
+ * mode: it only connects, and never spawns or kills a process, no matter what else is configured.
3607
+ * Leave it unset for SELF-MANAGED mode (see below).
3608
+ * @property [binaryPath] - path to the `moli` executable, used in SELF-MANAGED mode
3609
+ * (`endpoint` unset). Checked before `MOLI_PATH` and `PATH`.
3610
+ * @property [port] - port `moli serve` listens on, in SELF-MANAGED mode. When unset, a free
3611
+ * port is picked automatically, which is what makes `run-workers` collision-free — every worker
3612
+ * gets its own instance on its own port with zero config.
3613
+ * @property [serverStartTimeout = 15000] - milliseconds to wait for a spawned `moli serve` to
3614
+ * answer `/json/version` before `_connect` gives up.
3615
+ */
3616
+ type MoliConfig = {
3617
+ endpoint?: string;
3618
+ binaryPath?: string;
3619
+ port?: number;
3620
+ serverStartTimeout?: number;
3621
+ };
3622
+ /**
3623
+ * Moli drives [Moli](https://github.com/lexmount/moli), an open-source headless browser written
3624
+ * in Rust for automation, exposed over the Chrome DevTools Protocol. It runs real JavaScript in V8
3625
+ * and computes styles with Servo's Stylo, but by default skips layout and painting: element boxes
3626
+ * use deterministic placeholder geometry, so there are no screenshots and no coordinate input.
3627
+ *
3628
+ * This helper is a thin `CDPBrowser` subclass: it changes nothing about how locating or acting on
3629
+ * elements works, it only pins the config presets Moli requires and manages the `moli serve`
3630
+ * process lifecycle, the same way Playwright manages its own browser process.
3631
+ *
3632
+ * > Moli support is experimental. Pin the browser version in CI and keep a
3633
+ * > Playwright/WebDriver job for browser-compatibility coverage.
3634
+ *
3635
+ * ## Modes
3636
+ *
3637
+ * - **ATTACH** — `endpoint` is set explicitly in the config. The helper only connects to it; it
3638
+ * never spawns or kills anything, no matter what `binaryPath`/`port` are set to.
3639
+ * - **SELF-LAUNCH** — `endpoint` is unset and a binary can be resolved, in order: `binaryPath` in
3640
+ * the config, then the `MOLI_PATH` environment variable, then `moli` on `PATH`. The helper
3641
+ * spawns `moli serve --host 127.0.0.1 --port <port>` (`port` from the config, or a free port
3642
+ * picked automatically), waits for it to answer, connects, and kills it in `_finishTest`.
3643
+ * - **COURTESY-ATTACH** — `endpoint` is unset and no binary can be resolved, but something already
3644
+ * answers `http://127.0.0.1:9222/json/version` (e.g. `moli serve` started by hand). The helper
3645
+ * attaches to it and never kills it. If neither a binary nor a running server on :9222 can be
3646
+ * found, the helper throws a loud, actionable error.
3647
+ *
3648
+ * ## Install
3649
+ *
3650
+ * Follow the [official installation instructions](https://github.com/lexmount/moli#direct-installation),
3651
+ * then put `moli` on your `PATH`, or point `binaryPath`/`MOLI_PATH` at it. The helper then
3652
+ * launches and tears it down automatically.
3653
+ *
3654
+ * ## Config presets
3655
+ *
3656
+ * These are set automatically and only need overriding for unusual setups:
3657
+ *
3658
+ * | option | value | why |
3659
+ * | --- | --- | --- |
3660
+ * | `input` | `synthetic` | without layout Moli rejects coordinate mouse input, so `click` always takes the `forceClick` path |
3661
+ * | `xpathPolyfill` | `auto` | probed per binary/page |
3662
+ * | `capabilities.layout` | `real` | Moli computes real styles and gives displayed elements a non-empty placeholder box, which is enough for `seeElement` and the `waitForVisible` family; it is pinned because the runtime probe would also enable coordinate input |
3663
+ * | `capabilities.screenshot` | `false` | screenshots require `moli serve --layout`, which this helper does not use: its layout is a snapshot that goes stale when the page changes |
3664
+ *
3665
+ * ## Limitations
3666
+ *
3667
+ * - No screenshots and no screencast: `saveScreenshot` and `saveElementScreenshot` do nothing (a debug message is printed).
3668
+ * - No coordinate-based input (`clickXY`).
3669
+ * - No frames or popups.
3670
+ * - Uploaded files are sent as `application/octet-stream` regardless of their extension.
3671
+ * - The default stylesheet does not color links: `a` computes `color: rgb(0, 0, 0)`.
3672
+ *
3673
+ * <!-- configuration -->
3674
+ *
3675
+ * ## Example
3676
+ *
3677
+ * ```js
3678
+ * // inside codecept.conf.js — SELF-LAUNCH mode (recommended): the helper finds/starts/stops
3679
+ * // moli serve on its own, on a free port. Ideal for run-workers: every worker gets its own
3680
+ * // instance with no config.
3681
+ * {
3682
+ * helpers: {
3683
+ * Moli: {
3684
+ * url: 'http://localhost',
3685
+ * }
3686
+ * }
3687
+ * }
3688
+ * ```
3689
+ *
3690
+ * ```js
3691
+ * // ATTACH mode — connect to a Moli instance you manage yourself (remote host, container, etc.)
3692
+ * {
3693
+ * helpers: {
3694
+ * Moli: {
3695
+ * url: 'http://localhost',
3696
+ * endpoint: 'http://127.0.0.1:9222',
3697
+ * }
3698
+ * }
3699
+ * }
3700
+ * ```
3701
+ *
3702
+ * ## Methods
3703
+ */
3704
+ class Moli {
3705
+ constructor(config: MoliConfig);
3706
+ }
3601
3707
  /**
3602
3708
  * ## Configuration
3603
3709
  *
@@ -4545,7 +4651,7 @@ declare namespace CodeceptJS {
4545
4651
  * Handles a file download. A file name is required to save the file on disk.
4546
4652
  * Files are saved to "output" directory.
4547
4653
  *
4548
- * Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
4654
+ * Should be used with [FileSystem helper](https://codecept.io/helpers/file-system) to check that file were downloaded correctly.
4549
4655
  *
4550
4656
  * ```js
4551
4657
  * I.handleDownloads('downloads/avatar.jpg');
@@ -6178,7 +6284,7 @@ declare namespace CodeceptJS {
6178
6284
  * @property [windowSize] - default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
6179
6285
  * @property [userAgent] - user-agent string.
6180
6286
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
6181
- * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
6287
+ * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/puppeteer-firefox).
6182
6288
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
6183
6289
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6184
6290
  */
@@ -6221,7 +6327,7 @@ declare namespace CodeceptJS {
6221
6327
  * ```
6222
6328
  * Using `puppeteer-core` package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
6223
6329
  *
6224
- * > Experimental Firefox support [can be activated](https://codecept.io/helpers/Puppeteer-firefox).
6330
+ * > Experimental Firefox support [can be activated](https://codecept.io/helpers/puppeteer-firefox).
6225
6331
  *
6226
6332
  * <!-- configuration -->
6227
6333
  *
@@ -6862,7 +6968,7 @@ declare namespace CodeceptJS {
6862
6968
  clickLink(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): void;
6863
6969
  /**
6864
6970
  * Sets a directory to where save files. Allows to test file downloads.
6865
- * Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
6971
+ * Should be used with [FileSystem helper](https://codecept.io/helpers/file-system) to check that file were downloaded correctly.
6866
6972
  *
6867
6973
  * By default, files are saved to `output/downloads`.
6868
6974
  * This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.