codeceptjs 3.7.0-beta.4 → 3.7.0-beta.6

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 (47) hide show
  1. package/README.md +9 -10
  2. package/bin/codecept.js +7 -0
  3. package/lib/actor.js +47 -92
  4. package/lib/command/check.js +173 -0
  5. package/lib/command/definitions.js +2 -0
  6. package/lib/command/run-workers.js +1 -1
  7. package/lib/command/workers/runTests.js +112 -109
  8. package/lib/container.js +9 -0
  9. package/lib/effects.js +218 -0
  10. package/lib/heal.js +10 -0
  11. package/lib/helper/Appium.js +27 -16
  12. package/lib/helper/Playwright.js +15 -0
  13. package/lib/helper/Puppeteer.js +5 -0
  14. package/lib/helper/WebDriver.js +9 -1
  15. package/lib/listener/emptyRun.js +2 -5
  16. package/lib/listener/globalTimeout.js +15 -3
  17. package/lib/listener/steps.js +3 -0
  18. package/lib/mocha/cli.js +22 -5
  19. package/lib/mocha/featureConfig.js +13 -0
  20. package/lib/mocha/scenarioConfig.js +11 -0
  21. package/lib/mocha/test.js +15 -0
  22. package/lib/mocha/types.d.ts +6 -0
  23. package/lib/output.js +74 -73
  24. package/lib/pause.js +3 -7
  25. package/lib/plugin/heal.js +30 -0
  26. package/lib/plugin/retryTo.js +18 -126
  27. package/lib/plugin/stepTimeout.js +1 -1
  28. package/lib/plugin/tryTo.js +13 -111
  29. package/lib/recorder.js +1 -1
  30. package/lib/step/base.js +180 -0
  31. package/lib/step/config.js +50 -0
  32. package/lib/step/helper.js +47 -0
  33. package/lib/step/meta.js +91 -0
  34. package/lib/step/record.js +74 -0
  35. package/lib/step/retry.js +11 -0
  36. package/lib/step/timeout.js +42 -0
  37. package/lib/step.js +15 -348
  38. package/lib/steps.js +23 -0
  39. package/lib/store.js +2 -0
  40. package/lib/utils.js +58 -0
  41. package/lib/within.js +2 -2
  42. package/lib/workers.js +2 -12
  43. package/package.json +9 -7
  44. package/typings/index.d.ts +5 -4
  45. package/typings/promiseBasedTypes.d.ts +520 -6
  46. package/typings/types.d.ts +562 -44
  47. package/lib/step/section.js +0 -25
@@ -1203,6 +1203,242 @@ declare namespace CodeceptJS {
1203
1203
  */
1204
1204
  waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
1205
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
+ class ExpectHelper {
1233
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1234
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1235
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1236
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1237
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1238
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1239
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1240
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1241
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1242
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1243
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1244
+ /**
1245
+ * @param [ajvOptions] - Pass AJV options
1246
+ */
1247
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1248
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1249
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1250
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1251
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1252
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1253
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1254
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1255
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1256
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1257
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1258
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1259
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1260
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1261
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1262
+ /**
1263
+ * expects members of two arrays are deeply equal
1264
+ */
1265
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1266
+ /**
1267
+ * expects an array to be a superset of another array
1268
+ */
1269
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1270
+ /**
1271
+ * expects members of two JSON objects are deeply equal excluding some properties
1272
+ */
1273
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1274
+ /**
1275
+ * expects a JSON object matches a provided pattern
1276
+ */
1277
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1278
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1279
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1280
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1281
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1282
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1283
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1284
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1285
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1286
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1287
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1288
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1289
+ /**
1290
+ * @param [ajvOptions] - Pass AJV options
1291
+ */
1292
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1293
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1294
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1295
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1296
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1297
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1298
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1299
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1300
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1301
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1302
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1303
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1304
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1305
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1306
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1307
+ /**
1308
+ * expects members of two arrays are deeply equal
1309
+ */
1310
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1311
+ /**
1312
+ * expects an array to be a superset of another array
1313
+ */
1314
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1315
+ /**
1316
+ * expects members of two JSON objects are deeply equal excluding some properties
1317
+ */
1318
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1319
+ /**
1320
+ * expects a JSON object matches a provided pattern
1321
+ */
1322
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1323
+ }
1324
+ /**
1325
+ * This helper allows performing assertions based on Chai.
1326
+ *
1327
+ * ### Examples
1328
+ *
1329
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1330
+ *
1331
+ * ```js
1332
+ * // inside codecept.conf.js
1333
+ * {
1334
+ * helpers: {
1335
+ * Playwright: {...},
1336
+ * ExpectHelper: {},
1337
+ * }
1338
+ * }
1339
+ * ```
1340
+ *
1341
+ * ## Methods
1342
+ */
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): void;
1352
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1353
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1354
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1355
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1356
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1357
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1358
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1359
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1360
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1361
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1362
+ /**
1363
+ * @param [ajvOptions] - Pass AJV options
1364
+ */
1365
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1366
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1367
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1368
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1369
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1370
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1371
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1372
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1373
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1374
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1375
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1376
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1377
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1378
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1379
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1380
+ /**
1381
+ * expects members of two arrays are deeply equal
1382
+ */
1383
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1384
+ /**
1385
+ * expects an array to be a superset of another array
1386
+ */
1387
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
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): void;
1392
+ /**
1393
+ * expects a JSON object matches a provided pattern
1394
+ */
1395
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1396
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1397
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1398
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1399
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1400
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1401
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1402
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1403
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1404
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1405
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1406
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1407
+ /**
1408
+ * @param [ajvOptions] - Pass AJV options
1409
+ */
1410
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1411
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1412
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1413
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1414
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1415
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1416
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1417
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1418
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1419
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1420
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1421
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1422
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1423
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1424
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1425
+ /**
1426
+ * expects members of two arrays are deeply equal
1427
+ */
1428
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1429
+ /**
1430
+ * expects an array to be a superset of another array
1431
+ */
1432
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
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): void;
1437
+ /**
1438
+ * expects a JSON object matches a provided pattern
1439
+ */
1440
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1441
+ }
1206
1442
  /**
1207
1443
  * Helper for testing filesystem.
1208
1444
  * Can be easily used to check file structures:
@@ -1793,7 +2029,6 @@ declare namespace CodeceptJS {
1793
2029
  // @ts-ignore
1794
2030
  // @ts-ignore
1795
2031
  // @ts-ignore
1796
- // @ts-ignore
1797
2032
  type MockServerConfig = {
1798
2033
  port?: number;
1799
2034
  host?: string;
@@ -1925,7 +2160,6 @@ declare namespace CodeceptJS {
1925
2160
  // @ts-ignore
1926
2161
  // @ts-ignore
1927
2162
  // @ts-ignore
1928
- // @ts-ignore
1929
2163
  class MockServer {
1930
2164
  /**
1931
2165
  * Start the mock server
@@ -2981,6 +3215,46 @@ declare namespace CodeceptJS {
2981
3215
  */
2982
3216
  grabPageScrollPosition(): Promise<PageScrollPosition>;
2983
3217
  }
3218
+ /**
3219
+ * OpenAI Helper for CodeceptJS.
3220
+ *
3221
+ * 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.
3222
+ * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3223
+ *
3224
+ * ## Configuration
3225
+ *
3226
+ * This helper should be configured in codecept.json or codecept.conf.js
3227
+ *
3228
+ * * `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.
3229
+ */
3230
+ class OpenAI {
3231
+ /**
3232
+ * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3233
+ *
3234
+ * ```js
3235
+ * I.askGptOnPage('what does this page do?');
3236
+ * ```
3237
+ * @param prompt - The question or prompt to ask the GPT model.
3238
+ * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3239
+ */
3240
+ askGptOnPage(prompt: string): Promise<string>;
3241
+ /**
3242
+ * 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.
3243
+ *
3244
+ * ```js
3245
+ * I.askGptOnPageFragment('describe features of this screen', '.screen');
3246
+ * ```
3247
+ * @param prompt - The question or prompt to ask the GPT-3.5 model.
3248
+ * @param locator - The locator or selector used to identify the HTML fragment on the page.
3249
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3250
+ */
3251
+ askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3252
+ /**
3253
+ * Send a general request to ChatGPT and return response.
3254
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3255
+ */
3256
+ askGptGeneralPrompt(prompt: string): Promise<string>;
3257
+ }
2984
3258
  /**
2985
3259
  * ## Configuration
2986
3260
  *
@@ -3032,7 +3306,6 @@ declare namespace CodeceptJS {
3032
3306
  // @ts-ignore
3033
3307
  // @ts-ignore
3034
3308
  // @ts-ignore
3035
- // @ts-ignore
3036
3309
  type PlaywrightConfig = {
3037
3310
  url?: string;
3038
3311
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6567,7 +6840,6 @@ declare namespace CodeceptJS {
6567
6840
  // @ts-ignore
6568
6841
  // @ts-ignore
6569
6842
  // @ts-ignore
6570
- // @ts-ignore
6571
6843
  type PuppeteerConfig = {
6572
6844
  url: string;
6573
6845
  basicAuth?: any;
@@ -8517,7 +8789,6 @@ declare namespace CodeceptJS {
8517
8789
  // @ts-ignore
8518
8790
  // @ts-ignore
8519
8791
  // @ts-ignore
8520
- // @ts-ignore
8521
8792
  type RESTConfig = {
8522
8793
  endpoint?: string;
8523
8794
  prettyPrintJson?: boolean;
@@ -8710,6 +8981,250 @@ declare namespace CodeceptJS {
8710
8981
  */
8711
8982
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8712
8983
  }
8984
+ /**
8985
+ * SoftAssertHelper is a utility class for performing soft assertions.
8986
+ * Unlike traditional assertions that stop the execution on failure,
8987
+ * soft assertions allow the execution to continue and report all failures at the end.
8988
+ *
8989
+ * ### Examples
8990
+ *
8991
+ * Zero-configuration when paired with other helpers like REST, Playwright:
8992
+ *
8993
+ * ```js
8994
+ * // inside codecept.conf.js
8995
+ * {
8996
+ * helpers: {
8997
+ * Playwright: {...},
8998
+ * SoftExpectHelper: {},
8999
+ * }
9000
+ * }
9001
+ * ```
9002
+ *
9003
+ * ```js
9004
+ * // in scenario
9005
+ * I.softExpectEqual('a', 'b')
9006
+ * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
9007
+ * ```
9008
+ *
9009
+ * ## Methods
9010
+ */
9011
+ class SoftAssertHelper {
9012
+ /**
9013
+ * Performs a soft assertion by executing the provided assertion function.
9014
+ * If the assertion fails, the error is caught and stored without halting the execution.
9015
+ * @param assertionFn - The assertion function to execute.
9016
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9017
+ */
9018
+ softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
9019
+ /**
9020
+ * Throws an error if any soft assertions have failed.
9021
+ * The error message contains all the accumulated failures.
9022
+ */
9023
+ flushSoftAssertions(): void;
9024
+ /**
9025
+ * Softly asserts that two values are equal.
9026
+ * @param actualValue - The actual value.
9027
+ * @param expectedValue - The expected value.
9028
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9029
+ */
9030
+ softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9031
+ /**
9032
+ * Softly asserts that two values are not equal.
9033
+ * @param actualValue - The actual value.
9034
+ * @param expectedValue - The expected value.
9035
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9036
+ */
9037
+ softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9038
+ /**
9039
+ * Softly asserts that two values are deeply equal.
9040
+ * @param actualValue - The actual value.
9041
+ * @param expectedValue - The expected value.
9042
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9043
+ */
9044
+ softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9045
+ /**
9046
+ * Softly asserts that two values are not deeply equal.
9047
+ * @param actualValue - The actual value.
9048
+ * @param expectedValue - The expected value.
9049
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9050
+ */
9051
+ softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9052
+ /**
9053
+ * Softly asserts that a value contains the expected value.
9054
+ * @param actualValue - The actual value.
9055
+ * @param expectedValueToContain - The value that should be contained within the actual value.
9056
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9057
+ */
9058
+ softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9059
+ /**
9060
+ * Softly asserts that a value does not contain the expected value.
9061
+ * @param actualValue - The actual value.
9062
+ * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9063
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9064
+ */
9065
+ softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9066
+ /**
9067
+ * Softly asserts that a value starts with the expected value.
9068
+ * @param actualValue - The actual value.
9069
+ * @param expectedValueToStartWith - The value that the actual value should start with.
9070
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9071
+ */
9072
+ softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9073
+ /**
9074
+ * Softly asserts that a value does not start with the expected value.
9075
+ * @param actualValue - The actual value.
9076
+ * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9077
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9078
+ */
9079
+ softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9080
+ /**
9081
+ * Softly asserts that a value ends with the expected value.
9082
+ * @param actualValue - The actual value.
9083
+ * @param expectedValueToEndWith - The value that the actual value should end with.
9084
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9085
+ */
9086
+ softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9087
+ /**
9088
+ * Softly asserts that a value does not end with the expected value.
9089
+ * @param actualValue - The actual value.
9090
+ * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9091
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9092
+ */
9093
+ softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9094
+ /**
9095
+ * Softly asserts that the target data matches the given JSON schema.
9096
+ * @param targetData - The data to validate.
9097
+ * @param jsonSchema - The JSON schema to validate against.
9098
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9099
+ */
9100
+ softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9101
+ /**
9102
+ * Softly asserts that the target data matches the given JSON schema using AJV.
9103
+ * @param targetData - The data to validate.
9104
+ * @param jsonSchema - The JSON schema to validate against.
9105
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9106
+ * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9107
+ */
9108
+ softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9109
+ /**
9110
+ * Softly asserts that the target data has the specified property.
9111
+ * @param targetData - The data to check.
9112
+ * @param propertyName - The property name to check for.
9113
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9114
+ * fails.
9115
+ */
9116
+ softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9117
+ /**
9118
+ * Softly asserts that the target data has a property with the specified name.
9119
+ * @param targetData - The data to check.
9120
+ * @param propertyName - The property name to check for.
9121
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9122
+ */
9123
+ softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9124
+ /**
9125
+ * Softly asserts that the target data is of a specific type.
9126
+ * @param targetData - The data to check.
9127
+ * @param type - The expected type (e.g., 'string', 'number').
9128
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9129
+ */
9130
+ softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9131
+ /**
9132
+ * Softly asserts that the target data is of a specific type (alternative for articles).
9133
+ * @param targetData - The data to check.
9134
+ * @param type - The expected type (e.g., 'string', 'number').
9135
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9136
+ */
9137
+ softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9138
+ /**
9139
+ * Softly asserts that the target data has a specified length.
9140
+ * @param targetData - The data to check.
9141
+ * @param length - The expected length.
9142
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9143
+ */
9144
+ softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9145
+ /**
9146
+ * Softly asserts that the target data is empty.
9147
+ * @param targetData - The data to check.
9148
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9149
+ */
9150
+ softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9151
+ /**
9152
+ * Softly asserts that the target data is true.
9153
+ * @param targetData - The data to check.
9154
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9155
+ */
9156
+ softExpectTrue(targetData: any, customErrorMsg?: string): void;
9157
+ /**
9158
+ * Softly asserts that the target data is false.
9159
+ * @param targetData - The data to check.
9160
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9161
+ */
9162
+ softExpectFalse(targetData: any, customErrorMsg?: string): void;
9163
+ /**
9164
+ * Softly asserts that the target data is above a specified value.
9165
+ * @param targetData - The data to check.
9166
+ * @param aboveThan - The value that the target data should be above.
9167
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9168
+ */
9169
+ softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9170
+ /**
9171
+ * Softly asserts that the target data is below a specified value.
9172
+ * @param targetData - The data to check.
9173
+ * @param belowThan - The value that the target data should be below.
9174
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9175
+ */
9176
+ softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9177
+ /**
9178
+ * Softly asserts that the length of the target data is above a specified value.
9179
+ * @param targetData - The data to check.
9180
+ * @param lengthAboveThan - The length that the target data should be above.
9181
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9182
+ */
9183
+ softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9184
+ /**
9185
+ * Softly asserts that the length of the target data is below a specified value.
9186
+ * @param targetData - The data to check.
9187
+ * @param lengthBelowThan - The length that the target data should be below.
9188
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9189
+ */
9190
+ softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9191
+ /**
9192
+ * Softly asserts that two values are equal, ignoring case.
9193
+ * @param actualValue - The actual string value.
9194
+ * @param expectedValue - The expected string value.
9195
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9196
+ */
9197
+ softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9198
+ /**
9199
+ * Softly asserts that two arrays have deep equality, considering members in any order.
9200
+ * @param actualValue - The actual array.
9201
+ * @param expectedValue - The expected array.
9202
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9203
+ */
9204
+ softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9205
+ /**
9206
+ * Softly asserts that an array (superset) deeply includes all members of another array (set).
9207
+ * @param superset - The array that should contain the expected members.
9208
+ * @param set - The array with members that should be included.
9209
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9210
+ */
9211
+ softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9212
+ /**
9213
+ * Softly asserts that two objects are deeply equal, excluding specified fields.
9214
+ * @param actualValue - The actual object.
9215
+ * @param expectedValue - The expected object.
9216
+ * @param fieldsToExclude - The fields to exclude from the comparison.
9217
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9218
+ */
9219
+ softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9220
+ /**
9221
+ * Softly asserts that a value matches the expected pattern.
9222
+ * @param actualValue - The actual value.
9223
+ * @param expectedPattern - The pattern the value should match.
9224
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9225
+ */
9226
+ softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9227
+ }
8713
9228
  /**
8714
9229
  * Client Functions
8715
9230
  */
@@ -9729,7 +10244,6 @@ declare namespace CodeceptJS {
9729
10244
  // @ts-ignore
9730
10245
  // @ts-ignore
9731
10246
  // @ts-ignore
9732
- // @ts-ignore
9733
10247
  type WebDriverConfig = {
9734
10248
  url: string;
9735
10249
  browser: string;
@@ -11832,7 +12346,7 @@ declare namespace CodeceptJS {
11832
12346
  }, newPlugins: {
11833
12347
  [key: string]: any;
11834
12348
  }): void;
11835
- static started(fn: (...params: any[]) => any): Promise<void>;
12349
+ static started(fn: ((...params: any[]) => any) | null): Promise<void>;
11836
12350
  /**
11837
12351
  * Share data across worker threads
11838
12352
  * @param options - set {local: true} to not share among workers
@@ -12089,6 +12603,20 @@ declare namespace CodeceptJS {
12089
12603
  function pause(passedObject?: {
12090
12604
  [key: string]: any;
12091
12605
  }): void;
12606
+ /**
12607
+ * Creates a debug logger for a given namespace and optionally logs messages.
12608
+ * @example
12609
+ * // Log a message immediately
12610
+ * debugLog('codeceptjs:pause', 'This is a pause debug message.');
12611
+ * @example
12612
+ * // Create a reusable logger
12613
+ * const logger = debugLog('app:module');
12614
+ * logger('This is a reusable log for app:module.');
12615
+ * @param namespace - The namespace to use for the debug logger.
12616
+ * @param args - Additional arguments to log immediately.
12617
+ * @returns The debug logger instance for the given namespace.
12618
+ */
12619
+ function debugLog(namespace: string, ...args: any[]): (...params: any[]) => any;
12092
12620
  /**
12093
12621
  * Singleton object to record all test steps as promises and run them in chain.
12094
12622
  */
@@ -12165,49 +12693,24 @@ declare namespace CodeceptJS {
12165
12693
  function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
12166
12694
  [key: string]: any;
12167
12695
  }, fn?: (...params: any[]) => any): any;
12168
- /**
12169
- * StepConfig is a configuration object for a step.
12170
- * It is used to create a new step that is a combination of other steps.
12171
- */
12172
- class StepConfig {
12173
- config: any;
12174
- /**
12175
- * Set the options for the step.
12176
- * @param opts - The options for the step.
12177
- * @returns - The step configuration object.
12178
- */
12179
- opts(opts: any): StepConfig;
12180
- /**
12181
- * Set the timeout for the step.
12182
- * @param timeout - The timeout for the step.
12183
- * @returns - The step configuration object.
12184
- */
12185
- timeout(timeout: number): StepConfig;
12186
- /**
12187
- * Set the retry for the step.
12188
- * @param retry - The retry for the step.
12189
- * @returns - The step configuration object.
12190
- */
12191
- retry(retry: number): StepConfig;
12192
- }
12193
12696
  /**
12194
12697
  * Each command in test executed through `I.` object is wrapped in Step.
12195
12698
  * Step allows logging executed commands and triggers hook before and after step execution.
12196
12699
  */
12197
12700
  class Step {
12198
- constructor(name: string);
12199
- name: string;
12200
- timeouts: Map<number, number>;
12201
- args: any[];
12202
- opts: Record<string, any>;
12701
+ constructor(helper: CodeceptJS.Helper, name: string);
12203
12702
  actor: string;
12703
+ helper: CodeceptJS.Helper;
12704
+ name: string;
12204
12705
  helperMethod: string;
12205
12706
  status: string;
12707
+ suffix: string;
12206
12708
  prefix: string;
12207
12709
  comment: string;
12208
- metaStep: any;
12710
+ args: any[];
12711
+ metaStep: MetaStep;
12209
12712
  stack: string;
12210
- timeout: any;
12713
+ getTimeout(): number | undefined;
12211
12714
  /**
12212
12715
  * @param timeout - timeout in milliseconds or 0 if no timeout
12213
12716
  * @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
@@ -12216,6 +12719,7 @@ declare namespace CodeceptJS {
12216
12719
  setTimeout(timeout: number, order: number): void;
12217
12720
  setTrace(): void;
12218
12721
  setArguments(args: any[]): void;
12722
+ run(...args: any[]): any;
12219
12723
  setStatus(status: string): void;
12220
12724
  humanize(): string;
12221
12725
  humanizeArgs(): string;
@@ -12224,6 +12728,11 @@ declare namespace CodeceptJS {
12224
12728
  toCliStyled(): string;
12225
12729
  toCode(): string;
12226
12730
  hasBDDAncestor(): boolean;
12731
+ static MetaStep: typeof MetaStep;
12732
+ }
12733
+ class MetaStep extends Step {
12734
+ isBDD(): boolean;
12735
+ run(): any;
12227
12736
  }
12228
12737
  /**
12229
12738
  * global values for current session
@@ -12234,7 +12743,6 @@ declare namespace CodeceptJS {
12234
12743
  var dryRun: boolean;
12235
12744
  var onPause: boolean;
12236
12745
  var currentTest: CodeceptJS.Test | null;
12237
- var currentStep: any;
12238
12746
  }
12239
12747
  /**
12240
12748
  * Describe a "suite" with the given `title`
@@ -12927,12 +13435,22 @@ declare namespace CodeceptJS {
12927
13435
  }
12928
13436
 
12929
13437
  /**
12930
- * corresponding helper
13438
+ * timeouts set with order below zero only override timeouts of higher order if their value is smaller
13439
+ */
13440
+ declare var testOrSuite: any;
13441
+
13442
+ /**
13443
+ * 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
13444
+ */
13445
+ declare var stepTimeoutHard: any;
13446
+
13447
+ /**
13448
+ * 10-19 - designated for timeouts set from code, 15 is order of I.setTimeout(t) operation
12931
13449
  */
12932
- declare var helper: CodeceptJS.Helper;
13450
+ declare var codeLimitTime: any;
12933
13451
 
12934
13452
  /**
12935
- * name of method to be executed
13453
+ * 20-29 - designated for timeout settings which could be overriden in tests code, 25 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=false
12936
13454
  */
12937
- declare var helperMethod: string;
13455
+ declare var stepTimeoutSoft: any;
12938
13456