codeceptjs 3.7.0-beta.1 → 3.7.0-beta.10

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 (73) hide show
  1. package/README.md +9 -10
  2. package/bin/codecept.js +7 -0
  3. package/lib/actor.js +46 -92
  4. package/lib/ai.js +130 -121
  5. package/lib/codecept.js +2 -2
  6. package/lib/command/check.js +186 -0
  7. package/lib/command/definitions.js +3 -1
  8. package/lib/command/interactive.js +1 -1
  9. package/lib/command/run-workers.js +2 -54
  10. package/lib/command/workers/runTests.js +64 -225
  11. package/lib/container.js +27 -0
  12. package/lib/effects.js +218 -0
  13. package/lib/els.js +87 -106
  14. package/lib/event.js +18 -17
  15. package/lib/heal.js +10 -0
  16. package/lib/helper/AI.js +2 -1
  17. package/lib/helper/Appium.js +31 -22
  18. package/lib/helper/Playwright.js +22 -1
  19. package/lib/helper/Puppeteer.js +5 -0
  20. package/lib/helper/WebDriver.js +29 -8
  21. package/lib/listener/emptyRun.js +2 -5
  22. package/lib/listener/exit.js +5 -8
  23. package/lib/listener/globalTimeout.js +66 -10
  24. package/lib/listener/result.js +12 -0
  25. package/lib/listener/steps.js +3 -6
  26. package/lib/listener/store.js +9 -1
  27. package/lib/mocha/asyncWrapper.js +15 -3
  28. package/lib/mocha/cli.js +79 -28
  29. package/lib/mocha/featureConfig.js +13 -0
  30. package/lib/mocha/hooks.js +32 -3
  31. package/lib/mocha/inject.js +5 -0
  32. package/lib/mocha/scenarioConfig.js +11 -0
  33. package/lib/mocha/suite.js +27 -1
  34. package/lib/mocha/test.js +102 -3
  35. package/lib/mocha/types.d.ts +11 -0
  36. package/lib/output.js +75 -73
  37. package/lib/pause.js +3 -10
  38. package/lib/plugin/analyze.js +349 -0
  39. package/lib/plugin/autoDelay.js +2 -2
  40. package/lib/plugin/commentStep.js +5 -0
  41. package/lib/plugin/customReporter.js +52 -0
  42. package/lib/plugin/heal.js +30 -0
  43. package/lib/plugin/pageInfo.js +140 -0
  44. package/lib/plugin/retryTo.js +18 -118
  45. package/lib/plugin/screenshotOnFail.js +12 -17
  46. package/lib/plugin/standardActingHelpers.js +4 -1
  47. package/lib/plugin/stepByStepReport.js +6 -5
  48. package/lib/plugin/stepTimeout.js +1 -1
  49. package/lib/plugin/tryTo.js +17 -107
  50. package/lib/recorder.js +5 -5
  51. package/lib/rerun.js +43 -42
  52. package/lib/result.js +161 -0
  53. package/lib/step/base.js +228 -0
  54. package/lib/step/config.js +50 -0
  55. package/lib/step/func.js +46 -0
  56. package/lib/step/helper.js +50 -0
  57. package/lib/step/meta.js +99 -0
  58. package/lib/step/record.js +74 -0
  59. package/lib/step/retry.js +11 -0
  60. package/lib/step/section.js +55 -0
  61. package/lib/step.js +20 -347
  62. package/lib/steps.js +50 -0
  63. package/lib/store.js +4 -0
  64. package/lib/timeout.js +66 -0
  65. package/lib/utils.js +93 -0
  66. package/lib/within.js +2 -2
  67. package/lib/workers.js +29 -49
  68. package/package.json +23 -20
  69. package/typings/index.d.ts +5 -4
  70. package/typings/promiseBasedTypes.d.ts +617 -7
  71. package/typings/types.d.ts +663 -34
  72. package/lib/listener/artifacts.js +0 -19
  73. package/lib/plugin/debugErrors.js +0 -67
@@ -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): Promise<any>;
615
+ hideDeviceKeyboard(): Promise<any>;
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
@@ -1185,6 +1179,266 @@ declare namespace CodeceptJS {
1185
1179
  */
1186
1180
  waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): Promise<any>;
1187
1181
  }
1182
+ /**
1183
+ * This helper allows performing assertions based on Chai.
1184
+ *
1185
+ * ### Examples
1186
+ *
1187
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1188
+ *
1189
+ * ```js
1190
+ * // inside codecept.conf.js
1191
+ * {
1192
+ * helpers: {
1193
+ * Playwright: {...},
1194
+ * ExpectHelper: {},
1195
+ * }
1196
+ * }
1197
+ * ```
1198
+ *
1199
+ * ## Methods
1200
+ */
1201
+ // @ts-ignore
1202
+ // @ts-ignore
1203
+ // @ts-ignore
1204
+ // @ts-ignore
1205
+ // @ts-ignore
1206
+ // @ts-ignore
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
+ // @ts-ignore
1216
+ // @ts-ignore
1217
+ // @ts-ignore
1218
+ // @ts-ignore
1219
+ // @ts-ignore
1220
+ class ExpectHelper {
1221
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1222
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1223
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1224
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1225
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1226
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1227
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1228
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1229
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1230
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1231
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1232
+ /**
1233
+ * @param [ajvOptions] - Pass AJV options
1234
+ */
1235
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1236
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1237
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1238
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1239
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1240
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1241
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1242
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1243
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1244
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1245
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1246
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1247
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1248
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1249
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1250
+ /**
1251
+ * expects members of two arrays are deeply equal
1252
+ */
1253
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1254
+ /**
1255
+ * expects an array to be a superset of another array
1256
+ */
1257
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1258
+ /**
1259
+ * expects members of two JSON objects are deeply equal excluding some properties
1260
+ */
1261
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1262
+ /**
1263
+ * expects a JSON object matches a provided pattern
1264
+ */
1265
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1266
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1267
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1268
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1269
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1270
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1271
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1272
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1273
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1274
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1275
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1276
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1277
+ /**
1278
+ * @param [ajvOptions] - Pass AJV options
1279
+ */
1280
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1281
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1282
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1283
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1284
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1285
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1286
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1287
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1288
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1289
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1290
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1291
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1292
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1293
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1294
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1295
+ /**
1296
+ * expects members of two arrays are deeply equal
1297
+ */
1298
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1299
+ /**
1300
+ * expects an array to be a superset of another array
1301
+ */
1302
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1303
+ /**
1304
+ * expects members of two JSON objects are deeply equal excluding some properties
1305
+ */
1306
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1307
+ /**
1308
+ * expects a JSON object matches a provided pattern
1309
+ */
1310
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1311
+ }
1312
+ /**
1313
+ * This helper allows performing assertions based on Chai.
1314
+ *
1315
+ * ### Examples
1316
+ *
1317
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1318
+ *
1319
+ * ```js
1320
+ * // inside codecept.conf.js
1321
+ * {
1322
+ * helpers: {
1323
+ * Playwright: {...},
1324
+ * ExpectHelper: {},
1325
+ * }
1326
+ * }
1327
+ * ```
1328
+ *
1329
+ * ## Methods
1330
+ */
1331
+ // @ts-ignore
1332
+ // @ts-ignore
1333
+ // @ts-ignore
1334
+ // @ts-ignore
1335
+ // @ts-ignore
1336
+ // @ts-ignore
1337
+ // @ts-ignore
1338
+ // @ts-ignore
1339
+ // @ts-ignore
1340
+ // @ts-ignore
1341
+ // @ts-ignore
1342
+ // @ts-ignore
1343
+ // @ts-ignore
1344
+ // @ts-ignore
1345
+ // @ts-ignore
1346
+ // @ts-ignore
1347
+ // @ts-ignore
1348
+ // @ts-ignore
1349
+ // @ts-ignore
1350
+ class ExpectHelper {
1351
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1352
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1353
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1354
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1355
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1356
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1357
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1358
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1359
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1360
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1361
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1362
+ /**
1363
+ * @param [ajvOptions] - Pass AJV options
1364
+ */
1365
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1366
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1367
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1368
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1369
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1370
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1371
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1372
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1373
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1374
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1375
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1376
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1377
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1378
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1379
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1380
+ /**
1381
+ * expects members of two arrays are deeply equal
1382
+ */
1383
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1384
+ /**
1385
+ * expects an array to be a superset of another array
1386
+ */
1387
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1388
+ /**
1389
+ * expects members of two JSON objects are deeply equal excluding some properties
1390
+ */
1391
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1392
+ /**
1393
+ * expects a JSON object matches a provided pattern
1394
+ */
1395
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1396
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1397
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1398
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1399
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1400
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1401
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1402
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1403
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1404
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1405
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1406
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1407
+ /**
1408
+ * @param [ajvOptions] - Pass AJV options
1409
+ */
1410
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1411
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1412
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1413
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1414
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1415
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1416
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1417
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1418
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1419
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1420
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1421
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1422
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1423
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1424
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1425
+ /**
1426
+ * expects members of two arrays are deeply equal
1427
+ */
1428
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1429
+ /**
1430
+ * expects an array to be a superset of another array
1431
+ */
1432
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1433
+ /**
1434
+ * expects members of two JSON objects are deeply equal excluding some properties
1435
+ */
1436
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1437
+ /**
1438
+ * expects a JSON object matches a provided pattern
1439
+ */
1440
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1441
+ }
1188
1442
  /**
1189
1443
  * Helper for testing filesystem.
1190
1444
  * Can be easily used to check file structures:
@@ -1772,6 +2026,18 @@ declare namespace CodeceptJS {
1772
2026
  // @ts-ignore
1773
2027
  // @ts-ignore
1774
2028
  // @ts-ignore
2029
+ // @ts-ignore
2030
+ // @ts-ignore
2031
+ // @ts-ignore
2032
+ // @ts-ignore
2033
+ // @ts-ignore
2034
+ // @ts-ignore
2035
+ // @ts-ignore
2036
+ // @ts-ignore
2037
+ // @ts-ignore
2038
+ // @ts-ignore
2039
+ // @ts-ignore
2040
+ // @ts-ignore
1775
2041
  type MockServerConfig = {
1776
2042
  port?: number;
1777
2043
  host?: string;
@@ -1903,6 +2169,18 @@ declare namespace CodeceptJS {
1903
2169
  // @ts-ignore
1904
2170
  // @ts-ignore
1905
2171
  // @ts-ignore
2172
+ // @ts-ignore
2173
+ // @ts-ignore
2174
+ // @ts-ignore
2175
+ // @ts-ignore
2176
+ // @ts-ignore
2177
+ // @ts-ignore
2178
+ // @ts-ignore
2179
+ // @ts-ignore
2180
+ // @ts-ignore
2181
+ // @ts-ignore
2182
+ // @ts-ignore
2183
+ // @ts-ignore
1906
2184
  class MockServer {
1907
2185
  /**
1908
2186
  * Start the mock server
@@ -2892,6 +3170,46 @@ declare namespace CodeceptJS {
2892
3170
  */
2893
3171
  grabPageScrollPosition(): Promise<PageScrollPosition>;
2894
3172
  }
3173
+ /**
3174
+ * OpenAI Helper for CodeceptJS.
3175
+ *
3176
+ * 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.
3177
+ * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3178
+ *
3179
+ * ## Configuration
3180
+ *
3181
+ * This helper should be configured in codecept.json or codecept.conf.js
3182
+ *
3183
+ * * `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.
3184
+ */
3185
+ class OpenAITs {
3186
+ /**
3187
+ * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3188
+ *
3189
+ * ```js
3190
+ * I.askGptOnPage('what does this page do?');
3191
+ * ```
3192
+ * @param prompt - The question or prompt to ask the GPT model.
3193
+ * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3194
+ */
3195
+ askGptOnPage(prompt: string): Promise<string>;
3196
+ /**
3197
+ * 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.
3198
+ *
3199
+ * ```js
3200
+ * I.askGptOnPageFragment('describe features of this screen', '.screen');
3201
+ * ```
3202
+ * @param prompt - The question or prompt to ask the GPT-3.5 model.
3203
+ * @param locator - The locator or selector used to identify the HTML fragment on the page.
3204
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3205
+ */
3206
+ askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3207
+ /**
3208
+ * Send a general request to ChatGPT and return response.
3209
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3210
+ */
3211
+ askGptGeneralPrompt(prompt: string): Promise<string>;
3212
+ }
2895
3213
  /**
2896
3214
  * ## Configuration
2897
3215
  *
@@ -2943,6 +3261,18 @@ declare namespace CodeceptJS {
2943
3261
  // @ts-ignore
2944
3262
  // @ts-ignore
2945
3263
  // @ts-ignore
3264
+ // @ts-ignore
3265
+ // @ts-ignore
3266
+ // @ts-ignore
3267
+ // @ts-ignore
3268
+ // @ts-ignore
3269
+ // @ts-ignore
3270
+ // @ts-ignore
3271
+ // @ts-ignore
3272
+ // @ts-ignore
3273
+ // @ts-ignore
3274
+ // @ts-ignore
3275
+ // @ts-ignore
2946
3276
  type PlaywrightConfig = {
2947
3277
  url?: string;
2948
3278
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6326,6 +6656,18 @@ declare namespace CodeceptJS {
6326
6656
  // @ts-ignore
6327
6657
  // @ts-ignore
6328
6658
  // @ts-ignore
6659
+ // @ts-ignore
6660
+ // @ts-ignore
6661
+ // @ts-ignore
6662
+ // @ts-ignore
6663
+ // @ts-ignore
6664
+ // @ts-ignore
6665
+ // @ts-ignore
6666
+ // @ts-ignore
6667
+ // @ts-ignore
6668
+ // @ts-ignore
6669
+ // @ts-ignore
6670
+ // @ts-ignore
6329
6671
  type PuppeteerConfig = {
6330
6672
  url: string;
6331
6673
  basicAuth?: any;
@@ -8139,6 +8481,18 @@ declare namespace CodeceptJS {
8139
8481
  // @ts-ignore
8140
8482
  // @ts-ignore
8141
8483
  // @ts-ignore
8484
+ // @ts-ignore
8485
+ // @ts-ignore
8486
+ // @ts-ignore
8487
+ // @ts-ignore
8488
+ // @ts-ignore
8489
+ // @ts-ignore
8490
+ // @ts-ignore
8491
+ // @ts-ignore
8492
+ // @ts-ignore
8493
+ // @ts-ignore
8494
+ // @ts-ignore
8495
+ // @ts-ignore
8142
8496
  type RESTConfig = {
8143
8497
  endpoint?: string;
8144
8498
  prettyPrintJson?: boolean;
@@ -8331,6 +8685,250 @@ declare namespace CodeceptJS {
8331
8685
  */
8332
8686
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8333
8687
  }
8688
+ /**
8689
+ * SoftAssertHelper is a utility class for performing soft assertions.
8690
+ * Unlike traditional assertions that stop the execution on failure,
8691
+ * soft assertions allow the execution to continue and report all failures at the end.
8692
+ *
8693
+ * ### Examples
8694
+ *
8695
+ * Zero-configuration when paired with other helpers like REST, Playwright:
8696
+ *
8697
+ * ```js
8698
+ * // inside codecept.conf.js
8699
+ * {
8700
+ * helpers: {
8701
+ * Playwright: {...},
8702
+ * SoftExpectHelper: {},
8703
+ * }
8704
+ * }
8705
+ * ```
8706
+ *
8707
+ * ```js
8708
+ * // in scenario
8709
+ * I.softExpectEqual('a', 'b')
8710
+ * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8711
+ * ```
8712
+ *
8713
+ * ## Methods
8714
+ */
8715
+ class SoftAssertHelperTs {
8716
+ /**
8717
+ * Performs a soft assertion by executing the provided assertion function.
8718
+ * If the assertion fails, the error is caught and stored without halting the execution.
8719
+ * @param assertionFn - The assertion function to execute.
8720
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8721
+ */
8722
+ softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): Promise<any>;
8723
+ /**
8724
+ * Throws an error if any soft assertions have failed.
8725
+ * The error message contains all the accumulated failures.
8726
+ */
8727
+ flushSoftAssertions(): Promise<any>;
8728
+ /**
8729
+ * Softly asserts that two values are equal.
8730
+ * @param actualValue - The actual value.
8731
+ * @param expectedValue - The expected value.
8732
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8733
+ */
8734
+ softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8735
+ /**
8736
+ * Softly asserts that two values are not equal.
8737
+ * @param actualValue - The actual value.
8738
+ * @param expectedValue - The expected value.
8739
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8740
+ */
8741
+ softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8742
+ /**
8743
+ * Softly asserts that two values are deeply equal.
8744
+ * @param actualValue - The actual value.
8745
+ * @param expectedValue - The expected value.
8746
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8747
+ */
8748
+ softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8749
+ /**
8750
+ * Softly asserts that two values are not deeply equal.
8751
+ * @param actualValue - The actual value.
8752
+ * @param expectedValue - The expected value.
8753
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8754
+ */
8755
+ softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8756
+ /**
8757
+ * Softly asserts that a value contains the expected value.
8758
+ * @param actualValue - The actual value.
8759
+ * @param expectedValueToContain - The value that should be contained within the actual value.
8760
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8761
+ */
8762
+ softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): Promise<any>;
8763
+ /**
8764
+ * Softly asserts that a value does not contain the expected value.
8765
+ * @param actualValue - The actual value.
8766
+ * @param expectedValueToNotContain - The value that should not be contained within the actual value.
8767
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8768
+ */
8769
+ softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): Promise<any>;
8770
+ /**
8771
+ * Softly asserts that a value starts with the expected value.
8772
+ * @param actualValue - The actual value.
8773
+ * @param expectedValueToStartWith - The value that the actual value should start with.
8774
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8775
+ */
8776
+ softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): Promise<any>;
8777
+ /**
8778
+ * Softly asserts that a value does not start with the expected value.
8779
+ * @param actualValue - The actual value.
8780
+ * @param expectedValueToNotStartWith - The value that the actual value should not start with.
8781
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8782
+ */
8783
+ softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): Promise<any>;
8784
+ /**
8785
+ * Softly asserts that a value ends with the expected value.
8786
+ * @param actualValue - The actual value.
8787
+ * @param expectedValueToEndWith - The value that the actual value should end with.
8788
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8789
+ */
8790
+ softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): Promise<any>;
8791
+ /**
8792
+ * Softly asserts that a value does not end with the expected value.
8793
+ * @param actualValue - The actual value.
8794
+ * @param expectedValueToNotEndWith - The value that the actual value should not end with.
8795
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8796
+ */
8797
+ softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): Promise<any>;
8798
+ /**
8799
+ * Softly asserts that the target data matches the given JSON schema.
8800
+ * @param targetData - The data to validate.
8801
+ * @param jsonSchema - The JSON schema to validate against.
8802
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8803
+ */
8804
+ softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): Promise<any>;
8805
+ /**
8806
+ * Softly asserts that the target data matches the given JSON schema using AJV.
8807
+ * @param targetData - The data to validate.
8808
+ * @param jsonSchema - The JSON schema to validate against.
8809
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8810
+ * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
8811
+ */
8812
+ softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): Promise<any>;
8813
+ /**
8814
+ * Softly asserts that the target data has the specified property.
8815
+ * @param targetData - The data to check.
8816
+ * @param propertyName - The property name to check for.
8817
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion
8818
+ * fails.
8819
+ */
8820
+ softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
8821
+ /**
8822
+ * Softly asserts that the target data has a property with the specified name.
8823
+ * @param targetData - The data to check.
8824
+ * @param propertyName - The property name to check for.
8825
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8826
+ */
8827
+ softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
8828
+ /**
8829
+ * Softly asserts that the target data is of a specific type.
8830
+ * @param targetData - The data to check.
8831
+ * @param type - The expected type (e.g., 'string', 'number').
8832
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8833
+ */
8834
+ softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
8835
+ /**
8836
+ * Softly asserts that the target data is of a specific type (alternative for articles).
8837
+ * @param targetData - The data to check.
8838
+ * @param type - The expected type (e.g., 'string', 'number').
8839
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8840
+ */
8841
+ softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
8842
+ /**
8843
+ * Softly asserts that the target data has a specified length.
8844
+ * @param targetData - The data to check.
8845
+ * @param length - The expected length.
8846
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8847
+ */
8848
+ softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): Promise<any>;
8849
+ /**
8850
+ * Softly asserts that the target data is empty.
8851
+ * @param targetData - The data to check.
8852
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8853
+ */
8854
+ softExpectEmpty(targetData: any, customErrorMsg?: string): Promise<any>;
8855
+ /**
8856
+ * Softly asserts that the target data is true.
8857
+ * @param targetData - The data to check.
8858
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8859
+ */
8860
+ softExpectTrue(targetData: any, customErrorMsg?: string): Promise<any>;
8861
+ /**
8862
+ * Softly asserts that the target data is false.
8863
+ * @param targetData - The data to check.
8864
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8865
+ */
8866
+ softExpectFalse(targetData: any, customErrorMsg?: string): Promise<any>;
8867
+ /**
8868
+ * Softly asserts that the target data is above a specified value.
8869
+ * @param targetData - The data to check.
8870
+ * @param aboveThan - The value that the target data should be above.
8871
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8872
+ */
8873
+ softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): Promise<any>;
8874
+ /**
8875
+ * Softly asserts that the target data is below a specified value.
8876
+ * @param targetData - The data to check.
8877
+ * @param belowThan - The value that the target data should be below.
8878
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8879
+ */
8880
+ softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): Promise<any>;
8881
+ /**
8882
+ * Softly asserts that the length of the target data is above a specified value.
8883
+ * @param targetData - The data to check.
8884
+ * @param lengthAboveThan - The length that the target data should be above.
8885
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8886
+ */
8887
+ softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): Promise<any>;
8888
+ /**
8889
+ * Softly asserts that the length of the target data is below a specified value.
8890
+ * @param targetData - The data to check.
8891
+ * @param lengthBelowThan - The length that the target data should be below.
8892
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8893
+ */
8894
+ softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): Promise<any>;
8895
+ /**
8896
+ * Softly asserts that two values are equal, ignoring case.
8897
+ * @param actualValue - The actual string value.
8898
+ * @param expectedValue - The expected string value.
8899
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8900
+ */
8901
+ softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): Promise<any>;
8902
+ /**
8903
+ * Softly asserts that two arrays have deep equality, considering members in any order.
8904
+ * @param actualValue - The actual array.
8905
+ * @param expectedValue - The expected array.
8906
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8907
+ */
8908
+ softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): Promise<any>;
8909
+ /**
8910
+ * Softly asserts that an array (superset) deeply includes all members of another array (set).
8911
+ * @param superset - The array that should contain the expected members.
8912
+ * @param set - The array with members that should be included.
8913
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8914
+ */
8915
+ softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): Promise<any>;
8916
+ /**
8917
+ * Softly asserts that two objects are deeply equal, excluding specified fields.
8918
+ * @param actualValue - The actual object.
8919
+ * @param expectedValue - The expected object.
8920
+ * @param fieldsToExclude - The fields to exclude from the comparison.
8921
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8922
+ */
8923
+ softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): Promise<any>;
8924
+ /**
8925
+ * Softly asserts that a value matches the expected pattern.
8926
+ * @param actualValue - The actual value.
8927
+ * @param expectedPattern - The pattern the value should match.
8928
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8929
+ */
8930
+ softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): Promise<any>;
8931
+ }
8334
8932
  /**
8335
8933
  * Client Functions
8336
8934
  */
@@ -9290,6 +9888,18 @@ declare namespace CodeceptJS {
9290
9888
  // @ts-ignore
9291
9889
  // @ts-ignore
9292
9890
  // @ts-ignore
9891
+ // @ts-ignore
9892
+ // @ts-ignore
9893
+ // @ts-ignore
9894
+ // @ts-ignore
9895
+ // @ts-ignore
9896
+ // @ts-ignore
9897
+ // @ts-ignore
9898
+ // @ts-ignore
9899
+ // @ts-ignore
9900
+ // @ts-ignore
9901
+ // @ts-ignore
9902
+ // @ts-ignore
9293
9903
  type WebDriverConfig = {
9294
9904
  url: string;
9295
9905
  browser: string;