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): 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,6 +1203,266 @@ declare namespace CodeceptJS {
1209
1203
  */
1210
1204
  waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
1211
1205
  }
1206
+ /**
1207
+ * This helper allows performing assertions based on Chai.
1208
+ *
1209
+ * ### Examples
1210
+ *
1211
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1212
+ *
1213
+ * ```js
1214
+ * // inside codecept.conf.js
1215
+ * {
1216
+ * helpers: {
1217
+ * Playwright: {...},
1218
+ * ExpectHelper: {},
1219
+ * }
1220
+ * }
1221
+ * ```
1222
+ *
1223
+ * ## Methods
1224
+ */
1225
+ // @ts-ignore
1226
+ // @ts-ignore
1227
+ // @ts-ignore
1228
+ // @ts-ignore
1229
+ // @ts-ignore
1230
+ // @ts-ignore
1231
+ // @ts-ignore
1232
+ // @ts-ignore
1233
+ // @ts-ignore
1234
+ // @ts-ignore
1235
+ // @ts-ignore
1236
+ // @ts-ignore
1237
+ // @ts-ignore
1238
+ // @ts-ignore
1239
+ // @ts-ignore
1240
+ // @ts-ignore
1241
+ // @ts-ignore
1242
+ // @ts-ignore
1243
+ // @ts-ignore
1244
+ class ExpectHelper {
1245
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1246
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1247
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1248
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1249
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1250
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1251
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1252
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1253
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1254
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1255
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1256
+ /**
1257
+ * @param [ajvOptions] - Pass AJV options
1258
+ */
1259
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1260
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1261
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1262
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1263
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1264
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1265
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1266
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1267
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1268
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1269
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1270
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1271
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1272
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1273
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1274
+ /**
1275
+ * expects members of two arrays are deeply equal
1276
+ */
1277
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1278
+ /**
1279
+ * expects an array to be a superset of another array
1280
+ */
1281
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1282
+ /**
1283
+ * expects members of two JSON objects are deeply equal excluding some properties
1284
+ */
1285
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1286
+ /**
1287
+ * expects a JSON object matches a provided pattern
1288
+ */
1289
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1290
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1291
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1292
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1293
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1294
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1295
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1296
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1297
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1298
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1299
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1300
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1301
+ /**
1302
+ * @param [ajvOptions] - Pass AJV options
1303
+ */
1304
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1305
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1306
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1307
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1308
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1309
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1310
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1311
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1312
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1313
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1314
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1315
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1316
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1317
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1318
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1319
+ /**
1320
+ * expects members of two arrays are deeply equal
1321
+ */
1322
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1323
+ /**
1324
+ * expects an array to be a superset of another array
1325
+ */
1326
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1327
+ /**
1328
+ * expects members of two JSON objects are deeply equal excluding some properties
1329
+ */
1330
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1331
+ /**
1332
+ * expects a JSON object matches a provided pattern
1333
+ */
1334
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1335
+ }
1336
+ /**
1337
+ * This helper allows performing assertions based on Chai.
1338
+ *
1339
+ * ### Examples
1340
+ *
1341
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1342
+ *
1343
+ * ```js
1344
+ * // inside codecept.conf.js
1345
+ * {
1346
+ * helpers: {
1347
+ * Playwright: {...},
1348
+ * ExpectHelper: {},
1349
+ * }
1350
+ * }
1351
+ * ```
1352
+ *
1353
+ * ## Methods
1354
+ */
1355
+ // @ts-ignore
1356
+ // @ts-ignore
1357
+ // @ts-ignore
1358
+ // @ts-ignore
1359
+ // @ts-ignore
1360
+ // @ts-ignore
1361
+ // @ts-ignore
1362
+ // @ts-ignore
1363
+ // @ts-ignore
1364
+ // @ts-ignore
1365
+ // @ts-ignore
1366
+ // @ts-ignore
1367
+ // @ts-ignore
1368
+ // @ts-ignore
1369
+ // @ts-ignore
1370
+ // @ts-ignore
1371
+ // @ts-ignore
1372
+ // @ts-ignore
1373
+ // @ts-ignore
1374
+ class ExpectHelper {
1375
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1376
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1377
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1378
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1379
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1380
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1381
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1382
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1383
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1384
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1385
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1386
+ /**
1387
+ * @param [ajvOptions] - Pass AJV options
1388
+ */
1389
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1390
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1391
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1392
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1393
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1394
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1395
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1396
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1397
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1398
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1399
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1400
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1401
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1402
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1403
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1404
+ /**
1405
+ * expects members of two arrays are deeply equal
1406
+ */
1407
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1408
+ /**
1409
+ * expects an array to be a superset of another array
1410
+ */
1411
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1412
+ /**
1413
+ * expects members of two JSON objects are deeply equal excluding some properties
1414
+ */
1415
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1416
+ /**
1417
+ * expects a JSON object matches a provided pattern
1418
+ */
1419
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1420
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1421
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1422
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1423
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1424
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1425
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1426
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1427
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1428
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1429
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1430
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1431
+ /**
1432
+ * @param [ajvOptions] - Pass AJV options
1433
+ */
1434
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1435
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1436
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1437
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1438
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1439
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1440
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1441
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1442
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1443
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1444
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1445
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1446
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1447
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1448
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1449
+ /**
1450
+ * expects members of two arrays are deeply equal
1451
+ */
1452
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1453
+ /**
1454
+ * expects an array to be a superset of another array
1455
+ */
1456
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1457
+ /**
1458
+ * expects members of two JSON objects are deeply equal excluding some properties
1459
+ */
1460
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1461
+ /**
1462
+ * expects a JSON object matches a provided pattern
1463
+ */
1464
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1465
+ }
1212
1466
  /**
1213
1467
  * Helper for testing filesystem.
1214
1468
  * Can be easily used to check file structures:
@@ -1799,6 +2053,18 @@ declare namespace CodeceptJS {
1799
2053
  // @ts-ignore
1800
2054
  // @ts-ignore
1801
2055
  // @ts-ignore
2056
+ // @ts-ignore
2057
+ // @ts-ignore
2058
+ // @ts-ignore
2059
+ // @ts-ignore
2060
+ // @ts-ignore
2061
+ // @ts-ignore
2062
+ // @ts-ignore
2063
+ // @ts-ignore
2064
+ // @ts-ignore
2065
+ // @ts-ignore
2066
+ // @ts-ignore
2067
+ // @ts-ignore
1802
2068
  type MockServerConfig = {
1803
2069
  port?: number;
1804
2070
  host?: string;
@@ -1930,6 +2196,18 @@ declare namespace CodeceptJS {
1930
2196
  // @ts-ignore
1931
2197
  // @ts-ignore
1932
2198
  // @ts-ignore
2199
+ // @ts-ignore
2200
+ // @ts-ignore
2201
+ // @ts-ignore
2202
+ // @ts-ignore
2203
+ // @ts-ignore
2204
+ // @ts-ignore
2205
+ // @ts-ignore
2206
+ // @ts-ignore
2207
+ // @ts-ignore
2208
+ // @ts-ignore
2209
+ // @ts-ignore
2210
+ // @ts-ignore
1933
2211
  class MockServer {
1934
2212
  /**
1935
2213
  * Start the mock server
@@ -2985,6 +3263,46 @@ declare namespace CodeceptJS {
2985
3263
  */
2986
3264
  grabPageScrollPosition(): Promise<PageScrollPosition>;
2987
3265
  }
3266
+ /**
3267
+ * OpenAI Helper for CodeceptJS.
3268
+ *
3269
+ * 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.
3270
+ * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3271
+ *
3272
+ * ## Configuration
3273
+ *
3274
+ * This helper should be configured in codecept.json or codecept.conf.js
3275
+ *
3276
+ * * `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.
3277
+ */
3278
+ class OpenAI {
3279
+ /**
3280
+ * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3281
+ *
3282
+ * ```js
3283
+ * I.askGptOnPage('what does this page do?');
3284
+ * ```
3285
+ * @param prompt - The question or prompt to ask the GPT model.
3286
+ * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3287
+ */
3288
+ askGptOnPage(prompt: string): Promise<string>;
3289
+ /**
3290
+ * 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.
3291
+ *
3292
+ * ```js
3293
+ * I.askGptOnPageFragment('describe features of this screen', '.screen');
3294
+ * ```
3295
+ * @param prompt - The question or prompt to ask the GPT-3.5 model.
3296
+ * @param locator - The locator or selector used to identify the HTML fragment on the page.
3297
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3298
+ */
3299
+ askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3300
+ /**
3301
+ * Send a general request to ChatGPT and return response.
3302
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3303
+ */
3304
+ askGptGeneralPrompt(prompt: string): Promise<string>;
3305
+ }
2988
3306
  /**
2989
3307
  * ## Configuration
2990
3308
  *
@@ -3036,6 +3354,18 @@ declare namespace CodeceptJS {
3036
3354
  // @ts-ignore
3037
3355
  // @ts-ignore
3038
3356
  // @ts-ignore
3357
+ // @ts-ignore
3358
+ // @ts-ignore
3359
+ // @ts-ignore
3360
+ // @ts-ignore
3361
+ // @ts-ignore
3362
+ // @ts-ignore
3363
+ // @ts-ignore
3364
+ // @ts-ignore
3365
+ // @ts-ignore
3366
+ // @ts-ignore
3367
+ // @ts-ignore
3368
+ // @ts-ignore
3039
3369
  type PlaywrightConfig = {
3040
3370
  url?: string;
3041
3371
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6570,6 +6900,18 @@ declare namespace CodeceptJS {
6570
6900
  // @ts-ignore
6571
6901
  // @ts-ignore
6572
6902
  // @ts-ignore
6903
+ // @ts-ignore
6904
+ // @ts-ignore
6905
+ // @ts-ignore
6906
+ // @ts-ignore
6907
+ // @ts-ignore
6908
+ // @ts-ignore
6909
+ // @ts-ignore
6910
+ // @ts-ignore
6911
+ // @ts-ignore
6912
+ // @ts-ignore
6913
+ // @ts-ignore
6914
+ // @ts-ignore
6573
6915
  type PuppeteerConfig = {
6574
6916
  url: string;
6575
6917
  basicAuth?: any;
@@ -8519,6 +8861,18 @@ declare namespace CodeceptJS {
8519
8861
  // @ts-ignore
8520
8862
  // @ts-ignore
8521
8863
  // @ts-ignore
8864
+ // @ts-ignore
8865
+ // @ts-ignore
8866
+ // @ts-ignore
8867
+ // @ts-ignore
8868
+ // @ts-ignore
8869
+ // @ts-ignore
8870
+ // @ts-ignore
8871
+ // @ts-ignore
8872
+ // @ts-ignore
8873
+ // @ts-ignore
8874
+ // @ts-ignore
8875
+ // @ts-ignore
8522
8876
  type RESTConfig = {
8523
8877
  endpoint?: string;
8524
8878
  prettyPrintJson?: boolean;
@@ -8711,6 +9065,250 @@ declare namespace CodeceptJS {
8711
9065
  */
8712
9066
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8713
9067
  }
9068
+ /**
9069
+ * SoftAssertHelper is a utility class for performing soft assertions.
9070
+ * Unlike traditional assertions that stop the execution on failure,
9071
+ * soft assertions allow the execution to continue and report all failures at the end.
9072
+ *
9073
+ * ### Examples
9074
+ *
9075
+ * Zero-configuration when paired with other helpers like REST, Playwright:
9076
+ *
9077
+ * ```js
9078
+ * // inside codecept.conf.js
9079
+ * {
9080
+ * helpers: {
9081
+ * Playwright: {...},
9082
+ * SoftExpectHelper: {},
9083
+ * }
9084
+ * }
9085
+ * ```
9086
+ *
9087
+ * ```js
9088
+ * // in scenario
9089
+ * I.softExpectEqual('a', 'b')
9090
+ * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
9091
+ * ```
9092
+ *
9093
+ * ## Methods
9094
+ */
9095
+ class SoftAssertHelper {
9096
+ /**
9097
+ * Performs a soft assertion by executing the provided assertion function.
9098
+ * If the assertion fails, the error is caught and stored without halting the execution.
9099
+ * @param assertionFn - The assertion function to execute.
9100
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9101
+ */
9102
+ softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
9103
+ /**
9104
+ * Throws an error if any soft assertions have failed.
9105
+ * The error message contains all the accumulated failures.
9106
+ */
9107
+ flushSoftAssertions(): void;
9108
+ /**
9109
+ * Softly asserts that two values are equal.
9110
+ * @param actualValue - The actual value.
9111
+ * @param expectedValue - The expected value.
9112
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9113
+ */
9114
+ softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9115
+ /**
9116
+ * Softly asserts that two values are not equal.
9117
+ * @param actualValue - The actual value.
9118
+ * @param expectedValue - The expected value.
9119
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9120
+ */
9121
+ softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9122
+ /**
9123
+ * Softly asserts that two values are deeply equal.
9124
+ * @param actualValue - The actual value.
9125
+ * @param expectedValue - The expected value.
9126
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9127
+ */
9128
+ softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9129
+ /**
9130
+ * Softly asserts that two values are not deeply equal.
9131
+ * @param actualValue - The actual value.
9132
+ * @param expectedValue - The expected value.
9133
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9134
+ */
9135
+ softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9136
+ /**
9137
+ * Softly asserts that a value contains the expected value.
9138
+ * @param actualValue - The actual value.
9139
+ * @param expectedValueToContain - The value that should be contained within the actual value.
9140
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9141
+ */
9142
+ softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9143
+ /**
9144
+ * Softly asserts that a value does not contain the expected value.
9145
+ * @param actualValue - The actual value.
9146
+ * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9147
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9148
+ */
9149
+ softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9150
+ /**
9151
+ * Softly asserts that a value starts with the expected value.
9152
+ * @param actualValue - The actual value.
9153
+ * @param expectedValueToStartWith - The value that the actual value should start with.
9154
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9155
+ */
9156
+ softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9157
+ /**
9158
+ * Softly asserts that a value does not start with the expected value.
9159
+ * @param actualValue - The actual value.
9160
+ * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9161
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9162
+ */
9163
+ softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9164
+ /**
9165
+ * Softly asserts that a value ends with the expected value.
9166
+ * @param actualValue - The actual value.
9167
+ * @param expectedValueToEndWith - The value that the actual value should end with.
9168
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9169
+ */
9170
+ softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9171
+ /**
9172
+ * Softly asserts that a value does not end with the expected value.
9173
+ * @param actualValue - The actual value.
9174
+ * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9175
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9176
+ */
9177
+ softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9178
+ /**
9179
+ * Softly asserts that the target data matches the given JSON schema.
9180
+ * @param targetData - The data to validate.
9181
+ * @param jsonSchema - The JSON schema to validate against.
9182
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9183
+ */
9184
+ softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9185
+ /**
9186
+ * Softly asserts that the target data matches the given JSON schema using AJV.
9187
+ * @param targetData - The data to validate.
9188
+ * @param jsonSchema - The JSON schema to validate against.
9189
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9190
+ * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9191
+ */
9192
+ softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9193
+ /**
9194
+ * Softly asserts that the target data has the specified property.
9195
+ * @param targetData - The data to check.
9196
+ * @param propertyName - The property name to check for.
9197
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9198
+ * fails.
9199
+ */
9200
+ softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9201
+ /**
9202
+ * Softly asserts that the target data has a property with the specified name.
9203
+ * @param targetData - The data to check.
9204
+ * @param propertyName - The property name to check for.
9205
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9206
+ */
9207
+ softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9208
+ /**
9209
+ * Softly asserts that the target data is of a specific type.
9210
+ * @param targetData - The data to check.
9211
+ * @param type - The expected type (e.g., 'string', 'number').
9212
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9213
+ */
9214
+ softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9215
+ /**
9216
+ * Softly asserts that the target data is of a specific type (alternative for articles).
9217
+ * @param targetData - The data to check.
9218
+ * @param type - The expected type (e.g., 'string', 'number').
9219
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9220
+ */
9221
+ softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9222
+ /**
9223
+ * Softly asserts that the target data has a specified length.
9224
+ * @param targetData - The data to check.
9225
+ * @param length - The expected length.
9226
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9227
+ */
9228
+ softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9229
+ /**
9230
+ * Softly asserts that the target data is empty.
9231
+ * @param targetData - The data to check.
9232
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9233
+ */
9234
+ softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9235
+ /**
9236
+ * Softly asserts that the target data is true.
9237
+ * @param targetData - The data to check.
9238
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9239
+ */
9240
+ softExpectTrue(targetData: any, customErrorMsg?: string): void;
9241
+ /**
9242
+ * Softly asserts that the target data is false.
9243
+ * @param targetData - The data to check.
9244
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9245
+ */
9246
+ softExpectFalse(targetData: any, customErrorMsg?: string): void;
9247
+ /**
9248
+ * Softly asserts that the target data is above a specified value.
9249
+ * @param targetData - The data to check.
9250
+ * @param aboveThan - The value that the target data should be above.
9251
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9252
+ */
9253
+ softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9254
+ /**
9255
+ * Softly asserts that the target data is below a specified value.
9256
+ * @param targetData - The data to check.
9257
+ * @param belowThan - The value that the target data should be below.
9258
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9259
+ */
9260
+ softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9261
+ /**
9262
+ * Softly asserts that the length of the target data is above a specified value.
9263
+ * @param targetData - The data to check.
9264
+ * @param lengthAboveThan - The length that the target data should be above.
9265
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9266
+ */
9267
+ softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9268
+ /**
9269
+ * Softly asserts that the length of the target data is below a specified value.
9270
+ * @param targetData - The data to check.
9271
+ * @param lengthBelowThan - The length that the target data should be below.
9272
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9273
+ */
9274
+ softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9275
+ /**
9276
+ * Softly asserts that two values are equal, ignoring case.
9277
+ * @param actualValue - The actual string value.
9278
+ * @param expectedValue - The expected string value.
9279
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9280
+ */
9281
+ softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9282
+ /**
9283
+ * Softly asserts that two arrays have deep equality, considering members in any order.
9284
+ * @param actualValue - The actual array.
9285
+ * @param expectedValue - The expected array.
9286
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9287
+ */
9288
+ softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9289
+ /**
9290
+ * Softly asserts that an array (superset) deeply includes all members of another array (set).
9291
+ * @param superset - The array that should contain the expected members.
9292
+ * @param set - The array with members that should be included.
9293
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9294
+ */
9295
+ softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9296
+ /**
9297
+ * Softly asserts that two objects are deeply equal, excluding specified fields.
9298
+ * @param actualValue - The actual object.
9299
+ * @param expectedValue - The expected object.
9300
+ * @param fieldsToExclude - The fields to exclude from the comparison.
9301
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9302
+ */
9303
+ softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9304
+ /**
9305
+ * Softly asserts that a value matches the expected pattern.
9306
+ * @param actualValue - The actual value.
9307
+ * @param expectedPattern - The pattern the value should match.
9308
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9309
+ */
9310
+ softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9311
+ }
8714
9312
  /**
8715
9313
  * Client Functions
8716
9314
  */
@@ -9730,6 +10328,18 @@ declare namespace CodeceptJS {
9730
10328
  // @ts-ignore
9731
10329
  // @ts-ignore
9732
10330
  // @ts-ignore
10331
+ // @ts-ignore
10332
+ // @ts-ignore
10333
+ // @ts-ignore
10334
+ // @ts-ignore
10335
+ // @ts-ignore
10336
+ // @ts-ignore
10337
+ // @ts-ignore
10338
+ // @ts-ignore
10339
+ // @ts-ignore
10340
+ // @ts-ignore
10341
+ // @ts-ignore
10342
+ // @ts-ignore
9733
10343
  type WebDriverConfig = {
9734
10344
  url: string;
9735
10345
  browser: string;
@@ -12165,24 +12775,49 @@ declare namespace CodeceptJS {
12165
12775
  function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
12166
12776
  [key: string]: any;
12167
12777
  }, fn?: (...params: any[]) => any): any;
12778
+ /**
12779
+ * StepConfig is a configuration object for a step.
12780
+ * It is used to create a new step that is a combination of other steps.
12781
+ */
12782
+ class StepConfig {
12783
+ config: any;
12784
+ /**
12785
+ * Set the options for the step.
12786
+ * @param opts - The options for the step.
12787
+ * @returns - The step configuration object.
12788
+ */
12789
+ opts(opts: any): StepConfig;
12790
+ /**
12791
+ * Set the timeout for the step.
12792
+ * @param timeout - The timeout for the step.
12793
+ * @returns - The step configuration object.
12794
+ */
12795
+ timeout(timeout: number): StepConfig;
12796
+ /**
12797
+ * Set the retry for the step.
12798
+ * @param retry - The retry for the step.
12799
+ * @returns - The step configuration object.
12800
+ */
12801
+ retry(retry: number): StepConfig;
12802
+ }
12168
12803
  /**
12169
12804
  * Each command in test executed through `I.` object is wrapped in Step.
12170
12805
  * Step allows logging executed commands and triggers hook before and after step execution.
12171
12806
  */
12172
12807
  class Step {
12173
- constructor(helper: CodeceptJS.Helper, name: string);
12174
- actor: string;
12175
- helper: CodeceptJS.Helper;
12808
+ constructor(name: string);
12176
12809
  name: string;
12810
+ timeouts: Map<number, number>;
12811
+ args: any[];
12812
+ opts: Record<string, any>;
12813
+ actor: string;
12177
12814
  helperMethod: string;
12178
12815
  status: string;
12179
- suffix: string;
12180
12816
  prefix: string;
12181
12817
  comment: string;
12182
- args: any[];
12183
- metaStep: MetaStep;
12818
+ metaStep: any;
12184
12819
  stack: string;
12185
- getTimeout(): number | undefined;
12820
+ timeout: any;
12186
12821
  /**
12187
12822
  * @param timeout - timeout in milliseconds or 0 if no timeout
12188
12823
  * @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
@@ -12191,7 +12826,6 @@ declare namespace CodeceptJS {
12191
12826
  setTimeout(timeout: number, order: number): void;
12192
12827
  setTrace(): void;
12193
12828
  setArguments(args: any[]): void;
12194
- run(...args: any[]): any;
12195
12829
  setStatus(status: string): void;
12196
12830
  humanize(): string;
12197
12831
  humanizeArgs(): string;
@@ -12200,11 +12834,6 @@ declare namespace CodeceptJS {
12200
12834
  toCliStyled(): string;
12201
12835
  toCode(): string;
12202
12836
  hasBDDAncestor(): boolean;
12203
- static MetaStep: typeof MetaStep;
12204
- }
12205
- class MetaStep extends Step {
12206
- isBDD(): boolean;
12207
- run(): any;
12208
12837
  }
12209
12838
  /**
12210
12839
  * global values for current session
@@ -12213,7 +12842,9 @@ declare namespace CodeceptJS {
12213
12842
  var debugMode: boolean;
12214
12843
  var timeouts: boolean;
12215
12844
  var dryRun: boolean;
12845
+ var onPause: boolean;
12216
12846
  var currentTest: CodeceptJS.Test | null;
12847
+ var currentStep: any;
12217
12848
  }
12218
12849
  /**
12219
12850
  * Describe a "suite" with the given `title`
@@ -12240,6 +12871,10 @@ declare namespace CodeceptJS {
12240
12871
  * Can inject values and add custom configuration.
12241
12872
  */
12242
12873
  class FeatureConfig {
12874
+ /**
12875
+ * Set metadata for this suite
12876
+ */
12877
+ meta(key: string, value: string): this;
12243
12878
  /**
12244
12879
  * Retry this test for number of times
12245
12880
  */
@@ -12274,6 +12909,10 @@ declare namespace CodeceptJS {
12274
12909
  * Retry this test for x times
12275
12910
  */
12276
12911
  retry(retries: number): this;
12912
+ /**
12913
+ * Set metadata for this test
12914
+ */
12915
+ meta(key: string, value: string): this;
12277
12916
  /**
12278
12917
  * Set timeout for this test
12279
12918
  */
@@ -12906,22 +13545,12 @@ declare namespace CodeceptJS {
12906
13545
  }
12907
13546
 
12908
13547
  /**
12909
- * timeouts set with order below zero only override timeouts of higher order if their value is smaller
12910
- */
12911
- declare var testOrSuite: any;
12912
-
12913
- /**
12914
- * 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
12915
- */
12916
- declare var stepTimeoutHard: any;
12917
-
12918
- /**
12919
- * 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
13548
+ * corresponding helper
12920
13549
  */
12921
- declare var codeLimitTime: any;
13550
+ declare var helper: CodeceptJS.Helper;
12922
13551
 
12923
13552
  /**
12924
- * 20-29 - designated for timeout settings which could be overriden in tests code, 25 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=false
13553
+ * name of method to be executed
12925
13554
  */
12926
- declare var stepTimeoutSoft: any;
13555
+ declare var helperMethod: string;
12927
13556