codeceptjs 3.7.1 → 3.7.2-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.
@@ -23,15 +23,23 @@ module.exports = async function (path, options) {
23
23
 
24
24
  if (options.verbose) output.level(3)
25
25
 
26
+ let addGlobalRetries
27
+
28
+ if (config.retry) {
29
+ addGlobalRetries = function retries() {}
30
+ }
31
+
26
32
  output.print('Starting interactive shell for current suite...')
27
33
  recorder.start()
28
34
  event.emit(event.suite.before, {
29
35
  fullTitle: () => 'Interactive Shell',
30
36
  tests: [],
37
+ retries: addGlobalRetries,
31
38
  })
32
39
  event.emit(event.test.before, {
33
40
  title: '',
34
41
  artifacts: {},
42
+ retries: addGlobalRetries,
35
43
  })
36
44
 
37
45
  const enabledHelpers = Container.helpers()
@@ -488,6 +488,9 @@ class WebDriver extends Helper {
488
488
  config.capabilities = config.desiredCapabilities
489
489
  }
490
490
  config.capabilities.browserName = config.browser || config.capabilities.browserName
491
+
492
+ config.capabilities.webSocketUrl = config.webSocketUrl || config.capabilities.webSocketUrl || true
493
+
491
494
  config.capabilities.browserVersion = config.browserVersion || config.capabilities.browserVersion
492
495
  if (config.capabilities.chromeOptions) {
493
496
  config.capabilities['goog:chromeOptions'] = config.capabilities.chromeOptions
@@ -122,7 +122,7 @@ module.exports.injected = function (fn, suite, hookName) {
122
122
  recorder.session.start('teardown')
123
123
  recorder.cleanAsyncErr()
124
124
  if (hookName == 'before' || hookName == 'beforeSuite') suiteTestFailedHookError(suite, err, hookName)
125
- if (hookName === 'after') event.emit(event.test.after, suite)
125
+ if (hookName === 'after') suite.eachTest(test => event.emit(event.test.after, test))
126
126
  if (hookName === 'afterSuite') event.emit(event.suite.after, suite)
127
127
  recorder.add(() => doneFn(err))
128
128
  }
@@ -52,13 +52,13 @@ const defaultConfig = {
52
52
  *
53
53
  */
54
54
  module.exports = function (config) {
55
- supportedHelpers.push('REST')
55
+ const affectedHelpers = [...standardActingHelpers, 'REST']
56
56
  const helpers = Container.helpers()
57
57
  let helper
58
58
 
59
59
  config = Object.assign(defaultConfig, config)
60
60
 
61
- for (const helperName of supportedHelpers) {
61
+ for (const helperName of affectedHelpers) {
62
62
  if (Object.keys(helpers).indexOf(helperName) > -1) {
63
63
  helper = helpers[helperName]
64
64
  }
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.7.1",
3
+ "version": "3.7.2-beta.1",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -101,12 +101,12 @@
101
101
  "inquirer": "8.2.6",
102
102
  "invisi-data": "^1.0.0",
103
103
  "joi": "17.13.3",
104
- "js-beautify": "1.15.1",
104
+ "js-beautify": "1.15.2",
105
105
  "lodash.clonedeep": "4.5.0",
106
106
  "lodash.merge": "4.6.2",
107
107
  "mkdirp": "3.0.1",
108
108
  "mocha": "11.1.0",
109
- "monocart-coverage-reports": "2.12.0",
109
+ "monocart-coverage-reports": "2.12.1",
110
110
  "ms": "2.1.3",
111
111
  "ora-classic": "5.4.2",
112
112
  "parse-function": "5.6.10",
@@ -159,15 +159,15 @@
159
159
  "qrcode-terminal": "0.12.0",
160
160
  "rosie": "2.1.1",
161
161
  "runok": "0.9.3",
162
- "semver": "7.7.0",
162
+ "semver": "7.7.1",
163
163
  "sinon": "19.0.2",
164
164
  "sinon-chai": "3.7.0",
165
165
  "testcafe": "3.7.1",
166
- "ts-morph": "25.0.0",
166
+ "ts-morph": "25.0.1",
167
167
  "ts-node": "10.9.2",
168
168
  "tsd": "^0.31.0",
169
169
  "tsd-jsdoc": "2.5.0",
170
- "typedoc": "0.27.6",
170
+ "typedoc": "0.27.7",
171
171
  "typedoc-plugin-markdown": "4.4.1",
172
172
  "typescript": "5.7.3",
173
173
  "wdio-docker-service": "3.2.1",
@@ -1179,6 +1179,234 @@ 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
+ // @ts-ignore
1202
+ // @ts-ignore
1203
+ // @ts-ignore
1204
+ class ExpectHelper {
1205
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1206
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1207
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1208
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1209
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1210
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1211
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1212
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1213
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1214
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1215
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1216
+ /**
1217
+ * @param [ajvOptions] - Pass AJV options
1218
+ */
1219
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1220
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1221
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1222
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1223
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1224
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1225
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1226
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1227
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1228
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1229
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1230
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1231
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1232
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1233
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1234
+ /**
1235
+ * expects members of two arrays are deeply equal
1236
+ */
1237
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1238
+ /**
1239
+ * expects an array to be a superset of another array
1240
+ */
1241
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1242
+ /**
1243
+ * expects members of two JSON objects are deeply equal excluding some properties
1244
+ */
1245
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1246
+ /**
1247
+ * expects a JSON object matches a provided pattern
1248
+ */
1249
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1250
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1251
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1252
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1253
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1254
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1255
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1256
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1257
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1258
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1259
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1260
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1261
+ /**
1262
+ * @param [ajvOptions] - Pass AJV options
1263
+ */
1264
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1265
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1266
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1267
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1268
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1269
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1270
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1271
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1272
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1273
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1274
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1275
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1276
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1277
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1278
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1279
+ /**
1280
+ * expects members of two arrays are deeply equal
1281
+ */
1282
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1283
+ /**
1284
+ * expects an array to be a superset of another array
1285
+ */
1286
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1287
+ /**
1288
+ * expects members of two JSON objects are deeply equal excluding some properties
1289
+ */
1290
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1291
+ /**
1292
+ * expects a JSON object matches a provided pattern
1293
+ */
1294
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1295
+ }
1296
+ /**
1297
+ * This helper allows performing assertions based on Chai.
1298
+ *
1299
+ * ### Examples
1300
+ *
1301
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1302
+ *
1303
+ * ```js
1304
+ * // inside codecept.conf.js
1305
+ * {
1306
+ * helpers: {
1307
+ * Playwright: {...},
1308
+ * ExpectHelper: {},
1309
+ * }
1310
+ * }
1311
+ * ```
1312
+ *
1313
+ * ## Methods
1314
+ */
1315
+ // @ts-ignore
1316
+ // @ts-ignore
1317
+ // @ts-ignore
1318
+ class ExpectHelper {
1319
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1320
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1321
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1322
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1323
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1324
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1325
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1326
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1327
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1328
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1329
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1330
+ /**
1331
+ * @param [ajvOptions] - Pass AJV options
1332
+ */
1333
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1334
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1335
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1336
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1337
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1338
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1339
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1340
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1341
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1342
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1343
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1344
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1345
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1346
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1347
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1348
+ /**
1349
+ * expects members of two arrays are deeply equal
1350
+ */
1351
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1352
+ /**
1353
+ * expects an array to be a superset of another array
1354
+ */
1355
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1356
+ /**
1357
+ * expects members of two JSON objects are deeply equal excluding some properties
1358
+ */
1359
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1360
+ /**
1361
+ * expects a JSON object matches a provided pattern
1362
+ */
1363
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1364
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1365
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1366
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1367
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1368
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
1369
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
1370
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
1371
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
1372
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
1373
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
1374
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
1375
+ /**
1376
+ * @param [ajvOptions] - Pass AJV options
1377
+ */
1378
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
1379
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1380
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
1381
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1382
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
1383
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
1384
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
1385
+ expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
1386
+ expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
1387
+ expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
1388
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
1389
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
1390
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
1391
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
1392
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1393
+ /**
1394
+ * expects members of two arrays are deeply equal
1395
+ */
1396
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1397
+ /**
1398
+ * expects an array to be a superset of another array
1399
+ */
1400
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
1401
+ /**
1402
+ * expects members of two JSON objects are deeply equal excluding some properties
1403
+ */
1404
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
1405
+ /**
1406
+ * expects a JSON object matches a provided pattern
1407
+ */
1408
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
1409
+ }
1182
1410
  /**
1183
1411
  * Helper for testing filesystem.
1184
1412
  * Can be easily used to check file structures:
@@ -2878,6 +3106,46 @@ declare namespace CodeceptJS {
2878
3106
  */
2879
3107
  grabPageScrollPosition(): Promise<PageScrollPosition>;
2880
3108
  }
3109
+ /**
3110
+ * OpenAI Helper for CodeceptJS.
3111
+ *
3112
+ * 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.
3113
+ * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3114
+ *
3115
+ * ## Configuration
3116
+ *
3117
+ * This helper should be configured in codecept.json or codecept.conf.js
3118
+ *
3119
+ * * `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.
3120
+ */
3121
+ class OpenAITs {
3122
+ /**
3123
+ * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3124
+ *
3125
+ * ```js
3126
+ * I.askGptOnPage('what does this page do?');
3127
+ * ```
3128
+ * @param prompt - The question or prompt to ask the GPT model.
3129
+ * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3130
+ */
3131
+ askGptOnPage(prompt: string): Promise<string>;
3132
+ /**
3133
+ * 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.
3134
+ *
3135
+ * ```js
3136
+ * I.askGptOnPageFragment('describe features of this screen', '.screen');
3137
+ * ```
3138
+ * @param prompt - The question or prompt to ask the GPT-3.5 model.
3139
+ * @param locator - The locator or selector used to identify the HTML fragment on the page.
3140
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3141
+ */
3142
+ askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3143
+ /**
3144
+ * Send a general request to ChatGPT and return response.
3145
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3146
+ */
3147
+ askGptGeneralPrompt(prompt: string): Promise<string>;
3148
+ }
2881
3149
  /**
2882
3150
  * ## Configuration
2883
3151
  *
@@ -8305,6 +8573,250 @@ declare namespace CodeceptJS {
8305
8573
  */
8306
8574
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8307
8575
  }
8576
+ /**
8577
+ * SoftAssertHelper is a utility class for performing soft assertions.
8578
+ * Unlike traditional assertions that stop the execution on failure,
8579
+ * soft assertions allow the execution to continue and report all failures at the end.
8580
+ *
8581
+ * ### Examples
8582
+ *
8583
+ * Zero-configuration when paired with other helpers like REST, Playwright:
8584
+ *
8585
+ * ```js
8586
+ * // inside codecept.conf.js
8587
+ * {
8588
+ * helpers: {
8589
+ * Playwright: {...},
8590
+ * SoftExpectHelper: {},
8591
+ * }
8592
+ * }
8593
+ * ```
8594
+ *
8595
+ * ```js
8596
+ * // in scenario
8597
+ * I.softExpectEqual('a', 'b')
8598
+ * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8599
+ * ```
8600
+ *
8601
+ * ## Methods
8602
+ */
8603
+ class SoftAssertHelperTs {
8604
+ /**
8605
+ * Performs a soft assertion by executing the provided assertion function.
8606
+ * If the assertion fails, the error is caught and stored without halting the execution.
8607
+ * @param assertionFn - The assertion function to execute.
8608
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8609
+ */
8610
+ softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): Promise<any>;
8611
+ /**
8612
+ * Throws an error if any soft assertions have failed.
8613
+ * The error message contains all the accumulated failures.
8614
+ */
8615
+ flushSoftAssertions(): Promise<any>;
8616
+ /**
8617
+ * Softly asserts that two values are 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
+ softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8623
+ /**
8624
+ * Softly asserts that two values are not equal.
8625
+ * @param actualValue - The actual value.
8626
+ * @param expectedValue - The expected value.
8627
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8628
+ */
8629
+ softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8630
+ /**
8631
+ * Softly asserts that two values are deeply equal.
8632
+ * @param actualValue - The actual value.
8633
+ * @param expectedValue - The expected value.
8634
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8635
+ */
8636
+ softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8637
+ /**
8638
+ * Softly asserts that two values are not deeply equal.
8639
+ * @param actualValue - The actual value.
8640
+ * @param expectedValue - The expected value.
8641
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8642
+ */
8643
+ softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
8644
+ /**
8645
+ * Softly asserts that a value contains the expected value.
8646
+ * @param actualValue - The actual value.
8647
+ * @param expectedValueToContain - The value that should be contained within the actual value.
8648
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8649
+ */
8650
+ softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): Promise<any>;
8651
+ /**
8652
+ * Softly asserts that a value does not contain the expected value.
8653
+ * @param actualValue - The actual value.
8654
+ * @param expectedValueToNotContain - The value that should not be contained within the actual value.
8655
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8656
+ */
8657
+ softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): Promise<any>;
8658
+ /**
8659
+ * Softly asserts that a value starts with the expected value.
8660
+ * @param actualValue - The actual value.
8661
+ * @param expectedValueToStartWith - The value that the actual value should start with.
8662
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8663
+ */
8664
+ softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): Promise<any>;
8665
+ /**
8666
+ * Softly asserts that a value does not start with the expected value.
8667
+ * @param actualValue - The actual value.
8668
+ * @param expectedValueToNotStartWith - The value that the actual value should not start with.
8669
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8670
+ */
8671
+ softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): Promise<any>;
8672
+ /**
8673
+ * Softly asserts that a value ends with the expected value.
8674
+ * @param actualValue - The actual value.
8675
+ * @param expectedValueToEndWith - The value that the actual value should end with.
8676
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8677
+ */
8678
+ softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): Promise<any>;
8679
+ /**
8680
+ * Softly asserts that a value does not end with the expected value.
8681
+ * @param actualValue - The actual value.
8682
+ * @param expectedValueToNotEndWith - The value that the actual value should not end with.
8683
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8684
+ */
8685
+ softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): Promise<any>;
8686
+ /**
8687
+ * Softly asserts that the target data matches the given JSON schema.
8688
+ * @param targetData - The data to validate.
8689
+ * @param jsonSchema - The JSON schema to validate against.
8690
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8691
+ */
8692
+ softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): Promise<any>;
8693
+ /**
8694
+ * Softly asserts that the target data matches the given JSON schema using AJV.
8695
+ * @param targetData - The data to validate.
8696
+ * @param jsonSchema - The JSON schema to validate against.
8697
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8698
+ * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
8699
+ */
8700
+ softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): Promise<any>;
8701
+ /**
8702
+ * Softly asserts that the target data has the specified property.
8703
+ * @param targetData - The data to check.
8704
+ * @param propertyName - The property name to check for.
8705
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion
8706
+ * fails.
8707
+ */
8708
+ softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
8709
+ /**
8710
+ * Softly asserts that the target data has a property with the specified name.
8711
+ * @param targetData - The data to check.
8712
+ * @param propertyName - The property name to check for.
8713
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8714
+ */
8715
+ softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
8716
+ /**
8717
+ * Softly asserts that the target data is of a specific type.
8718
+ * @param targetData - The data to check.
8719
+ * @param type - The expected type (e.g., 'string', 'number').
8720
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8721
+ */
8722
+ softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
8723
+ /**
8724
+ * Softly asserts that the target data is of a specific type (alternative for articles).
8725
+ * @param targetData - The data to check.
8726
+ * @param type - The expected type (e.g., 'string', 'number').
8727
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8728
+ */
8729
+ softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
8730
+ /**
8731
+ * Softly asserts that the target data has a specified length.
8732
+ * @param targetData - The data to check.
8733
+ * @param length - The expected length.
8734
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8735
+ */
8736
+ softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): Promise<any>;
8737
+ /**
8738
+ * Softly asserts that the target data is empty.
8739
+ * @param targetData - The data to check.
8740
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8741
+ */
8742
+ softExpectEmpty(targetData: any, customErrorMsg?: string): Promise<any>;
8743
+ /**
8744
+ * Softly asserts that the target data is true.
8745
+ * @param targetData - The data to check.
8746
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8747
+ */
8748
+ softExpectTrue(targetData: any, customErrorMsg?: string): Promise<any>;
8749
+ /**
8750
+ * Softly asserts that the target data is false.
8751
+ * @param targetData - The data to check.
8752
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8753
+ */
8754
+ softExpectFalse(targetData: any, customErrorMsg?: string): Promise<any>;
8755
+ /**
8756
+ * Softly asserts that the target data is above a specified value.
8757
+ * @param targetData - The data to check.
8758
+ * @param aboveThan - The value that the target data should be above.
8759
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8760
+ */
8761
+ softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): Promise<any>;
8762
+ /**
8763
+ * Softly asserts that the target data is below a specified value.
8764
+ * @param targetData - The data to check.
8765
+ * @param belowThan - The value that the target data should be below.
8766
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8767
+ */
8768
+ softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): Promise<any>;
8769
+ /**
8770
+ * Softly asserts that the length of the target data is above a specified value.
8771
+ * @param targetData - The data to check.
8772
+ * @param lengthAboveThan - The length that the target data should be above.
8773
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8774
+ */
8775
+ softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): Promise<any>;
8776
+ /**
8777
+ * Softly asserts that the length of the target data is below a specified value.
8778
+ * @param targetData - The data to check.
8779
+ * @param lengthBelowThan - The length that the target data should be below.
8780
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8781
+ */
8782
+ softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): Promise<any>;
8783
+ /**
8784
+ * Softly asserts that two values are equal, ignoring case.
8785
+ * @param actualValue - The actual string value.
8786
+ * @param expectedValue - The expected string value.
8787
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8788
+ */
8789
+ softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): Promise<any>;
8790
+ /**
8791
+ * Softly asserts that two arrays have deep equality, considering members in any order.
8792
+ * @param actualValue - The actual array.
8793
+ * @param expectedValue - The expected array.
8794
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8795
+ */
8796
+ softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): Promise<any>;
8797
+ /**
8798
+ * Softly asserts that an array (superset) deeply includes all members of another array (set).
8799
+ * @param superset - The array that should contain the expected members.
8800
+ * @param set - The array with members that should be included.
8801
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8802
+ */
8803
+ softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): Promise<any>;
8804
+ /**
8805
+ * Softly asserts that two objects are deeply equal, excluding specified fields.
8806
+ * @param actualValue - The actual object.
8807
+ * @param expectedValue - The expected object.
8808
+ * @param fieldsToExclude - The fields to exclude from the comparison.
8809
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8810
+ */
8811
+ softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): Promise<any>;
8812
+ /**
8813
+ * Softly asserts that a value matches the expected pattern.
8814
+ * @param actualValue - The actual value.
8815
+ * @param expectedPattern - The pattern the value should match.
8816
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8817
+ */
8818
+ softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): Promise<any>;
8819
+ }
8308
8820
  /**
8309
8821
  * Client Functions
8310
8822
  */
@@ -1203,6 +1203,234 @@ 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
+ class ExpectHelper {
1229
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1230
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1231
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1232
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1233
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1234
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1235
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1236
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1237
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1238
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1239
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1240
+ /**
1241
+ * @param [ajvOptions] - Pass AJV options
1242
+ */
1243
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1244
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1245
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1246
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1247
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1248
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1249
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1250
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1251
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1252
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1253
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1254
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1255
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1256
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1257
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1258
+ /**
1259
+ * expects members of two arrays are deeply equal
1260
+ */
1261
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1262
+ /**
1263
+ * expects an array to be a superset of another array
1264
+ */
1265
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1266
+ /**
1267
+ * expects members of two JSON objects are deeply equal excluding some properties
1268
+ */
1269
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1270
+ /**
1271
+ * expects a JSON object matches a provided pattern
1272
+ */
1273
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1274
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1275
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1276
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1277
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1278
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1279
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1280
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1281
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1282
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1283
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1284
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1285
+ /**
1286
+ * @param [ajvOptions] - Pass AJV options
1287
+ */
1288
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1289
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1290
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1291
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1292
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1293
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1294
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1295
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1296
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1297
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1298
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1299
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1300
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1301
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1302
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1303
+ /**
1304
+ * expects members of two arrays are deeply equal
1305
+ */
1306
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1307
+ /**
1308
+ * expects an array to be a superset of another array
1309
+ */
1310
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1311
+ /**
1312
+ * expects members of two JSON objects are deeply equal excluding some properties
1313
+ */
1314
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1315
+ /**
1316
+ * expects a JSON object matches a provided pattern
1317
+ */
1318
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1319
+ }
1320
+ /**
1321
+ * This helper allows performing assertions based on Chai.
1322
+ *
1323
+ * ### Examples
1324
+ *
1325
+ * Zero-configuration when paired with other helpers like REST, Playwright:
1326
+ *
1327
+ * ```js
1328
+ * // inside codecept.conf.js
1329
+ * {
1330
+ * helpers: {
1331
+ * Playwright: {...},
1332
+ * ExpectHelper: {},
1333
+ * }
1334
+ * }
1335
+ * ```
1336
+ *
1337
+ * ## Methods
1338
+ */
1339
+ // @ts-ignore
1340
+ // @ts-ignore
1341
+ // @ts-ignore
1342
+ class ExpectHelper {
1343
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1344
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1345
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1346
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1347
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1348
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1349
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1350
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1351
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1352
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1353
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1354
+ /**
1355
+ * @param [ajvOptions] - Pass AJV options
1356
+ */
1357
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1358
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1359
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1360
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1361
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1362
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1363
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1364
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1365
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1366
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1367
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1368
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1369
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1370
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1371
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1372
+ /**
1373
+ * expects members of two arrays are deeply equal
1374
+ */
1375
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1376
+ /**
1377
+ * expects an array to be a superset of another array
1378
+ */
1379
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1380
+ /**
1381
+ * expects members of two JSON objects are deeply equal excluding some properties
1382
+ */
1383
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1384
+ /**
1385
+ * expects a JSON object matches a provided pattern
1386
+ */
1387
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1388
+ expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1389
+ expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1390
+ expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1391
+ expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1392
+ expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
1393
+ expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
1394
+ expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
1395
+ expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
1396
+ expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
1397
+ expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
1398
+ expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
1399
+ /**
1400
+ * @param [ajvOptions] - Pass AJV options
1401
+ */
1402
+ expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
1403
+ expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1404
+ expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
1405
+ expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
1406
+ expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
1407
+ expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
1408
+ expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
1409
+ expectEmpty(targetData: any, customErrorMsg?: any): void;
1410
+ expectTrue(targetData: any, customErrorMsg?: any): void;
1411
+ expectFalse(targetData: any, customErrorMsg?: any): void;
1412
+ expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
1413
+ expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
1414
+ expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
1415
+ expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
1416
+ expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1417
+ /**
1418
+ * expects members of two arrays are deeply equal
1419
+ */
1420
+ expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1421
+ /**
1422
+ * expects an array to be a superset of another array
1423
+ */
1424
+ expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
1425
+ /**
1426
+ * expects members of two JSON objects are deeply equal excluding some properties
1427
+ */
1428
+ expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
1429
+ /**
1430
+ * expects a JSON object matches a provided pattern
1431
+ */
1432
+ expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
1433
+ }
1206
1434
  /**
1207
1435
  * Helper for testing filesystem.
1208
1436
  * Can be easily used to check file structures:
@@ -2971,6 +3199,46 @@ declare namespace CodeceptJS {
2971
3199
  */
2972
3200
  grabPageScrollPosition(): Promise<PageScrollPosition>;
2973
3201
  }
3202
+ /**
3203
+ * OpenAI Helper for CodeceptJS.
3204
+ *
3205
+ * 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.
3206
+ * This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
3207
+ *
3208
+ * ## Configuration
3209
+ *
3210
+ * This helper should be configured in codecept.json or codecept.conf.js
3211
+ *
3212
+ * * `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.
3213
+ */
3214
+ class OpenAI {
3215
+ /**
3216
+ * Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
3217
+ *
3218
+ * ```js
3219
+ * I.askGptOnPage('what does this page do?');
3220
+ * ```
3221
+ * @param prompt - The question or prompt to ask the GPT model.
3222
+ * @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
3223
+ */
3224
+ askGptOnPage(prompt: string): Promise<string>;
3225
+ /**
3226
+ * 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.
3227
+ *
3228
+ * ```js
3229
+ * I.askGptOnPageFragment('describe features of this screen', '.screen');
3230
+ * ```
3231
+ * @param prompt - The question or prompt to ask the GPT-3.5 model.
3232
+ * @param locator - The locator or selector used to identify the HTML fragment on the page.
3233
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3234
+ */
3235
+ askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
3236
+ /**
3237
+ * Send a general request to ChatGPT and return response.
3238
+ * @returns - A Promise that resolves to the generated response from the GPT model.
3239
+ */
3240
+ askGptGeneralPrompt(prompt: string): Promise<string>;
3241
+ }
2974
3242
  /**
2975
3243
  * ## Configuration
2976
3244
  *
@@ -8685,6 +8953,250 @@ declare namespace CodeceptJS {
8685
8953
  */
8686
8954
  sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
8687
8955
  }
8956
+ /**
8957
+ * SoftAssertHelper is a utility class for performing soft assertions.
8958
+ * Unlike traditional assertions that stop the execution on failure,
8959
+ * soft assertions allow the execution to continue and report all failures at the end.
8960
+ *
8961
+ * ### Examples
8962
+ *
8963
+ * Zero-configuration when paired with other helpers like REST, Playwright:
8964
+ *
8965
+ * ```js
8966
+ * // inside codecept.conf.js
8967
+ * {
8968
+ * helpers: {
8969
+ * Playwright: {...},
8970
+ * SoftExpectHelper: {},
8971
+ * }
8972
+ * }
8973
+ * ```
8974
+ *
8975
+ * ```js
8976
+ * // in scenario
8977
+ * I.softExpectEqual('a', 'b')
8978
+ * I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
8979
+ * ```
8980
+ *
8981
+ * ## Methods
8982
+ */
8983
+ class SoftAssertHelper {
8984
+ /**
8985
+ * Performs a soft assertion by executing the provided assertion function.
8986
+ * If the assertion fails, the error is caught and stored without halting the execution.
8987
+ * @param assertionFn - The assertion function to execute.
8988
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
8989
+ */
8990
+ softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
8991
+ /**
8992
+ * Throws an error if any soft assertions have failed.
8993
+ * The error message contains all the accumulated failures.
8994
+ */
8995
+ flushSoftAssertions(): void;
8996
+ /**
8997
+ * Softly asserts that two values are 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
+ softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9003
+ /**
9004
+ * Softly asserts that two values are not equal.
9005
+ * @param actualValue - The actual value.
9006
+ * @param expectedValue - The expected value.
9007
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9008
+ */
9009
+ softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9010
+ /**
9011
+ * Softly asserts that two values are deeply equal.
9012
+ * @param actualValue - The actual value.
9013
+ * @param expectedValue - The expected value.
9014
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9015
+ */
9016
+ softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9017
+ /**
9018
+ * Softly asserts that two values are not deeply 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
+ softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
9024
+ /**
9025
+ * Softly asserts that a value contains the expected value.
9026
+ * @param actualValue - The actual value.
9027
+ * @param expectedValueToContain - The value that should be contained within the actual value.
9028
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9029
+ */
9030
+ softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
9031
+ /**
9032
+ * Softly asserts that a value does not contain the expected value.
9033
+ * @param actualValue - The actual value.
9034
+ * @param expectedValueToNotContain - The value that should not be contained within the actual value.
9035
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9036
+ */
9037
+ softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
9038
+ /**
9039
+ * Softly asserts that a value starts with the expected value.
9040
+ * @param actualValue - The actual value.
9041
+ * @param expectedValueToStartWith - The value that the actual value should start with.
9042
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9043
+ */
9044
+ softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
9045
+ /**
9046
+ * Softly asserts that a value does not start with the expected value.
9047
+ * @param actualValue - The actual value.
9048
+ * @param expectedValueToNotStartWith - The value that the actual value should not start with.
9049
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9050
+ */
9051
+ softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
9052
+ /**
9053
+ * Softly asserts that a value ends with the expected value.
9054
+ * @param actualValue - The actual value.
9055
+ * @param expectedValueToEndWith - The value that the actual value should end with.
9056
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9057
+ */
9058
+ softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
9059
+ /**
9060
+ * Softly asserts that a value does not end with the expected value.
9061
+ * @param actualValue - The actual value.
9062
+ * @param expectedValueToNotEndWith - The value that the actual value should not end with.
9063
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9064
+ */
9065
+ softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
9066
+ /**
9067
+ * Softly asserts that the target data matches the given JSON schema.
9068
+ * @param targetData - The data to validate.
9069
+ * @param jsonSchema - The JSON schema to validate against.
9070
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9071
+ */
9072
+ softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
9073
+ /**
9074
+ * Softly asserts that the target data matches the given JSON schema using AJV.
9075
+ * @param targetData - The data to validate.
9076
+ * @param jsonSchema - The JSON schema to validate against.
9077
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9078
+ * @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
9079
+ */
9080
+ softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
9081
+ /**
9082
+ * Softly asserts that the target data has the specified property.
9083
+ * @param targetData - The data to check.
9084
+ * @param propertyName - The property name to check for.
9085
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion
9086
+ * fails.
9087
+ */
9088
+ softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9089
+ /**
9090
+ * Softly asserts that the target data has a property with the specified name.
9091
+ * @param targetData - The data to check.
9092
+ * @param propertyName - The property name to check for.
9093
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9094
+ */
9095
+ softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
9096
+ /**
9097
+ * Softly asserts that the target data is of a specific type.
9098
+ * @param targetData - The data to check.
9099
+ * @param type - The expected type (e.g., 'string', 'number').
9100
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9101
+ */
9102
+ softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
9103
+ /**
9104
+ * Softly asserts that the target data is of a specific type (alternative for articles).
9105
+ * @param targetData - The data to check.
9106
+ * @param type - The expected type (e.g., 'string', 'number').
9107
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9108
+ */
9109
+ softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
9110
+ /**
9111
+ * Softly asserts that the target data has a specified length.
9112
+ * @param targetData - The data to check.
9113
+ * @param length - The expected length.
9114
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9115
+ */
9116
+ softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
9117
+ /**
9118
+ * Softly asserts that the target data is empty.
9119
+ * @param targetData - The data to check.
9120
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9121
+ */
9122
+ softExpectEmpty(targetData: any, customErrorMsg?: string): void;
9123
+ /**
9124
+ * Softly asserts that the target data is true.
9125
+ * @param targetData - The data to check.
9126
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9127
+ */
9128
+ softExpectTrue(targetData: any, customErrorMsg?: string): void;
9129
+ /**
9130
+ * Softly asserts that the target data is false.
9131
+ * @param targetData - The data to check.
9132
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9133
+ */
9134
+ softExpectFalse(targetData: any, customErrorMsg?: string): void;
9135
+ /**
9136
+ * Softly asserts that the target data is above a specified value.
9137
+ * @param targetData - The data to check.
9138
+ * @param aboveThan - The value that the target data should be above.
9139
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9140
+ */
9141
+ softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
9142
+ /**
9143
+ * Softly asserts that the target data is below a specified value.
9144
+ * @param targetData - The data to check.
9145
+ * @param belowThan - The value that the target data should be below.
9146
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9147
+ */
9148
+ softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
9149
+ /**
9150
+ * Softly asserts that the length of the target data is above a specified value.
9151
+ * @param targetData - The data to check.
9152
+ * @param lengthAboveThan - The length that the target data should be above.
9153
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9154
+ */
9155
+ softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
9156
+ /**
9157
+ * Softly asserts that the length of the target data is below a specified value.
9158
+ * @param targetData - The data to check.
9159
+ * @param lengthBelowThan - The length that the target data should be below.
9160
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9161
+ */
9162
+ softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
9163
+ /**
9164
+ * Softly asserts that two values are equal, ignoring case.
9165
+ * @param actualValue - The actual string value.
9166
+ * @param expectedValue - The expected string value.
9167
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9168
+ */
9169
+ softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
9170
+ /**
9171
+ * Softly asserts that two arrays have deep equality, considering members in any order.
9172
+ * @param actualValue - The actual array.
9173
+ * @param expectedValue - The expected array.
9174
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9175
+ */
9176
+ softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
9177
+ /**
9178
+ * Softly asserts that an array (superset) deeply includes all members of another array (set).
9179
+ * @param superset - The array that should contain the expected members.
9180
+ * @param set - The array with members that should be included.
9181
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9182
+ */
9183
+ softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
9184
+ /**
9185
+ * Softly asserts that two objects are deeply equal, excluding specified fields.
9186
+ * @param actualValue - The actual object.
9187
+ * @param expectedValue - The expected object.
9188
+ * @param fieldsToExclude - The fields to exclude from the comparison.
9189
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9190
+ */
9191
+ softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
9192
+ /**
9193
+ * Softly asserts that a value matches the expected pattern.
9194
+ * @param actualValue - The actual value.
9195
+ * @param expectedPattern - The pattern the value should match.
9196
+ * @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
9197
+ */
9198
+ softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
9199
+ }
8688
9200
  /**
8689
9201
  * Client Functions
8690
9202
  */