codeceptjs 4.0.0-beta.4 → 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 (150) 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 +139 -87
  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/generate.js +10 -14
  17. package/lib/command/gherkin/snippets.js +75 -73
  18. package/lib/command/gherkin/steps.js +1 -1
  19. package/lib/command/info.js +42 -8
  20. package/lib/command/init.js +13 -12
  21. package/lib/command/interactive.js +10 -2
  22. package/lib/command/list.js +1 -1
  23. package/lib/command/run-multiple/chunk.js +48 -45
  24. package/lib/command/run-multiple.js +12 -35
  25. package/lib/command/run-workers.js +21 -58
  26. package/lib/command/utils.js +5 -6
  27. package/lib/command/workers/runTests.js +262 -220
  28. package/lib/container.js +386 -238
  29. package/lib/data/context.js +10 -13
  30. package/lib/data/dataScenarioConfig.js +8 -8
  31. package/lib/data/dataTableArgument.js +6 -6
  32. package/lib/data/table.js +5 -11
  33. package/lib/effects.js +223 -0
  34. package/lib/element/WebElement.js +327 -0
  35. package/lib/els.js +158 -0
  36. package/lib/event.js +21 -17
  37. package/lib/heal.js +88 -80
  38. package/lib/helper/AI.js +2 -1
  39. package/lib/helper/ApiDataFactory.js +3 -6
  40. package/lib/helper/Appium.js +47 -51
  41. package/lib/helper/FileSystem.js +3 -3
  42. package/lib/helper/GraphQLDataFactory.js +3 -3
  43. package/lib/helper/JSONResponse.js +75 -37
  44. package/lib/helper/Mochawesome.js +31 -9
  45. package/lib/helper/Nightmare.js +35 -53
  46. package/lib/helper/Playwright.js +262 -267
  47. package/lib/helper/Protractor.js +54 -77
  48. package/lib/helper/Puppeteer.js +246 -260
  49. package/lib/helper/REST.js +5 -17
  50. package/lib/helper/TestCafe.js +21 -44
  51. package/lib/helper/WebDriver.js +151 -170
  52. package/lib/helper/extras/Popup.js +22 -22
  53. package/lib/helper/testcafe/testcafe-utils.js +26 -27
  54. package/lib/listener/emptyRun.js +55 -0
  55. package/lib/listener/exit.js +7 -10
  56. package/lib/listener/{retry.js → globalRetry.js} +5 -5
  57. package/lib/listener/globalTimeout.js +165 -0
  58. package/lib/listener/helpers.js +15 -15
  59. package/lib/listener/mocha.js +1 -1
  60. package/lib/listener/result.js +12 -0
  61. package/lib/listener/retryEnhancer.js +85 -0
  62. package/lib/listener/steps.js +32 -18
  63. package/lib/listener/store.js +20 -0
  64. package/lib/mocha/asyncWrapper.js +231 -0
  65. package/lib/{interfaces → mocha}/bdd.js +3 -3
  66. package/lib/mocha/cli.js +308 -0
  67. package/lib/mocha/factory.js +104 -0
  68. package/lib/{interfaces → mocha}/featureConfig.js +32 -12
  69. package/lib/{interfaces → mocha}/gherkin.js +26 -28
  70. package/lib/mocha/hooks.js +112 -0
  71. package/lib/mocha/index.js +12 -0
  72. package/lib/mocha/inject.js +29 -0
  73. package/lib/{interfaces → mocha}/scenarioConfig.js +31 -7
  74. package/lib/mocha/suite.js +82 -0
  75. package/lib/mocha/test.js +181 -0
  76. package/lib/mocha/types.d.ts +42 -0
  77. package/lib/mocha/ui.js +232 -0
  78. package/lib/output.js +82 -62
  79. package/lib/pause.js +160 -138
  80. package/lib/plugin/analyze.js +396 -0
  81. package/lib/plugin/auth.js +435 -0
  82. package/lib/plugin/autoDelay.js +8 -8
  83. package/lib/plugin/autoLogin.js +3 -338
  84. package/lib/plugin/commentStep.js +6 -1
  85. package/lib/plugin/coverage.js +10 -19
  86. package/lib/plugin/customLocator.js +3 -3
  87. package/lib/plugin/customReporter.js +52 -0
  88. package/lib/plugin/eachElement.js +1 -1
  89. package/lib/plugin/fakerTransform.js +1 -1
  90. package/lib/plugin/heal.js +36 -9
  91. package/lib/plugin/htmlReporter.js +1947 -0
  92. package/lib/plugin/pageInfo.js +140 -0
  93. package/lib/plugin/retryFailedStep.js +17 -18
  94. package/lib/plugin/retryTo.js +2 -113
  95. package/lib/plugin/screenshotOnFail.js +17 -58
  96. package/lib/plugin/selenoid.js +15 -35
  97. package/lib/plugin/standardActingHelpers.js +4 -1
  98. package/lib/plugin/stepByStepReport.js +56 -17
  99. package/lib/plugin/stepTimeout.js +5 -12
  100. package/lib/plugin/subtitles.js +4 -4
  101. package/lib/plugin/tryTo.js +3 -102
  102. package/lib/plugin/wdio.js +8 -10
  103. package/lib/recorder.js +155 -124
  104. package/lib/rerun.js +43 -42
  105. package/lib/result.js +161 -0
  106. package/lib/secret.js +1 -1
  107. package/lib/step/base.js +239 -0
  108. package/lib/step/comment.js +10 -0
  109. package/lib/step/config.js +50 -0
  110. package/lib/step/func.js +46 -0
  111. package/lib/step/helper.js +50 -0
  112. package/lib/step/meta.js +99 -0
  113. package/lib/step/record.js +74 -0
  114. package/lib/step/retry.js +11 -0
  115. package/lib/step/section.js +55 -0
  116. package/lib/step.js +21 -332
  117. package/lib/steps.js +50 -0
  118. package/lib/store.js +37 -5
  119. package/lib/template/heal.js +2 -11
  120. package/lib/test-server.js +323 -0
  121. package/lib/timeout.js +66 -0
  122. package/lib/utils.js +351 -218
  123. package/lib/within.js +75 -55
  124. package/lib/workerStorage.js +2 -1
  125. package/lib/workers.js +386 -276
  126. package/package.json +76 -70
  127. package/translations/de-DE.js +4 -3
  128. package/translations/fr-FR.js +4 -3
  129. package/translations/index.js +1 -0
  130. package/translations/it-IT.js +4 -3
  131. package/translations/ja-JP.js +4 -3
  132. package/translations/nl-NL.js +76 -0
  133. package/translations/pl-PL.js +4 -3
  134. package/translations/pt-BR.js +4 -3
  135. package/translations/ru-RU.js +4 -3
  136. package/translations/utils.js +9 -0
  137. package/translations/zh-CN.js +4 -3
  138. package/translations/zh-TW.js +4 -3
  139. package/typings/index.d.ts +188 -186
  140. package/typings/promiseBasedTypes.d.ts +18 -705
  141. package/typings/types.d.ts +301 -804
  142. package/lib/cli.js +0 -256
  143. package/lib/helper/ExpectHelper.js +0 -391
  144. package/lib/helper/SoftExpectHelper.js +0 -381
  145. package/lib/listener/artifacts.js +0 -19
  146. package/lib/listener/timeout.js +0 -109
  147. package/lib/mochaFactory.js +0 -113
  148. package/lib/plugin/debugErrors.js +0 -67
  149. package/lib/scenario.js +0 -224
  150. package/lib/ui.js +0 -236
@@ -608,17 +608,11 @@ declare namespace CodeceptJS {
608
608
  * ```js
609
609
  * // taps outside to hide keyboard per default
610
610
  * I.hideDeviceKeyboard();
611
- * I.hideDeviceKeyboard('tapOutside');
612
- *
613
- * // or by pressing key
614
- * I.hideDeviceKeyboard('pressKey', 'Done');
615
611
  * ```
616
612
  *
617
613
  * Appium: support Android and iOS
618
- * @param [strategy] - Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
619
- * @param [key] - Optional key
620
614
  */
621
- hideDeviceKeyboard(strategy?: 'tapOutside' | 'pressKey', key?: string): void;
615
+ hideDeviceKeyboard(): void;
622
616
  /**
623
617
  * Send a key event to the device.
624
618
  * List of keys: https://developer.android.com/reference/android/view/KeyEvent.html
@@ -1209,228 +1203,6 @@ declare namespace CodeceptJS {
1209
1203
  */
1210
1204
  waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
1211
1205
  }
1212
- /**
1213
- * This helper allows performing assertions based on Chai.
1214
- *
1215
- * ### Examples
1216
- *
1217
- * Zero-configuration when paired with other helpers like REST, Playwright:
1218
- *
1219
- * ```js
1220
- * // inside codecept.conf.js
1221
- * {
1222
- * helpers: {
1223
- * Playwright: {...},
1224
- * ExpectHelper: {},
1225
- * }
1226
- * }
1227
- * ```
1228
- *
1229
- * ## Methods
1230
- */
1231
- class ExpectHelper {
1232
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1233
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1234
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1235
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1236
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1237
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1238
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1239
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1240
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1241
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1242
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1243
- /**
1244
- * @param [ajvOptions] - Pass AJV options
1245
- */
1246
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1247
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1248
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1249
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1250
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1251
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1252
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1253
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1254
- expectTrue(targetData: any, customErrorMsg?: any): void;
1255
- expectFalse(targetData: any, customErrorMsg?: any): void;
1256
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1257
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1258
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1259
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1260
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1261
- /**
1262
- * expects members of two arrays are deeply equal
1263
- */
1264
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1265
- /**
1266
- * expects an array to be a superset of another array
1267
- */
1268
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1269
- /**
1270
- * expects members of two JSON objects are deeply equal excluding some properties
1271
- */
1272
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1273
- /**
1274
- * expects a JSON object matches a provided pattern
1275
- */
1276
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1277
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1278
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1279
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1280
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1281
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1282
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1283
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1284
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1285
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1286
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1287
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1288
- /**
1289
- * @param [ajvOptions] - Pass AJV options
1290
- */
1291
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1292
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1293
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1294
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1295
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1296
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1297
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1298
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1299
- expectTrue(targetData: any, customErrorMsg?: any): void;
1300
- expectFalse(targetData: any, customErrorMsg?: any): void;
1301
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1302
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1303
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1304
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1305
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1306
- /**
1307
- * expects members of two arrays are deeply equal
1308
- */
1309
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1310
- /**
1311
- * expects an array to be a superset of another array
1312
- */
1313
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1314
- /**
1315
- * expects members of two JSON objects are deeply equal excluding some properties
1316
- */
1317
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1318
- /**
1319
- * expects a JSON object matches a provided pattern
1320
- */
1321
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1322
- }
1323
- /**
1324
- * This helper allows performing assertions based on Chai.
1325
- *
1326
- * ### Examples
1327
- *
1328
- * Zero-configuration when paired with other helpers like REST, Playwright:
1329
- *
1330
- * ```js
1331
- * // inside codecept.conf.js
1332
- * {
1333
- * helpers: {
1334
- * Playwright: {...},
1335
- * ExpectHelper: {},
1336
- * }
1337
- * }
1338
- * ```
1339
- *
1340
- * ## Methods
1341
- */
1342
- class ExpectHelper {
1343
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1344
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1345
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1346
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1347
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1348
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1349
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1350
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1351
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1352
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1353
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1354
- /**
1355
- * @param [ajvOptions] - Pass AJV options
1356
- */
1357
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1358
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1359
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1360
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1361
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1362
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1363
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1364
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1365
- expectTrue(targetData: any, customErrorMsg?: any): void;
1366
- expectFalse(targetData: any, customErrorMsg?: any): void;
1367
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1368
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1369
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1370
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1371
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1372
- /**
1373
- * expects members of two arrays are deeply equal
1374
- */
1375
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1376
- /**
1377
- * expects an array to be a superset of another array
1378
- */
1379
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1380
- /**
1381
- * expects members of two JSON objects are deeply equal excluding some properties
1382
- */
1383
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1384
- /**
1385
- * expects a JSON object matches a provided pattern
1386
- */
1387
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1388
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1389
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1390
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1391
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1392
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1393
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1394
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1395
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1396
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1397
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1398
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1399
- /**
1400
- * @param [ajvOptions] - Pass AJV options
1401
- */
1402
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1403
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1404
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1405
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1406
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1407
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1408
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1409
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1410
- expectTrue(targetData: any, customErrorMsg?: any): void;
1411
- expectFalse(targetData: any, customErrorMsg?: any): void;
1412
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1413
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1414
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1415
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1416
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1417
- /**
1418
- * expects members of two arrays are deeply equal
1419
- */
1420
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1421
- /**
1422
- * expects an array to be a superset of another array
1423
- */
1424
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1425
- /**
1426
- * expects members of two JSON objects are deeply equal excluding some properties
1427
- */
1428
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1429
- /**
1430
- * expects a JSON object matches a provided pattern
1431
- */
1432
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1433
- }
1434
1206
  /**
1435
1207
  * Helper for testing filesystem.
1436
1208
  * Can be easily used to check file structures:
@@ -1957,13 +1729,14 @@ declare namespace CodeceptJS {
1957
1729
  */
1958
1730
  seeResponseContainsKeys(keys: any[]): void;
1959
1731
  /**
1960
- * Executes a callback function passing in `response` object and chai assertions with `expect`
1732
+ * Executes a callback function passing in `response` object and assert
1961
1733
  * Use it to perform custom checks of response data
1962
1734
  *
1963
1735
  * ```js
1964
- * I.seeResponseValidByCallback(({ data, status, expect }) => {
1965
- * expect(status).to.eql(200);
1966
- * 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);
1967
1740
  * });
1968
1741
  * ```
1969
1742
  */
@@ -2005,191 +1778,6 @@ declare namespace CodeceptJS {
2005
1778
  */
2006
1779
  seeResponseMatchesJsonSchema(fnOrSchema: any): void;
2007
1780
  }
2008
- /**
2009
- * ## Configuration
2010
- *
2011
- * This helper should be configured in codecept.conf.(js|ts)
2012
- * @property [port = 9393] - Mock server port
2013
- * @property [host = "0.0.0.0"] - Mock server host
2014
- * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
2015
- */
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
- class MockServer {
2141
- /**
2142
- * Start the mock server
2143
- * @param [port] - start the mock server with given port
2144
- * @returns void
2145
- */
2146
- startMockServer(port?: number): any;
2147
- /**
2148
- * Stop the mock server
2149
- * @returns void
2150
- */
2151
- stopMockServer(): any;
2152
- /**
2153
- * An interaction adds behavior to the mock server
2154
- *
2155
- *
2156
- * ```js
2157
- * I.addInteractionToMockServer({
2158
- * request: {
2159
- * method: 'GET',
2160
- * path: '/api/hello'
2161
- * },
2162
- * response: {
2163
- * status: 200,
2164
- * body: {
2165
- * 'say': 'hello to mock server'
2166
- * }
2167
- * }
2168
- * });
2169
- * ```
2170
- * ```js
2171
- * // with query params
2172
- * I.addInteractionToMockServer({
2173
- * request: {
2174
- * method: 'GET',
2175
- * path: '/api/hello',
2176
- * queryParams: {
2177
- * id: 2
2178
- * }
2179
- * },
2180
- * response: {
2181
- * status: 200,
2182
- * body: {
2183
- * 'say': 'hello to mock server'
2184
- * }
2185
- * }
2186
- * });
2187
- * ```
2188
- * @param interaction - add behavior to the mock server
2189
- * @returns void
2190
- */
2191
- addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
2192
- }
2193
1781
  /**
2194
1782
  * Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
2195
1783
  * fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
@@ -2977,7 +2565,7 @@ declare namespace CodeceptJS {
2977
2565
  *
2978
2566
  * ```js
2979
2567
  * I.clearCookie();
2980
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
2568
+ * I.clearCookie('test');
2981
2569
  * ```
2982
2570
  * @param [cookie = null] - (optional, `null` by default) cookie name
2983
2571
  */
@@ -3192,46 +2780,6 @@ declare namespace CodeceptJS {
3192
2780
  */
3193
2781
  grabPageScrollPosition(): Promise<PageScrollPosition>;
3194
2782
  }
3195
- /**
3196
- * OpenAI Helper for CodeceptJS.
3197
- *
3198
- * 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.
3199
- * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3200
- *
3201
- * ## Configuration
3202
- *
3203
- * This helper should be configured in codecept.json or codecept.conf.js
3204
- *
3205
- * * `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.
3206
- */
3207
- class OpenAI {
3208
- /**
3209
- * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3210
- *
3211
- * ```js
3212
- * I.askGptOnPage('what does this page do?');
3213
- * ```
3214
- * @param prompt - The question or prompt to ask the GPT model.
3215
- * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3216
- */
3217
- askGptOnPage(prompt: string): Promise<string>;
3218
- /**
3219
- * 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.
3220
- *
3221
- * ```js
3222
- * I.askGptOnPageFragment('describe features of this screen', '.screen');
3223
- * ```
3224
- * @param prompt - The question or prompt to ask the GPT-3.5 model.
3225
- * @param locator - The locator or selector used to identify the HTML fragment on the page.
3226
- * @returns - A Promise that resolves to the generated response from the GPT model.
3227
- */
3228
- askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3229
- /**
3230
- * Send a general request to ChatGPT and return response.
3231
- * @returns - A Promise that resolves to the generated response from the GPT model.
3232
- */
3233
- askGptGeneralPrompt(prompt: string): Promise<string>;
3234
- }
3235
2783
  /**
3236
2784
  * ## Configuration
3237
2785
  *
@@ -3276,6 +2824,7 @@ declare namespace CodeceptJS {
3276
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).
3277
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).
3278
2826
  */
2827
+ // @ts-ignore
3279
2828
  type PlaywrightConfig = {
3280
2829
  url?: string;
3281
2830
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4681,7 +4230,7 @@ declare namespace CodeceptJS {
4681
4230
  *
4682
4231
  * ```js
4683
4232
  * I.clearCookie();
4684
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
4233
+ * I.clearCookie('test');
4685
4234
  * ```
4686
4235
  * @param [cookie = null] - (optional, `null` by default) cookie name
4687
4236
  */
@@ -6354,7 +5903,7 @@ declare namespace CodeceptJS {
6354
5903
  *
6355
5904
  * ```js
6356
5905
  * I.clearCookie();
6357
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
5906
+ * I.clearCookie('test');
6358
5907
  * ```
6359
5908
  * @param [cookie = null] - (optional, `null` by default) cookie name
6360
5909
  */
@@ -6803,6 +6352,7 @@ declare namespace CodeceptJS {
6803
6352
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6804
6353
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6805
6354
  */
6355
+ // @ts-ignore
6806
6356
  type PuppeteerConfig = {
6807
6357
  url: string;
6808
6358
  basicAuth?: any;
@@ -8051,7 +7601,7 @@ declare namespace CodeceptJS {
8051
7601
  *
8052
7602
  * ```js
8053
7603
  * I.clearCookie();
8054
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
7604
+ * I.clearCookie('test');
8055
7605
  * ```
8056
7606
  * @param [cookie = null] - (optional, `null` by default) cookie name
8057
7607
  */
@@ -8745,6 +8295,7 @@ declare namespace CodeceptJS {
8745
8295
  * @property [onResponse] - an async function which can update response object.
8746
8296
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8747
8297
  */
8298
+ // @ts-ignore
8748
8299
  type RESTConfig = {
8749
8300
  endpoint?: string;
8750
8301
  prettyPrintJson?: boolean;
@@ -8937,250 +8488,6 @@ declare namespace CodeceptJS {
8937
8488
  */
8938
8489
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8939
8490
  }
8940
- /**
8941
- * SoftAssertHelper is a utility class for performing soft assertions.
8942
- * Unlike traditional assertions that stop the execution on failure,
8943
- * soft assertions allow the execution to continue and report all failures at the end.
8944
- *
8945
- * ### Examples
8946
- *
8947
- * Zero-configuration when paired with other helpers like REST, Playwright:
8948
- *
8949
- * ```js
8950
- * // inside codecept.conf.js
8951
- * {
8952
- * helpers: {
8953
- * Playwright: {...},
8954
- * SoftExpectHelper: {},
8955
- * }
8956
- * }
8957
- * ```
8958
- *
8959
- * ```js
8960
- * // in scenario
8961
- * I.softExpectEqual('a', 'b')
8962
- * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8963
- * ```
8964
- *
8965
- * ## Methods
8966
- */
8967
- class SoftAssertHelper {
8968
- /**
8969
- * Performs a soft assertion by executing the provided assertion function.
8970
- * If the assertion fails, the error is caught and stored without halting the execution.
8971
- * @param assertionFn - The assertion function to execute.
8972
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8973
- */
8974
- softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
8975
- /**
8976
- * Throws an error if any soft assertions have failed.
8977
- * The error message contains all the accumulated failures.
8978
- */
8979
- flushSoftAssertions(): void;
8980
- /**
8981
- * Softly asserts that two values are 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
- softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
8987
- /**
8988
- * Softly asserts that two values are not 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
- softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
8994
- /**
8995
- * Softly asserts that two values are 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
- softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9001
- /**
9002
- * Softly asserts that two values are not deeply 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
- softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9008
- /**
9009
- * Softly asserts that a value contains the expected value.
9010
- * @param actualValue - The actual value.
9011
- * @param expectedValueToContain - The value that should be contained within the actual value.
9012
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9013
- */
9014
- softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9015
- /**
9016
- * Softly asserts that a value does not contain the expected value.
9017
- * @param actualValue - The actual value.
9018
- * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9019
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9020
- */
9021
- softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9022
- /**
9023
- * Softly asserts that a value starts with the expected value.
9024
- * @param actualValue - The actual value.
9025
- * @param expectedValueToStartWith - The value that the actual value should start with.
9026
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9027
- */
9028
- softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9029
- /**
9030
- * Softly asserts that a value does not start with the expected value.
9031
- * @param actualValue - The actual value.
9032
- * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9033
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9034
- */
9035
- softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9036
- /**
9037
- * Softly asserts that a value ends with the expected value.
9038
- * @param actualValue - The actual value.
9039
- * @param expectedValueToEndWith - The value that the actual value should end with.
9040
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9041
- */
9042
- softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9043
- /**
9044
- * Softly asserts that a value does not end with the expected value.
9045
- * @param actualValue - The actual value.
9046
- * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9047
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9048
- */
9049
- softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9050
- /**
9051
- * Softly asserts that the target data matches the given JSON schema.
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
- */
9056
- softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9057
- /**
9058
- * Softly asserts that the target data matches the given JSON schema using AJV.
9059
- * @param targetData - The data to validate.
9060
- * @param jsonSchema - The JSON schema to validate against.
9061
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9062
- * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9063
- */
9064
- softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9065
- /**
9066
- * Softly asserts that the target data has the specified property.
9067
- * @param targetData - The data to check.
9068
- * @param propertyName - The property name to check for.
9069
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9070
- * fails.
9071
- */
9072
- softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9073
- /**
9074
- * Softly asserts that the target data has a property with the specified name.
9075
- * @param targetData - The data to check.
9076
- * @param propertyName - The property name to check for.
9077
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9078
- */
9079
- softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9080
- /**
9081
- * Softly asserts that the target data is of a specific type.
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
- softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9087
- /**
9088
- * Softly asserts that the target data is of a specific type (alternative for articles).
9089
- * @param targetData - The data to check.
9090
- * @param type - The expected type (e.g., 'string', 'number').
9091
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9092
- */
9093
- softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9094
- /**
9095
- * Softly asserts that the target data has a specified length.
9096
- * @param targetData - The data to check.
9097
- * @param length - The expected length.
9098
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9099
- */
9100
- softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9101
- /**
9102
- * Softly asserts that the target data is empty.
9103
- * @param targetData - The data to check.
9104
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9105
- */
9106
- softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9107
- /**
9108
- * Softly asserts that the target data is true.
9109
- * @param targetData - The data to check.
9110
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9111
- */
9112
- softExpectTrue(targetData: any, customErrorMsg?: string): void;
9113
- /**
9114
- * Softly asserts that the target data is false.
9115
- * @param targetData - The data to check.
9116
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9117
- */
9118
- softExpectFalse(targetData: any, customErrorMsg?: string): void;
9119
- /**
9120
- * Softly asserts that the target data is above a specified value.
9121
- * @param targetData - The data to check.
9122
- * @param aboveThan - The value that the target data should be above.
9123
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9124
- */
9125
- softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9126
- /**
9127
- * Softly asserts that the target data is below a specified value.
9128
- * @param targetData - The data to check.
9129
- * @param belowThan - The value that the target data should be below.
9130
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9131
- */
9132
- softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9133
- /**
9134
- * Softly asserts that the length of the target data is above a specified value.
9135
- * @param targetData - The data to check.
9136
- * @param lengthAboveThan - The length that the target data should be above.
9137
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9138
- */
9139
- softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9140
- /**
9141
- * Softly asserts that the length of the target data is below a specified value.
9142
- * @param targetData - The data to check.
9143
- * @param lengthBelowThan - The length that the target data should be below.
9144
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9145
- */
9146
- softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9147
- /**
9148
- * Softly asserts that two values are equal, ignoring case.
9149
- * @param actualValue - The actual string value.
9150
- * @param expectedValue - The expected string value.
9151
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9152
- */
9153
- softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9154
- /**
9155
- * Softly asserts that two arrays have deep equality, considering members in any order.
9156
- * @param actualValue - The actual array.
9157
- * @param expectedValue - The expected array.
9158
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9159
- */
9160
- softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9161
- /**
9162
- * Softly asserts that an array (superset) deeply includes all members of another array (set).
9163
- * @param superset - The array that should contain the expected members.
9164
- * @param set - The array with members that should be included.
9165
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9166
- */
9167
- softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9168
- /**
9169
- * Softly asserts that two objects are deeply equal, excluding specified fields.
9170
- * @param actualValue - The actual object.
9171
- * @param expectedValue - The expected object.
9172
- * @param fieldsToExclude - The fields to exclude from the comparison.
9173
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9174
- */
9175
- softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9176
- /**
9177
- * Softly asserts that a value matches the expected pattern.
9178
- * @param actualValue - The actual value.
9179
- * @param expectedPattern - The pattern the value should match.
9180
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9181
- */
9182
- softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9183
- }
9184
8491
  /**
9185
8492
  * Client Functions
9186
8493
  */
@@ -10055,7 +9362,7 @@ declare namespace CodeceptJS {
10055
9362
  *
10056
9363
  * ```js
10057
9364
  * I.clearCookie();
10058
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
9365
+ * I.clearCookie('test');
10059
9366
  * ```
10060
9367
  * @param [cookie = null] - (optional, `null` by default) cookie name
10061
9368
  */
@@ -10173,6 +9480,7 @@ declare namespace CodeceptJS {
10173
9480
  * This helper should be configured in codecept.conf.js
10174
9481
  * @property url - base url of website to be tested.
10175
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/
10176
9484
  * @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
10177
9485
  * @property [host = localhost] - WebDriver host to connect.
10178
9486
  * @property [port = 4444] - WebDriver port to connect.
@@ -10193,9 +9501,11 @@ declare namespace CodeceptJS {
10193
9501
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
10194
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
10195
9503
  */
9504
+ // @ts-ignore
10196
9505
  type WebDriverConfig = {
10197
9506
  url: string;
10198
9507
  browser: string;
9508
+ bidiProtocol?: boolean;
10199
9509
  basicAuth?: string;
10200
9510
  host?: string;
10201
9511
  port?: number;
@@ -11540,7 +10850,7 @@ declare namespace CodeceptJS {
11540
10850
  *
11541
10851
  * ```js
11542
10852
  * I.clearCookie();
11543
- * I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name
10853
+ * I.clearCookie('test');
11544
10854
  * ```
11545
10855
  * @param [cookie = null] - (optional, `null` by default) cookie name
11546
10856
  */
@@ -12251,10 +11561,33 @@ declare namespace CodeceptJS {
12251
11561
  [key: string]: any;
12252
11562
  };
12253
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
+ }
12254
11583
  /**
12255
11584
  * Dependency Injection Container
12256
11585
  */
12257
11586
  class Container {
11587
+ /**
11588
+ * Get the standard acting helpers of CodeceptJS Container
11589
+ */
11590
+ static STANDARD_ACTING_HELPERS: any;
12258
11591
  /**
12259
11592
  * Create container with all required helpers and support objects
12260
11593
  */
@@ -12279,6 +11612,10 @@ declare namespace CodeceptJS {
12279
11612
  * Get Mocha instance
12280
11613
  */
12281
11614
  static mocha(): any;
11615
+ /**
11616
+ * Get result
11617
+ */
11618
+ static result(): Result;
12282
11619
  /**
12283
11620
  * Append new services to container
12284
11621
  */
@@ -12295,6 +11632,7 @@ declare namespace CodeceptJS {
12295
11632
  }, newPlugins: {
12296
11633
  [key: string]: any;
12297
11634
  }): void;
11635
+ static started(fn: ((...params: any[]) => any) | null): Promise<void>;
12298
11636
  /**
12299
11637
  * Share data across worker threads
12300
11638
  * @param options - set {local: true} to not share among workers
@@ -12304,7 +11642,7 @@ declare namespace CodeceptJS {
12304
11642
  /**
12305
11643
  * Method collect own property and prototype
12306
11644
  */
12307
- function getObjectMethods(): void;
11645
+ function loadTranslation(): void;
12308
11646
  /**
12309
11647
  * Datatable class to provide data driven testing
12310
11648
  */
@@ -12342,6 +11680,63 @@ declare namespace CodeceptJS {
12342
11680
  */
12343
11681
  transpose(): void;
12344
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>;
12345
11740
  namespace event {
12346
11741
  const dispatcher: NodeJS.EventEmitter;
12347
11742
  const test: {
@@ -12360,6 +11755,8 @@ declare namespace CodeceptJS {
12360
11755
  const hook: {
12361
11756
  started: 'hook.start';
12362
11757
  passed: 'hook.passed';
11758
+ failed: 'hook.failed';
11759
+ finished: 'hook.finished';
12363
11760
  };
12364
11761
  const step: {
12365
11762
  started: 'step.start';
@@ -12418,76 +11815,6 @@ declare namespace CodeceptJS {
12418
11815
  var store: typeof CodeceptJS.store;
12419
11816
  var locator: typeof CodeceptJS.Locator;
12420
11817
  }
12421
- function addStep(step: any, fn: any): void;
12422
- class FeatureConfig {
12423
- /**
12424
- * Retry this suite for x times
12425
- */
12426
- retry(retries: number): this;
12427
- /**
12428
- * Set timeout for this suite
12429
- */
12430
- timeout(timeout: number): this;
12431
- /**
12432
- * Configures a helper.
12433
- * Helper name can be omitted and values will be applied to first helper.
12434
- */
12435
- config(helper: string | {
12436
- [key: string]: any;
12437
- }, obj?: {
12438
- [key: string]: any;
12439
- }): this;
12440
- /**
12441
- * Append a tag name to scenario title
12442
- */
12443
- tag(tagName: string): this;
12444
- }
12445
- class ScenarioConfig {
12446
- /**
12447
- * Declares that test throws error.
12448
- * Can pass an Error object or regex matching expected message.
12449
- */
12450
- throws(err: any): this;
12451
- /**
12452
- * Declares that test should fail.
12453
- * If test passes - throws an error.
12454
- * Can pass an Error object or regex matching expected message.
12455
- */
12456
- fails(): this;
12457
- /**
12458
- * Retry this test for x times
12459
- */
12460
- retry(retries: number): this;
12461
- /**
12462
- * Set timeout for this test
12463
- */
12464
- timeout(timeout: number): this;
12465
- /**
12466
- * Pass in additional objects to inject into test
12467
- */
12468
- inject(obj: {
12469
- [key: string]: any;
12470
- }): this;
12471
- /**
12472
- * Configures a helper.
12473
- * Helper name can be omitted and values will be applied to first helper.
12474
- */
12475
- config(helper: string | {
12476
- [key: string]: any;
12477
- }, obj?: {
12478
- [key: string]: any;
12479
- }): this;
12480
- /**
12481
- * Append a tag name to scenario title
12482
- */
12483
- tag(tagName: string): this;
12484
- /**
12485
- * Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
12486
- */
12487
- injectDependencies(dependencies: {
12488
- [key: string]: any;
12489
- }): this;
12490
- }
12491
11818
  class Locator {
12492
11819
  constructor(locator: CodeceptJS.LocatorOrString, defaultType?: string);
12493
11820
  toString(): string;
@@ -12697,24 +12024,50 @@ declare namespace CodeceptJS {
12697
12024
  function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
12698
12025
  [key: string]: any;
12699
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
+ }
12700
12052
  /**
12701
12053
  * Each command in test executed through `I.` object is wrapped in Step.
12702
12054
  * Step allows logging executed commands and triggers hook before and after step execution.
12703
12055
  */
12704
12056
  class Step {
12705
- constructor(helper: CodeceptJS.Helper, name: string);
12706
- actor: string;
12707
- helper: CodeceptJS.Helper;
12057
+ constructor(name: string);
12708
12058
  name: string;
12709
- helperMethod: string;
12059
+ timeouts: Map<number, number>;
12060
+ args: any[];
12061
+ opts: Record<string, any>;
12062
+ actor: string;
12710
12063
  status: string;
12711
- suffix: string;
12712
12064
  prefix: string;
12713
12065
  comment: string;
12714
- args: any[];
12715
- metaStep: MetaStep;
12066
+ metaStep: any;
12716
12067
  stack: string;
12717
- getTimeout(): number | undefined;
12068
+ helper: any;
12069
+ helperMethod: string;
12070
+ timeout: any;
12718
12071
  /**
12719
12072
  * @param timeout - timeout in milliseconds or 0 if no timeout
12720
12073
  * @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
@@ -12723,27 +12076,43 @@ declare namespace CodeceptJS {
12723
12076
  setTimeout(timeout: number, order: number): void;
12724
12077
  setTrace(): void;
12725
12078
  setArguments(args: any[]): void;
12726
- run(...args: any[]): any;
12727
12079
  setStatus(status: string): void;
12728
12080
  humanize(): string;
12729
12081
  humanizeArgs(): string;
12730
12082
  line(): string;
12731
12083
  toString(): string;
12084
+ toCliStyled(): string;
12732
12085
  toCode(): string;
12733
12086
  hasBDDAncestor(): boolean;
12734
- static MetaStep: typeof MetaStep;
12735
- }
12736
- class MetaStep extends Step {
12737
- isBDD(): boolean;
12738
- run(): any;
12739
12087
  }
12740
12088
  /**
12741
12089
  * global values for current session
12742
12090
  */
12743
12091
  namespace store {
12092
+ /**
12093
+ * If we are in --debug mode
12094
+ */
12744
12095
  var debugMode: boolean;
12096
+ /**
12097
+ * Is timeouts enabled
12098
+ */
12745
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
+ */
12746
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;
12747
12116
  }
12748
12117
  /**
12749
12118
  * Describe a "suite" with the given `title`
@@ -12765,6 +12134,139 @@ declare namespace CodeceptJS {
12765
12134
  * Pending test case with message: 'Test not implemented!'.
12766
12135
  */
12767
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
+ */
12768
12270
  function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
12769
12271
  /**
12770
12272
  * This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
@@ -13366,22 +12868,17 @@ declare namespace CodeceptJS {
13366
12868
  }
13367
12869
 
13368
12870
  /**
13369
- * timeouts set with order below zero only override timeouts of higher order if their value is smaller
13370
- */
13371
- declare var testOrSuite: any;
13372
-
13373
- /**
13374
- * 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
12871
+ * corresponding helper
13375
12872
  */
13376
- declare var stepTimeoutHard: any;
12873
+ declare var helper: CodeceptJS.Helper;
13377
12874
 
13378
12875
  /**
13379
- * 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
12876
+ * name of method to be executed
13380
12877
  */
13381
- declare var codeLimitTime: any;
12878
+ declare var helperMethod: string;
13382
12879
 
13383
12880
  /**
13384
- * 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
13385
12882
  */
13386
- declare var stepTimeoutSoft: any;
12883
+ declare var collsapsed: boolean;
13387
12884