codeceptjs 4.0.0-beta.1 → 4.0.0-beta.10.esm-aria

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 (207) hide show
  1. package/README.md +133 -120
  2. package/bin/codecept.js +107 -96
  3. package/bin/test-server.js +64 -0
  4. package/docs/webapi/clearCookie.mustache +1 -1
  5. package/docs/webapi/click.mustache +5 -1
  6. package/lib/actor.js +71 -103
  7. package/lib/ai.js +159 -188
  8. package/lib/assert/empty.js +22 -24
  9. package/lib/assert/equal.js +30 -37
  10. package/lib/assert/error.js +14 -14
  11. package/lib/assert/include.js +43 -48
  12. package/lib/assert/throws.js +11 -11
  13. package/lib/assert/truth.js +22 -22
  14. package/lib/assert.js +20 -18
  15. package/lib/codecept.js +238 -162
  16. package/lib/colorUtils.js +50 -52
  17. package/lib/command/check.js +206 -0
  18. package/lib/command/configMigrate.js +56 -51
  19. package/lib/command/definitions.js +96 -109
  20. package/lib/command/dryRun.js +77 -79
  21. package/lib/command/generate.js +234 -194
  22. package/lib/command/gherkin/init.js +42 -33
  23. package/lib/command/gherkin/snippets.js +76 -74
  24. package/lib/command/gherkin/steps.js +20 -17
  25. package/lib/command/info.js +74 -38
  26. package/lib/command/init.js +300 -290
  27. package/lib/command/interactive.js +41 -32
  28. package/lib/command/list.js +28 -27
  29. package/lib/command/run-multiple/chunk.js +51 -48
  30. package/lib/command/run-multiple/collection.js +5 -5
  31. package/lib/command/run-multiple/run.js +5 -1
  32. package/lib/command/run-multiple.js +97 -97
  33. package/lib/command/run-rerun.js +19 -25
  34. package/lib/command/run-workers.js +68 -92
  35. package/lib/command/run.js +39 -27
  36. package/lib/command/utils.js +80 -64
  37. package/lib/command/workers/runTests.js +388 -226
  38. package/lib/config.js +124 -50
  39. package/lib/container.js +751 -260
  40. package/lib/data/context.js +60 -61
  41. package/lib/data/dataScenarioConfig.js +47 -47
  42. package/lib/data/dataTableArgument.js +32 -32
  43. package/lib/data/table.js +22 -22
  44. package/lib/effects.js +307 -0
  45. package/lib/element/WebElement.js +327 -0
  46. package/lib/els.js +160 -0
  47. package/lib/event.js +173 -163
  48. package/lib/globals.js +141 -0
  49. package/lib/heal.js +89 -85
  50. package/lib/helper/AI.js +131 -41
  51. package/lib/helper/ApiDataFactory.js +107 -75
  52. package/lib/helper/Appium.js +542 -404
  53. package/lib/helper/FileSystem.js +100 -79
  54. package/lib/helper/GraphQL.js +44 -43
  55. package/lib/helper/GraphQLDataFactory.js +52 -52
  56. package/lib/helper/JSONResponse.js +126 -88
  57. package/lib/helper/Mochawesome.js +54 -29
  58. package/lib/helper/Playwright.js +2547 -1316
  59. package/lib/helper/Puppeteer.js +1578 -1181
  60. package/lib/helper/REST.js +209 -68
  61. package/lib/helper/WebDriver.js +1482 -1342
  62. package/lib/helper/errors/ConnectionRefused.js +6 -6
  63. package/lib/helper/errors/ElementAssertion.js +11 -16
  64. package/lib/helper/errors/ElementNotFound.js +5 -9
  65. package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
  66. package/lib/helper/extras/Console.js +11 -11
  67. package/lib/helper/extras/PlaywrightLocator.js +110 -0
  68. package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
  69. package/lib/helper/extras/PlaywrightReactVueLocator.js +17 -8
  70. package/lib/helper/extras/PlaywrightRestartOpts.js +25 -11
  71. package/lib/helper/extras/Popup.js +22 -22
  72. package/lib/helper/extras/React.js +27 -28
  73. package/lib/helper/network/actions.js +36 -42
  74. package/lib/helper/network/utils.js +78 -84
  75. package/lib/helper/scripts/blurElement.js +5 -5
  76. package/lib/helper/scripts/focusElement.js +5 -5
  77. package/lib/helper/scripts/highlightElement.js +8 -8
  78. package/lib/helper/scripts/isElementClickable.js +34 -34
  79. package/lib/helper.js +2 -3
  80. package/lib/history.js +23 -19
  81. package/lib/hooks.js +8 -8
  82. package/lib/html.js +94 -104
  83. package/lib/index.js +38 -27
  84. package/lib/listener/config.js +30 -23
  85. package/lib/listener/emptyRun.js +54 -0
  86. package/lib/listener/enhancedGlobalRetry.js +110 -0
  87. package/lib/listener/exit.js +16 -18
  88. package/lib/listener/globalRetry.js +70 -0
  89. package/lib/listener/globalTimeout.js +181 -0
  90. package/lib/listener/helpers.js +76 -51
  91. package/lib/listener/mocha.js +10 -11
  92. package/lib/listener/result.js +11 -0
  93. package/lib/listener/retryEnhancer.js +85 -0
  94. package/lib/listener/steps.js +71 -59
  95. package/lib/listener/store.js +20 -0
  96. package/lib/locator.js +214 -197
  97. package/lib/mocha/asyncWrapper.js +274 -0
  98. package/lib/mocha/bdd.js +167 -0
  99. package/lib/mocha/cli.js +341 -0
  100. package/lib/mocha/factory.js +163 -0
  101. package/lib/mocha/featureConfig.js +89 -0
  102. package/lib/mocha/gherkin.js +231 -0
  103. package/lib/mocha/hooks.js +121 -0
  104. package/lib/mocha/index.js +21 -0
  105. package/lib/mocha/inject.js +46 -0
  106. package/lib/{interfaces → mocha}/scenarioConfig.js +58 -34
  107. package/lib/mocha/suite.js +89 -0
  108. package/lib/mocha/test.js +184 -0
  109. package/lib/mocha/types.d.ts +42 -0
  110. package/lib/mocha/ui.js +242 -0
  111. package/lib/output.js +141 -71
  112. package/lib/parser.js +47 -44
  113. package/lib/pause.js +173 -145
  114. package/lib/plugin/analyze.js +403 -0
  115. package/lib/plugin/{autoLogin.js → auth.js} +178 -79
  116. package/lib/plugin/autoDelay.js +36 -40
  117. package/lib/plugin/coverage.js +131 -78
  118. package/lib/plugin/customLocator.js +22 -21
  119. package/lib/plugin/customReporter.js +53 -0
  120. package/lib/plugin/enhancedRetryFailedStep.js +99 -0
  121. package/lib/plugin/heal.js +101 -110
  122. package/lib/plugin/htmlReporter.js +3648 -0
  123. package/lib/plugin/pageInfo.js +140 -0
  124. package/lib/plugin/pauseOnFail.js +12 -11
  125. package/lib/plugin/retryFailedStep.js +82 -47
  126. package/lib/plugin/screenshotOnFail.js +111 -92
  127. package/lib/plugin/stepByStepReport.js +159 -101
  128. package/lib/plugin/stepTimeout.js +20 -25
  129. package/lib/plugin/subtitles.js +38 -38
  130. package/lib/recorder.js +193 -130
  131. package/lib/rerun.js +94 -49
  132. package/lib/result.js +238 -0
  133. package/lib/retryCoordinator.js +207 -0
  134. package/lib/secret.js +20 -18
  135. package/lib/session.js +95 -89
  136. package/lib/step/base.js +239 -0
  137. package/lib/step/comment.js +10 -0
  138. package/lib/step/config.js +50 -0
  139. package/lib/step/func.js +46 -0
  140. package/lib/step/helper.js +50 -0
  141. package/lib/step/meta.js +99 -0
  142. package/lib/step/record.js +74 -0
  143. package/lib/step/retry.js +11 -0
  144. package/lib/step/section.js +55 -0
  145. package/lib/step.js +18 -329
  146. package/lib/steps.js +54 -0
  147. package/lib/store.js +38 -7
  148. package/lib/template/heal.js +3 -12
  149. package/lib/template/prompts/generatePageObject.js +31 -0
  150. package/lib/template/prompts/healStep.js +13 -0
  151. package/lib/template/prompts/writeStep.js +9 -0
  152. package/lib/test-server.js +334 -0
  153. package/lib/timeout.js +60 -0
  154. package/lib/transform.js +8 -8
  155. package/lib/translation.js +34 -21
  156. package/lib/utils/mask_data.js +47 -0
  157. package/lib/utils.js +411 -228
  158. package/lib/workerStorage.js +37 -34
  159. package/lib/workers.js +532 -296
  160. package/package.json +115 -95
  161. package/translations/de-DE.js +5 -3
  162. package/translations/fr-FR.js +5 -4
  163. package/translations/index.js +22 -12
  164. package/translations/it-IT.js +4 -3
  165. package/translations/ja-JP.js +4 -3
  166. package/translations/nl-NL.js +76 -0
  167. package/translations/pl-PL.js +4 -3
  168. package/translations/pt-BR.js +4 -3
  169. package/translations/ru-RU.js +4 -3
  170. package/translations/utils.js +10 -0
  171. package/translations/zh-CN.js +4 -3
  172. package/translations/zh-TW.js +4 -3
  173. package/typings/index.d.ts +546 -185
  174. package/typings/promiseBasedTypes.d.ts +150 -879
  175. package/typings/types.d.ts +547 -996
  176. package/lib/cli.js +0 -249
  177. package/lib/dirname.js +0 -5
  178. package/lib/helper/Expect.js +0 -425
  179. package/lib/helper/ExpectHelper.js +0 -399
  180. package/lib/helper/MockServer.js +0 -223
  181. package/lib/helper/Nightmare.js +0 -1411
  182. package/lib/helper/Protractor.js +0 -1835
  183. package/lib/helper/SoftExpectHelper.js +0 -381
  184. package/lib/helper/TestCafe.js +0 -1410
  185. package/lib/helper/clientscripts/nightmare.js +0 -213
  186. package/lib/helper/testcafe/testControllerHolder.js +0 -42
  187. package/lib/helper/testcafe/testcafe-utils.js +0 -63
  188. package/lib/interfaces/bdd.js +0 -98
  189. package/lib/interfaces/featureConfig.js +0 -69
  190. package/lib/interfaces/gherkin.js +0 -195
  191. package/lib/listener/artifacts.js +0 -19
  192. package/lib/listener/retry.js +0 -68
  193. package/lib/listener/timeout.js +0 -109
  194. package/lib/mochaFactory.js +0 -110
  195. package/lib/plugin/allure.js +0 -15
  196. package/lib/plugin/commentStep.js +0 -136
  197. package/lib/plugin/debugErrors.js +0 -67
  198. package/lib/plugin/eachElement.js +0 -127
  199. package/lib/plugin/fakerTransform.js +0 -49
  200. package/lib/plugin/retryTo.js +0 -121
  201. package/lib/plugin/selenoid.js +0 -371
  202. package/lib/plugin/standardActingHelpers.js +0 -9
  203. package/lib/plugin/tryTo.js +0 -105
  204. package/lib/plugin/wdio.js +0 -246
  205. package/lib/scenario.js +0 -222
  206. package/lib/ui.js +0 -238
  207. package/lib/within.js +0 -70
@@ -113,7 +113,7 @@ declare namespace CodeceptJS {
113
113
  *
114
114
  * module.exports = new Factory()
115
115
  * // no need to set id, it will be set by REST API
116
- * .attr('author', () => faker.name.findName())
116
+ * .attr('author', () => faker.person.findName())
117
117
  * .attr('title', () => faker.lorem.sentence())
118
118
  * .attr('body', () => faker.lorem.paragraph());
119
119
  * ```
@@ -354,6 +354,17 @@ declare namespace CodeceptJS {
354
354
  * ```
355
355
  */
356
356
  runOnAndroid(caps: any, fn: any): void;
357
+ /**
358
+ * Execute code only in Web mode.
359
+ *
360
+ * ```js
361
+ * I.runInWeb(() => {
362
+ * I.waitForElement('#data');
363
+ * I.seeInCurrentUrl('/data');
364
+ * });
365
+ * ```
366
+ */
367
+ runInWeb(): void;
357
368
  /**
358
369
  * Returns app installation status.
359
370
  *
@@ -597,17 +608,11 @@ declare namespace CodeceptJS {
597
608
  * ```js
598
609
  * // taps outside to hide keyboard per default
599
610
  * I.hideDeviceKeyboard();
600
- * I.hideDeviceKeyboard('tapOutside');
601
- *
602
- * // or by pressing key
603
- * I.hideDeviceKeyboard('pressKey', 'Done');
604
611
  * ```
605
612
  *
606
613
  * Appium: support Android and iOS
607
- * @param [strategy] - Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
608
- * @param [key] - Optional key
609
614
  */
610
- hideDeviceKeyboard(strategy?: 'tapOutside' | 'pressKey', key?: string): void;
615
+ hideDeviceKeyboard(): void;
611
616
  /**
612
617
  * Send a key event to the device.
613
618
  * List of keys: https://developer.android.com/reference/android/view/KeyEvent.html
@@ -651,6 +656,19 @@ declare namespace CodeceptJS {
651
656
  * Shortcut for `makeTouchAction`
652
657
  */
653
658
  tap(locator: any): Promise<void>;
659
+ /**
660
+ * Perform a swipe on the screen or an element.
661
+ *
662
+ * ```js
663
+ * let locator = "#io.selendroid.testapp:id/LinearLayout1";
664
+ * I.swipe(locator, 800, 1200, 1000);
665
+ * ```
666
+ *
667
+ * [See complete reference](http://webdriver.io/api/mobile/swipe.html)
668
+ * @param [speed = 1000] - (optional), 1000 by default
669
+ * @returns Appium: support Android and iOS
670
+ */
671
+ swipe(locator: CodeceptJS.LocatorOrString, xoffset: number, yoffset: number, speed?: number): Promise<void>;
654
672
  /**
655
673
  * Perform a swipe on the screen.
656
674
  *
@@ -1185,236 +1203,6 @@ declare namespace CodeceptJS {
1185
1203
  */
1186
1204
  waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
1187
1205
  }
1188
- /**
1189
- * This helper allows performing assertions based on Chai.
1190
- *
1191
- * ### Examples
1192
- *
1193
- * Zero-configuration when paired with other helpers like REST, Playwright:
1194
- *
1195
- * ```js
1196
- * // inside codecept.conf.js
1197
- * {
1198
- * helpers: {
1199
- * Playwright: {...},
1200
- * ExpectHelper: {},
1201
- * }
1202
- * }
1203
- * ```
1204
- *
1205
- * ## Methods
1206
- */
1207
- // @ts-ignore
1208
- // @ts-ignore
1209
- // @ts-ignore
1210
- // @ts-ignore
1211
- class ExpectHelper {
1212
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1213
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1214
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1215
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1216
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1217
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1218
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1219
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1220
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1221
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1222
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1223
- /**
1224
- * @param [ajvOptions] - Pass AJV options
1225
- */
1226
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1227
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1228
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1229
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1230
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1231
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1232
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1233
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1234
- expectTrue(targetData: any, customErrorMsg?: any): void;
1235
- expectFalse(targetData: any, customErrorMsg?: any): void;
1236
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1237
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1238
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1239
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1240
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1241
- /**
1242
- * expects members of two arrays are deeply equal
1243
- */
1244
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1245
- /**
1246
- * expects an array to be a superset of another array
1247
- */
1248
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1249
- /**
1250
- * expects members of two JSON objects are deeply equal excluding some properties
1251
- */
1252
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1253
- /**
1254
- * expects a JSON object matches a provided pattern
1255
- */
1256
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1257
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1258
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1259
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1260
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1261
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1262
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1263
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1264
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1265
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1266
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1267
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1268
- /**
1269
- * @param [ajvOptions] - Pass AJV options
1270
- */
1271
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1272
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1273
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1274
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1275
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1276
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1277
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1278
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1279
- expectTrue(targetData: any, customErrorMsg?: any): void;
1280
- expectFalse(targetData: any, customErrorMsg?: any): void;
1281
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1282
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1283
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1284
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1285
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1286
- /**
1287
- * expects members of two arrays are deeply equal
1288
- */
1289
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1290
- /**
1291
- * expects an array to be a superset of another array
1292
- */
1293
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1294
- /**
1295
- * expects members of two JSON objects are deeply equal excluding some properties
1296
- */
1297
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1298
- /**
1299
- * expects a JSON object matches a provided pattern
1300
- */
1301
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1302
- }
1303
- /**
1304
- * This helper allows performing assertions based on Chai.
1305
- *
1306
- * ### Examples
1307
- *
1308
- * Zero-configuration when paired with other helpers like REST, Playwright:
1309
- *
1310
- * ```js
1311
- * // inside codecept.conf.js
1312
- * {
1313
- * helpers: {
1314
- * Playwright: {...},
1315
- * ExpectHelper: {},
1316
- * }
1317
- * }
1318
- * ```
1319
- *
1320
- * ## Methods
1321
- */
1322
- // @ts-ignore
1323
- // @ts-ignore
1324
- // @ts-ignore
1325
- // @ts-ignore
1326
- class ExpectHelper {
1327
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1328
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1329
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1330
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1331
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1332
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1333
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1334
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1335
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1336
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1337
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1338
- /**
1339
- * @param [ajvOptions] - Pass AJV options
1340
- */
1341
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1342
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1343
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1344
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1345
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1346
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1347
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1348
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1349
- expectTrue(targetData: any, customErrorMsg?: any): void;
1350
- expectFalse(targetData: any, customErrorMsg?: any): void;
1351
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1352
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1353
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1354
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1355
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1356
- /**
1357
- * expects members of two arrays are deeply equal
1358
- */
1359
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1360
- /**
1361
- * expects an array to be a superset of another array
1362
- */
1363
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1364
- /**
1365
- * expects members of two JSON objects are deeply equal excluding some properties
1366
- */
1367
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1368
- /**
1369
- * expects a JSON object matches a provided pattern
1370
- */
1371
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1372
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1373
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1374
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1375
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1376
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1377
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1378
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1379
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1380
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1381
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1382
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1383
- /**
1384
- * @param [ajvOptions] - Pass AJV options
1385
- */
1386
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1387
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1388
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1389
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1390
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1391
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1392
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1393
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1394
- expectTrue(targetData: any, customErrorMsg?: any): void;
1395
- expectFalse(targetData: any, customErrorMsg?: any): void;
1396
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1397
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1398
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1399
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1400
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1401
- /**
1402
- * expects members of two arrays are deeply equal
1403
- */
1404
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1405
- /**
1406
- * expects an array to be a superset of another array
1407
- */
1408
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1409
- /**
1410
- * expects members of two JSON objects are deeply equal excluding some properties
1411
- */
1412
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1413
- /**
1414
- * expects a JSON object matches a provided pattern
1415
- */
1416
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1417
- }
1418
1206
  /**
1419
1207
  * Helper for testing filesystem.
1420
1208
  * Can be easily used to check file structures:
@@ -1664,7 +1452,7 @@ declare namespace CodeceptJS {
1664
1452
  * input: { ...buildObj },
1665
1453
  * }))
1666
1454
  * // 'attr'-id can be left out depending on the GraphQl resolvers
1667
- * .attr('name', () => faker.name.findName())
1455
+ * .attr('name', () => faker.person.findName())
1668
1456
  * .attr('email', () => faker.interact.email())
1669
1457
  * ```
1670
1458
  * For more options see [rosie documentation](https://github.com/rosiejs/rosie).
@@ -1941,13 +1729,14 @@ declare namespace CodeceptJS {
1941
1729
  */
1942
1730
  seeResponseContainsKeys(keys: any[]): void;
1943
1731
  /**
1944
- * Executes a callback function passing in `response` object and chai assertions with `expect`
1732
+ * Executes a callback function passing in `response` object and assert
1945
1733
  * Use it to perform custom checks of response data
1946
1734
  *
1947
1735
  * ```js
1948
- * I.seeResponseValidByCallback(({ data, status, expect }) => {
1949
- * expect(status).to.eql(200);
1950
- * expect(data).keys.to.include(['user', 'company']);
1736
+ * I.seeResponseValidByCallback(({ data, status }) => {
1737
+ * assert.strictEqual(status, 200);
1738
+ * assert('user' in data);
1739
+ * assert('company' in data);
1951
1740
  * });
1952
1741
  * ```
1953
1742
  */
@@ -1989,199 +1778,6 @@ declare namespace CodeceptJS {
1989
1778
  */
1990
1779
  seeResponseMatchesJsonSchema(fnOrSchema: any): void;
1991
1780
  }
1992
- /**
1993
- * ## Configuration
1994
- *
1995
- * This helper should be configured in codecept.conf.(js|ts)
1996
- * @property [port = 9393] - Mock server port
1997
- * @property [host = "0.0.0.0"] - Mock server host
1998
- * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1999
- */
2000
- // @ts-ignore
2001
- // @ts-ignore
2002
- // @ts-ignore
2003
- // @ts-ignore
2004
- type MockServerConfig = {
2005
- port?: number;
2006
- host?: string;
2007
- httpsOpts?: any;
2008
- };
2009
- /**
2010
- * MockServer
2011
- *
2012
- * The MockServer Helper in CodeceptJS empowers you to mock any server or service via HTTP or HTTPS, making it an excellent tool for simulating REST endpoints and other HTTP-based APIs.
2013
- *
2014
- * <!-- configuration -->
2015
- *
2016
- * #### Examples
2017
- *
2018
- * You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
2019
- *
2020
- * ```javascript
2021
- * {
2022
- * helpers: {
2023
- * REST: {...},
2024
- * MockServer: {
2025
- * // default mock server config
2026
- * port: 9393,
2027
- * host: '0.0.0.0',
2028
- * httpsOpts: {
2029
- * key: '',
2030
- * cert: '',
2031
- * },
2032
- * },
2033
- * }
2034
- * }
2035
- * ```
2036
- *
2037
- * #### Adding Interactions
2038
- *
2039
- * Interactions add behavior to the mock server. Use the `I.addInteractionToMockServer()` method to include interactions. It takes an interaction object as an argument, containing request and response details.
2040
- *
2041
- * ```javascript
2042
- * I.addInteractionToMockServer({
2043
- * request: {
2044
- * method: 'GET',
2045
- * path: '/api/hello'
2046
- * },
2047
- * response: {
2048
- * status: 200,
2049
- * body: {
2050
- * 'say': 'hello to mock server'
2051
- * }
2052
- * }
2053
- * });
2054
- * ```
2055
- *
2056
- * #### Request Matching
2057
- *
2058
- * When a real request is sent to the mock server, it matches the received request with the interactions. If a match is found, it returns the specified response; otherwise, a 404 status code is returned.
2059
- *
2060
- * - Strong match on HTTP Method, Path, Query Params & JSON body.
2061
- * - Loose match on Headers.
2062
- *
2063
- * ##### Strong Match on Query Params
2064
- *
2065
- * You can send different responses based on query parameters:
2066
- *
2067
- * ```javascript
2068
- * I.addInteractionToMockServer({
2069
- * request: {
2070
- * method: 'GET',
2071
- * path: '/api/users',
2072
- * queryParams: {
2073
- * id: 1
2074
- * }
2075
- * },
2076
- * response: {
2077
- * status: 200,
2078
- * body: 'user 1'
2079
- * }
2080
- * });
2081
- *
2082
- * I.addInteractionToMockServer({
2083
- * request: {
2084
- * method: 'GET',
2085
- * path: '/api/users',
2086
- * queryParams: {
2087
- * id: 2
2088
- * }
2089
- * },
2090
- * response: {
2091
- * status: 200,
2092
- * body: 'user 2'
2093
- * }
2094
- * });
2095
- * ```
2096
- *
2097
- * - GET to `/api/users?id=1` will return 'user 1'.
2098
- * - GET to `/api/users?id=2` will return 'user 2'.
2099
- * - For all other requests, it returns a 404 status code.
2100
- *
2101
- * ##### Loose Match on Body
2102
- *
2103
- * When `strict` is set to false, it performs a loose match on query params and response body:
2104
- *
2105
- * ```javascript
2106
- * I.addInteractionToMockServer({
2107
- * strict: false,
2108
- * request: {
2109
- * method: 'POST',
2110
- * path: '/api/users',
2111
- * body: {
2112
- * name: 'john'
2113
- * }
2114
- * },
2115
- * response: {
2116
- * status: 200
2117
- * }
2118
- * });
2119
- * ```
2120
- *
2121
- * - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
2122
- * - POST to `/api/users` without the `name` property in the body will return a 404 status code.
2123
- *
2124
- * Happy testing with MockServer in CodeceptJS! 🚀
2125
- *
2126
- * ## Methods
2127
- */
2128
- // @ts-ignore
2129
- // @ts-ignore
2130
- // @ts-ignore
2131
- // @ts-ignore
2132
- class MockServer {
2133
- /**
2134
- * Start the mock server
2135
- * @param [port] - start the mock server with given port
2136
- * @returns void
2137
- */
2138
- startMockServer(port?: number): any;
2139
- /**
2140
- * Stop the mock server
2141
- * @returns void
2142
- */
2143
- stopMockServer(): any;
2144
- /**
2145
- * An interaction adds behavior to the mock server
2146
- *
2147
- *
2148
- * ```js
2149
- * I.addInteractionToMockServer({
2150
- * request: {
2151
- * method: 'GET',
2152
- * path: '/api/hello'
2153
- * },
2154
- * response: {
2155
- * status: 200,
2156
- * body: {
2157
- * 'say': 'hello to mock server'
2158
- * }
2159
- * }
2160
- * });
2161
- * ```
2162
- * ```js
2163
- * // with query params
2164
- * I.addInteractionToMockServer({
2165
- * request: {
2166
- * method: 'GET',
2167
- * path: '/api/hello',
2168
- * queryParams: {
2169
- * id: 2
2170
- * }
2171
- * },
2172
- * response: {
2173
- * status: 200,
2174
- * body: {
2175
- * 'say': 'hello to mock server'
2176
- * }
2177
- * }
2178
- * });
2179
- * ```
2180
- * @param interaction - add behavior to the mock server
2181
- * @returns void
2182
- */
2183
- addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
2184
- }
2185
1781
  /**
2186
1782
  * Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
2187
1783
  * fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
@@ -2969,7 +2565,7 @@ declare namespace CodeceptJS {
2969
2565
  *
2970
2566
  * ```js
2971
2567
  * I.clearCookie();
2972
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
2568
+ * I.clearCookie('test');
2973
2569
  * ```
2974
2570
  * @param [cookie = null] - (optional, `null` by default) cookie name
2975
2571
  */
@@ -3184,46 +2780,6 @@ declare namespace CodeceptJS {
3184
2780
  */
3185
2781
  grabPageScrollPosition(): Promise<PageScrollPosition>;
3186
2782
  }
3187
- /**
3188
- * OpenAI Helper for CodeceptJS.
3189
- *
3190
- * This helper class provides integration with the OpenAI GPT-3.5 or 4 language model for generating responses to questions or prompts within the context of web pages. It allows you to interact with the GPT-3.5 model to obtain intelligent responses based on HTML fragments or general prompts.
3191
- * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3192
- *
3193
- * ## Configuration
3194
- *
3195
- * This helper should be configured in codecept.json or codecept.conf.js
3196
- *
3197
- * * `chunkSize`: (optional, default: 80000) - The maximum number of characters to send to the OpenAI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.
3198
- */
3199
- class OpenAI {
3200
- /**
3201
- * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3202
- *
3203
- * ```js
3204
- * I.askGptOnPage('what does this page do?');
3205
- * ```
3206
- * @param prompt - The question or prompt to ask the GPT model.
3207
- * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3208
- */
3209
- askGptOnPage(prompt: string): Promise<string>;
3210
- /**
3211
- * Asks the OpenAI GPT-3.5 language model a question based on the provided prompt within the context of a specific HTML fragment on the current page.
3212
- *
3213
- * ```js
3214
- * I.askGptOnPageFragment('describe features of this screen', '.screen');
3215
- * ```
3216
- * @param prompt - The question or prompt to ask the GPT-3.5 model.
3217
- * @param locator - The locator or selector used to identify the HTML fragment on the page.
3218
- * @returns - A Promise that resolves to the generated response from the GPT model.
3219
- */
3220
- askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3221
- /**
3222
- * Send a general request to ChatGPT and return response.
3223
- * @returns - A Promise that resolves to the generated response from the GPT model.
3224
- */
3225
- askGptGeneralPrompt(prompt: string): Promise<string>;
3226
- }
3227
2783
  /**
3228
2784
  * ## Configuration
3229
2785
  *
@@ -3267,11 +2823,15 @@ declare namespace CodeceptJS {
3267
2823
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
3268
2824
  * @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
3269
2825
  * @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
2826
+ * @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(`[role="${selector}"]`) } }`
2827
+ * @property [storageState] - Playwright storage state (path to JSON file or object)
2828
+ * passed directly to `browser.newContext`.
2829
+ * If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
2830
+ * those cookies are used instead and the configured `storageState` is ignored (no merge).
2831
+ * May include session cookies, auth tokens, localStorage and (if captured with
2832
+ * `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
3270
2833
  */
3271
2834
  // @ts-ignore
3272
- // @ts-ignore
3273
- // @ts-ignore
3274
- // @ts-ignore
3275
2835
  type PlaywrightConfig = {
3276
2836
  url?: string;
3277
2837
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -3309,6 +2869,8 @@ declare namespace CodeceptJS {
3309
2869
  highlightElement?: boolean;
3310
2870
  recordHar?: any;
3311
2871
  testIdAttribute?: string;
2872
+ customLocatorStrategies?: any;
2873
+ storageState?: string | any;
3312
2874
  };
3313
2875
  /**
3314
2876
  * Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
@@ -4249,7 +3811,7 @@ declare namespace CodeceptJS {
4249
3811
  */
4250
3812
  pressKeyUp(key: string): void;
4251
3813
  /**
4252
- * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
3814
+ * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
4253
3815
  *
4254
3816
  * Presses a key in the browser (on a focused element).
4255
3817
  *
@@ -4671,13 +4233,34 @@ declare namespace CodeceptJS {
4671
4233
  * @returns attribute value
4672
4234
  */
4673
4235
  grabCookie(name?: string): any;
4236
+ /**
4237
+ * Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
4238
+ * Returns the raw object that Playwright provides.
4239
+ *
4240
+ * Security: The returned object can contain authentication tokens, session cookies
4241
+ * and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
4242
+ * Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
4243
+ * @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
4244
+ *
4245
+ * ```js
4246
+ * // basic usage
4247
+ * const state = await I.grabStorageState();
4248
+ * require('fs').writeFileSync('authState.json', JSON.stringify(state));
4249
+ *
4250
+ * // include IndexedDB when using Firebase Auth, etc.
4251
+ * const stateWithIDB = await I.grabStorageState({ indexedDB: true });
4252
+ * ```
4253
+ */
4254
+ grabStorageState(options?: {
4255
+ indexedDB?: boolean;
4256
+ }): void;
4674
4257
  /**
4675
4258
  * Clears a cookie by name,
4676
4259
  * if none provided clears all cookies.
4677
4260
  *
4678
4261
  * ```js
4679
4262
  * I.clearCookie();
4680
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
4263
+ * I.clearCookie('test');
4681
4264
  * ```
4682
4265
  * @param [cookie = null] - (optional, `null` by default) cookie name
4683
4266
  */
@@ -5122,7 +4705,7 @@ declare namespace CodeceptJS {
5122
4705
  /**
5123
4706
  * Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
5124
4707
  *
5125
- * See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
4708
+ * See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
5126
4709
  */
5127
4710
  waitForNavigation(options: any): void;
5128
4711
  /**
@@ -6350,7 +5933,7 @@ declare namespace CodeceptJS {
6350
5933
  *
6351
5934
  * ```js
6352
5935
  * I.clearCookie();
6353
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
5936
+ * I.clearCookie('test');
6354
5937
  * ```
6355
5938
  * @param [cookie = null] - (optional, `null` by default) cookie name
6356
5939
  */
@@ -6788,7 +6371,7 @@ declare namespace CodeceptJS {
6788
6371
  * @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
6789
6372
  * @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
6790
6373
  * @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
6791
- * @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions). Array values are accepted as well.
6374
+ * @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md). Array values are accepted as well.
6792
6375
  * @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
6793
6376
  * @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
6794
6377
  * @property [waitForTimeout = 1000] - default wait* timeout in ms.
@@ -6796,13 +6379,10 @@ declare namespace CodeceptJS {
6796
6379
  * @property [userAgent] - user-agent string.
6797
6380
  * @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
6798
6381
  * @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
6799
- * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6382
+ * @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
6800
6383
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6801
6384
  */
6802
6385
  // @ts-ignore
6803
- // @ts-ignore
6804
- // @ts-ignore
6805
- // @ts-ignore
6806
6386
  type PuppeteerConfig = {
6807
6387
  url: string;
6808
6388
  basicAuth?: any;
@@ -6816,7 +6396,7 @@ declare namespace CodeceptJS {
6816
6396
  keepBrowserState?: boolean;
6817
6397
  keepCookies?: boolean;
6818
6398
  waitForAction?: number;
6819
- waitForNavigation?: string;
6399
+ waitForNavigation?: string | string[];
6820
6400
  pressKeyDelay?: number;
6821
6401
  getPageTimeout?: number;
6822
6402
  waitForTimeout?: number;
@@ -6828,7 +6408,7 @@ declare namespace CodeceptJS {
6828
6408
  highlightElement?: boolean;
6829
6409
  };
6830
6410
  /**
6831
- * Uses [Google Chrome's Puppeteer](https://github.com/GoogleChrome/puppeteer) library to run tests inside headless Chrome.
6411
+ * Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
6832
6412
  * Browser control is executed via DevTools Protocol (instead of Selenium).
6833
6413
  * This helper works with a browser out of the box with no additional tools required to install.
6834
6414
  *
@@ -7242,6 +6822,17 @@ declare namespace CodeceptJS {
7242
6822
  * {{ react }}
7243
6823
  */
7244
6824
  _locate(): void;
6825
+ /**
6826
+ * Get single element by different locator types, including strict locator
6827
+ * Should be used in custom helpers:
6828
+ *
6829
+ * ```js
6830
+ * const element = await this.helpers['Puppeteer']._locateElement({name: 'password'});
6831
+ * ```
6832
+ *
6833
+ * {{ react }}
6834
+ */
6835
+ _locateElement(): void;
7245
6836
  /**
7246
6837
  * Find a checkbox by providing human-readable text:
7247
6838
  * NOTE: Assumes the checkable element exists
@@ -7278,6 +6869,17 @@ declare namespace CodeceptJS {
7278
6869
  * @returns WebElement of being used Web helper
7279
6870
  */
7280
6871
  grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
6872
+ /**
6873
+ * Grab WebElement for given locator
6874
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
6875
+ *
6876
+ * ```js
6877
+ * const webElement = await I.grabWebElement('#button');
6878
+ * ```
6879
+ * @param locator - element located by CSS|XPath|strict locator.
6880
+ * @returns WebElement of being used Web helper
6881
+ */
6882
+ grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
7281
6883
  /**
7282
6884
  * Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
7283
6885
  *
@@ -7598,7 +7200,7 @@ declare namespace CodeceptJS {
7598
7200
  */
7599
7201
  pressKeyUp(key: string): void;
7600
7202
  /**
7601
- * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
7203
+ * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
7602
7204
  *
7603
7205
  * Presses a key in the browser (on a focused element).
7604
7206
  *
@@ -8051,7 +7653,7 @@ declare namespace CodeceptJS {
8051
7653
  *
8052
7654
  * ```js
8053
7655
  * I.clearCookie();
8054
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
7656
+ * I.clearCookie('test');
8055
7657
  * ```
8056
7658
  * @param [cookie = null] - (optional, `null` by default) cookie name
8057
7659
  */
@@ -8524,7 +8126,7 @@ declare namespace CodeceptJS {
8524
8126
  /**
8525
8127
  * Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
8526
8128
  *
8527
- * See [Puppeteer's reference](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions)
8129
+ * See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
8528
8130
  */
8529
8131
  waitForNavigation(opts: any): void;
8530
8132
  /**
@@ -8733,6 +8335,22 @@ declare namespace CodeceptJS {
8733
8335
  */
8734
8336
  flushWebSocketMessages(): void;
8735
8337
  }
8338
+ /**
8339
+ * Find elements using Puppeteer's native element discovery methods
8340
+ * Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for multiple elements
8341
+ * @param matcher - Puppeteer context to search within
8342
+ * @param locator - Locator specification
8343
+ * @returns Array of ElementHandle objects
8344
+ */
8345
+ function findElements(matcher: any, locator: any | string): Promise<any[]>;
8346
+ /**
8347
+ * Find a single element using Puppeteer's native element discovery methods
8348
+ * Note: Puppeteer Locator API doesn't have .first() method like Playwright
8349
+ * @param matcher - Puppeteer context to search within
8350
+ * @param locator - Locator specification
8351
+ * @returns Single ElementHandle object
8352
+ */
8353
+ function findElement(matcher: any, locator: any | string): Promise<object>;
8736
8354
  /**
8737
8355
  * ## Configuration
8738
8356
  * @property [endpoint] - API base URL
@@ -8746,9 +8364,6 @@ declare namespace CodeceptJS {
8746
8364
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8747
8365
  */
8748
8366
  // @ts-ignore
8749
- // @ts-ignore
8750
- // @ts-ignore
8751
- // @ts-ignore
8752
8367
  type RESTConfig = {
8753
8368
  endpoint?: string;
8754
8369
  prettyPrintJson?: boolean;
@@ -8874,6 +8489,16 @@ declare namespace CodeceptJS {
8874
8489
  * @returns response
8875
8490
  */
8876
8491
  sendGetRequest(url: any, headers?: any): Promise<any>;
8492
+ /**
8493
+ * Send HEAD request to REST API
8494
+ *
8495
+ * ```js
8496
+ * I.sendHeadRequest('/api/users.json');
8497
+ * ```
8498
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8499
+ * @returns response
8500
+ */
8501
+ sendHeadRequest(url: any, headers?: any): Promise<any>;
8877
8502
  /**
8878
8503
  * Sends POST request to API.
8879
8504
  *
@@ -8929,263 +8554,30 @@ declare namespace CodeceptJS {
8929
8554
  * @returns response
8930
8555
  */
8931
8556
  sendDeleteRequest(url: any, headers?: any): Promise<any>;
8557
+ /**
8558
+ * Sends DELETE request to API with payload.
8559
+ *
8560
+ * ```js
8561
+ * I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
8562
+ * ```
8563
+ * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
8564
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8565
+ * @returns response
8566
+ */
8567
+ sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8932
8568
  }
8933
8569
  /**
8934
- * SoftAssertHelper is a utility class for performing soft assertions.
8935
- * Unlike traditional assertions that stop the execution on failure,
8936
- * soft assertions allow the execution to continue and report all failures at the end.
8937
- *
8938
- * ### Examples
8570
+ * Client Functions
8571
+ */
8572
+ function getPageUrl(): void;
8573
+ /**
8574
+ * Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
8575
+ * The browser version you want to use in tests must be installed on your system.
8939
8576
  *
8940
- * Zero-configuration when paired with other helpers like REST, Playwright:
8577
+ * Requires `testcafe` package to be installed.
8941
8578
  *
8942
- * ```js
8943
- * // inside codecept.conf.js
8944
- * {
8945
- * helpers: {
8946
- * Playwright: {...},
8947
- * SoftExpectHelper: {},
8948
- * }
8949
- * }
8950
8579
  * ```
8951
- *
8952
- * ```js
8953
- * // in scenario
8954
- * I.softExpectEqual('a', 'b')
8955
- * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8956
- * ```
8957
- *
8958
- * ## Methods
8959
- */
8960
- class SoftAssertHelper {
8961
- /**
8962
- * Performs a soft assertion by executing the provided assertion function.
8963
- * If the assertion fails, the error is caught and stored without halting the execution.
8964
- * @param assertionFn - The assertion function to execute.
8965
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8966
- */
8967
- softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
8968
- /**
8969
- * Throws an error if any soft assertions have failed.
8970
- * The error message contains all the accumulated failures.
8971
- */
8972
- flushSoftAssertions(): void;
8973
- /**
8974
- * Softly asserts that two values are equal.
8975
- * @param actualValue - The actual value.
8976
- * @param expectedValue - The expected value.
8977
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8978
- */
8979
- softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
8980
- /**
8981
- * Softly asserts that two values are not equal.
8982
- * @param actualValue - The actual value.
8983
- * @param expectedValue - The expected value.
8984
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8985
- */
8986
- softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
8987
- /**
8988
- * Softly asserts that two values are deeply equal.
8989
- * @param actualValue - The actual value.
8990
- * @param expectedValue - The expected value.
8991
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8992
- */
8993
- softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
8994
- /**
8995
- * Softly asserts that two values are not deeply equal.
8996
- * @param actualValue - The actual value.
8997
- * @param expectedValue - The expected value.
8998
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8999
- */
9000
- softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9001
- /**
9002
- * Softly asserts that a value contains the expected value.
9003
- * @param actualValue - The actual value.
9004
- * @param expectedValueToContain - The value that should be contained within the actual value.
9005
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9006
- */
9007
- softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9008
- /**
9009
- * Softly asserts that a value does not contain the expected value.
9010
- * @param actualValue - The actual value.
9011
- * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9012
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9013
- */
9014
- softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9015
- /**
9016
- * Softly asserts that a value starts with the expected value.
9017
- * @param actualValue - The actual value.
9018
- * @param expectedValueToStartWith - The value that the actual value should start with.
9019
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9020
- */
9021
- softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9022
- /**
9023
- * Softly asserts that a value does not start with the expected value.
9024
- * @param actualValue - The actual value.
9025
- * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9026
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9027
- */
9028
- softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9029
- /**
9030
- * Softly asserts that a value ends with the expected value.
9031
- * @param actualValue - The actual value.
9032
- * @param expectedValueToEndWith - The value that the actual value should end with.
9033
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9034
- */
9035
- softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9036
- /**
9037
- * Softly asserts that a value does not end with the expected value.
9038
- * @param actualValue - The actual value.
9039
- * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9040
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9041
- */
9042
- softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9043
- /**
9044
- * Softly asserts that the target data matches the given JSON schema.
9045
- * @param targetData - The data to validate.
9046
- * @param jsonSchema - The JSON schema to validate against.
9047
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9048
- */
9049
- softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9050
- /**
9051
- * Softly asserts that the target data matches the given JSON schema using AJV.
9052
- * @param targetData - The data to validate.
9053
- * @param jsonSchema - The JSON schema to validate against.
9054
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9055
- * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9056
- */
9057
- softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9058
- /**
9059
- * Softly asserts that the target data has the specified property.
9060
- * @param targetData - The data to check.
9061
- * @param propertyName - The property name to check for.
9062
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9063
- * fails.
9064
- */
9065
- softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9066
- /**
9067
- * Softly asserts that the target data has a property with the specified name.
9068
- * @param targetData - The data to check.
9069
- * @param propertyName - The property name to check for.
9070
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9071
- */
9072
- softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9073
- /**
9074
- * Softly asserts that the target data is of a specific type.
9075
- * @param targetData - The data to check.
9076
- * @param type - The expected type (e.g., 'string', 'number').
9077
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9078
- */
9079
- softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9080
- /**
9081
- * Softly asserts that the target data is of a specific type (alternative for articles).
9082
- * @param targetData - The data to check.
9083
- * @param type - The expected type (e.g., 'string', 'number').
9084
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9085
- */
9086
- softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9087
- /**
9088
- * Softly asserts that the target data has a specified length.
9089
- * @param targetData - The data to check.
9090
- * @param length - The expected length.
9091
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9092
- */
9093
- softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9094
- /**
9095
- * Softly asserts that the target data is empty.
9096
- * @param targetData - The data to check.
9097
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9098
- */
9099
- softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9100
- /**
9101
- * Softly asserts that the target data is true.
9102
- * @param targetData - The data to check.
9103
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9104
- */
9105
- softExpectTrue(targetData: any, customErrorMsg?: string): void;
9106
- /**
9107
- * Softly asserts that the target data is false.
9108
- * @param targetData - The data to check.
9109
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9110
- */
9111
- softExpectFalse(targetData: any, customErrorMsg?: string): void;
9112
- /**
9113
- * Softly asserts that the target data is above a specified value.
9114
- * @param targetData - The data to check.
9115
- * @param aboveThan - The value that the target data should be above.
9116
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9117
- */
9118
- softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9119
- /**
9120
- * Softly asserts that the target data is below a specified value.
9121
- * @param targetData - The data to check.
9122
- * @param belowThan - The value that the target data should be below.
9123
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9124
- */
9125
- softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9126
- /**
9127
- * Softly asserts that the length of the target data is above a specified value.
9128
- * @param targetData - The data to check.
9129
- * @param lengthAboveThan - The length that the target data should be above.
9130
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9131
- */
9132
- softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9133
- /**
9134
- * Softly asserts that the length of the target data is below a specified value.
9135
- * @param targetData - The data to check.
9136
- * @param lengthBelowThan - The length that the target data should be below.
9137
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9138
- */
9139
- softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9140
- /**
9141
- * Softly asserts that two values are equal, ignoring case.
9142
- * @param actualValue - The actual string value.
9143
- * @param expectedValue - The expected string value.
9144
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9145
- */
9146
- softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9147
- /**
9148
- * Softly asserts that two arrays have deep equality, considering members in any order.
9149
- * @param actualValue - The actual array.
9150
- * @param expectedValue - The expected array.
9151
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9152
- */
9153
- softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9154
- /**
9155
- * Softly asserts that an array (superset) deeply includes all members of another array (set).
9156
- * @param superset - The array that should contain the expected members.
9157
- * @param set - The array with members that should be included.
9158
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9159
- */
9160
- softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9161
- /**
9162
- * Softly asserts that two objects are deeply equal, excluding specified fields.
9163
- * @param actualValue - The actual object.
9164
- * @param expectedValue - The expected object.
9165
- * @param fieldsToExclude - The fields to exclude from the comparison.
9166
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9167
- */
9168
- softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9169
- /**
9170
- * Softly asserts that a value matches the expected pattern.
9171
- * @param actualValue - The actual value.
9172
- * @param expectedPattern - The pattern the value should match.
9173
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9174
- */
9175
- softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9176
- }
9177
- /**
9178
- * Client Functions
9179
- */
9180
- function getPageUrl(): void;
9181
- /**
9182
- * Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
9183
- * The browser version you want to use in tests must be installed on your system.
9184
- *
9185
- * Requires `testcafe` package to be installed.
9186
- *
9187
- * ```
9188
- * npm i testcafe --save-dev
8580
+ * npm i testcafe --save-dev
9189
8581
  * ```
9190
8582
  *
9191
8583
  * ## Configuration
@@ -10048,7 +9440,7 @@ declare namespace CodeceptJS {
10048
9440
  *
10049
9441
  * ```js
10050
9442
  * I.clearCookie();
10051
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
9443
+ * I.clearCookie('test');
10052
9444
  * ```
10053
9445
  * @param [cookie = null] - (optional, `null` by default) cookie name
10054
9446
  */
@@ -10166,6 +9558,7 @@ declare namespace CodeceptJS {
10166
9558
  * This helper should be configured in codecept.conf.js
10167
9559
  * @property url - base url of website to be tested.
10168
9560
  * @property browser - Browser in which to perform testing.
9561
+ * @property [bidiProtocol = false] - WebDriver Bidi Protocol. Default: false. More info: https://webdriver.io/docs/api/webdriverBidi/
10169
9562
  * @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
10170
9563
  * @property [host = localhost] - WebDriver host to connect.
10171
9564
  * @property [port = 4444] - WebDriver port to connect.
@@ -10185,15 +9578,12 @@ declare namespace CodeceptJS {
10185
9578
  * @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
10186
9579
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
10187
9580
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
10188
- * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10189
9581
  */
10190
9582
  // @ts-ignore
10191
- // @ts-ignore
10192
- // @ts-ignore
10193
- // @ts-ignore
10194
9583
  type WebDriverConfig = {
10195
9584
  url: string;
10196
9585
  browser: string;
9586
+ bidiProtocol?: boolean;
10197
9587
  basicAuth?: string;
10198
9588
  host?: string;
10199
9589
  port?: number;
@@ -10213,7 +9603,6 @@ declare namespace CodeceptJS {
10213
9603
  timeouts?: any;
10214
9604
  highlightElement?: boolean;
10215
9605
  logLevel?: string;
10216
- devtoolsProtocol?: boolean;
10217
9606
  };
10218
9607
  /**
10219
9608
  * WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
@@ -10319,7 +9708,6 @@ declare namespace CodeceptJS {
10319
9708
  * WebDriver : {
10320
9709
  * url: "http://localhost",
10321
9710
  * browser: "chrome",
10322
- * devtoolsProtocol: true,
10323
9711
  * desiredCapabilities: {
10324
9712
  * chromeOptions: {
10325
9713
  * args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
@@ -10662,6 +10050,17 @@ declare namespace CodeceptJS {
10662
10050
  * @returns WebElement of being used Web helper
10663
10051
  */
10664
10052
  grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
10053
+ /**
10054
+ * Grab WebElement for given locator
10055
+ * Resumes test execution, so **should be used inside an async function with `await`** operator.
10056
+ *
10057
+ * ```js
10058
+ * const webElement = await I.grabWebElement('#button');
10059
+ * ```
10060
+ * @param locator - element located by CSS|XPath|strict locator.
10061
+ * @returns WebElement of being used Web helper
10062
+ */
10063
+ grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
10665
10064
  /**
10666
10065
  * Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
10667
10066
  *
@@ -11540,7 +10939,7 @@ declare namespace CodeceptJS {
11540
10939
  *
11541
10940
  * ```js
11542
10941
  * I.clearCookie();
11543
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
10942
+ * I.clearCookie('test');
11544
10943
  * ```
11545
10944
  * @param [cookie = null] - (optional, `null` by default) cookie name
11546
10945
  */
@@ -12123,34 +11522,6 @@ declare namespace CodeceptJS {
12123
11522
  * @returns scroll position
12124
11523
  */
12125
11524
  grabPageScrollPosition(): Promise<PageScrollPosition>;
12126
- /**
12127
- * This method is **deprecated**.
12128
- *
12129
- *
12130
- * Set the current geo location
12131
- *
12132
- *
12133
- * ```js
12134
- * I.setGeoLocation(121.21, 11.56);
12135
- * I.setGeoLocation(121.21, 11.56, 10);
12136
- * ```
12137
- * @param latitude - to set.
12138
- * @param longitude - to set
12139
- * @param [altitude] - (optional, null by default) to set
12140
- * @returns automatically synchronized promise through #recorder
12141
- */
12142
- setGeoLocation(latitude: number, longitude: number, altitude?: number): void;
12143
- /**
12144
- * This method is **deprecated**.
12145
- *
12146
- * Return the current geo location
12147
- * Resumes test execution, so **should be used inside async function with `await`** operator.
12148
- *
12149
- * ```js
12150
- * let geoLocation = await I.grabGeoLocation();
12151
- * ```
12152
- */
12153
- grabGeoLocation(): Promise<{ latitude: number; longitude: number; altitude: number; }>;
12154
11525
  /**
12155
11526
  * Grab the width, height, location of given locator.
12156
11527
  * Provide `width` or `height`as second param to get your desired prop.
@@ -12177,123 +11548,15 @@ declare namespace CodeceptJS {
12177
11548
  /**
12178
11549
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12179
11550
  */
12180
- runOnAndroid(caps: any, fn: any): void;
11551
+ runOnIOS(caps: any, fn: any): void;
12181
11552
  /**
12182
11553
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12183
11554
  */
12184
- runInWeb(): void;
12185
- /**
12186
- * _Note:_ Only works when devtoolsProtocol is enabled.
12187
- *
12188
- * Resets all recorded network requests.
12189
- *
12190
- * ```js
12191
- * I.flushNetworkTraffics();
12192
- * ```
12193
- */
12194
- flushNetworkTraffics(): void;
12195
- /**
12196
- * _Note:_ Only works when devtoolsProtocol is enabled.
12197
- *
12198
- * Stops recording of network traffic. Recorded traffic is not flashed.
12199
- *
12200
- * ```js
12201
- * I.stopRecordingTraffic();
12202
- * ```
12203
- */
12204
- stopRecordingTraffic(): void;
12205
- /**
12206
- * _Note:_ Only works when devtoolsProtocol is enabled.
12207
- *
12208
- * Starts recording the network traffics.
12209
- * This also resets recorded network requests.
12210
- *
12211
- * ```js
12212
- * I.startRecordingTraffic();
12213
- * ```
12214
- * @returns automatically synchronized promise through #recorder
12215
- */
12216
- startRecordingTraffic(): void;
12217
- /**
12218
- * _Note:_ Only works when devtoolsProtocol is enabled.
12219
- *
12220
- * Grab the recording network traffics
12221
- *
12222
- * ```js
12223
- * const traffics = await I.grabRecordedNetworkTraffics();
12224
- * expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
12225
- * expect(traffics[0].response.status).to.equal(200);
12226
- * expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
12227
- * ```
12228
- * @returns recorded network traffics
12229
- */
12230
- grabRecordedNetworkTraffics(): any[];
12231
- /**
12232
- * _Note:_ Only works when devtoolsProtocol is enabled.
12233
- *
12234
- * Verifies that a certain request is part of network traffic.
12235
- *
12236
- * ```js
12237
- * // checking the request url contains certain query strings
12238
- * I.amOnPage('https://openai.com/blog/chatgpt');
12239
- * I.startRecordingTraffic();
12240
- * await I.seeTraffic({
12241
- * name: 'sentry event',
12242
- * url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
12243
- * parameters: {
12244
- * width: '1919',
12245
- * height: '1138',
12246
- * },
12247
- * });
12248
- * ```
12249
- *
12250
- * ```js
12251
- * // checking the request url contains certain post data
12252
- * I.amOnPage('https://openai.com/blog/chatgpt');
12253
- * I.startRecordingTraffic();
12254
- * await I.seeTraffic({
12255
- * name: 'event',
12256
- * url: 'https://cloudflareinsights.com/cdn-cgi/rum',
12257
- * requestPostData: {
12258
- * st: 2,
12259
- * },
12260
- * });
12261
- * ```
12262
- * @param opts - options when checking the traffic network.
12263
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
12264
- * @param opts.url - Expected URL of request in network traffic
12265
- * @param [opts.parameters] - Expected parameters of that request in network traffic
12266
- * @param [opts.requestPostData] - Expected that request contains post data in network traffic
12267
- * @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
12268
- * @returns automatically synchronized promise through #recorder
12269
- */
12270
- seeTraffic(opts: {
12271
- name: string;
12272
- url: string;
12273
- parameters?: any;
12274
- requestPostData?: any;
12275
- timeout?: number;
12276
- }): void;
11555
+ runOnAndroid(caps: any, fn: any): void;
12277
11556
  /**
12278
- * _Note:_ Only works when devtoolsProtocol is enabled.
12279
- *
12280
- * Verifies that a certain request is not part of network traffic.
12281
- *
12282
- * Examples:
12283
- *
12284
- * ```js
12285
- * I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
12286
- * I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
12287
- * ```
12288
- * @param opts - options when checking the traffic network.
12289
- * @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
12290
- * @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
12291
- * @returns automatically synchronized promise through #recorder
11557
+ * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12292
11558
  */
12293
- dontSeeTraffic(opts: {
12294
- name: string;
12295
- url: string | RegExp;
12296
- }): void;
11559
+ runInWeb(): void;
12297
11560
  }
12298
11561
  interface ActorStatic {
12299
11562
  /**
@@ -12333,19 +11596,31 @@ declare namespace CodeceptJS {
12333
11596
  /**
12334
11597
  * Executes bootstrap.
12335
11598
  */
12336
- bootstrap(): void;
11599
+ bootstrap(): Promise<void>;
12337
11600
  /**
12338
11601
  * Executes teardown.
12339
11602
  */
12340
- teardown(): void;
11603
+ teardown(): Promise<void>;
12341
11604
  /**
12342
11605
  * Loads tests by pattern or by config.tests
12343
11606
  */
12344
11607
  loadTests(pattern?: string): void;
11608
+ /**
11609
+ * Apply sharding to test files based on shard configuration
11610
+ * @param testFiles - Array of test file paths
11611
+ * @param shardConfig - Shard configuration in format "index/total" (e.g., "1/4")
11612
+ * @returns - Filtered array of test files for this shard
11613
+ */
11614
+ _applySharding(testFiles: string[], shardConfig: string): string[];
12345
11615
  /**
12346
11616
  * Run a specific test or all loaded tests.
12347
11617
  */
12348
11618
  run(test?: string): Promise<void>;
11619
+ /**
11620
+ * Returns the version string of CodeceptJS.
11621
+ * @returns The version string.
11622
+ */
11623
+ static version(): string;
12349
11624
  }
12350
11625
  /**
12351
11626
  * Current configuration
@@ -12387,10 +11662,113 @@ declare namespace CodeceptJS {
12387
11662
  [key: string]: any;
12388
11663
  };
12389
11664
  }
11665
+ /**
11666
+ * Statistics for a test result.
11667
+ * @property passes - Number of passed tests.
11668
+ * @property failures - Number of failed tests.
11669
+ * @property tests - Total number of tests.
11670
+ * @property pending - Number of pending tests.
11671
+ * @property failedHooks - Number of failed hooks.
11672
+ * @property start - Start time of the test run.
11673
+ * @property end - End time of the test run.
11674
+ * @property duration - Duration of the test run, in milliseconds.
11675
+ */
11676
+ type Stats = {
11677
+ passes: number;
11678
+ failures: number;
11679
+ tests: number;
11680
+ pending: number;
11681
+ failedHooks: number;
11682
+ start: Date;
11683
+ end: Date;
11684
+ duration: number;
11685
+ };
11686
+ /**
11687
+ * Result of a test run. Will be emitted for example in "event.all.result" events.
11688
+ */
11689
+ class Result {
11690
+ /**
11691
+ * Resets all collected stats, tests, and failure reports.
11692
+ */
11693
+ reset(): void;
11694
+ /**
11695
+ * Sets the start time to the current time.
11696
+ */
11697
+ start(): void;
11698
+ /**
11699
+ * Sets the end time to the current time.
11700
+ */
11701
+ finish(): void;
11702
+ /**
11703
+ * Whether this result contains any failed tests.
11704
+ */
11705
+ readonly hasFailed: boolean;
11706
+ /**
11707
+ * All collected tests.
11708
+ */
11709
+ readonly tests: CodeceptJS.Test[];
11710
+ /**
11711
+ * The failure reports (array of strings per failed test).
11712
+ */
11713
+ readonly failures: string[][];
11714
+ /**
11715
+ * The test statistics.
11716
+ */
11717
+ readonly stats: Stats;
11718
+ /**
11719
+ * The start time of the test run.
11720
+ */
11721
+ readonly startTime: Date;
11722
+ /**
11723
+ * Adds a test to this result.
11724
+ */
11725
+ addTest(test: CodeceptJS.Test): void;
11726
+ /**
11727
+ * Adds failure reports to this result.
11728
+ */
11729
+ addFailures(newFailures: string[][]): void;
11730
+ /**
11731
+ * Whether this result contains any failed tests.
11732
+ */
11733
+ readonly hasFailures: boolean;
11734
+ /**
11735
+ * The duration of the test run, in milliseconds.
11736
+ */
11737
+ readonly duration: number;
11738
+ /**
11739
+ * All failed tests.
11740
+ */
11741
+ failedTests: CodeceptJS.Test[];
11742
+ /**
11743
+ * All passed tests.
11744
+ */
11745
+ readonly passedTests: CodeceptJS.Test[];
11746
+ /**
11747
+ * All skipped tests.
11748
+ */
11749
+ readonly skippedTests: CodeceptJS.Test[];
11750
+ /**
11751
+ * @returns The JSON representation of this result.
11752
+ */
11753
+ simplify(): any;
11754
+ /**
11755
+ * Saves this result to a JSON file.
11756
+ * @param [fileName] - Path to the JSON file, relative to `output_dir`. Defaults to "result.json".
11757
+ */
11758
+ save(fileName?: string): void;
11759
+ /**
11760
+ * Adds stats to this result.
11761
+ */
11762
+ addStats(newStats?: Partial<Stats>): void;
11763
+ }
12390
11764
  /**
12391
11765
  * Dependency Injection Container
12392
11766
  */
12393
11767
  class Container {
11768
+ /**
11769
+ * Get the standard acting helpers of CodeceptJS Container
11770
+ */
11771
+ static STANDARD_ACTING_HELPERS: any;
12394
11772
  /**
12395
11773
  * Create container with all required helpers and support objects
12396
11774
  */
@@ -12415,6 +11793,10 @@ declare namespace CodeceptJS {
12415
11793
  * Get Mocha instance
12416
11794
  */
12417
11795
  static mocha(): any;
11796
+ /**
11797
+ * Get result
11798
+ */
11799
+ static result(): Result;
12418
11800
  /**
12419
11801
  * Append new services to container
12420
11802
  */
@@ -12431,6 +11813,7 @@ declare namespace CodeceptJS {
12431
11813
  }, newPlugins: {
12432
11814
  [key: string]: any;
12433
11815
  }): void;
11816
+ static started(fn: ((...params: any[]) => any) | null): Promise<void>;
12434
11817
  /**
12435
11818
  * Share data across worker threads
12436
11819
  * @param options - set {local: true} to not share among workers
@@ -12440,7 +11823,7 @@ declare namespace CodeceptJS {
12440
11823
  /**
12441
11824
  * Method collect own property and prototype
12442
11825
  */
12443
- function getObjectMethods(): void;
11826
+ function loadTranslation(): void;
12444
11827
  /**
12445
11828
  * Datatable class to provide data driven testing
12446
11829
  */
@@ -12478,6 +11861,63 @@ declare namespace CodeceptJS {
12478
11861
  */
12479
11862
  transpose(): void;
12480
11863
  }
11864
+ /**
11865
+ * - Designed for use in CodeceptJS tests as a "soft assertion."
11866
+ * Unlike standard assertions, it does not stop the test execution on failure.
11867
+ * - Starts a new recorder session named 'hopeThat' and manages state restoration.
11868
+ * - Logs errors and attaches them as notes to the test, enabling post-test reporting of soft assertion failures.
11869
+ * - Resets the `store.hopeThat` flag after the execution, ensuring clean state for subsequent operations.
11870
+ * @example
11871
+ * const { hopeThat } = require('codeceptjs/effects')
11872
+ * await hopeThat(() => {
11873
+ * I.see('Welcome'); // Perform a soft assertion
11874
+ * });
11875
+ * @param callback - The callback function containing the logic to validate.
11876
+ * This function should perform the desired assertion or condition check.
11877
+ * @returns A promise resolving to `true` if the assertion or condition was successful,
11878
+ * or `false` if an error occurred.
11879
+ */
11880
+ function hopeThat(callback: (...params: any[]) => any): Promise<boolean | any>;
11881
+ /**
11882
+ * - This function is designed for use in CodeceptJS tests to handle intermittent or flaky test steps.
11883
+ * - Starts a new recorder session for each retry attempt, ensuring proper state management and error handling.
11884
+ * - Logs errors and retries the callback until it either succeeds or the maximum number of attempts is reached.
11885
+ * - Restores the session state after each attempt, whether successful or not.
11886
+ * @example
11887
+ * const { retryTo } = require('codeceptjs/effects')
11888
+ * await retryTo((tries) => {
11889
+ * if (tries < 3) {
11890
+ * I.see('Non-existent element'); // Simulates a failure
11891
+ * } else {
11892
+ * I.see('Welcome'); // Succeeds on the 3rd attempt
11893
+ * }
11894
+ * }, 5, 300); // Retry up to 5 times, with a 300ms interval
11895
+ * @param callback - The function to execute, which will be retried upon failure.
11896
+ * Receives the current retry count as an argument.
11897
+ * @param maxTries - The maximum number of attempts to retry the callback.
11898
+ * @param [pollInterval = 200] - The delay (in milliseconds) between retry attempts.
11899
+ * @returns A promise that resolves when the callback executes successfully, or rejects after reaching the maximum retries.
11900
+ */
11901
+ function retryTo(callback: (...params: any[]) => any, maxTries: number, pollInterval?: number): Promise<void | any>;
11902
+ /**
11903
+ * - Useful for scenarios where certain steps are optional or their failure should not interrupt the test flow.
11904
+ * - Starts a new recorder session named 'tryTo' for isolation and error handling.
11905
+ * - Captures errors during execution and logs them for debugging purposes.
11906
+ * - Ensures the `store.tryTo` flag is reset after execution to maintain a clean state.
11907
+ * @example
11908
+ * const { tryTo } = require('codeceptjs/effects')
11909
+ * const wasSuccessful = await tryTo(() => {
11910
+ * I.see('Welcome'); // Attempt to find an element on the page
11911
+ * });
11912
+ *
11913
+ * if (!wasSuccessful) {
11914
+ * I.say('Optional step failed, but test continues.');
11915
+ * }
11916
+ * @param callback - The function to execute, which may succeed or fail.
11917
+ * This function contains the logic to be attempted.
11918
+ * @returns A promise resolving to `true` if the step succeeds, or `false` if it fails.
11919
+ */
11920
+ function tryTo(callback: (...params: any[]) => any): Promise<boolean | any>;
12481
11921
  namespace event {
12482
11922
  const dispatcher: NodeJS.EventEmitter;
12483
11923
  const test: {
@@ -12496,6 +11936,8 @@ declare namespace CodeceptJS {
12496
11936
  const hook: {
12497
11937
  started: 'hook.start';
12498
11938
  passed: 'hook.passed';
11939
+ failed: 'hook.failed';
11940
+ finished: 'hook.finished';
12499
11941
  };
12500
11942
  const step: {
12501
11943
  started: 'step.start';
@@ -12554,76 +11996,6 @@ declare namespace CodeceptJS {
12554
11996
  var store: typeof CodeceptJS.store;
12555
11997
  var locator: typeof CodeceptJS.Locator;
12556
11998
  }
12557
- function addStep(step: any, fn: any): void;
12558
- class FeatureConfig {
12559
- /**
12560
- * Retry this suite for x times
12561
- */
12562
- retry(retries: number): this;
12563
- /**
12564
- * Set timeout for this suite
12565
- */
12566
- timeout(timeout: number): this;
12567
- /**
12568
- * Configures a helper.
12569
- * Helper name can be omitted and values will be applied to first helper.
12570
- */
12571
- config(helper: string | {
12572
- [key: string]: any;
12573
- }, obj?: {
12574
- [key: string]: any;
12575
- }): this;
12576
- /**
12577
- * Append a tag name to scenario title
12578
- */
12579
- tag(tagName: string): this;
12580
- }
12581
- class ScenarioConfig {
12582
- /**
12583
- * Declares that test throws error.
12584
- * Can pass an Error object or regex matching expected message.
12585
- */
12586
- throws(err: any): this;
12587
- /**
12588
- * Declares that test should fail.
12589
- * If test passes - throws an error.
12590
- * Can pass an Error object or regex matching expected message.
12591
- */
12592
- fails(): this;
12593
- /**
12594
- * Retry this test for x times
12595
- */
12596
- retry(retries: number): this;
12597
- /**
12598
- * Set timeout for this test
12599
- */
12600
- timeout(timeout: number): this;
12601
- /**
12602
- * Pass in additional objects to inject into test
12603
- */
12604
- inject(obj: {
12605
- [key: string]: any;
12606
- }): this;
12607
- /**
12608
- * Configures a helper.
12609
- * Helper name can be omitted and values will be applied to first helper.
12610
- */
12611
- config(helper: string | {
12612
- [key: string]: any;
12613
- }, obj?: {
12614
- [key: string]: any;
12615
- }): this;
12616
- /**
12617
- * Append a tag name to scenario title
12618
- */
12619
- tag(tagName: string): this;
12620
- /**
12621
- * Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
12622
- */
12623
- injectDependencies(dependencies: {
12624
- [key: string]: any;
12625
- }): this;
12626
- }
12627
11999
  class Locator {
12628
12000
  constructor(locator: CodeceptJS.LocatorOrString, defaultType?: string);
12629
12001
  toString(): string;
@@ -12686,7 +12058,7 @@ declare namespace CodeceptJS {
12686
12058
  inside(locator: CodeceptJS.LocatorOrString): Locator;
12687
12059
  after(locator: CodeceptJS.LocatorOrString): Locator;
12688
12060
  before(locator: CodeceptJS.LocatorOrString): Locator;
12689
- static build(locator: CodeceptJS.LocatorOrString): Locator;
12061
+ static build(locator?: CodeceptJS.LocatorOrString): Locator;
12690
12062
  /**
12691
12063
  * Filters to modify locators
12692
12064
  */
@@ -12741,6 +12113,7 @@ declare namespace CodeceptJS {
12741
12113
  function skipped(test: Mocha.Test): void;
12742
12114
  }
12743
12115
  namespace scenario {
12116
+ function started(test: Mocha.Test): void;
12744
12117
  function passed(test: Mocha.Test): void;
12745
12118
  function failed(test: Mocha.Test): void;
12746
12119
  }
@@ -12817,6 +12190,10 @@ declare namespace CodeceptJS {
12817
12190
  * Get a state of current queue and tasks
12818
12191
  */
12819
12192
  toString(): string;
12193
+ /**
12194
+ * Get current session ID
12195
+ */
12196
+ getCurrentSessionId(): string | null;
12820
12197
  }
12821
12198
  interface RecorderSession {
12822
12199
  running: boolean;
@@ -12832,24 +12209,50 @@ declare namespace CodeceptJS {
12832
12209
  function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
12833
12210
  [key: string]: any;
12834
12211
  }, fn?: (...params: any[]) => any): any;
12212
+ /**
12213
+ * StepConfig is a configuration object for a step.
12214
+ * It is used to create a new step that is a combination of other steps.
12215
+ */
12216
+ class StepConfig {
12217
+ config: any;
12218
+ /**
12219
+ * Set the options for the step.
12220
+ * @param opts - The options for the step.
12221
+ * @returns - The step configuration object.
12222
+ */
12223
+ opts(opts: any): StepConfig;
12224
+ /**
12225
+ * Set the timeout for the step.
12226
+ * @param timeout - The timeout for the step.
12227
+ * @returns - The step configuration object.
12228
+ */
12229
+ timeout(timeout: number): StepConfig;
12230
+ /**
12231
+ * Set the retry for the step.
12232
+ * @param retry - The retry for the step.
12233
+ * @returns - The step configuration object.
12234
+ */
12235
+ retry(retry: number): StepConfig;
12236
+ }
12835
12237
  /**
12836
12238
  * Each command in test executed through `I.` object is wrapped in Step.
12837
12239
  * Step allows logging executed commands and triggers hook before and after step execution.
12838
12240
  */
12839
12241
  class Step {
12840
- constructor(helper: CodeceptJS.Helper, name: string);
12841
- actor: string;
12842
- helper: CodeceptJS.Helper;
12242
+ constructor(name: string);
12843
12243
  name: string;
12844
- helperMethod: string;
12244
+ timeouts: Map<number, number>;
12245
+ args: any[];
12246
+ opts: Record<string, any>;
12247
+ actor: string;
12845
12248
  status: string;
12846
- suffix: string;
12847
12249
  prefix: string;
12848
12250
  comment: string;
12849
- args: any[];
12850
- metaStep: MetaStep;
12251
+ metaStep: any;
12851
12252
  stack: string;
12852
- getTimeout(): number | undefined;
12253
+ helper: any;
12254
+ helperMethod: string;
12255
+ timeout: any;
12853
12256
  /**
12854
12257
  * @param timeout - timeout in milliseconds or 0 if no timeout
12855
12258
  * @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
@@ -12858,27 +12261,43 @@ declare namespace CodeceptJS {
12858
12261
  setTimeout(timeout: number, order: number): void;
12859
12262
  setTrace(): void;
12860
12263
  setArguments(args: any[]): void;
12861
- run(...args: any[]): any;
12862
12264
  setStatus(status: string): void;
12863
12265
  humanize(): string;
12864
12266
  humanizeArgs(): string;
12865
12267
  line(): string;
12866
12268
  toString(): string;
12269
+ toCliStyled(): string;
12867
12270
  toCode(): string;
12868
12271
  hasBDDAncestor(): boolean;
12869
- static MetaStep: typeof MetaStep;
12870
- }
12871
- class MetaStep extends Step {
12872
- isBDD(): boolean;
12873
- run(): any;
12874
12272
  }
12875
12273
  /**
12876
12274
  * global values for current session
12877
12275
  */
12878
12276
  namespace store {
12277
+ /**
12278
+ * If we are in --debug mode
12279
+ */
12879
12280
  var debugMode: boolean;
12281
+ /**
12282
+ * Is timeouts enabled
12283
+ */
12880
12284
  var timeouts: boolean;
12285
+ /**
12286
+ * If auto-retries are enabled by retryFailedStep plugin
12287
+ * tryTo effect disables them
12288
+ */
12289
+ var autoRetries: boolean;
12290
+ /**
12291
+ * Tests are executed via dry-run
12292
+ */
12881
12293
  var dryRun: boolean;
12294
+ /**
12295
+ * If we are in pause mode
12296
+ */
12297
+ var onPause: boolean;
12298
+ var currentTest: CodeceptJS.Test | null;
12299
+ var currentStep: CodeceptJS.Step | null;
12300
+ var currentSuite: CodeceptJS.Suite | null;
12882
12301
  }
12883
12302
  /**
12884
12303
  * Describe a "suite" with the given `title`
@@ -12888,6 +12307,10 @@ declare namespace CodeceptJS {
12888
12307
  function Feature(title: string, opts?: {
12889
12308
  [key: string]: any;
12890
12309
  }): FeatureConfig;
12310
+ /**
12311
+ * Exclusive test suite - runs only this feature.
12312
+ */
12313
+ const only: CodeceptJS.IFeature;
12891
12314
  /**
12892
12315
  * Pending test suite.
12893
12316
  */
@@ -12900,6 +12323,139 @@ declare namespace CodeceptJS {
12900
12323
  * Pending test case with message: 'Test not implemented!'.
12901
12324
  */
12902
12325
  const todo: CodeceptJS.IScenario;
12326
+ /**
12327
+ * Configuration for a Feature.
12328
+ * Can inject values and add custom configuration.
12329
+ */
12330
+ class FeatureConfig {
12331
+ constructor(suite: CodeceptJS.Suite);
12332
+ /**
12333
+ * Set metadata for this suite
12334
+ */
12335
+ meta(key: string, value: string): this;
12336
+ /**
12337
+ * Retry this test for number of times
12338
+ */
12339
+ retry(retries: number): this;
12340
+ /**
12341
+ * Set timeout for this test
12342
+ */
12343
+ timeout(timeout: number): this;
12344
+ /**
12345
+ * Configures a helper.
12346
+ * Helper name can be omitted and values will be applied to first helper.
12347
+ */
12348
+ config(helper: string | {
12349
+ [key: string]: any;
12350
+ } | FeatureConfigCallback, obj?: {
12351
+ [key: string]: any;
12352
+ }): this;
12353
+ /**
12354
+ * Append a tag name to scenario title
12355
+ */
12356
+ tag(tagName: string): this;
12357
+ }
12358
+ type FeatureConfigCallback = (suite: CodeceptJS.Suite) => {
12359
+ [key: string]: any;
12360
+ };
12361
+ class ScenarioConfig {
12362
+ constructor(test: CodeceptJS.Test);
12363
+ /**
12364
+ * Declares that test throws error.
12365
+ * Can pass an Error object or regex matching expected message.
12366
+ */
12367
+ throws(err: any): this;
12368
+ /**
12369
+ * Declares that test should fail.
12370
+ * If test passes - throws an error.
12371
+ * Can pass an Error object or regex matching expected message.
12372
+ */
12373
+ fails(): this;
12374
+ /**
12375
+ * Retry this test for x times
12376
+ */
12377
+ retry(retries: number): this;
12378
+ /**
12379
+ * Set metadata for this test
12380
+ */
12381
+ meta(key: string, value: string): this;
12382
+ /**
12383
+ * Set timeout for this test
12384
+ */
12385
+ timeout(timeout: number): this;
12386
+ /**
12387
+ * Pass in additional objects to inject into test
12388
+ */
12389
+ inject(obj: {
12390
+ [key: string]: any;
12391
+ }): this;
12392
+ /**
12393
+ * Configures a helper.
12394
+ * Helper name can be omitted and values will be applied to first helper.
12395
+ */
12396
+ config(helper: string | {
12397
+ [key: string]: any;
12398
+ } | ScenarioConfigCallback, obj?: {
12399
+ [key: string]: any;
12400
+ }): this;
12401
+ /**
12402
+ * Append a tag name to scenario title
12403
+ */
12404
+ tag(tagName: string): this;
12405
+ /**
12406
+ * Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
12407
+ */
12408
+ injectDependencies(dependencies: {
12409
+ [key: string]: any;
12410
+ }): this;
12411
+ }
12412
+ type ScenarioConfigCallback = (test: CodeceptJS.Test) => {
12413
+ [key: string]: any;
12414
+ };
12415
+ function addStep(step: any, fn: any): void;
12416
+ /**
12417
+ * Creates a new Hook instance
12418
+ * @property suite - The test suite this hook belongs to
12419
+ * @property test - The test object associated with this hook
12420
+ * @property runnable - The current test being executed
12421
+ * @property ctx - The context object
12422
+ * @property err - The error that occurred during hook execution, if any
12423
+ * @param context - The context object containing suite and test information
12424
+ * @param context.suite - The test suite
12425
+ * @param context.test - The test object
12426
+ * @param context.ctx - The context object
12427
+ * @param error - The error object if hook execution failed
12428
+ */
12429
+ class Hook {
12430
+ constructor(context: {
12431
+ suite: any;
12432
+ test: any;
12433
+ ctx: any;
12434
+ }, error: Error);
12435
+ /**
12436
+ * The test suite this hook belongs to
12437
+ */
12438
+ suite: any;
12439
+ /**
12440
+ * The test object associated with this hook
12441
+ */
12442
+ test: any;
12443
+ /**
12444
+ * The current test being executed
12445
+ */
12446
+ runnable: any;
12447
+ /**
12448
+ * The context object
12449
+ */
12450
+ ctx: any;
12451
+ /**
12452
+ * The error that occurred during hook execution, if any
12453
+ */
12454
+ err: Error | null;
12455
+ }
12456
+ /**
12457
+ * TODO: move to effects
12458
+ */
12903
12459
  function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
12904
12460
  /**
12905
12461
  * This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
@@ -13501,22 +13057,17 @@ declare namespace CodeceptJS {
13501
13057
  }
13502
13058
 
13503
13059
  /**
13504
- * timeouts set with order below zero only override timeouts of higher order if their value is smaller
13505
- */
13506
- declare var testOrSuite: any;
13507
-
13508
- /**
13509
- * 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
13060
+ * corresponding helper
13510
13061
  */
13511
- declare var stepTimeoutHard: any;
13062
+ declare var helper: CodeceptJS.Helper;
13512
13063
 
13513
13064
  /**
13514
- * 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
13065
+ * name of method to be executed
13515
13066
  */
13516
- declare var codeLimitTime: any;
13067
+ declare var helperMethod: string;
13517
13068
 
13518
13069
  /**
13519
- * 20-29 - designated for timeout settings which could be overriden in tests code, 25 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=false
13070
+ * hide children steps from output
13520
13071
  */
13521
- declare var stepTimeoutSoft: any;
13072
+ declare var collsapsed: boolean;
13522
13073