codeceptjs 3.7.0-beta.5 → 3.7.0-beta.7
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.
- package/README.md +7 -7
- package/lib/effects.js +165 -70
- package/lib/helper/Appium.js +4 -6
- package/lib/helper/WebDriver.js +20 -7
- package/lib/pause.js +0 -3
- package/lib/plugin/retryTo.js +18 -126
- package/lib/plugin/tryTo.js +13 -111
- package/package.json +13 -13
- package/typings/promiseBasedTypes.d.ts +518 -24
- package/typings/types.d.ts +526 -24
- package/lib/step/section.js +0 -25
package/typings/types.d.ts
CHANGED
|
@@ -1203,6 +1203,240 @@ 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
|
+
}
|
|
1206
1440
|
/**
|
|
1207
1441
|
* Helper for testing filesystem.
|
|
1208
1442
|
* Can be easily used to check file structures:
|
|
@@ -1792,10 +2026,6 @@ declare namespace CodeceptJS {
|
|
|
1792
2026
|
// @ts-ignore
|
|
1793
2027
|
// @ts-ignore
|
|
1794
2028
|
// @ts-ignore
|
|
1795
|
-
// @ts-ignore
|
|
1796
|
-
// @ts-ignore
|
|
1797
|
-
// @ts-ignore
|
|
1798
|
-
// @ts-ignore
|
|
1799
2029
|
type MockServerConfig = {
|
|
1800
2030
|
port?: number;
|
|
1801
2031
|
host?: string;
|
|
@@ -1926,10 +2156,6 @@ declare namespace CodeceptJS {
|
|
|
1926
2156
|
// @ts-ignore
|
|
1927
2157
|
// @ts-ignore
|
|
1928
2158
|
// @ts-ignore
|
|
1929
|
-
// @ts-ignore
|
|
1930
|
-
// @ts-ignore
|
|
1931
|
-
// @ts-ignore
|
|
1932
|
-
// @ts-ignore
|
|
1933
2159
|
class MockServer {
|
|
1934
2160
|
/**
|
|
1935
2161
|
* Start the mock server
|
|
@@ -2985,6 +3211,46 @@ declare namespace CodeceptJS {
|
|
|
2985
3211
|
*/
|
|
2986
3212
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2987
3213
|
}
|
|
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
|
+
}
|
|
2988
3254
|
/**
|
|
2989
3255
|
* ## Configuration
|
|
2990
3256
|
*
|
|
@@ -3035,10 +3301,6 @@ declare namespace CodeceptJS {
|
|
|
3035
3301
|
// @ts-ignore
|
|
3036
3302
|
// @ts-ignore
|
|
3037
3303
|
// @ts-ignore
|
|
3038
|
-
// @ts-ignore
|
|
3039
|
-
// @ts-ignore
|
|
3040
|
-
// @ts-ignore
|
|
3041
|
-
// @ts-ignore
|
|
3042
3304
|
type PlaywrightConfig = {
|
|
3043
3305
|
url?: string;
|
|
3044
3306
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6572,10 +6834,6 @@ declare namespace CodeceptJS {
|
|
|
6572
6834
|
// @ts-ignore
|
|
6573
6835
|
// @ts-ignore
|
|
6574
6836
|
// @ts-ignore
|
|
6575
|
-
// @ts-ignore
|
|
6576
|
-
// @ts-ignore
|
|
6577
|
-
// @ts-ignore
|
|
6578
|
-
// @ts-ignore
|
|
6579
6837
|
type PuppeteerConfig = {
|
|
6580
6838
|
url: string;
|
|
6581
6839
|
basicAuth?: any;
|
|
@@ -8524,10 +8782,6 @@ declare namespace CodeceptJS {
|
|
|
8524
8782
|
// @ts-ignore
|
|
8525
8783
|
// @ts-ignore
|
|
8526
8784
|
// @ts-ignore
|
|
8527
|
-
// @ts-ignore
|
|
8528
|
-
// @ts-ignore
|
|
8529
|
-
// @ts-ignore
|
|
8530
|
-
// @ts-ignore
|
|
8531
8785
|
type RESTConfig = {
|
|
8532
8786
|
endpoint?: string;
|
|
8533
8787
|
prettyPrintJson?: boolean;
|
|
@@ -8720,6 +8974,250 @@ declare namespace CodeceptJS {
|
|
|
8720
8974
|
*/
|
|
8721
8975
|
sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
|
|
8722
8976
|
}
|
|
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
|
+
}
|
|
8723
9221
|
/**
|
|
8724
9222
|
* Client Functions
|
|
8725
9223
|
*/
|
|
@@ -9738,10 +10236,6 @@ declare namespace CodeceptJS {
|
|
|
9738
10236
|
// @ts-ignore
|
|
9739
10237
|
// @ts-ignore
|
|
9740
10238
|
// @ts-ignore
|
|
9741
|
-
// @ts-ignore
|
|
9742
|
-
// @ts-ignore
|
|
9743
|
-
// @ts-ignore
|
|
9744
|
-
// @ts-ignore
|
|
9745
10239
|
type WebDriverConfig = {
|
|
9746
10240
|
url: string;
|
|
9747
10241
|
browser: string;
|
|
@@ -12273,6 +12767,10 @@ declare namespace CodeceptJS {
|
|
|
12273
12767
|
* Can inject values and add custom configuration.
|
|
12274
12768
|
*/
|
|
12275
12769
|
class FeatureConfig {
|
|
12770
|
+
/**
|
|
12771
|
+
* Set metadata for this suite
|
|
12772
|
+
*/
|
|
12773
|
+
meta(key: string, value: string): this;
|
|
12276
12774
|
/**
|
|
12277
12775
|
* Retry this test for number of times
|
|
12278
12776
|
*/
|
|
@@ -12307,6 +12805,10 @@ declare namespace CodeceptJS {
|
|
|
12307
12805
|
* Retry this test for x times
|
|
12308
12806
|
*/
|
|
12309
12807
|
retry(retries: number): this;
|
|
12808
|
+
/**
|
|
12809
|
+
* Set metadata for this test
|
|
12810
|
+
*/
|
|
12811
|
+
meta(key: string, value: string): this;
|
|
12310
12812
|
/**
|
|
12311
12813
|
* Set timeout for this test
|
|
12312
12814
|
*/
|
package/lib/step/section.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const event = require('../event')
|
|
2
|
-
|
|
3
|
-
class Section {
|
|
4
|
-
constructor(name = '') {
|
|
5
|
-
this.name = name
|
|
6
|
-
|
|
7
|
-
this.attachMetaStep = (step) => {
|
|
8
|
-
console.log('attach meta step', this.name)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
start() {
|
|
13
|
-
event.dispatcher.on(event.step.started, this.attachMetaStep)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
end() {
|
|
17
|
-
event.dispatcher.off(event.step.started, this.attachMetaStep)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function getRootMetaStep(step) {
|
|
23
|
-
if (step.metaStep) return getRootMetaStep(step.metaStep)
|
|
24
|
-
return step
|
|
25
|
-
}
|