codeceptjs 3.7.0 → 3.7.1-beta.1
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/lib/plugin/analyze.js +2 -1
- package/lib/utils.js +4 -4
- package/package.json +1 -1
- package/typings/promiseBasedTypes.d.ts +506 -6
- package/typings/types.d.ts +506 -6
package/lib/plugin/analyze.js
CHANGED
|
@@ -160,7 +160,8 @@ const defaultConfig = {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
*
|
|
164
|
+
* Uses AI to analyze test failures and provide insights
|
|
164
165
|
*
|
|
165
166
|
* This plugin analyzes failed tests using AI to provide detailed explanations and group similar failures.
|
|
166
167
|
* When enabled with --ai flag, it generates reports after test execution.
|
package/lib/utils.js
CHANGED
|
@@ -94,19 +94,19 @@ module.exports.template = function (template, data) {
|
|
|
94
94
|
/**
|
|
95
95
|
* Make first char uppercase.
|
|
96
96
|
* @param {string} str
|
|
97
|
-
* @returns {string}
|
|
97
|
+
* @returns {string | undefined}
|
|
98
98
|
*/
|
|
99
99
|
module.exports.ucfirst = function (str) {
|
|
100
|
-
return str.charAt(0).toUpperCase() + str.substr(1)
|
|
100
|
+
if (str) return str.charAt(0).toUpperCase() + str.substr(1)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Make first char lowercase.
|
|
105
105
|
* @param {string} str
|
|
106
|
-
* @returns {string}
|
|
106
|
+
* @returns {string | undefined}
|
|
107
107
|
*/
|
|
108
108
|
module.exports.lcfirst = function (str) {
|
|
109
|
-
return str.charAt(0).toLowerCase() + str.substr(1)
|
|
109
|
+
if (str) return str.charAt(0).toLowerCase() + str.substr(1)
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
module.exports.chunkArray = function (arr, chunk) {
|
package/package.json
CHANGED
|
@@ -1179,6 +1179,228 @@ declare namespace CodeceptJS {
|
|
|
1179
1179
|
*/
|
|
1180
1180
|
waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* This helper allows performing assertions based on Chai.
|
|
1184
|
+
*
|
|
1185
|
+
* ### Examples
|
|
1186
|
+
*
|
|
1187
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1188
|
+
*
|
|
1189
|
+
* ```js
|
|
1190
|
+
* // inside codecept.conf.js
|
|
1191
|
+
* {
|
|
1192
|
+
* helpers: {
|
|
1193
|
+
* Playwright: {...},
|
|
1194
|
+
* ExpectHelper: {},
|
|
1195
|
+
* }
|
|
1196
|
+
* }
|
|
1197
|
+
* ```
|
|
1198
|
+
*
|
|
1199
|
+
* ## Methods
|
|
1200
|
+
*/
|
|
1201
|
+
class ExpectHelper {
|
|
1202
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1203
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1204
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1205
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1206
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1207
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1208
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1209
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1210
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1211
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1212
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1213
|
+
/**
|
|
1214
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1215
|
+
*/
|
|
1216
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1217
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1218
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1219
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1220
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1221
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1222
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1223
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1224
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1225
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1226
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1227
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1228
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1229
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1230
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1231
|
+
/**
|
|
1232
|
+
* expects members of two arrays are deeply equal
|
|
1233
|
+
*/
|
|
1234
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1235
|
+
/**
|
|
1236
|
+
* expects an array to be a superset of another array
|
|
1237
|
+
*/
|
|
1238
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1239
|
+
/**
|
|
1240
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1241
|
+
*/
|
|
1242
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1243
|
+
/**
|
|
1244
|
+
* expects a JSON object matches a provided pattern
|
|
1245
|
+
*/
|
|
1246
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1247
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1248
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1249
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1250
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1251
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1252
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1253
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1254
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1255
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1256
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1257
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1258
|
+
/**
|
|
1259
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1260
|
+
*/
|
|
1261
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1262
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1263
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1264
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1265
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1266
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1267
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1268
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1269
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1270
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1271
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1272
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1273
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1274
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1275
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1276
|
+
/**
|
|
1277
|
+
* expects members of two arrays are deeply equal
|
|
1278
|
+
*/
|
|
1279
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1280
|
+
/**
|
|
1281
|
+
* expects an array to be a superset of another array
|
|
1282
|
+
*/
|
|
1283
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1284
|
+
/**
|
|
1285
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1286
|
+
*/
|
|
1287
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1288
|
+
/**
|
|
1289
|
+
* expects a JSON object matches a provided pattern
|
|
1290
|
+
*/
|
|
1291
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* This helper allows performing assertions based on Chai.
|
|
1295
|
+
*
|
|
1296
|
+
* ### Examples
|
|
1297
|
+
*
|
|
1298
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1299
|
+
*
|
|
1300
|
+
* ```js
|
|
1301
|
+
* // inside codecept.conf.js
|
|
1302
|
+
* {
|
|
1303
|
+
* helpers: {
|
|
1304
|
+
* Playwright: {...},
|
|
1305
|
+
* ExpectHelper: {},
|
|
1306
|
+
* }
|
|
1307
|
+
* }
|
|
1308
|
+
* ```
|
|
1309
|
+
*
|
|
1310
|
+
* ## Methods
|
|
1311
|
+
*/
|
|
1312
|
+
class ExpectHelper {
|
|
1313
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1314
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1315
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1316
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1317
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1318
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1319
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1320
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1321
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1322
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1323
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1324
|
+
/**
|
|
1325
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1326
|
+
*/
|
|
1327
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1328
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1329
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1330
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1331
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1332
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1333
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1334
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1335
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1336
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1337
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1338
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1339
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1340
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1341
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1342
|
+
/**
|
|
1343
|
+
* expects members of two arrays are deeply equal
|
|
1344
|
+
*/
|
|
1345
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1346
|
+
/**
|
|
1347
|
+
* expects an array to be a superset of another array
|
|
1348
|
+
*/
|
|
1349
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1350
|
+
/**
|
|
1351
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1352
|
+
*/
|
|
1353
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1354
|
+
/**
|
|
1355
|
+
* expects a JSON object matches a provided pattern
|
|
1356
|
+
*/
|
|
1357
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1358
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1359
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1360
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1361
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1362
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1363
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1364
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1365
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1366
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1367
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1368
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1369
|
+
/**
|
|
1370
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1371
|
+
*/
|
|
1372
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1373
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1374
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1375
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1376
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1377
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1378
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1379
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1380
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1381
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1382
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1383
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1384
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1385
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1386
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1387
|
+
/**
|
|
1388
|
+
* expects members of two arrays are deeply equal
|
|
1389
|
+
*/
|
|
1390
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1391
|
+
/**
|
|
1392
|
+
* expects an array to be a superset of another array
|
|
1393
|
+
*/
|
|
1394
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1395
|
+
/**
|
|
1396
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1397
|
+
*/
|
|
1398
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1399
|
+
/**
|
|
1400
|
+
* expects a JSON object matches a provided pattern
|
|
1401
|
+
*/
|
|
1402
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1403
|
+
}
|
|
1182
1404
|
/**
|
|
1183
1405
|
* Helper for testing filesystem.
|
|
1184
1406
|
* Can be easily used to check file structures:
|
|
@@ -1759,7 +1981,6 @@ declare namespace CodeceptJS {
|
|
|
1759
1981
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1760
1982
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1761
1983
|
*/
|
|
1762
|
-
// @ts-ignore
|
|
1763
1984
|
type MockServerConfig = {
|
|
1764
1985
|
port?: number;
|
|
1765
1986
|
host?: string;
|
|
@@ -1884,7 +2105,6 @@ declare namespace CodeceptJS {
|
|
|
1884
2105
|
*
|
|
1885
2106
|
* ## Methods
|
|
1886
2107
|
*/
|
|
1887
|
-
// @ts-ignore
|
|
1888
2108
|
class MockServer {
|
|
1889
2109
|
/**
|
|
1890
2110
|
* Start the mock server
|
|
@@ -2874,6 +3094,46 @@ declare namespace CodeceptJS {
|
|
|
2874
3094
|
*/
|
|
2875
3095
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2876
3096
|
}
|
|
3097
|
+
/**
|
|
3098
|
+
* OpenAI Helper for CodeceptJS.
|
|
3099
|
+
*
|
|
3100
|
+
* 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.
|
|
3101
|
+
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
3102
|
+
*
|
|
3103
|
+
* ## Configuration
|
|
3104
|
+
*
|
|
3105
|
+
* This helper should be configured in codecept.json or codecept.conf.js
|
|
3106
|
+
*
|
|
3107
|
+
* * `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.
|
|
3108
|
+
*/
|
|
3109
|
+
class OpenAITs {
|
|
3110
|
+
/**
|
|
3111
|
+
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
|
|
3112
|
+
*
|
|
3113
|
+
* ```js
|
|
3114
|
+
* I.askGptOnPage('what does this page do?');
|
|
3115
|
+
* ```
|
|
3116
|
+
* @param prompt - The question or prompt to ask the GPT model.
|
|
3117
|
+
* @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
|
|
3118
|
+
*/
|
|
3119
|
+
askGptOnPage(prompt: string): Promise<string>;
|
|
3120
|
+
/**
|
|
3121
|
+
* 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.
|
|
3122
|
+
*
|
|
3123
|
+
* ```js
|
|
3124
|
+
* I.askGptOnPageFragment('describe features of this screen', '.screen');
|
|
3125
|
+
* ```
|
|
3126
|
+
* @param prompt - The question or prompt to ask the GPT-3.5 model.
|
|
3127
|
+
* @param locator - The locator or selector used to identify the HTML fragment on the page.
|
|
3128
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3129
|
+
*/
|
|
3130
|
+
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
3131
|
+
/**
|
|
3132
|
+
* Send a general request to ChatGPT and return response.
|
|
3133
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3134
|
+
*/
|
|
3135
|
+
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
3136
|
+
}
|
|
2877
3137
|
/**
|
|
2878
3138
|
* ## Configuration
|
|
2879
3139
|
*
|
|
@@ -2918,7 +3178,6 @@ declare namespace CodeceptJS {
|
|
|
2918
3178
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
2919
3179
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
2920
3180
|
*/
|
|
2921
|
-
// @ts-ignore
|
|
2922
3181
|
type PlaywrightConfig = {
|
|
2923
3182
|
url?: string;
|
|
2924
3183
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6295,7 +6554,6 @@ declare namespace CodeceptJS {
|
|
|
6295
6554
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6296
6555
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6297
6556
|
*/
|
|
6298
|
-
// @ts-ignore
|
|
6299
6557
|
type PuppeteerConfig = {
|
|
6300
6558
|
url: string;
|
|
6301
6559
|
basicAuth?: any;
|
|
@@ -8102,7 +8360,6 @@ declare namespace CodeceptJS {
|
|
|
8102
8360
|
* @property [onResponse] - an async function which can update response object.
|
|
8103
8361
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8104
8362
|
*/
|
|
8105
|
-
// @ts-ignore
|
|
8106
8363
|
type RESTConfig = {
|
|
8107
8364
|
endpoint?: string;
|
|
8108
8365
|
prettyPrintJson?: boolean;
|
|
@@ -8295,6 +8552,250 @@ declare namespace CodeceptJS {
|
|
|
8295
8552
|
*/
|
|
8296
8553
|
sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
|
|
8297
8554
|
}
|
|
8555
|
+
/**
|
|
8556
|
+
* SoftAssertHelper is a utility class for performing soft assertions.
|
|
8557
|
+
* Unlike traditional assertions that stop the execution on failure,
|
|
8558
|
+
* soft assertions allow the execution to continue and report all failures at the end.
|
|
8559
|
+
*
|
|
8560
|
+
* ### Examples
|
|
8561
|
+
*
|
|
8562
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
8563
|
+
*
|
|
8564
|
+
* ```js
|
|
8565
|
+
* // inside codecept.conf.js
|
|
8566
|
+
* {
|
|
8567
|
+
* helpers: {
|
|
8568
|
+
* Playwright: {...},
|
|
8569
|
+
* SoftExpectHelper: {},
|
|
8570
|
+
* }
|
|
8571
|
+
* }
|
|
8572
|
+
* ```
|
|
8573
|
+
*
|
|
8574
|
+
* ```js
|
|
8575
|
+
* // in scenario
|
|
8576
|
+
* I.softExpectEqual('a', 'b')
|
|
8577
|
+
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
8578
|
+
* ```
|
|
8579
|
+
*
|
|
8580
|
+
* ## Methods
|
|
8581
|
+
*/
|
|
8582
|
+
class SoftAssertHelperTs {
|
|
8583
|
+
/**
|
|
8584
|
+
* Performs a soft assertion by executing the provided assertion function.
|
|
8585
|
+
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
8586
|
+
* @param assertionFn - The assertion function to execute.
|
|
8587
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8588
|
+
*/
|
|
8589
|
+
softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): Promise<any>;
|
|
8590
|
+
/**
|
|
8591
|
+
* Throws an error if any soft assertions have failed.
|
|
8592
|
+
* The error message contains all the accumulated failures.
|
|
8593
|
+
*/
|
|
8594
|
+
flushSoftAssertions(): Promise<any>;
|
|
8595
|
+
/**
|
|
8596
|
+
* Softly asserts that two values are equal.
|
|
8597
|
+
* @param actualValue - The actual value.
|
|
8598
|
+
* @param expectedValue - The expected value.
|
|
8599
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8600
|
+
*/
|
|
8601
|
+
softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8602
|
+
/**
|
|
8603
|
+
* Softly asserts that two values are not equal.
|
|
8604
|
+
* @param actualValue - The actual value.
|
|
8605
|
+
* @param expectedValue - The expected value.
|
|
8606
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8607
|
+
*/
|
|
8608
|
+
softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8609
|
+
/**
|
|
8610
|
+
* Softly asserts that two values are deeply equal.
|
|
8611
|
+
* @param actualValue - The actual value.
|
|
8612
|
+
* @param expectedValue - The expected value.
|
|
8613
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8614
|
+
*/
|
|
8615
|
+
softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8616
|
+
/**
|
|
8617
|
+
* Softly asserts that two values are not deeply equal.
|
|
8618
|
+
* @param actualValue - The actual value.
|
|
8619
|
+
* @param expectedValue - The expected value.
|
|
8620
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8621
|
+
*/
|
|
8622
|
+
softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8623
|
+
/**
|
|
8624
|
+
* Softly asserts that a value contains the expected value.
|
|
8625
|
+
* @param actualValue - The actual value.
|
|
8626
|
+
* @param expectedValueToContain - The value that should be contained within the actual value.
|
|
8627
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8628
|
+
*/
|
|
8629
|
+
softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): Promise<any>;
|
|
8630
|
+
/**
|
|
8631
|
+
* Softly asserts that a value does not contain the expected value.
|
|
8632
|
+
* @param actualValue - The actual value.
|
|
8633
|
+
* @param expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
8634
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8635
|
+
*/
|
|
8636
|
+
softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): Promise<any>;
|
|
8637
|
+
/**
|
|
8638
|
+
* Softly asserts that a value starts with the expected value.
|
|
8639
|
+
* @param actualValue - The actual value.
|
|
8640
|
+
* @param expectedValueToStartWith - The value that the actual value should start with.
|
|
8641
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8642
|
+
*/
|
|
8643
|
+
softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): Promise<any>;
|
|
8644
|
+
/**
|
|
8645
|
+
* Softly asserts that a value does not start with the expected value.
|
|
8646
|
+
* @param actualValue - The actual value.
|
|
8647
|
+
* @param expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
8648
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8649
|
+
*/
|
|
8650
|
+
softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): Promise<any>;
|
|
8651
|
+
/**
|
|
8652
|
+
* Softly asserts that a value ends with the expected value.
|
|
8653
|
+
* @param actualValue - The actual value.
|
|
8654
|
+
* @param expectedValueToEndWith - The value that the actual value should end with.
|
|
8655
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8656
|
+
*/
|
|
8657
|
+
softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): Promise<any>;
|
|
8658
|
+
/**
|
|
8659
|
+
* Softly asserts that a value does not end with the expected value.
|
|
8660
|
+
* @param actualValue - The actual value.
|
|
8661
|
+
* @param expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
8662
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8663
|
+
*/
|
|
8664
|
+
softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): Promise<any>;
|
|
8665
|
+
/**
|
|
8666
|
+
* Softly asserts that the target data matches the given JSON schema.
|
|
8667
|
+
* @param targetData - The data to validate.
|
|
8668
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
8669
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8670
|
+
*/
|
|
8671
|
+
softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): Promise<any>;
|
|
8672
|
+
/**
|
|
8673
|
+
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
8674
|
+
* @param targetData - The data to validate.
|
|
8675
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
8676
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8677
|
+
* @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
|
|
8678
|
+
*/
|
|
8679
|
+
softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): Promise<any>;
|
|
8680
|
+
/**
|
|
8681
|
+
* Softly asserts that the target data has the specified property.
|
|
8682
|
+
* @param targetData - The data to check.
|
|
8683
|
+
* @param propertyName - The property name to check for.
|
|
8684
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion
|
|
8685
|
+
* fails.
|
|
8686
|
+
*/
|
|
8687
|
+
softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
|
|
8688
|
+
/**
|
|
8689
|
+
* Softly asserts that the target data has a property with the specified name.
|
|
8690
|
+
* @param targetData - The data to check.
|
|
8691
|
+
* @param propertyName - The property name to check for.
|
|
8692
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8693
|
+
*/
|
|
8694
|
+
softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
|
|
8695
|
+
/**
|
|
8696
|
+
* Softly asserts that the target data is of a specific type.
|
|
8697
|
+
* @param targetData - The data to check.
|
|
8698
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
8699
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8700
|
+
*/
|
|
8701
|
+
softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
|
|
8702
|
+
/**
|
|
8703
|
+
* Softly asserts that the target data is of a specific type (alternative for articles).
|
|
8704
|
+
* @param targetData - The data to check.
|
|
8705
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
8706
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8707
|
+
*/
|
|
8708
|
+
softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
|
|
8709
|
+
/**
|
|
8710
|
+
* Softly asserts that the target data has a specified length.
|
|
8711
|
+
* @param targetData - The data to check.
|
|
8712
|
+
* @param length - The expected length.
|
|
8713
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8714
|
+
*/
|
|
8715
|
+
softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): Promise<any>;
|
|
8716
|
+
/**
|
|
8717
|
+
* Softly asserts that the target data is empty.
|
|
8718
|
+
* @param targetData - The data to check.
|
|
8719
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8720
|
+
*/
|
|
8721
|
+
softExpectEmpty(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8722
|
+
/**
|
|
8723
|
+
* Softly asserts that the target data is true.
|
|
8724
|
+
* @param targetData - The data to check.
|
|
8725
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8726
|
+
*/
|
|
8727
|
+
softExpectTrue(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8728
|
+
/**
|
|
8729
|
+
* Softly asserts that the target data is false.
|
|
8730
|
+
* @param targetData - The data to check.
|
|
8731
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8732
|
+
*/
|
|
8733
|
+
softExpectFalse(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8734
|
+
/**
|
|
8735
|
+
* Softly asserts that the target data is above a specified value.
|
|
8736
|
+
* @param targetData - The data to check.
|
|
8737
|
+
* @param aboveThan - The value that the target data should be above.
|
|
8738
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8739
|
+
*/
|
|
8740
|
+
softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): Promise<any>;
|
|
8741
|
+
/**
|
|
8742
|
+
* Softly asserts that the target data is below a specified value.
|
|
8743
|
+
* @param targetData - The data to check.
|
|
8744
|
+
* @param belowThan - The value that the target data should be below.
|
|
8745
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8746
|
+
*/
|
|
8747
|
+
softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): Promise<any>;
|
|
8748
|
+
/**
|
|
8749
|
+
* Softly asserts that the length of the target data is above a specified value.
|
|
8750
|
+
* @param targetData - The data to check.
|
|
8751
|
+
* @param lengthAboveThan - The length that the target data should be above.
|
|
8752
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8753
|
+
*/
|
|
8754
|
+
softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): Promise<any>;
|
|
8755
|
+
/**
|
|
8756
|
+
* Softly asserts that the length of the target data is below a specified value.
|
|
8757
|
+
* @param targetData - The data to check.
|
|
8758
|
+
* @param lengthBelowThan - The length that the target data should be below.
|
|
8759
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8760
|
+
*/
|
|
8761
|
+
softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): Promise<any>;
|
|
8762
|
+
/**
|
|
8763
|
+
* Softly asserts that two values are equal, ignoring case.
|
|
8764
|
+
* @param actualValue - The actual string value.
|
|
8765
|
+
* @param expectedValue - The expected string value.
|
|
8766
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8767
|
+
*/
|
|
8768
|
+
softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): Promise<any>;
|
|
8769
|
+
/**
|
|
8770
|
+
* Softly asserts that two arrays have deep equality, considering members in any order.
|
|
8771
|
+
* @param actualValue - The actual array.
|
|
8772
|
+
* @param expectedValue - The expected array.
|
|
8773
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8774
|
+
*/
|
|
8775
|
+
softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): Promise<any>;
|
|
8776
|
+
/**
|
|
8777
|
+
* Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
8778
|
+
* @param superset - The array that should contain the expected members.
|
|
8779
|
+
* @param set - The array with members that should be included.
|
|
8780
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8781
|
+
*/
|
|
8782
|
+
softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): Promise<any>;
|
|
8783
|
+
/**
|
|
8784
|
+
* Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
8785
|
+
* @param actualValue - The actual object.
|
|
8786
|
+
* @param expectedValue - The expected object.
|
|
8787
|
+
* @param fieldsToExclude - The fields to exclude from the comparison.
|
|
8788
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8789
|
+
*/
|
|
8790
|
+
softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): Promise<any>;
|
|
8791
|
+
/**
|
|
8792
|
+
* Softly asserts that a value matches the expected pattern.
|
|
8793
|
+
* @param actualValue - The actual value.
|
|
8794
|
+
* @param expectedPattern - The pattern the value should match.
|
|
8795
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8796
|
+
*/
|
|
8797
|
+
softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): Promise<any>;
|
|
8798
|
+
}
|
|
8298
8799
|
/**
|
|
8299
8800
|
* Client Functions
|
|
8300
8801
|
*/
|
|
@@ -9247,7 +9748,6 @@ declare namespace CodeceptJS {
|
|
|
9247
9748
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9248
9749
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9249
9750
|
*/
|
|
9250
|
-
// @ts-ignore
|
|
9251
9751
|
type WebDriverConfig = {
|
|
9252
9752
|
url: string;
|
|
9253
9753
|
browser: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1203,6 +1203,228 @@ 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
|
+
class ExpectHelper {
|
|
1226
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1227
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1228
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1229
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1230
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1231
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1232
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1233
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1234
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1235
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1236
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1237
|
+
/**
|
|
1238
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1239
|
+
*/
|
|
1240
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1241
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1242
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1243
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1244
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1245
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1246
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1247
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1248
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1249
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1250
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1251
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1252
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1253
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1254
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1255
|
+
/**
|
|
1256
|
+
* expects members of two arrays are deeply equal
|
|
1257
|
+
*/
|
|
1258
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1259
|
+
/**
|
|
1260
|
+
* expects an array to be a superset of another array
|
|
1261
|
+
*/
|
|
1262
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1263
|
+
/**
|
|
1264
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1265
|
+
*/
|
|
1266
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1267
|
+
/**
|
|
1268
|
+
* expects a JSON object matches a provided pattern
|
|
1269
|
+
*/
|
|
1270
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1271
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1272
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1273
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1274
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1275
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1276
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1277
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1278
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1279
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1280
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1281
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1282
|
+
/**
|
|
1283
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1284
|
+
*/
|
|
1285
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1286
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1287
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1288
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1289
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1290
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1291
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1292
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1293
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1294
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1295
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1296
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1297
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1298
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1299
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1300
|
+
/**
|
|
1301
|
+
* expects members of two arrays are deeply equal
|
|
1302
|
+
*/
|
|
1303
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1304
|
+
/**
|
|
1305
|
+
* expects an array to be a superset of another array
|
|
1306
|
+
*/
|
|
1307
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1308
|
+
/**
|
|
1309
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1310
|
+
*/
|
|
1311
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* expects a JSON object matches a provided pattern
|
|
1314
|
+
*/
|
|
1315
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* This helper allows performing assertions based on Chai.
|
|
1319
|
+
*
|
|
1320
|
+
* ### Examples
|
|
1321
|
+
*
|
|
1322
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1323
|
+
*
|
|
1324
|
+
* ```js
|
|
1325
|
+
* // inside codecept.conf.js
|
|
1326
|
+
* {
|
|
1327
|
+
* helpers: {
|
|
1328
|
+
* Playwright: {...},
|
|
1329
|
+
* ExpectHelper: {},
|
|
1330
|
+
* }
|
|
1331
|
+
* }
|
|
1332
|
+
* ```
|
|
1333
|
+
*
|
|
1334
|
+
* ## Methods
|
|
1335
|
+
*/
|
|
1336
|
+
class ExpectHelper {
|
|
1337
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1338
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1339
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1340
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1341
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1342
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1343
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1344
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1345
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1346
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1347
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1348
|
+
/**
|
|
1349
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1350
|
+
*/
|
|
1351
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1352
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1353
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1354
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1355
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1356
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1357
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1358
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1359
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1360
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1361
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1362
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1363
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1364
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1365
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1366
|
+
/**
|
|
1367
|
+
* expects members of two arrays are deeply equal
|
|
1368
|
+
*/
|
|
1369
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1370
|
+
/**
|
|
1371
|
+
* expects an array to be a superset of another array
|
|
1372
|
+
*/
|
|
1373
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1374
|
+
/**
|
|
1375
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1376
|
+
*/
|
|
1377
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1378
|
+
/**
|
|
1379
|
+
* expects a JSON object matches a provided pattern
|
|
1380
|
+
*/
|
|
1381
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1382
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1383
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1384
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1385
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1386
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1387
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1388
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1389
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1390
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1391
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1392
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1393
|
+
/**
|
|
1394
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1395
|
+
*/
|
|
1396
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1397
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1398
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1399
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1400
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1401
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1402
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1403
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1404
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1405
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1406
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1407
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1408
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1409
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1410
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1411
|
+
/**
|
|
1412
|
+
* expects members of two arrays are deeply equal
|
|
1413
|
+
*/
|
|
1414
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1415
|
+
/**
|
|
1416
|
+
* expects an array to be a superset of another array
|
|
1417
|
+
*/
|
|
1418
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1419
|
+
/**
|
|
1420
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1421
|
+
*/
|
|
1422
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1423
|
+
/**
|
|
1424
|
+
* expects a JSON object matches a provided pattern
|
|
1425
|
+
*/
|
|
1426
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1427
|
+
}
|
|
1206
1428
|
/**
|
|
1207
1429
|
* Helper for testing filesystem.
|
|
1208
1430
|
* Can be easily used to check file structures:
|
|
@@ -1786,7 +2008,6 @@ declare namespace CodeceptJS {
|
|
|
1786
2008
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1787
2009
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1788
2010
|
*/
|
|
1789
|
-
// @ts-ignore
|
|
1790
2011
|
type MockServerConfig = {
|
|
1791
2012
|
port?: number;
|
|
1792
2013
|
host?: string;
|
|
@@ -1911,7 +2132,6 @@ declare namespace CodeceptJS {
|
|
|
1911
2132
|
*
|
|
1912
2133
|
* ## Methods
|
|
1913
2134
|
*/
|
|
1914
|
-
// @ts-ignore
|
|
1915
2135
|
class MockServer {
|
|
1916
2136
|
/**
|
|
1917
2137
|
* Start the mock server
|
|
@@ -2967,6 +3187,46 @@ declare namespace CodeceptJS {
|
|
|
2967
3187
|
*/
|
|
2968
3188
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
2969
3189
|
}
|
|
3190
|
+
/**
|
|
3191
|
+
* OpenAI Helper for CodeceptJS.
|
|
3192
|
+
*
|
|
3193
|
+
* 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.
|
|
3194
|
+
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
3195
|
+
*
|
|
3196
|
+
* ## Configuration
|
|
3197
|
+
*
|
|
3198
|
+
* This helper should be configured in codecept.json or codecept.conf.js
|
|
3199
|
+
*
|
|
3200
|
+
* * `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.
|
|
3201
|
+
*/
|
|
3202
|
+
class OpenAI {
|
|
3203
|
+
/**
|
|
3204
|
+
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
|
|
3205
|
+
*
|
|
3206
|
+
* ```js
|
|
3207
|
+
* I.askGptOnPage('what does this page do?');
|
|
3208
|
+
* ```
|
|
3209
|
+
* @param prompt - The question or prompt to ask the GPT model.
|
|
3210
|
+
* @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
|
|
3211
|
+
*/
|
|
3212
|
+
askGptOnPage(prompt: string): Promise<string>;
|
|
3213
|
+
/**
|
|
3214
|
+
* 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.
|
|
3215
|
+
*
|
|
3216
|
+
* ```js
|
|
3217
|
+
* I.askGptOnPageFragment('describe features of this screen', '.screen');
|
|
3218
|
+
* ```
|
|
3219
|
+
* @param prompt - The question or prompt to ask the GPT-3.5 model.
|
|
3220
|
+
* @param locator - The locator or selector used to identify the HTML fragment on the page.
|
|
3221
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3222
|
+
*/
|
|
3223
|
+
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
3224
|
+
/**
|
|
3225
|
+
* Send a general request to ChatGPT and return response.
|
|
3226
|
+
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3227
|
+
*/
|
|
3228
|
+
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
3229
|
+
}
|
|
2970
3230
|
/**
|
|
2971
3231
|
* ## Configuration
|
|
2972
3232
|
*
|
|
@@ -3011,7 +3271,6 @@ declare namespace CodeceptJS {
|
|
|
3011
3271
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
3012
3272
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3013
3273
|
*/
|
|
3014
|
-
// @ts-ignore
|
|
3015
3274
|
type PlaywrightConfig = {
|
|
3016
3275
|
url?: string;
|
|
3017
3276
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6539,7 +6798,6 @@ declare namespace CodeceptJS {
|
|
|
6539
6798
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6540
6799
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6541
6800
|
*/
|
|
6542
|
-
// @ts-ignore
|
|
6543
6801
|
type PuppeteerConfig = {
|
|
6544
6802
|
url: string;
|
|
6545
6803
|
basicAuth?: any;
|
|
@@ -8482,7 +8740,6 @@ declare namespace CodeceptJS {
|
|
|
8482
8740
|
* @property [onResponse] - an async function which can update response object.
|
|
8483
8741
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8484
8742
|
*/
|
|
8485
|
-
// @ts-ignore
|
|
8486
8743
|
type RESTConfig = {
|
|
8487
8744
|
endpoint?: string;
|
|
8488
8745
|
prettyPrintJson?: boolean;
|
|
@@ -8675,6 +8932,250 @@ declare namespace CodeceptJS {
|
|
|
8675
8932
|
*/
|
|
8676
8933
|
sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
|
|
8677
8934
|
}
|
|
8935
|
+
/**
|
|
8936
|
+
* SoftAssertHelper is a utility class for performing soft assertions.
|
|
8937
|
+
* Unlike traditional assertions that stop the execution on failure,
|
|
8938
|
+
* soft assertions allow the execution to continue and report all failures at the end.
|
|
8939
|
+
*
|
|
8940
|
+
* ### Examples
|
|
8941
|
+
*
|
|
8942
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
8943
|
+
*
|
|
8944
|
+
* ```js
|
|
8945
|
+
* // inside codecept.conf.js
|
|
8946
|
+
* {
|
|
8947
|
+
* helpers: {
|
|
8948
|
+
* Playwright: {...},
|
|
8949
|
+
* SoftExpectHelper: {},
|
|
8950
|
+
* }
|
|
8951
|
+
* }
|
|
8952
|
+
* ```
|
|
8953
|
+
*
|
|
8954
|
+
* ```js
|
|
8955
|
+
* // in scenario
|
|
8956
|
+
* I.softExpectEqual('a', 'b')
|
|
8957
|
+
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
8958
|
+
* ```
|
|
8959
|
+
*
|
|
8960
|
+
* ## Methods
|
|
8961
|
+
*/
|
|
8962
|
+
class SoftAssertHelper {
|
|
8963
|
+
/**
|
|
8964
|
+
* Performs a soft assertion by executing the provided assertion function.
|
|
8965
|
+
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
8966
|
+
* @param assertionFn - The assertion function to execute.
|
|
8967
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8968
|
+
*/
|
|
8969
|
+
softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
|
|
8970
|
+
/**
|
|
8971
|
+
* Throws an error if any soft assertions have failed.
|
|
8972
|
+
* The error message contains all the accumulated failures.
|
|
8973
|
+
*/
|
|
8974
|
+
flushSoftAssertions(): void;
|
|
8975
|
+
/**
|
|
8976
|
+
* Softly asserts that two values are equal.
|
|
8977
|
+
* @param actualValue - The actual value.
|
|
8978
|
+
* @param expectedValue - The expected value.
|
|
8979
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8980
|
+
*/
|
|
8981
|
+
softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8982
|
+
/**
|
|
8983
|
+
* Softly asserts that two values are not equal.
|
|
8984
|
+
* @param actualValue - The actual value.
|
|
8985
|
+
* @param expectedValue - The expected value.
|
|
8986
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8987
|
+
*/
|
|
8988
|
+
softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8989
|
+
/**
|
|
8990
|
+
* Softly asserts that two values are deeply equal.
|
|
8991
|
+
* @param actualValue - The actual value.
|
|
8992
|
+
* @param expectedValue - The expected value.
|
|
8993
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8994
|
+
*/
|
|
8995
|
+
softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8996
|
+
/**
|
|
8997
|
+
* Softly asserts that two values are not deeply equal.
|
|
8998
|
+
* @param actualValue - The actual value.
|
|
8999
|
+
* @param expectedValue - The expected value.
|
|
9000
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9001
|
+
*/
|
|
9002
|
+
softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
9003
|
+
/**
|
|
9004
|
+
* Softly asserts that a value contains the expected value.
|
|
9005
|
+
* @param actualValue - The actual value.
|
|
9006
|
+
* @param expectedValueToContain - The value that should be contained within the actual value.
|
|
9007
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9008
|
+
*/
|
|
9009
|
+
softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
|
|
9010
|
+
/**
|
|
9011
|
+
* Softly asserts that a value does not contain the expected value.
|
|
9012
|
+
* @param actualValue - The actual value.
|
|
9013
|
+
* @param expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
9014
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9015
|
+
*/
|
|
9016
|
+
softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
|
|
9017
|
+
/**
|
|
9018
|
+
* Softly asserts that a value starts with the expected value.
|
|
9019
|
+
* @param actualValue - The actual value.
|
|
9020
|
+
* @param expectedValueToStartWith - The value that the actual value should start with.
|
|
9021
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9022
|
+
*/
|
|
9023
|
+
softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
|
|
9024
|
+
/**
|
|
9025
|
+
* Softly asserts that a value does not start with the expected value.
|
|
9026
|
+
* @param actualValue - The actual value.
|
|
9027
|
+
* @param expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
9028
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9029
|
+
*/
|
|
9030
|
+
softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
|
|
9031
|
+
/**
|
|
9032
|
+
* Softly asserts that a value ends with the expected value.
|
|
9033
|
+
* @param actualValue - The actual value.
|
|
9034
|
+
* @param expectedValueToEndWith - The value that the actual value should end with.
|
|
9035
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9036
|
+
*/
|
|
9037
|
+
softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
|
|
9038
|
+
/**
|
|
9039
|
+
* Softly asserts that a value does not end with the expected value.
|
|
9040
|
+
* @param actualValue - The actual value.
|
|
9041
|
+
* @param expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
9042
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9043
|
+
*/
|
|
9044
|
+
softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
|
|
9045
|
+
/**
|
|
9046
|
+
* Softly asserts that the target data matches the given JSON schema.
|
|
9047
|
+
* @param targetData - The data to validate.
|
|
9048
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
9049
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9050
|
+
*/
|
|
9051
|
+
softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
|
|
9052
|
+
/**
|
|
9053
|
+
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
9054
|
+
* @param targetData - The data to validate.
|
|
9055
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
9056
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9057
|
+
* @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
|
|
9058
|
+
*/
|
|
9059
|
+
softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
|
|
9060
|
+
/**
|
|
9061
|
+
* Softly asserts that the target data has the specified property.
|
|
9062
|
+
* @param targetData - The data to check.
|
|
9063
|
+
* @param propertyName - The property name to check for.
|
|
9064
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion
|
|
9065
|
+
* fails.
|
|
9066
|
+
*/
|
|
9067
|
+
softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9068
|
+
/**
|
|
9069
|
+
* Softly asserts that the target data has a property with the specified name.
|
|
9070
|
+
* @param targetData - The data to check.
|
|
9071
|
+
* @param propertyName - The property name to check for.
|
|
9072
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9073
|
+
*/
|
|
9074
|
+
softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9075
|
+
/**
|
|
9076
|
+
* Softly asserts that the target data is of a specific type.
|
|
9077
|
+
* @param targetData - The data to check.
|
|
9078
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
9079
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9080
|
+
*/
|
|
9081
|
+
softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9082
|
+
/**
|
|
9083
|
+
* Softly asserts that the target data is of a specific type (alternative for articles).
|
|
9084
|
+
* @param targetData - The data to check.
|
|
9085
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
9086
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9087
|
+
*/
|
|
9088
|
+
softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9089
|
+
/**
|
|
9090
|
+
* Softly asserts that the target data has a specified length.
|
|
9091
|
+
* @param targetData - The data to check.
|
|
9092
|
+
* @param length - The expected length.
|
|
9093
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9094
|
+
*/
|
|
9095
|
+
softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
|
|
9096
|
+
/**
|
|
9097
|
+
* Softly asserts that the target data is empty.
|
|
9098
|
+
* @param targetData - The data to check.
|
|
9099
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9100
|
+
*/
|
|
9101
|
+
softExpectEmpty(targetData: any, customErrorMsg?: string): void;
|
|
9102
|
+
/**
|
|
9103
|
+
* Softly asserts that the target data is true.
|
|
9104
|
+
* @param targetData - The data to check.
|
|
9105
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9106
|
+
*/
|
|
9107
|
+
softExpectTrue(targetData: any, customErrorMsg?: string): void;
|
|
9108
|
+
/**
|
|
9109
|
+
* Softly asserts that the target data is false.
|
|
9110
|
+
* @param targetData - The data to check.
|
|
9111
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9112
|
+
*/
|
|
9113
|
+
softExpectFalse(targetData: any, customErrorMsg?: string): void;
|
|
9114
|
+
/**
|
|
9115
|
+
* Softly asserts that the target data is above a specified value.
|
|
9116
|
+
* @param targetData - The data to check.
|
|
9117
|
+
* @param aboveThan - The value that the target data should be above.
|
|
9118
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9119
|
+
*/
|
|
9120
|
+
softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
|
|
9121
|
+
/**
|
|
9122
|
+
* Softly asserts that the target data is below a specified value.
|
|
9123
|
+
* @param targetData - The data to check.
|
|
9124
|
+
* @param belowThan - The value that the target data should be below.
|
|
9125
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9126
|
+
*/
|
|
9127
|
+
softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
|
|
9128
|
+
/**
|
|
9129
|
+
* Softly asserts that the length of the target data is above a specified value.
|
|
9130
|
+
* @param targetData - The data to check.
|
|
9131
|
+
* @param lengthAboveThan - The length that the target data should be above.
|
|
9132
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9133
|
+
*/
|
|
9134
|
+
softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
|
|
9135
|
+
/**
|
|
9136
|
+
* Softly asserts that the length of the target data is below a specified value.
|
|
9137
|
+
* @param targetData - The data to check.
|
|
9138
|
+
* @param lengthBelowThan - The length that the target data should be below.
|
|
9139
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9140
|
+
*/
|
|
9141
|
+
softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
|
|
9142
|
+
/**
|
|
9143
|
+
* Softly asserts that two values are equal, ignoring case.
|
|
9144
|
+
* @param actualValue - The actual string value.
|
|
9145
|
+
* @param expectedValue - The expected string value.
|
|
9146
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9147
|
+
*/
|
|
9148
|
+
softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
|
|
9149
|
+
/**
|
|
9150
|
+
* Softly asserts that two arrays have deep equality, considering members in any order.
|
|
9151
|
+
* @param actualValue - The actual array.
|
|
9152
|
+
* @param expectedValue - The expected array.
|
|
9153
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9154
|
+
*/
|
|
9155
|
+
softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
|
|
9156
|
+
/**
|
|
9157
|
+
* Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
9158
|
+
* @param superset - The array that should contain the expected members.
|
|
9159
|
+
* @param set - The array with members that should be included.
|
|
9160
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9161
|
+
*/
|
|
9162
|
+
softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
|
|
9163
|
+
/**
|
|
9164
|
+
* Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
9165
|
+
* @param actualValue - The actual object.
|
|
9166
|
+
* @param expectedValue - The expected object.
|
|
9167
|
+
* @param fieldsToExclude - The fields to exclude from the comparison.
|
|
9168
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9169
|
+
*/
|
|
9170
|
+
softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
|
|
9171
|
+
/**
|
|
9172
|
+
* Softly asserts that a value matches the expected pattern.
|
|
9173
|
+
* @param actualValue - The actual value.
|
|
9174
|
+
* @param expectedPattern - The pattern the value should match.
|
|
9175
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9176
|
+
*/
|
|
9177
|
+
softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
|
|
9178
|
+
}
|
|
8678
9179
|
/**
|
|
8679
9180
|
* Client Functions
|
|
8680
9181
|
*/
|
|
@@ -9687,7 +10188,6 @@ declare namespace CodeceptJS {
|
|
|
9687
10188
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
9688
10189
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9689
10190
|
*/
|
|
9690
|
-
// @ts-ignore
|
|
9691
10191
|
type WebDriverConfig = {
|
|
9692
10192
|
url: string;
|
|
9693
10193
|
browser: string;
|