codeceptjs 4.0.0-beta.3 → 4.0.0-beta.5

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 (155) hide show
  1. package/README.md +134 -119
  2. package/bin/codecept.js +12 -2
  3. package/bin/test-server.js +53 -0
  4. package/docs/webapi/clearCookie.mustache +1 -1
  5. package/lib/actor.js +66 -102
  6. package/lib/ai.js +130 -121
  7. package/lib/assert/empty.js +3 -5
  8. package/lib/assert/equal.js +4 -7
  9. package/lib/assert/include.js +4 -6
  10. package/lib/assert/throws.js +2 -4
  11. package/lib/assert/truth.js +2 -2
  12. package/lib/codecept.js +141 -86
  13. package/lib/command/check.js +201 -0
  14. package/lib/command/configMigrate.js +2 -4
  15. package/lib/command/definitions.js +8 -26
  16. package/lib/command/dryRun.js +30 -35
  17. package/lib/command/generate.js +10 -14
  18. package/lib/command/gherkin/snippets.js +75 -73
  19. package/lib/command/gherkin/steps.js +1 -1
  20. package/lib/command/info.js +42 -8
  21. package/lib/command/init.js +13 -12
  22. package/lib/command/interactive.js +10 -2
  23. package/lib/command/list.js +1 -1
  24. package/lib/command/run-multiple/chunk.js +48 -45
  25. package/lib/command/run-multiple.js +12 -35
  26. package/lib/command/run-workers.js +21 -58
  27. package/lib/command/utils.js +5 -6
  28. package/lib/command/workers/runTests.js +263 -222
  29. package/lib/container.js +386 -238
  30. package/lib/data/context.js +10 -13
  31. package/lib/data/dataScenarioConfig.js +8 -8
  32. package/lib/data/dataTableArgument.js +6 -6
  33. package/lib/data/table.js +5 -11
  34. package/lib/effects.js +223 -0
  35. package/lib/element/WebElement.js +327 -0
  36. package/lib/els.js +158 -0
  37. package/lib/event.js +21 -17
  38. package/lib/heal.js +88 -80
  39. package/lib/helper/AI.js +2 -1
  40. package/lib/helper/ApiDataFactory.js +4 -7
  41. package/lib/helper/Appium.js +50 -57
  42. package/lib/helper/FileSystem.js +3 -3
  43. package/lib/helper/GraphQLDataFactory.js +4 -4
  44. package/lib/helper/JSONResponse.js +75 -37
  45. package/lib/helper/Mochawesome.js +31 -9
  46. package/lib/helper/Nightmare.js +37 -58
  47. package/lib/helper/Playwright.js +267 -272
  48. package/lib/helper/Protractor.js +56 -87
  49. package/lib/helper/Puppeteer.js +247 -264
  50. package/lib/helper/REST.js +29 -17
  51. package/lib/helper/TestCafe.js +22 -47
  52. package/lib/helper/WebDriver.js +157 -368
  53. package/lib/helper/extras/PlaywrightPropEngine.js +2 -2
  54. package/lib/helper/extras/Popup.js +22 -22
  55. package/lib/helper/network/utils.js +1 -1
  56. package/lib/helper/testcafe/testcafe-utils.js +27 -28
  57. package/lib/listener/emptyRun.js +55 -0
  58. package/lib/listener/exit.js +7 -10
  59. package/lib/listener/{retry.js → globalRetry.js} +5 -5
  60. package/lib/listener/globalTimeout.js +165 -0
  61. package/lib/listener/helpers.js +15 -15
  62. package/lib/listener/mocha.js +1 -1
  63. package/lib/listener/result.js +12 -0
  64. package/lib/listener/retryEnhancer.js +85 -0
  65. package/lib/listener/steps.js +32 -18
  66. package/lib/listener/store.js +20 -0
  67. package/lib/locator.js +1 -1
  68. package/lib/mocha/asyncWrapper.js +231 -0
  69. package/lib/{interfaces → mocha}/bdd.js +3 -3
  70. package/lib/mocha/cli.js +308 -0
  71. package/lib/mocha/factory.js +104 -0
  72. package/lib/{interfaces → mocha}/featureConfig.js +32 -12
  73. package/lib/{interfaces → mocha}/gherkin.js +26 -28
  74. package/lib/mocha/hooks.js +112 -0
  75. package/lib/mocha/index.js +12 -0
  76. package/lib/mocha/inject.js +29 -0
  77. package/lib/{interfaces → mocha}/scenarioConfig.js +31 -7
  78. package/lib/mocha/suite.js +82 -0
  79. package/lib/mocha/test.js +181 -0
  80. package/lib/mocha/types.d.ts +42 -0
  81. package/lib/mocha/ui.js +232 -0
  82. package/lib/output.js +93 -65
  83. package/lib/pause.js +160 -138
  84. package/lib/plugin/analyze.js +396 -0
  85. package/lib/plugin/auth.js +435 -0
  86. package/lib/plugin/autoDelay.js +8 -8
  87. package/lib/plugin/autoLogin.js +3 -338
  88. package/lib/plugin/commentStep.js +6 -1
  89. package/lib/plugin/coverage.js +10 -22
  90. package/lib/plugin/customLocator.js +3 -3
  91. package/lib/plugin/customReporter.js +52 -0
  92. package/lib/plugin/eachElement.js +1 -1
  93. package/lib/plugin/fakerTransform.js +1 -1
  94. package/lib/plugin/heal.js +36 -9
  95. package/lib/plugin/htmlReporter.js +1947 -0
  96. package/lib/plugin/pageInfo.js +140 -0
  97. package/lib/plugin/retryFailedStep.js +17 -18
  98. package/lib/plugin/retryTo.js +2 -113
  99. package/lib/plugin/screenshotOnFail.js +17 -58
  100. package/lib/plugin/selenoid.js +15 -35
  101. package/lib/plugin/standardActingHelpers.js +4 -1
  102. package/lib/plugin/stepByStepReport.js +56 -17
  103. package/lib/plugin/stepTimeout.js +5 -12
  104. package/lib/plugin/subtitles.js +4 -4
  105. package/lib/plugin/tryTo.js +3 -102
  106. package/lib/plugin/wdio.js +8 -10
  107. package/lib/recorder.js +155 -124
  108. package/lib/rerun.js +43 -42
  109. package/lib/result.js +161 -0
  110. package/lib/secret.js +1 -2
  111. package/lib/step/base.js +239 -0
  112. package/lib/step/comment.js +10 -0
  113. package/lib/step/config.js +50 -0
  114. package/lib/step/func.js +46 -0
  115. package/lib/step/helper.js +50 -0
  116. package/lib/step/meta.js +99 -0
  117. package/lib/step/record.js +74 -0
  118. package/lib/step/retry.js +11 -0
  119. package/lib/step/section.js +55 -0
  120. package/lib/step.js +21 -332
  121. package/lib/steps.js +50 -0
  122. package/lib/store.js +37 -5
  123. package/lib/template/heal.js +2 -11
  124. package/lib/test-server.js +323 -0
  125. package/lib/timeout.js +66 -0
  126. package/lib/utils.js +351 -218
  127. package/lib/within.js +75 -55
  128. package/lib/workerStorage.js +2 -1
  129. package/lib/workers.js +386 -277
  130. package/package.json +81 -75
  131. package/translations/de-DE.js +5 -3
  132. package/translations/fr-FR.js +5 -4
  133. package/translations/index.js +1 -0
  134. package/translations/it-IT.js +4 -3
  135. package/translations/ja-JP.js +4 -3
  136. package/translations/nl-NL.js +76 -0
  137. package/translations/pl-PL.js +4 -3
  138. package/translations/pt-BR.js +4 -3
  139. package/translations/ru-RU.js +4 -3
  140. package/translations/utils.js +9 -0
  141. package/translations/zh-CN.js +4 -3
  142. package/translations/zh-TW.js +4 -3
  143. package/typings/index.d.ts +197 -187
  144. package/typings/promiseBasedTypes.d.ts +53 -903
  145. package/typings/types.d.ts +372 -1042
  146. package/lib/cli.js +0 -257
  147. package/lib/helper/ExpectHelper.js +0 -391
  148. package/lib/helper/MockServer.js +0 -221
  149. package/lib/helper/SoftExpectHelper.js +0 -381
  150. package/lib/listener/artifacts.js +0 -19
  151. package/lib/listener/timeout.js +0 -109
  152. package/lib/mochaFactory.js +0 -113
  153. package/lib/plugin/debugErrors.js +0 -67
  154. package/lib/scenario.js +0 -224
  155. package/lib/ui.js +0 -236
@@ -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,244 +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
- // @ts-ignore
1212
- // @ts-ignore
1213
- // @ts-ignore
1214
- // @ts-ignore
1215
- class ExpectHelper {
1216
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1217
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1218
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1219
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1220
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1221
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1222
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1223
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1224
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1225
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1226
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1227
- /**
1228
- * @param [ajvOptions] - Pass AJV options
1229
- */
1230
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1231
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1232
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1233
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1234
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1235
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1236
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1237
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1238
- expectTrue(targetData: any, customErrorMsg?: any): void;
1239
- expectFalse(targetData: any, customErrorMsg?: any): void;
1240
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1241
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1242
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1243
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1244
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1245
- /**
1246
- * expects members of two arrays are deeply equal
1247
- */
1248
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1249
- /**
1250
- * expects an array to be a superset of another array
1251
- */
1252
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1253
- /**
1254
- * expects members of two JSON objects are deeply equal excluding some properties
1255
- */
1256
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1257
- /**
1258
- * expects a JSON object matches a provided pattern
1259
- */
1260
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1261
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1262
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1263
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1264
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1265
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1266
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1267
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1268
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1269
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1270
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1271
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1272
- /**
1273
- * @param [ajvOptions] - Pass AJV options
1274
- */
1275
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1276
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1277
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1278
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1279
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1280
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1281
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1282
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1283
- expectTrue(targetData: any, customErrorMsg?: any): void;
1284
- expectFalse(targetData: any, customErrorMsg?: any): void;
1285
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1286
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1287
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1288
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1289
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1290
- /**
1291
- * expects members of two arrays are deeply equal
1292
- */
1293
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1294
- /**
1295
- * expects an array to be a superset of another array
1296
- */
1297
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1298
- /**
1299
- * expects members of two JSON objects are deeply equal excluding some properties
1300
- */
1301
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1302
- /**
1303
- * expects a JSON object matches a provided pattern
1304
- */
1305
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1306
- }
1307
- /**
1308
- * This helper allows performing assertions based on Chai.
1309
- *
1310
- * ### Examples
1311
- *
1312
- * Zero-configuration when paired with other helpers like REST, Playwright:
1313
- *
1314
- * ```js
1315
- * // inside codecept.conf.js
1316
- * {
1317
- * helpers: {
1318
- * Playwright: {...},
1319
- * ExpectHelper: {},
1320
- * }
1321
- * }
1322
- * ```
1323
- *
1324
- * ## Methods
1325
- */
1326
- // @ts-ignore
1327
- // @ts-ignore
1328
- // @ts-ignore
1329
- // @ts-ignore
1330
- // @ts-ignore
1331
- // @ts-ignore
1332
- // @ts-ignore
1333
- // @ts-ignore
1334
- class ExpectHelper {
1335
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1336
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1337
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1338
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1339
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1340
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1341
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1342
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1343
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1344
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1345
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1346
- /**
1347
- * @param [ajvOptions] - Pass AJV options
1348
- */
1349
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1350
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1351
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1352
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1353
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1354
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1355
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1356
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1357
- expectTrue(targetData: any, customErrorMsg?: any): void;
1358
- expectFalse(targetData: any, customErrorMsg?: any): void;
1359
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1360
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1361
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1362
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1363
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1364
- /**
1365
- * expects members of two arrays are deeply equal
1366
- */
1367
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1368
- /**
1369
- * expects an array to be a superset of another array
1370
- */
1371
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1372
- /**
1373
- * expects members of two JSON objects are deeply equal excluding some properties
1374
- */
1375
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1376
- /**
1377
- * expects a JSON object matches a provided pattern
1378
- */
1379
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1380
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1381
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1382
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1383
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1384
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1385
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1386
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1387
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1388
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1389
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1390
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1391
- /**
1392
- * @param [ajvOptions] - Pass AJV options
1393
- */
1394
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1395
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1396
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1397
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1398
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1399
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1400
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1401
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1402
- expectTrue(targetData: any, customErrorMsg?: any): void;
1403
- expectFalse(targetData: any, customErrorMsg?: any): void;
1404
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1405
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1406
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1407
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1408
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1409
- /**
1410
- * expects members of two arrays are deeply equal
1411
- */
1412
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1413
- /**
1414
- * expects an array to be a superset of another array
1415
- */
1416
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1417
- /**
1418
- * expects members of two JSON objects are deeply equal excluding some properties
1419
- */
1420
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1421
- /**
1422
- * expects a JSON object matches a provided pattern
1423
- */
1424
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1425
- }
1426
1206
  /**
1427
1207
  * Helper for testing filesystem.
1428
1208
  * Can be easily used to check file structures:
@@ -1672,7 +1452,7 @@ declare namespace CodeceptJS {
1672
1452
  * input: { ...buildObj },
1673
1453
  * }))
1674
1454
  * // 'attr'-id can be left out depending on the GraphQl resolvers
1675
- * .attr('name', () => faker.name.findName())
1455
+ * .attr('name', () => faker.person.findName())
1676
1456
  * .attr('email', () => faker.interact.email())
1677
1457
  * ```
1678
1458
  * For more options see [rosie documentation](https://github.com/rosiejs/rosie).
@@ -1949,13 +1729,14 @@ declare namespace CodeceptJS {
1949
1729
  */
1950
1730
  seeResponseContainsKeys(keys: any[]): void;
1951
1731
  /**
1952
- * Executes a callback function passing in `response` object and chai assertions with `expect`
1732
+ * Executes a callback function passing in `response` object and assert
1953
1733
  * Use it to perform custom checks of response data
1954
1734
  *
1955
1735
  * ```js
1956
- * I.seeResponseValidByCallback(({ data, status, expect }) => {
1957
- * expect(status).to.eql(200);
1958
- * 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);
1959
1740
  * });
1960
1741
  * ```
1961
1742
  */
@@ -1997,207 +1778,6 @@ declare namespace CodeceptJS {
1997
1778
  */
1998
1779
  seeResponseMatchesJsonSchema(fnOrSchema: any): void;
1999
1780
  }
2000
- /**
2001
- * ## Configuration
2002
- *
2003
- * This helper should be configured in codecept.conf.(js|ts)
2004
- * @property [port = 9393] - Mock server port
2005
- * @property [host = "0.0.0.0"] - Mock server host
2006
- * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
2007
- */
2008
- // @ts-ignore
2009
- // @ts-ignore
2010
- // @ts-ignore
2011
- // @ts-ignore
2012
- // @ts-ignore
2013
- // @ts-ignore
2014
- // @ts-ignore
2015
- // @ts-ignore
2016
- type MockServerConfig = {
2017
- port?: number;
2018
- host?: string;
2019
- httpsOpts?: any;
2020
- };
2021
- /**
2022
- * MockServer
2023
- *
2024
- * 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.
2025
- *
2026
- * <!-- configuration -->
2027
- *
2028
- * #### Examples
2029
- *
2030
- * You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
2031
- *
2032
- * ```javascript
2033
- * {
2034
- * helpers: {
2035
- * REST: {...},
2036
- * MockServer: {
2037
- * // default mock server config
2038
- * port: 9393,
2039
- * host: '0.0.0.0',
2040
- * httpsOpts: {
2041
- * key: '',
2042
- * cert: '',
2043
- * },
2044
- * },
2045
- * }
2046
- * }
2047
- * ```
2048
- *
2049
- * #### Adding Interactions
2050
- *
2051
- * 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.
2052
- *
2053
- * ```javascript
2054
- * I.addInteractionToMockServer({
2055
- * request: {
2056
- * method: 'GET',
2057
- * path: '/api/hello'
2058
- * },
2059
- * response: {
2060
- * status: 200,
2061
- * body: {
2062
- * 'say': 'hello to mock server'
2063
- * }
2064
- * }
2065
- * });
2066
- * ```
2067
- *
2068
- * #### Request Matching
2069
- *
2070
- * 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.
2071
- *
2072
- * - Strong match on HTTP Method, Path, Query Params & JSON body.
2073
- * - Loose match on Headers.
2074
- *
2075
- * ##### Strong Match on Query Params
2076
- *
2077
- * You can send different responses based on query parameters:
2078
- *
2079
- * ```javascript
2080
- * I.addInteractionToMockServer({
2081
- * request: {
2082
- * method: 'GET',
2083
- * path: '/api/users',
2084
- * queryParams: {
2085
- * id: 1
2086
- * }
2087
- * },
2088
- * response: {
2089
- * status: 200,
2090
- * body: 'user 1'
2091
- * }
2092
- * });
2093
- *
2094
- * I.addInteractionToMockServer({
2095
- * request: {
2096
- * method: 'GET',
2097
- * path: '/api/users',
2098
- * queryParams: {
2099
- * id: 2
2100
- * }
2101
- * },
2102
- * response: {
2103
- * status: 200,
2104
- * body: 'user 2'
2105
- * }
2106
- * });
2107
- * ```
2108
- *
2109
- * - GET to `/api/users?id=1` will return 'user 1'.
2110
- * - GET to `/api/users?id=2` will return 'user 2'.
2111
- * - For all other requests, it returns a 404 status code.
2112
- *
2113
- * ##### Loose Match on Body
2114
- *
2115
- * When `strict` is set to false, it performs a loose match on query params and response body:
2116
- *
2117
- * ```javascript
2118
- * I.addInteractionToMockServer({
2119
- * strict: false,
2120
- * request: {
2121
- * method: 'POST',
2122
- * path: '/api/users',
2123
- * body: {
2124
- * name: 'john'
2125
- * }
2126
- * },
2127
- * response: {
2128
- * status: 200
2129
- * }
2130
- * });
2131
- * ```
2132
- *
2133
- * - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
2134
- * - POST to `/api/users` without the `name` property in the body will return a 404 status code.
2135
- *
2136
- * Happy testing with MockServer in CodeceptJS! 🚀
2137
- *
2138
- * ## Methods
2139
- */
2140
- // @ts-ignore
2141
- // @ts-ignore
2142
- // @ts-ignore
2143
- // @ts-ignore
2144
- // @ts-ignore
2145
- // @ts-ignore
2146
- // @ts-ignore
2147
- // @ts-ignore
2148
- class MockServer {
2149
- /**
2150
- * Start the mock server
2151
- * @param [port] - start the mock server with given port
2152
- * @returns void
2153
- */
2154
- startMockServer(port?: number): any;
2155
- /**
2156
- * Stop the mock server
2157
- * @returns void
2158
- */
2159
- stopMockServer(): any;
2160
- /**
2161
- * An interaction adds behavior to the mock server
2162
- *
2163
- *
2164
- * ```js
2165
- * I.addInteractionToMockServer({
2166
- * request: {
2167
- * method: 'GET',
2168
- * path: '/api/hello'
2169
- * },
2170
- * response: {
2171
- * status: 200,
2172
- * body: {
2173
- * 'say': 'hello to mock server'
2174
- * }
2175
- * }
2176
- * });
2177
- * ```
2178
- * ```js
2179
- * // with query params
2180
- * I.addInteractionToMockServer({
2181
- * request: {
2182
- * method: 'GET',
2183
- * path: '/api/hello',
2184
- * queryParams: {
2185
- * id: 2
2186
- * }
2187
- * },
2188
- * response: {
2189
- * status: 200,
2190
- * body: {
2191
- * 'say': 'hello to mock server'
2192
- * }
2193
- * }
2194
- * });
2195
- * ```
2196
- * @param interaction - add behavior to the mock server
2197
- * @returns void
2198
- */
2199
- addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
2200
- }
2201
1781
  /**
2202
1782
  * Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
2203
1783
  * fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
@@ -2985,7 +2565,7 @@ declare namespace CodeceptJS {
2985
2565
  *
2986
2566
  * ```js
2987
2567
  * I.clearCookie();
2988
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
2568
+ * I.clearCookie('test');
2989
2569
  * ```
2990
2570
  * @param [cookie = null] - (optional, `null` by default) cookie name
2991
2571
  */
@@ -3200,46 +2780,6 @@ declare namespace CodeceptJS {
3200
2780
  */
3201
2781
  grabPageScrollPosition(): Promise<PageScrollPosition>;
3202
2782
  }
3203
- /**
3204
- * OpenAI Helper for CodeceptJS.
3205
- *
3206
- * 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.
3207
- * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3208
- *
3209
- * ## Configuration
3210
- *
3211
- * This helper should be configured in codecept.json or codecept.conf.js
3212
- *
3213
- * * `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.
3214
- */
3215
- class OpenAI {
3216
- /**
3217
- * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3218
- *
3219
- * ```js
3220
- * I.askGptOnPage('what does this page do?');
3221
- * ```
3222
- * @param prompt - The question or prompt to ask the GPT model.
3223
- * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3224
- */
3225
- askGptOnPage(prompt: string): Promise<string>;
3226
- /**
3227
- * 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.
3228
- *
3229
- * ```js
3230
- * I.askGptOnPageFragment('describe features of this screen', '.screen');
3231
- * ```
3232
- * @param prompt - The question or prompt to ask the GPT-3.5 model.
3233
- * @param locator - The locator or selector used to identify the HTML fragment on the page.
3234
- * @returns - A Promise that resolves to the generated response from the GPT model.
3235
- */
3236
- askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3237
- /**
3238
- * Send a general request to ChatGPT and return response.
3239
- * @returns - A Promise that resolves to the generated response from the GPT model.
3240
- */
3241
- askGptGeneralPrompt(prompt: string): Promise<string>;
3242
- }
3243
2783
  /**
3244
2784
  * ## Configuration
3245
2785
  *
@@ -3285,13 +2825,6 @@ declare namespace CodeceptJS {
3285
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).
3286
2826
  */
3287
2827
  // @ts-ignore
3288
- // @ts-ignore
3289
- // @ts-ignore
3290
- // @ts-ignore
3291
- // @ts-ignore
3292
- // @ts-ignore
3293
- // @ts-ignore
3294
- // @ts-ignore
3295
2828
  type PlaywrightConfig = {
3296
2829
  url?: string;
3297
2830
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4697,7 +4230,7 @@ declare namespace CodeceptJS {
4697
4230
  *
4698
4231
  * ```js
4699
4232
  * I.clearCookie();
4700
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
4233
+ * I.clearCookie('test');
4701
4234
  * ```
4702
4235
  * @param [cookie = null] - (optional, `null` by default) cookie name
4703
4236
  */
@@ -6370,7 +5903,7 @@ declare namespace CodeceptJS {
6370
5903
  *
6371
5904
  * ```js
6372
5905
  * I.clearCookie();
6373
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
5906
+ * I.clearCookie('test');
6374
5907
  * ```
6375
5908
  * @param [cookie = null] - (optional, `null` by default) cookie name
6376
5909
  */
@@ -6820,13 +6353,6 @@ declare namespace CodeceptJS {
6820
6353
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6821
6354
  */
6822
6355
  // @ts-ignore
6823
- // @ts-ignore
6824
- // @ts-ignore
6825
- // @ts-ignore
6826
- // @ts-ignore
6827
- // @ts-ignore
6828
- // @ts-ignore
6829
- // @ts-ignore
6830
6356
  type PuppeteerConfig = {
6831
6357
  url: string;
6832
6358
  basicAuth?: any;
@@ -8075,7 +7601,7 @@ declare namespace CodeceptJS {
8075
7601
  *
8076
7602
  * ```js
8077
7603
  * I.clearCookie();
8078
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
7604
+ * I.clearCookie('test');
8079
7605
  * ```
8080
7606
  * @param [cookie = null] - (optional, `null` by default) cookie name
8081
7607
  */
@@ -8770,13 +8296,6 @@ declare namespace CodeceptJS {
8770
8296
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8771
8297
  */
8772
8298
  // @ts-ignore
8773
- // @ts-ignore
8774
- // @ts-ignore
8775
- // @ts-ignore
8776
- // @ts-ignore
8777
- // @ts-ignore
8778
- // @ts-ignore
8779
- // @ts-ignore
8780
8299
  type RESTConfig = {
8781
8300
  endpoint?: string;
8782
8301
  prettyPrintJson?: boolean;
@@ -8957,289 +8476,56 @@ declare namespace CodeceptJS {
8957
8476
  * @returns response
8958
8477
  */
8959
8478
  sendDeleteRequest(url: any, headers?: any): Promise<any>;
8479
+ /**
8480
+ * Sends DELETE request to API with payload.
8481
+ *
8482
+ * ```js
8483
+ * I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
8484
+ * ```
8485
+ * @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
8486
+ * @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
8487
+ * @returns response
8488
+ */
8489
+ sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8960
8490
  }
8961
8491
  /**
8962
- * SoftAssertHelper is a utility class for performing soft assertions.
8963
- * Unlike traditional assertions that stop the execution on failure,
8964
- * soft assertions allow the execution to continue and report all failures at the end.
8492
+ * Client Functions
8493
+ */
8494
+ function getPageUrl(): void;
8495
+ /**
8496
+ * Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
8497
+ * The browser version you want to use in tests must be installed on your system.
8965
8498
  *
8966
- * ### Examples
8499
+ * Requires `testcafe` package to be installed.
8500
+ *
8501
+ * ```
8502
+ * npm i testcafe --save-dev
8503
+ * ```
8504
+ *
8505
+ * ## Configuration
8506
+ *
8507
+ * This helper should be configured in codecept.conf.ts or codecept.conf.js
8508
+ *
8509
+ * * `url`: base url of website to be tested
8510
+ * * `show`: (optional, default: false) - show browser window.
8511
+ * * `windowSize`: (optional) - set browser window width and height
8512
+ * * `getPageTimeout` (optional, default: '30000') config option to set maximum navigation time in milliseconds.
8513
+ * * `waitForTimeout`: (optional) default wait* timeout in ms. Default: 5000.
8514
+ * * `browser`: (optional, default: chrome) - See https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/browser-support.html
8967
8515
  *
8968
- * Zero-configuration when paired with other helpers like REST, Playwright:
8516
+ *
8517
+ * #### Example #1: Show chrome browser window
8969
8518
  *
8970
8519
  * ```js
8971
- * // inside codecept.conf.js
8972
8520
  * {
8973
- * helpers: {
8974
- * Playwright: {...},
8975
- * SoftExpectHelper: {},
8976
- * }
8977
- * }
8978
- * ```
8979
- *
8980
- * ```js
8981
- * // in scenario
8982
- * I.softExpectEqual('a', 'b')
8983
- * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8984
- * ```
8985
- *
8986
- * ## Methods
8987
- */
8988
- class SoftAssertHelper {
8989
- /**
8990
- * Performs a soft assertion by executing the provided assertion function.
8991
- * If the assertion fails, the error is caught and stored without halting the execution.
8992
- * @param assertionFn - The assertion function to execute.
8993
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8994
- */
8995
- softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
8996
- /**
8997
- * Throws an error if any soft assertions have failed.
8998
- * The error message contains all the accumulated failures.
8999
- */
9000
- flushSoftAssertions(): void;
9001
- /**
9002
- * Softly asserts that two values are equal.
9003
- * @param actualValue - The actual value.
9004
- * @param expectedValue - The expected value.
9005
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9006
- */
9007
- softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9008
- /**
9009
- * Softly asserts that two values are not equal.
9010
- * @param actualValue - The actual value.
9011
- * @param expectedValue - The expected value.
9012
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9013
- */
9014
- softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9015
- /**
9016
- * Softly asserts that two values are deeply equal.
9017
- * @param actualValue - The actual value.
9018
- * @param expectedValue - The expected value.
9019
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9020
- */
9021
- softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9022
- /**
9023
- * Softly asserts that two values are not deeply equal.
9024
- * @param actualValue - The actual value.
9025
- * @param expectedValue - The expected value.
9026
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9027
- */
9028
- softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9029
- /**
9030
- * Softly asserts that a value contains the expected value.
9031
- * @param actualValue - The actual value.
9032
- * @param expectedValueToContain - The value that should be contained within the actual value.
9033
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9034
- */
9035
- softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9036
- /**
9037
- * Softly asserts that a value does not contain the expected value.
9038
- * @param actualValue - The actual value.
9039
- * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9040
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9041
- */
9042
- softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9043
- /**
9044
- * Softly asserts that a value starts with the expected value.
9045
- * @param actualValue - The actual value.
9046
- * @param expectedValueToStartWith - The value that the actual value should start with.
9047
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9048
- */
9049
- softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9050
- /**
9051
- * Softly asserts that a value does not start with the expected value.
9052
- * @param actualValue - The actual value.
9053
- * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9054
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9055
- */
9056
- softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9057
- /**
9058
- * Softly asserts that a value ends with the expected value.
9059
- * @param actualValue - The actual value.
9060
- * @param expectedValueToEndWith - The value that the actual value should end with.
9061
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9062
- */
9063
- softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9064
- /**
9065
- * Softly asserts that a value does not end with the expected value.
9066
- * @param actualValue - The actual value.
9067
- * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9068
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9069
- */
9070
- softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9071
- /**
9072
- * Softly asserts that the target data matches the given JSON schema.
9073
- * @param targetData - The data to validate.
9074
- * @param jsonSchema - The JSON schema to validate against.
9075
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9076
- */
9077
- softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9078
- /**
9079
- * Softly asserts that the target data matches the given JSON schema using AJV.
9080
- * @param targetData - The data to validate.
9081
- * @param jsonSchema - The JSON schema to validate against.
9082
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9083
- * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9084
- */
9085
- softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9086
- /**
9087
- * Softly asserts that the target data has the specified property.
9088
- * @param targetData - The data to check.
9089
- * @param propertyName - The property name to check for.
9090
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9091
- * fails.
9092
- */
9093
- softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9094
- /**
9095
- * Softly asserts that the target data has a property with the specified name.
9096
- * @param targetData - The data to check.
9097
- * @param propertyName - The property name to check for.
9098
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9099
- */
9100
- softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9101
- /**
9102
- * Softly asserts that the target data is of a specific type.
9103
- * @param targetData - The data to check.
9104
- * @param type - The expected type (e.g., 'string', 'number').
9105
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9106
- */
9107
- softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9108
- /**
9109
- * Softly asserts that the target data is of a specific type (alternative for articles).
9110
- * @param targetData - The data to check.
9111
- * @param type - The expected type (e.g., 'string', 'number').
9112
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9113
- */
9114
- softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9115
- /**
9116
- * Softly asserts that the target data has a specified length.
9117
- * @param targetData - The data to check.
9118
- * @param length - The expected length.
9119
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9120
- */
9121
- softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9122
- /**
9123
- * Softly asserts that the target data is empty.
9124
- * @param targetData - The data to check.
9125
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9126
- */
9127
- softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9128
- /**
9129
- * Softly asserts that the target data is true.
9130
- * @param targetData - The data to check.
9131
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9132
- */
9133
- softExpectTrue(targetData: any, customErrorMsg?: string): void;
9134
- /**
9135
- * Softly asserts that the target data is false.
9136
- * @param targetData - The data to check.
9137
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9138
- */
9139
- softExpectFalse(targetData: any, customErrorMsg?: string): void;
9140
- /**
9141
- * Softly asserts that the target data is above a specified value.
9142
- * @param targetData - The data to check.
9143
- * @param aboveThan - The value that the target data should be above.
9144
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9145
- */
9146
- softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9147
- /**
9148
- * Softly asserts that the target data is below a specified value.
9149
- * @param targetData - The data to check.
9150
- * @param belowThan - The value that the target data should be below.
9151
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9152
- */
9153
- softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9154
- /**
9155
- * Softly asserts that the length of the target data is above a specified value.
9156
- * @param targetData - The data to check.
9157
- * @param lengthAboveThan - The length that the target data should be above.
9158
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9159
- */
9160
- softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9161
- /**
9162
- * Softly asserts that the length of the target data is below a specified value.
9163
- * @param targetData - The data to check.
9164
- * @param lengthBelowThan - The length that the target data should be below.
9165
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9166
- */
9167
- softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9168
- /**
9169
- * Softly asserts that two values are equal, ignoring case.
9170
- * @param actualValue - The actual string value.
9171
- * @param expectedValue - The expected string value.
9172
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9173
- */
9174
- softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9175
- /**
9176
- * Softly asserts that two arrays have deep equality, considering members in any order.
9177
- * @param actualValue - The actual array.
9178
- * @param expectedValue - The expected array.
9179
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9180
- */
9181
- softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9182
- /**
9183
- * Softly asserts that an array (superset) deeply includes all members of another array (set).
9184
- * @param superset - The array that should contain the expected members.
9185
- * @param set - The array with members that should be included.
9186
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9187
- */
9188
- softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9189
- /**
9190
- * Softly asserts that two objects are deeply equal, excluding specified fields.
9191
- * @param actualValue - The actual object.
9192
- * @param expectedValue - The expected object.
9193
- * @param fieldsToExclude - The fields to exclude from the comparison.
9194
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9195
- */
9196
- softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9197
- /**
9198
- * Softly asserts that a value matches the expected pattern.
9199
- * @param actualValue - The actual value.
9200
- * @param expectedPattern - The pattern the value should match.
9201
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9202
- */
9203
- softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9204
- }
9205
- /**
9206
- * Client Functions
9207
- */
9208
- function getPageUrl(): void;
9209
- /**
9210
- * Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
9211
- * The browser version you want to use in tests must be installed on your system.
9212
- *
9213
- * Requires `testcafe` package to be installed.
9214
- *
9215
- * ```
9216
- * npm i testcafe --save-dev
9217
- * ```
9218
- *
9219
- * ## Configuration
9220
- *
9221
- * This helper should be configured in codecept.conf.ts or codecept.conf.js
9222
- *
9223
- * * `url`: base url of website to be tested
9224
- * * `show`: (optional, default: false) - show browser window.
9225
- * * `windowSize`: (optional) - set browser window width and height
9226
- * * `getPageTimeout` (optional, default: '30000') config option to set maximum navigation time in milliseconds.
9227
- * * `waitForTimeout`: (optional) default wait* timeout in ms. Default: 5000.
9228
- * * `browser`: (optional, default: chrome) - See https://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browsers/browser-support.html
9229
- *
9230
- *
9231
- * #### Example #1: Show chrome browser window
9232
- *
9233
- * ```js
9234
- * {
9235
- * helpers: {
9236
- * TestCafe : {
9237
- * url: "http://localhost",
9238
- * waitForTimeout: 15000,
9239
- * show: true,
9240
- * browser: "chrome"
9241
- * }
9242
- * }
8521
+ * helpers: {
8522
+ * TestCafe : {
8523
+ * url: "http://localhost",
8524
+ * waitForTimeout: 15000,
8525
+ * show: true,
8526
+ * browser: "chrome"
8527
+ * }
8528
+ * }
9243
8529
  * }
9244
8530
  * ```
9245
8531
  *
@@ -10076,7 +9362,7 @@ declare namespace CodeceptJS {
10076
9362
  *
10077
9363
  * ```js
10078
9364
  * I.clearCookie();
10079
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
9365
+ * I.clearCookie('test');
10080
9366
  * ```
10081
9367
  * @param [cookie = null] - (optional, `null` by default) cookie name
10082
9368
  */
@@ -10194,6 +9480,7 @@ declare namespace CodeceptJS {
10194
9480
  * This helper should be configured in codecept.conf.js
10195
9481
  * @property url - base url of website to be tested.
10196
9482
  * @property browser - Browser in which to perform testing.
9483
+ * @property [bidiProtocol = false] - WebDriver Bidi Protocol. Default: false. More info: https://webdriver.io/docs/api/webdriverBidi/
10197
9484
  * @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
10198
9485
  * @property [host = localhost] - WebDriver host to connect.
10199
9486
  * @property [port = 4444] - WebDriver port to connect.
@@ -10213,19 +9500,12 @@ declare namespace CodeceptJS {
10213
9500
  * @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
10214
9501
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
10215
9502
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
10216
- * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10217
9503
  */
10218
9504
  // @ts-ignore
10219
- // @ts-ignore
10220
- // @ts-ignore
10221
- // @ts-ignore
10222
- // @ts-ignore
10223
- // @ts-ignore
10224
- // @ts-ignore
10225
- // @ts-ignore
10226
9505
  type WebDriverConfig = {
10227
9506
  url: string;
10228
9507
  browser: string;
9508
+ bidiProtocol?: boolean;
10229
9509
  basicAuth?: string;
10230
9510
  host?: string;
10231
9511
  port?: number;
@@ -10245,7 +9525,6 @@ declare namespace CodeceptJS {
10245
9525
  timeouts?: any;
10246
9526
  highlightElement?: boolean;
10247
9527
  logLevel?: string;
10248
- devtoolsProtocol?: boolean;
10249
9528
  };
10250
9529
  /**
10251
9530
  * WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
@@ -10351,7 +9630,6 @@ declare namespace CodeceptJS {
10351
9630
  * WebDriver : {
10352
9631
  * url: "http://localhost",
10353
9632
  * browser: "chrome",
10354
- * devtoolsProtocol: true,
10355
9633
  * desiredCapabilities: {
10356
9634
  * chromeOptions: {
10357
9635
  * args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
@@ -11572,7 +10850,7 @@ declare namespace CodeceptJS {
11572
10850
  *
11573
10851
  * ```js
11574
10852
  * I.clearCookie();
11575
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
10853
+ * I.clearCookie('test');
11576
10854
  * ```
11577
10855
  * @param [cookie = null] - (optional, `null` by default) cookie name
11578
10856
  */
@@ -12155,34 +11433,6 @@ declare namespace CodeceptJS {
12155
11433
  * @returns scroll position
12156
11434
  */
12157
11435
  grabPageScrollPosition(): Promise<PageScrollPosition>;
12158
- /**
12159
- * This method is **deprecated**.
12160
- *
12161
- *
12162
- * Set the current geo location
12163
- *
12164
- *
12165
- * ```js
12166
- * I.setGeoLocation(121.21, 11.56);
12167
- * I.setGeoLocation(121.21, 11.56, 10);
12168
- * ```
12169
- * @param latitude - to set.
12170
- * @param longitude - to set
12171
- * @param [altitude] - (optional, null by default) to set
12172
- * @returns automatically synchronized promise through #recorder
12173
- */
12174
- setGeoLocation(latitude: number, longitude: number, altitude?: number): void;
12175
- /**
12176
- * This method is **deprecated**.
12177
- *
12178
- * Return the current geo location
12179
- * Resumes test execution, so **should be used inside async function with `await`** operator.
12180
- *
12181
- * ```js
12182
- * let geoLocation = await I.grabGeoLocation();
12183
- * ```
12184
- */
12185
- grabGeoLocation(): Promise<{ latitude: number; longitude: number; altitude: number; }>;
12186
11436
  /**
12187
11437
  * Grab the width, height, location of given locator.
12188
11438
  * Provide `width` or `height`as second param to get your desired prop.
@@ -12209,123 +11459,15 @@ declare namespace CodeceptJS {
12209
11459
  /**
12210
11460
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12211
11461
  */
12212
- runOnAndroid(caps: any, fn: any): void;
11462
+ runOnIOS(caps: any, fn: any): void;
12213
11463
  /**
12214
11464
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12215
11465
  */
12216
- runInWeb(): void;
12217
- /**
12218
- * _Note:_ Only works when devtoolsProtocol is enabled.
12219
- *
12220
- * Resets all recorded network requests.
12221
- *
12222
- * ```js
12223
- * I.flushNetworkTraffics();
12224
- * ```
12225
- */
12226
- flushNetworkTraffics(): void;
12227
- /**
12228
- * _Note:_ Only works when devtoolsProtocol is enabled.
12229
- *
12230
- * Stops recording of network traffic. Recorded traffic is not flashed.
12231
- *
12232
- * ```js
12233
- * I.stopRecordingTraffic();
12234
- * ```
12235
- */
12236
- stopRecordingTraffic(): void;
12237
- /**
12238
- * _Note:_ Only works when devtoolsProtocol is enabled.
12239
- *
12240
- * Starts recording the network traffics.
12241
- * This also resets recorded network requests.
12242
- *
12243
- * ```js
12244
- * I.startRecordingTraffic();
12245
- * ```
12246
- * @returns automatically synchronized promise through #recorder
12247
- */
12248
- startRecordingTraffic(): void;
12249
- /**
12250
- * _Note:_ Only works when devtoolsProtocol is enabled.
12251
- *
12252
- * Grab the recording network traffics
12253
- *
12254
- * ```js
12255
- * const traffics = await I.grabRecordedNetworkTraffics();
12256
- * expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
12257
- * expect(traffics[0].response.status).to.equal(200);
12258
- * expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
12259
- * ```
12260
- * @returns recorded network traffics
12261
- */
12262
- grabRecordedNetworkTraffics(): any[];
12263
- /**
12264
- * _Note:_ Only works when devtoolsProtocol is enabled.
12265
- *
12266
- * Verifies that a certain request is part of network traffic.
12267
- *
12268
- * ```js
12269
- * // checking the request url contains certain query strings
12270
- * I.amOnPage('https://openai.com/blog/chatgpt');
12271
- * I.startRecordingTraffic();
12272
- * await I.seeTraffic({
12273
- * name: 'sentry event',
12274
- * url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
12275
- * parameters: {
12276
- * width: '1919',
12277
- * height: '1138',
12278
- * },
12279
- * });
12280
- * ```
12281
- *
12282
- * ```js
12283
- * // checking the request url contains certain post data
12284
- * I.amOnPage('https://openai.com/blog/chatgpt');
12285
- * I.startRecordingTraffic();
12286
- * await I.seeTraffic({
12287
- * name: 'event',
12288
- * url: 'https://cloudflareinsights.com/cdn-cgi/rum',
12289
- * requestPostData: {
12290
- * st: 2,
12291
- * },
12292
- * });
12293
- * ```
12294
- * @param opts - options when checking the traffic network.
12295
- * @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.
12296
- * @param opts.url - Expected URL of request in network traffic
12297
- * @param [opts.parameters] - Expected parameters of that request in network traffic
12298
- * @param [opts.requestPostData] - Expected that request contains post data in network traffic
12299
- * @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
12300
- * @returns automatically synchronized promise through #recorder
12301
- */
12302
- seeTraffic(opts: {
12303
- name: string;
12304
- url: string;
12305
- parameters?: any;
12306
- requestPostData?: any;
12307
- timeout?: number;
12308
- }): void;
11466
+ runOnAndroid(caps: any, fn: any): void;
12309
11467
  /**
12310
- * _Note:_ Only works when devtoolsProtocol is enabled.
12311
- *
12312
- * Verifies that a certain request is not part of network traffic.
12313
- *
12314
- * Examples:
12315
- *
12316
- * ```js
12317
- * I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
12318
- * I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
12319
- * ```
12320
- * @param opts - options when checking the traffic network.
12321
- * @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.
12322
- * @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
12323
- * @returns automatically synchronized promise through #recorder
11468
+ * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
12324
11469
  */
12325
- dontSeeTraffic(opts: {
12326
- name: string;
12327
- url: string | RegExp;
12328
- }): void;
11470
+ runInWeb(): void;
12329
11471
  }
12330
11472
  interface ActorStatic {
12331
11473
  /**
@@ -12419,10 +11561,33 @@ declare namespace CodeceptJS {
12419
11561
  [key: string]: any;
12420
11562
  };
12421
11563
  }
11564
+ /**
11565
+ * Result of the test run
11566
+ */
11567
+ type Stats = {
11568
+ passes: number;
11569
+ failures: number;
11570
+ tests: number;
11571
+ pending: number;
11572
+ failedHooks: number;
11573
+ start: Date;
11574
+ end: Date;
11575
+ duration: number;
11576
+ };
11577
+ /**
11578
+ * Create Result of the test run
11579
+ */
11580
+ class Result {
11581
+ constructor();
11582
+ }
12422
11583
  /**
12423
11584
  * Dependency Injection Container
12424
11585
  */
12425
11586
  class Container {
11587
+ /**
11588
+ * Get the standard acting helpers of CodeceptJS Container
11589
+ */
11590
+ static STANDARD_ACTING_HELPERS: any;
12426
11591
  /**
12427
11592
  * Create container with all required helpers and support objects
12428
11593
  */
@@ -12447,6 +11612,10 @@ declare namespace CodeceptJS {
12447
11612
  * Get Mocha instance
12448
11613
  */
12449
11614
  static mocha(): any;
11615
+ /**
11616
+ * Get result
11617
+ */
11618
+ static result(): Result;
12450
11619
  /**
12451
11620
  * Append new services to container
12452
11621
  */
@@ -12463,6 +11632,7 @@ declare namespace CodeceptJS {
12463
11632
  }, newPlugins: {
12464
11633
  [key: string]: any;
12465
11634
  }): void;
11635
+ static started(fn: ((...params: any[]) => any) | null): Promise<void>;
12466
11636
  /**
12467
11637
  * Share data across worker threads
12468
11638
  * @param options - set {local: true} to not share among workers
@@ -12472,7 +11642,7 @@ declare namespace CodeceptJS {
12472
11642
  /**
12473
11643
  * Method collect own property and prototype
12474
11644
  */
12475
- function getObjectMethods(): void;
11645
+ function loadTranslation(): void;
12476
11646
  /**
12477
11647
  * Datatable class to provide data driven testing
12478
11648
  */
@@ -12510,6 +11680,63 @@ declare namespace CodeceptJS {
12510
11680
  */
12511
11681
  transpose(): void;
12512
11682
  }
11683
+ /**
11684
+ * - Designed for use in CodeceptJS tests as a "soft assertion."
11685
+ * Unlike standard assertions, it does not stop the test execution on failure.
11686
+ * - Starts a new recorder session named 'hopeThat' and manages state restoration.
11687
+ * - Logs errors and attaches them as notes to the test, enabling post-test reporting of soft assertion failures.
11688
+ * - Resets the `store.hopeThat` flag after the execution, ensuring clean state for subsequent operations.
11689
+ * @example
11690
+ * const { hopeThat } = require('codeceptjs/effects')
11691
+ * await hopeThat(() => {
11692
+ * I.see('Welcome'); // Perform a soft assertion
11693
+ * });
11694
+ * @param callback - The callback function containing the logic to validate.
11695
+ * This function should perform the desired assertion or condition check.
11696
+ * @returns A promise resolving to `true` if the assertion or condition was successful,
11697
+ * or `false` if an error occurred.
11698
+ */
11699
+ function hopeThat(callback: (...params: any[]) => any): Promise<boolean | any>;
11700
+ /**
11701
+ * - This function is designed for use in CodeceptJS tests to handle intermittent or flaky test steps.
11702
+ * - Starts a new recorder session for each retry attempt, ensuring proper state management and error handling.
11703
+ * - Logs errors and retries the callback until it either succeeds or the maximum number of attempts is reached.
11704
+ * - Restores the session state after each attempt, whether successful or not.
11705
+ * @example
11706
+ * const { hopeThat } = require('codeceptjs/effects')
11707
+ * await retryTo((tries) => {
11708
+ * if (tries < 3) {
11709
+ * I.see('Non-existent element'); // Simulates a failure
11710
+ * } else {
11711
+ * I.see('Welcome'); // Succeeds on the 3rd attempt
11712
+ * }
11713
+ * }, 5, 300); // Retry up to 5 times, with a 300ms interval
11714
+ * @param callback - The function to execute, which will be retried upon failure.
11715
+ * Receives the current retry count as an argument.
11716
+ * @param maxTries - The maximum number of attempts to retry the callback.
11717
+ * @param [pollInterval = 200] - The delay (in milliseconds) between retry attempts.
11718
+ * @returns A promise that resolves when the callback executes successfully, or rejects after reaching the maximum retries.
11719
+ */
11720
+ function retryTo(callback: (...params: any[]) => any, maxTries: number, pollInterval?: number): Promise<void | any>;
11721
+ /**
11722
+ * - Useful for scenarios where certain steps are optional or their failure should not interrupt the test flow.
11723
+ * - Starts a new recorder session named 'tryTo' for isolation and error handling.
11724
+ * - Captures errors during execution and logs them for debugging purposes.
11725
+ * - Ensures the `store.tryTo` flag is reset after execution to maintain a clean state.
11726
+ * @example
11727
+ * const { tryTo } = require('codeceptjs/effects')
11728
+ * const wasSuccessful = await tryTo(() => {
11729
+ * I.see('Welcome'); // Attempt to find an element on the page
11730
+ * });
11731
+ *
11732
+ * if (!wasSuccessful) {
11733
+ * I.say('Optional step failed, but test continues.');
11734
+ * }
11735
+ * @param callback - The function to execute, which may succeed or fail.
11736
+ * This function contains the logic to be attempted.
11737
+ * @returns A promise resolving to `true` if the step succeeds, or `false` if it fails.
11738
+ */
11739
+ function tryTo(callback: (...params: any[]) => any): Promise<boolean | any>;
12513
11740
  namespace event {
12514
11741
  const dispatcher: NodeJS.EventEmitter;
12515
11742
  const test: {
@@ -12528,6 +11755,8 @@ declare namespace CodeceptJS {
12528
11755
  const hook: {
12529
11756
  started: 'hook.start';
12530
11757
  passed: 'hook.passed';
11758
+ failed: 'hook.failed';
11759
+ finished: 'hook.finished';
12531
11760
  };
12532
11761
  const step: {
12533
11762
  started: 'step.start';
@@ -12586,76 +11815,6 @@ declare namespace CodeceptJS {
12586
11815
  var store: typeof CodeceptJS.store;
12587
11816
  var locator: typeof CodeceptJS.Locator;
12588
11817
  }
12589
- function addStep(step: any, fn: any): void;
12590
- class FeatureConfig {
12591
- /**
12592
- * Retry this suite for x times
12593
- */
12594
- retry(retries: number): this;
12595
- /**
12596
- * Set timeout for this suite
12597
- */
12598
- timeout(timeout: number): this;
12599
- /**
12600
- * Configures a helper.
12601
- * Helper name can be omitted and values will be applied to first helper.
12602
- */
12603
- config(helper: string | {
12604
- [key: string]: any;
12605
- }, obj?: {
12606
- [key: string]: any;
12607
- }): this;
12608
- /**
12609
- * Append a tag name to scenario title
12610
- */
12611
- tag(tagName: string): this;
12612
- }
12613
- class ScenarioConfig {
12614
- /**
12615
- * Declares that test throws error.
12616
- * Can pass an Error object or regex matching expected message.
12617
- */
12618
- throws(err: any): this;
12619
- /**
12620
- * Declares that test should fail.
12621
- * If test passes - throws an error.
12622
- * Can pass an Error object or regex matching expected message.
12623
- */
12624
- fails(): this;
12625
- /**
12626
- * Retry this test for x times
12627
- */
12628
- retry(retries: number): this;
12629
- /**
12630
- * Set timeout for this test
12631
- */
12632
- timeout(timeout: number): this;
12633
- /**
12634
- * Pass in additional objects to inject into test
12635
- */
12636
- inject(obj: {
12637
- [key: string]: any;
12638
- }): this;
12639
- /**
12640
- * Configures a helper.
12641
- * Helper name can be omitted and values will be applied to first helper.
12642
- */
12643
- config(helper: string | {
12644
- [key: string]: any;
12645
- }, obj?: {
12646
- [key: string]: any;
12647
- }): this;
12648
- /**
12649
- * Append a tag name to scenario title
12650
- */
12651
- tag(tagName: string): this;
12652
- /**
12653
- * Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
12654
- */
12655
- injectDependencies(dependencies: {
12656
- [key: string]: any;
12657
- }): this;
12658
- }
12659
11818
  class Locator {
12660
11819
  constructor(locator: CodeceptJS.LocatorOrString, defaultType?: string);
12661
11820
  toString(): string;
@@ -12718,7 +11877,7 @@ declare namespace CodeceptJS {
12718
11877
  inside(locator: CodeceptJS.LocatorOrString): Locator;
12719
11878
  after(locator: CodeceptJS.LocatorOrString): Locator;
12720
11879
  before(locator: CodeceptJS.LocatorOrString): Locator;
12721
- static build(locator: CodeceptJS.LocatorOrString): Locator;
11880
+ static build(locator?: CodeceptJS.LocatorOrString): Locator;
12722
11881
  /**
12723
11882
  * Filters to modify locators
12724
11883
  */
@@ -12773,6 +11932,7 @@ declare namespace CodeceptJS {
12773
11932
  function skipped(test: Mocha.Test): void;
12774
11933
  }
12775
11934
  namespace scenario {
11935
+ function started(test: Mocha.Test): void;
12776
11936
  function passed(test: Mocha.Test): void;
12777
11937
  function failed(test: Mocha.Test): void;
12778
11938
  }
@@ -12864,24 +12024,50 @@ declare namespace CodeceptJS {
12864
12024
  function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
12865
12025
  [key: string]: any;
12866
12026
  }, fn?: (...params: any[]) => any): any;
12027
+ /**
12028
+ * StepConfig is a configuration object for a step.
12029
+ * It is used to create a new step that is a combination of other steps.
12030
+ */
12031
+ class StepConfig {
12032
+ config: any;
12033
+ /**
12034
+ * Set the options for the step.
12035
+ * @param opts - The options for the step.
12036
+ * @returns - The step configuration object.
12037
+ */
12038
+ opts(opts: any): StepConfig;
12039
+ /**
12040
+ * Set the timeout for the step.
12041
+ * @param timeout - The timeout for the step.
12042
+ * @returns - The step configuration object.
12043
+ */
12044
+ timeout(timeout: number): StepConfig;
12045
+ /**
12046
+ * Set the retry for the step.
12047
+ * @param retry - The retry for the step.
12048
+ * @returns - The step configuration object.
12049
+ */
12050
+ retry(retry: number): StepConfig;
12051
+ }
12867
12052
  /**
12868
12053
  * Each command in test executed through `I.` object is wrapped in Step.
12869
12054
  * Step allows logging executed commands and triggers hook before and after step execution.
12870
12055
  */
12871
12056
  class Step {
12872
- constructor(helper: CodeceptJS.Helper, name: string);
12873
- actor: string;
12874
- helper: CodeceptJS.Helper;
12057
+ constructor(name: string);
12875
12058
  name: string;
12876
- helperMethod: string;
12059
+ timeouts: Map<number, number>;
12060
+ args: any[];
12061
+ opts: Record<string, any>;
12062
+ actor: string;
12877
12063
  status: string;
12878
- suffix: string;
12879
12064
  prefix: string;
12880
12065
  comment: string;
12881
- args: any[];
12882
- metaStep: MetaStep;
12066
+ metaStep: any;
12883
12067
  stack: string;
12884
- getTimeout(): number | undefined;
12068
+ helper: any;
12069
+ helperMethod: string;
12070
+ timeout: any;
12885
12071
  /**
12886
12072
  * @param timeout - timeout in milliseconds or 0 if no timeout
12887
12073
  * @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
@@ -12890,27 +12076,43 @@ declare namespace CodeceptJS {
12890
12076
  setTimeout(timeout: number, order: number): void;
12891
12077
  setTrace(): void;
12892
12078
  setArguments(args: any[]): void;
12893
- run(...args: any[]): any;
12894
12079
  setStatus(status: string): void;
12895
12080
  humanize(): string;
12896
12081
  humanizeArgs(): string;
12897
12082
  line(): string;
12898
12083
  toString(): string;
12084
+ toCliStyled(): string;
12899
12085
  toCode(): string;
12900
12086
  hasBDDAncestor(): boolean;
12901
- static MetaStep: typeof MetaStep;
12902
- }
12903
- class MetaStep extends Step {
12904
- isBDD(): boolean;
12905
- run(): any;
12906
12087
  }
12907
12088
  /**
12908
12089
  * global values for current session
12909
12090
  */
12910
12091
  namespace store {
12092
+ /**
12093
+ * If we are in --debug mode
12094
+ */
12911
12095
  var debugMode: boolean;
12096
+ /**
12097
+ * Is timeouts enabled
12098
+ */
12912
12099
  var timeouts: boolean;
12100
+ /**
12101
+ * If auto-retries are enabled by retryFailedStep plugin
12102
+ * tryTo effect disables them
12103
+ */
12104
+ var autoRetries: boolean;
12105
+ /**
12106
+ * Tests are executed via dry-run
12107
+ */
12913
12108
  var dryRun: boolean;
12109
+ /**
12110
+ * If we are in pause mode
12111
+ */
12112
+ var onPause: boolean;
12113
+ var currentTest: CodeceptJS.Test | null;
12114
+ var currentStep: CodeceptJS.Step | null;
12115
+ var currentSuite: CodeceptJS.Suite | null;
12914
12116
  }
12915
12117
  /**
12916
12118
  * Describe a "suite" with the given `title`
@@ -12932,6 +12134,139 @@ declare namespace CodeceptJS {
12932
12134
  * Pending test case with message: 'Test not implemented!'.
12933
12135
  */
12934
12136
  const todo: CodeceptJS.IScenario;
12137
+ /**
12138
+ * Configuration for a Feature.
12139
+ * Can inject values and add custom configuration.
12140
+ */
12141
+ class FeatureConfig {
12142
+ constructor(suite: CodeceptJS.Suite);
12143
+ /**
12144
+ * Set metadata for this suite
12145
+ */
12146
+ meta(key: string, value: string): this;
12147
+ /**
12148
+ * Retry this test for number of times
12149
+ */
12150
+ retry(retries: number): this;
12151
+ /**
12152
+ * Set timeout for this test
12153
+ */
12154
+ timeout(timeout: number): this;
12155
+ /**
12156
+ * Configures a helper.
12157
+ * Helper name can be omitted and values will be applied to first helper.
12158
+ */
12159
+ config(helper: string | {
12160
+ [key: string]: any;
12161
+ } | FeatureConfigCallback, obj?: {
12162
+ [key: string]: any;
12163
+ }): this;
12164
+ /**
12165
+ * Append a tag name to scenario title
12166
+ */
12167
+ tag(tagName: string): this;
12168
+ }
12169
+ type FeatureConfigCallback = (suite: CodeceptJS.Suite) => {
12170
+ [key: string]: any;
12171
+ };
12172
+ class ScenarioConfig {
12173
+ constructor(test: CodeceptJS.Test);
12174
+ /**
12175
+ * Declares that test throws error.
12176
+ * Can pass an Error object or regex matching expected message.
12177
+ */
12178
+ throws(err: any): this;
12179
+ /**
12180
+ * Declares that test should fail.
12181
+ * If test passes - throws an error.
12182
+ * Can pass an Error object or regex matching expected message.
12183
+ */
12184
+ fails(): this;
12185
+ /**
12186
+ * Retry this test for x times
12187
+ */
12188
+ retry(retries: number): this;
12189
+ /**
12190
+ * Set metadata for this test
12191
+ */
12192
+ meta(key: string, value: string): this;
12193
+ /**
12194
+ * Set timeout for this test
12195
+ */
12196
+ timeout(timeout: number): this;
12197
+ /**
12198
+ * Pass in additional objects to inject into test
12199
+ */
12200
+ inject(obj: {
12201
+ [key: string]: any;
12202
+ }): this;
12203
+ /**
12204
+ * Configures a helper.
12205
+ * Helper name can be omitted and values will be applied to first helper.
12206
+ */
12207
+ config(helper: string | {
12208
+ [key: string]: any;
12209
+ } | ScenarioConfigCallback, obj?: {
12210
+ [key: string]: any;
12211
+ }): this;
12212
+ /**
12213
+ * Append a tag name to scenario title
12214
+ */
12215
+ tag(tagName: string): this;
12216
+ /**
12217
+ * Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
12218
+ */
12219
+ injectDependencies(dependencies: {
12220
+ [key: string]: any;
12221
+ }): this;
12222
+ }
12223
+ type ScenarioConfigCallback = (test: CodeceptJS.Test) => {
12224
+ [key: string]: any;
12225
+ };
12226
+ function addStep(step: any, fn: any): void;
12227
+ /**
12228
+ * Creates a new Hook instance
12229
+ * @property suite - The test suite this hook belongs to
12230
+ * @property test - The test object associated with this hook
12231
+ * @property runnable - The current test being executed
12232
+ * @property ctx - The context object
12233
+ * @property err - The error that occurred during hook execution, if any
12234
+ * @param context - The context object containing suite and test information
12235
+ * @param context.suite - The test suite
12236
+ * @param context.test - The test object
12237
+ * @param context.ctx - The context object
12238
+ * @param error - The error object if hook execution failed
12239
+ */
12240
+ class Hook {
12241
+ constructor(context: {
12242
+ suite: any;
12243
+ test: any;
12244
+ ctx: any;
12245
+ }, error: Error);
12246
+ /**
12247
+ * The test suite this hook belongs to
12248
+ */
12249
+ suite: any;
12250
+ /**
12251
+ * The test object associated with this hook
12252
+ */
12253
+ test: any;
12254
+ /**
12255
+ * The current test being executed
12256
+ */
12257
+ runnable: any;
12258
+ /**
12259
+ * The context object
12260
+ */
12261
+ ctx: any;
12262
+ /**
12263
+ * The error that occurred during hook execution, if any
12264
+ */
12265
+ err: Error | null;
12266
+ }
12267
+ /**
12268
+ * TODO: move to effects
12269
+ */
12935
12270
  function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
12936
12271
  /**
12937
12272
  * This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
@@ -13533,22 +12868,17 @@ declare namespace CodeceptJS {
13533
12868
  }
13534
12869
 
13535
12870
  /**
13536
- * timeouts set with order below zero only override timeouts of higher order if their value is smaller
13537
- */
13538
- declare var testOrSuite: any;
13539
-
13540
- /**
13541
- * 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
12871
+ * corresponding helper
13542
12872
  */
13543
- declare var stepTimeoutHard: any;
12873
+ declare var helper: CodeceptJS.Helper;
13544
12874
 
13545
12875
  /**
13546
- * 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
12876
+ * name of method to be executed
13547
12877
  */
13548
- declare var codeLimitTime: any;
12878
+ declare var helperMethod: string;
13549
12879
 
13550
12880
  /**
13551
- * 20-29 - designated for timeout settings which could be overriden in tests code, 25 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=false
12881
+ * hide children steps from output
13552
12882
  */
13553
- declare var stepTimeoutSoft: any;
12883
+ declare var collsapsed: boolean;
13554
12884