codeceptjs 3.7.0-beta.7 → 3.7.0-beta.8

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 (45) hide show
  1. package/lib/actor.js +1 -2
  2. package/lib/ai.js +130 -121
  3. package/lib/codecept.js +4 -4
  4. package/lib/command/check.js +4 -0
  5. package/lib/command/run-workers.js +1 -53
  6. package/lib/command/workers/runTests.js +25 -189
  7. package/lib/container.js +16 -0
  8. package/lib/event.js +18 -17
  9. package/lib/listener/exit.js +5 -8
  10. package/lib/listener/globalTimeout.js +26 -9
  11. package/lib/listener/result.js +12 -0
  12. package/lib/listener/steps.js +0 -6
  13. package/lib/mocha/asyncWrapper.js +12 -2
  14. package/lib/mocha/cli.js +50 -24
  15. package/lib/mocha/hooks.js +32 -3
  16. package/lib/mocha/suite.js +27 -1
  17. package/lib/mocha/test.js +91 -7
  18. package/lib/mocha/types.d.ts +5 -0
  19. package/lib/output.js +1 -0
  20. package/lib/plugin/analyze.js +351 -0
  21. package/lib/plugin/commentStep.js +5 -0
  22. package/lib/plugin/customReporter.js +52 -0
  23. package/lib/plugin/heal.js +2 -2
  24. package/lib/plugin/pageInfo.js +143 -0
  25. package/lib/plugin/retryTo.js +10 -2
  26. package/lib/plugin/screenshotOnFail.js +4 -6
  27. package/lib/plugin/stepTimeout.js +1 -1
  28. package/lib/plugin/tryTo.js +9 -1
  29. package/lib/recorder.js +4 -4
  30. package/lib/rerun.js +43 -42
  31. package/lib/result.js +161 -0
  32. package/lib/step/base.js +52 -4
  33. package/lib/step/helper.js +3 -0
  34. package/lib/step/meta.js +9 -1
  35. package/lib/step/record.js +5 -5
  36. package/lib/step/section.js +55 -0
  37. package/lib/steps.js +28 -1
  38. package/lib/{step/timeout.js → timeout.js} +24 -0
  39. package/lib/utils.js +35 -0
  40. package/lib/workers.js +28 -38
  41. package/package.json +2 -2
  42. package/typings/promiseBasedTypes.d.ts +12 -518
  43. package/typings/types.d.ts +75 -518
  44. package/lib/listener/artifacts.js +0 -19
  45. package/lib/plugin/debugErrors.js +0 -67
@@ -1203,240 +1203,6 @@ 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
- class ExpectHelper {
1232
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1233
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1234
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1235
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1236
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1237
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1238
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1239
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1240
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1241
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1242
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1243
- /**
1244
- * @param [ajvOptions] - Pass AJV options
1245
- */
1246
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1247
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1248
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1249
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1250
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1251
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1252
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1253
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1254
- expectTrue(targetData: any, customErrorMsg?: any): void;
1255
- expectFalse(targetData: any, customErrorMsg?: any): void;
1256
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1257
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1258
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1259
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1260
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1261
- /**
1262
- * expects members of two arrays are deeply equal
1263
- */
1264
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1265
- /**
1266
- * expects an array to be a superset of another array
1267
- */
1268
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1269
- /**
1270
- * expects members of two JSON objects are deeply equal excluding some properties
1271
- */
1272
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1273
- /**
1274
- * expects a JSON object matches a provided pattern
1275
- */
1276
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1277
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1278
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1279
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1280
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1281
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1282
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1283
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1284
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1285
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1286
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1287
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1288
- /**
1289
- * @param [ajvOptions] - Pass AJV options
1290
- */
1291
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1292
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1293
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1294
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1295
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1296
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1297
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1298
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1299
- expectTrue(targetData: any, customErrorMsg?: any): void;
1300
- expectFalse(targetData: any, customErrorMsg?: any): void;
1301
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1302
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1303
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1304
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1305
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1306
- /**
1307
- * expects members of two arrays are deeply equal
1308
- */
1309
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1310
- /**
1311
- * expects an array to be a superset of another array
1312
- */
1313
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1314
- /**
1315
- * expects members of two JSON objects are deeply equal excluding some properties
1316
- */
1317
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1318
- /**
1319
- * expects a JSON object matches a provided pattern
1320
- */
1321
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1322
- }
1323
- /**
1324
- * This helper allows performing assertions based on Chai.
1325
- *
1326
- * ### Examples
1327
- *
1328
- * Zero-configuration when paired with other helpers like REST, Playwright:
1329
- *
1330
- * ```js
1331
- * // inside codecept.conf.js
1332
- * {
1333
- * helpers: {
1334
- * Playwright: {...},
1335
- * ExpectHelper: {},
1336
- * }
1337
- * }
1338
- * ```
1339
- *
1340
- * ## Methods
1341
- */
1342
- // @ts-ignore
1343
- // @ts-ignore
1344
- // @ts-ignore
1345
- // @ts-ignore
1346
- // @ts-ignore
1347
- // @ts-ignore
1348
- class ExpectHelper {
1349
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1350
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1351
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1352
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1353
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1354
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1355
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1356
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1357
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1358
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1359
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1360
- /**
1361
- * @param [ajvOptions] - Pass AJV options
1362
- */
1363
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1364
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1365
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1366
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1367
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1368
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1369
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1370
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1371
- expectTrue(targetData: any, customErrorMsg?: any): void;
1372
- expectFalse(targetData: any, customErrorMsg?: any): void;
1373
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1374
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1375
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1376
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1377
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1378
- /**
1379
- * expects members of two arrays are deeply equal
1380
- */
1381
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1382
- /**
1383
- * expects an array to be a superset of another array
1384
- */
1385
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1386
- /**
1387
- * expects members of two JSON objects are deeply equal excluding some properties
1388
- */
1389
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1390
- /**
1391
- * expects a JSON object matches a provided pattern
1392
- */
1393
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1394
- expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1395
- expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1396
- expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1397
- expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1398
- expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1399
- expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1400
- expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1401
- expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1402
- expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1403
- expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1404
- expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1405
- /**
1406
- * @param [ajvOptions] - Pass AJV options
1407
- */
1408
- expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1409
- expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1410
- expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1411
- expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1412
- expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1413
- expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1414
- expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1415
- expectEmpty(targetData: any, customErrorMsg?: any): void;
1416
- expectTrue(targetData: any, customErrorMsg?: any): void;
1417
- expectFalse(targetData: any, customErrorMsg?: any): void;
1418
- expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1419
- expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1420
- expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1421
- expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1422
- expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1423
- /**
1424
- * expects members of two arrays are deeply equal
1425
- */
1426
- expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1427
- /**
1428
- * expects an array to be a superset of another array
1429
- */
1430
- expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1431
- /**
1432
- * expects members of two JSON objects are deeply equal excluding some properties
1433
- */
1434
- expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1435
- /**
1436
- * expects a JSON object matches a provided pattern
1437
- */
1438
- expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1439
- }
1440
1206
  /**
1441
1207
  * Helper for testing filesystem.
1442
1208
  * Can be easily used to check file structures:
@@ -2026,6 +1792,8 @@ declare namespace CodeceptJS {
2026
1792
  // @ts-ignore
2027
1793
  // @ts-ignore
2028
1794
  // @ts-ignore
1795
+ // @ts-ignore
1796
+ // @ts-ignore
2029
1797
  type MockServerConfig = {
2030
1798
  port?: number;
2031
1799
  host?: string;
@@ -2156,6 +1924,8 @@ declare namespace CodeceptJS {
2156
1924
  // @ts-ignore
2157
1925
  // @ts-ignore
2158
1926
  // @ts-ignore
1927
+ // @ts-ignore
1928
+ // @ts-ignore
2159
1929
  class MockServer {
2160
1930
  /**
2161
1931
  * Start the mock server
@@ -3211,46 +2981,6 @@ declare namespace CodeceptJS {
3211
2981
  */
3212
2982
  grabPageScrollPosition(): Promise<PageScrollPosition>;
3213
2983
  }
3214
- /**
3215
- * OpenAI Helper for CodeceptJS.
3216
- *
3217
- * 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.
3218
- * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3219
- *
3220
- * ## Configuration
3221
- *
3222
- * This helper should be configured in codecept.json or codecept.conf.js
3223
- *
3224
- * * `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.
3225
- */
3226
- class OpenAI {
3227
- /**
3228
- * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3229
- *
3230
- * ```js
3231
- * I.askGptOnPage('what does this page do?');
3232
- * ```
3233
- * @param prompt - The question or prompt to ask the GPT model.
3234
- * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3235
- */
3236
- askGptOnPage(prompt: string): Promise<string>;
3237
- /**
3238
- * 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.
3239
- *
3240
- * ```js
3241
- * I.askGptOnPageFragment('describe features of this screen', '.screen');
3242
- * ```
3243
- * @param prompt - The question or prompt to ask the GPT-3.5 model.
3244
- * @param locator - The locator or selector used to identify the HTML fragment on the page.
3245
- * @returns - A Promise that resolves to the generated response from the GPT model.
3246
- */
3247
- askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3248
- /**
3249
- * Send a general request to ChatGPT and return response.
3250
- * @returns - A Promise that resolves to the generated response from the GPT model.
3251
- */
3252
- askGptGeneralPrompt(prompt: string): Promise<string>;
3253
- }
3254
2984
  /**
3255
2985
  * ## Configuration
3256
2986
  *
@@ -3301,6 +3031,8 @@ declare namespace CodeceptJS {
3301
3031
  // @ts-ignore
3302
3032
  // @ts-ignore
3303
3033
  // @ts-ignore
3034
+ // @ts-ignore
3035
+ // @ts-ignore
3304
3036
  type PlaywrightConfig = {
3305
3037
  url?: string;
3306
3038
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -6834,6 +6566,8 @@ declare namespace CodeceptJS {
6834
6566
  // @ts-ignore
6835
6567
  // @ts-ignore
6836
6568
  // @ts-ignore
6569
+ // @ts-ignore
6570
+ // @ts-ignore
6837
6571
  type PuppeteerConfig = {
6838
6572
  url: string;
6839
6573
  basicAuth?: any;
@@ -8782,6 +8516,8 @@ declare namespace CodeceptJS {
8782
8516
  // @ts-ignore
8783
8517
  // @ts-ignore
8784
8518
  // @ts-ignore
8519
+ // @ts-ignore
8520
+ // @ts-ignore
8785
8521
  type RESTConfig = {
8786
8522
  endpoint?: string;
8787
8523
  prettyPrintJson?: boolean;
@@ -8974,250 +8710,6 @@ declare namespace CodeceptJS {
8974
8710
  */
8975
8711
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8976
8712
  }
8977
- /**
8978
- * SoftAssertHelper is a utility class for performing soft assertions.
8979
- * Unlike traditional assertions that stop the execution on failure,
8980
- * soft assertions allow the execution to continue and report all failures at the end.
8981
- *
8982
- * ### Examples
8983
- *
8984
- * Zero-configuration when paired with other helpers like REST, Playwright:
8985
- *
8986
- * ```js
8987
- * // inside codecept.conf.js
8988
- * {
8989
- * helpers: {
8990
- * Playwright: {...},
8991
- * SoftExpectHelper: {},
8992
- * }
8993
- * }
8994
- * ```
8995
- *
8996
- * ```js
8997
- * // in scenario
8998
- * I.softExpectEqual('a', 'b')
8999
- * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
9000
- * ```
9001
- *
9002
- * ## Methods
9003
- */
9004
- class SoftAssertHelper {
9005
- /**
9006
- * Performs a soft assertion by executing the provided assertion function.
9007
- * If the assertion fails, the error is caught and stored without halting the execution.
9008
- * @param assertionFn - The assertion function to execute.
9009
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9010
- */
9011
- softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
9012
- /**
9013
- * Throws an error if any soft assertions have failed.
9014
- * The error message contains all the accumulated failures.
9015
- */
9016
- flushSoftAssertions(): void;
9017
- /**
9018
- * Softly asserts that two values are equal.
9019
- * @param actualValue - The actual value.
9020
- * @param expectedValue - The expected value.
9021
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9022
- */
9023
- softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9024
- /**
9025
- * Softly asserts that two values are not 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
- softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9031
- /**
9032
- * Softly asserts that two values are deeply 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
- softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9038
- /**
9039
- * Softly asserts that two values are not 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
- softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9045
- /**
9046
- * Softly asserts that a value contains the expected value.
9047
- * @param actualValue - The actual value.
9048
- * @param expectedValueToContain - The value that should be contained within the actual value.
9049
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9050
- */
9051
- softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9052
- /**
9053
- * Softly asserts that a value does not contain the expected value.
9054
- * @param actualValue - The actual value.
9055
- * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9056
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9057
- */
9058
- softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9059
- /**
9060
- * Softly asserts that a value starts with the expected value.
9061
- * @param actualValue - The actual value.
9062
- * @param expectedValueToStartWith - The value that the actual value should start with.
9063
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9064
- */
9065
- softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9066
- /**
9067
- * Softly asserts that a value does not start with the expected value.
9068
- * @param actualValue - The actual value.
9069
- * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9070
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9071
- */
9072
- softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9073
- /**
9074
- * Softly asserts that a value ends with the expected value.
9075
- * @param actualValue - The actual value.
9076
- * @param expectedValueToEndWith - The value that the actual value should end with.
9077
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9078
- */
9079
- softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9080
- /**
9081
- * Softly asserts that a value does not end with the expected value.
9082
- * @param actualValue - The actual value.
9083
- * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9084
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9085
- */
9086
- softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9087
- /**
9088
- * Softly asserts that the target data matches the given JSON schema.
9089
- * @param targetData - The data to validate.
9090
- * @param jsonSchema - The JSON schema to validate against.
9091
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9092
- */
9093
- softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9094
- /**
9095
- * Softly asserts that the target data matches the given JSON schema using AJV.
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
- * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9100
- */
9101
- softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9102
- /**
9103
- * Softly asserts that the target data has the specified property.
9104
- * @param targetData - The data to check.
9105
- * @param propertyName - The property name to check for.
9106
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9107
- * fails.
9108
- */
9109
- softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9110
- /**
9111
- * Softly asserts that the target data has a property with the specified name.
9112
- * @param targetData - The data to check.
9113
- * @param propertyName - The property name to check for.
9114
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9115
- */
9116
- softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9117
- /**
9118
- * Softly asserts that the target data is of a specific type.
9119
- * @param targetData - The data to check.
9120
- * @param type - The expected type (e.g., 'string', 'number').
9121
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9122
- */
9123
- softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9124
- /**
9125
- * Softly asserts that the target data is of a specific type (alternative for articles).
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
- softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9131
- /**
9132
- * Softly asserts that the target data has a specified length.
9133
- * @param targetData - The data to check.
9134
- * @param length - The expected length.
9135
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9136
- */
9137
- softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9138
- /**
9139
- * Softly asserts that the target data is empty.
9140
- * @param targetData - The data to check.
9141
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9142
- */
9143
- softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9144
- /**
9145
- * Softly asserts that the target data is true.
9146
- * @param targetData - The data to check.
9147
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9148
- */
9149
- softExpectTrue(targetData: any, customErrorMsg?: string): void;
9150
- /**
9151
- * Softly asserts that the target data is false.
9152
- * @param targetData - The data to check.
9153
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9154
- */
9155
- softExpectFalse(targetData: any, customErrorMsg?: string): void;
9156
- /**
9157
- * Softly asserts that the target data is above a specified value.
9158
- * @param targetData - The data to check.
9159
- * @param aboveThan - The value that the target data should be above.
9160
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9161
- */
9162
- softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9163
- /**
9164
- * Softly asserts that the target data is below a specified value.
9165
- * @param targetData - The data to check.
9166
- * @param belowThan - The value that the target data should be below.
9167
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9168
- */
9169
- softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9170
- /**
9171
- * Softly asserts that the length of the target data is above a specified value.
9172
- * @param targetData - The data to check.
9173
- * @param lengthAboveThan - The length that the target data should be above.
9174
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9175
- */
9176
- softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9177
- /**
9178
- * Softly asserts that the length of the target data is below a specified value.
9179
- * @param targetData - The data to check.
9180
- * @param lengthBelowThan - The length that the target data should be below.
9181
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9182
- */
9183
- softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9184
- /**
9185
- * Softly asserts that two values are equal, ignoring case.
9186
- * @param actualValue - The actual string value.
9187
- * @param expectedValue - The expected string value.
9188
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9189
- */
9190
- softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9191
- /**
9192
- * Softly asserts that two arrays have deep equality, considering members in any order.
9193
- * @param actualValue - The actual array.
9194
- * @param expectedValue - The expected array.
9195
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9196
- */
9197
- softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9198
- /**
9199
- * Softly asserts that an array (superset) deeply includes all members of another array (set).
9200
- * @param superset - The array that should contain the expected members.
9201
- * @param set - The array with members that should be included.
9202
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9203
- */
9204
- softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9205
- /**
9206
- * Softly asserts that two objects are deeply equal, excluding specified fields.
9207
- * @param actualValue - The actual object.
9208
- * @param expectedValue - The expected object.
9209
- * @param fieldsToExclude - The fields to exclude from the comparison.
9210
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9211
- */
9212
- softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9213
- /**
9214
- * Softly asserts that a value matches the expected pattern.
9215
- * @param actualValue - The actual value.
9216
- * @param expectedPattern - The pattern the value should match.
9217
- * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9218
- */
9219
- softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9220
- }
9221
8713
  /**
9222
8714
  * Client Functions
9223
8715
  */
@@ -10236,6 +9728,8 @@ declare namespace CodeceptJS {
10236
9728
  // @ts-ignore
10237
9729
  // @ts-ignore
10238
9730
  // @ts-ignore
9731
+ // @ts-ignore
9732
+ // @ts-ignore
10239
9733
  type WebDriverConfig = {
10240
9734
  url: string;
10241
9735
  browser: string;
@@ -12294,6 +11788,25 @@ declare namespace CodeceptJS {
12294
11788
  [key: string]: any;
12295
11789
  };
12296
11790
  }
11791
+ /**
11792
+ * Result of the test run
11793
+ */
11794
+ type Stats = {
11795
+ passes: number;
11796
+ failures: number;
11797
+ tests: number;
11798
+ pending: number;
11799
+ failedHooks: number;
11800
+ start: Date;
11801
+ end: Date;
11802
+ duration: number;
11803
+ };
11804
+ /**
11805
+ * Create Result of the test run
11806
+ */
11807
+ class Result {
11808
+ constructor();
11809
+ }
12297
11810
  /**
12298
11811
  * Dependency Injection Container
12299
11812
  */
@@ -12322,6 +11835,10 @@ declare namespace CodeceptJS {
12322
11835
  * Get Mocha instance
12323
11836
  */
12324
11837
  static mocha(): any;
11838
+ /**
11839
+ * Get result
11840
+ */
11841
+ static result(): Result;
12325
11842
  /**
12326
11843
  * Append new services to container
12327
11844
  */
@@ -12840,6 +12357,46 @@ declare namespace CodeceptJS {
12840
12357
  }): this;
12841
12358
  }
12842
12359
  function addStep(step: any, fn: any): void;
12360
+ /**
12361
+ * Creates a new Hook instance
12362
+ * @property suite - The test suite this hook belongs to
12363
+ * @property test - The test object associated with this hook
12364
+ * @property runnable - The current test being executed
12365
+ * @property ctx - The context object
12366
+ * @property err - The error that occurred during hook execution, if any
12367
+ * @param context - The context object containing suite and test information
12368
+ * @param context.suite - The test suite
12369
+ * @param context.test - The test object
12370
+ * @param context.ctx - The context object
12371
+ * @param error - The error object if hook execution failed
12372
+ */
12373
+ class Hook {
12374
+ constructor(context: {
12375
+ suite: any;
12376
+ test: any;
12377
+ ctx: any;
12378
+ }, error: Error);
12379
+ /**
12380
+ * The test suite this hook belongs to
12381
+ */
12382
+ suite: any;
12383
+ /**
12384
+ * The test object associated with this hook
12385
+ */
12386
+ test: any;
12387
+ /**
12388
+ * The current test being executed
12389
+ */
12390
+ runnable: any;
12391
+ /**
12392
+ * The context object
12393
+ */
12394
+ ctx: any;
12395
+ /**
12396
+ * The error that occurred during hook execution, if any
12397
+ */
12398
+ err: Error | null;
12399
+ }
12843
12400
  function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
12844
12401
  /**
12845
12402
  * This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.