codeceptjs 4.0.0-beta.2 → 4.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -120
- package/bin/codecept.js +107 -96
- package/bin/test-server.js +64 -0
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +5 -1
- package/lib/actor.js +73 -103
- package/lib/ai.js +159 -188
- package/lib/assert/empty.js +22 -24
- package/lib/assert/equal.js +30 -37
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +43 -48
- package/lib/assert/throws.js +11 -11
- package/lib/assert/truth.js +22 -22
- package/lib/assert.js +20 -18
- package/lib/codecept.js +262 -162
- package/lib/colorUtils.js +50 -52
- package/lib/command/check.js +206 -0
- package/lib/command/configMigrate.js +56 -51
- package/lib/command/definitions.js +96 -109
- package/lib/command/dryRun.js +77 -79
- package/lib/command/generate.js +234 -194
- package/lib/command/gherkin/init.js +42 -33
- package/lib/command/gherkin/snippets.js +76 -74
- package/lib/command/gherkin/steps.js +20 -17
- package/lib/command/info.js +74 -38
- package/lib/command/init.js +301 -290
- package/lib/command/interactive.js +41 -32
- package/lib/command/list.js +28 -27
- package/lib/command/run-multiple/chunk.js +51 -48
- package/lib/command/run-multiple/collection.js +5 -5
- package/lib/command/run-multiple/run.js +5 -1
- package/lib/command/run-multiple.js +97 -97
- package/lib/command/run-rerun.js +19 -25
- package/lib/command/run-workers.js +68 -92
- package/lib/command/run.js +39 -27
- package/lib/command/utils.js +80 -64
- package/lib/command/workers/runTests.js +388 -226
- package/lib/config.js +109 -50
- package/lib/container.js +765 -261
- package/lib/data/context.js +60 -61
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +32 -32
- package/lib/data/table.js +22 -22
- package/lib/effects.js +307 -0
- package/lib/element/WebElement.js +327 -0
- package/lib/els.js +160 -0
- package/lib/event.js +173 -163
- package/lib/globals.js +141 -0
- package/lib/heal.js +89 -85
- package/lib/helper/AI.js +131 -41
- package/lib/helper/ApiDataFactory.js +107 -75
- package/lib/helper/Appium.js +542 -404
- package/lib/helper/FileSystem.js +100 -79
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +52 -52
- package/lib/helper/JSONResponse.js +126 -88
- package/lib/helper/Mochawesome.js +54 -29
- package/lib/helper/Playwright.js +2547 -1316
- package/lib/helper/Puppeteer.js +1578 -1181
- package/lib/helper/REST.js +209 -68
- package/lib/helper/WebDriver.js +1482 -1342
- package/lib/helper/errors/ConnectionRefused.js +6 -6
- package/lib/helper/errors/ElementAssertion.js +11 -16
- package/lib/helper/errors/ElementNotFound.js +5 -9
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
- package/lib/helper/extras/Console.js +11 -11
- package/lib/helper/extras/PlaywrightLocator.js +110 -0
- package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
- package/lib/helper/extras/PlaywrightReactVueLocator.js +17 -8
- package/lib/helper/extras/PlaywrightRestartOpts.js +25 -11
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/helper/extras/React.js +27 -28
- package/lib/helper/network/actions.js +36 -42
- package/lib/helper/network/utils.js +78 -84
- package/lib/helper/scripts/blurElement.js +5 -5
- package/lib/helper/scripts/focusElement.js +5 -5
- package/lib/helper/scripts/highlightElement.js +8 -8
- package/lib/helper/scripts/isElementClickable.js +34 -34
- package/lib/helper.js +2 -3
- package/lib/history.js +23 -19
- package/lib/hooks.js +8 -8
- package/lib/html.js +94 -104
- package/lib/index.js +38 -27
- package/lib/listener/config.js +30 -23
- package/lib/listener/emptyRun.js +54 -0
- package/lib/listener/enhancedGlobalRetry.js +110 -0
- package/lib/listener/exit.js +16 -18
- package/lib/listener/globalRetry.js +70 -0
- package/lib/listener/globalTimeout.js +181 -0
- package/lib/listener/helpers.js +76 -51
- package/lib/listener/mocha.js +10 -11
- package/lib/listener/result.js +11 -0
- package/lib/listener/retryEnhancer.js +85 -0
- package/lib/listener/steps.js +71 -59
- package/lib/listener/store.js +20 -0
- package/lib/locator.js +214 -197
- package/lib/mocha/asyncWrapper.js +274 -0
- package/lib/mocha/bdd.js +167 -0
- package/lib/mocha/cli.js +341 -0
- package/lib/mocha/factory.js +163 -0
- package/lib/mocha/featureConfig.js +89 -0
- package/lib/mocha/gherkin.js +231 -0
- package/lib/mocha/hooks.js +121 -0
- package/lib/mocha/index.js +21 -0
- package/lib/mocha/inject.js +46 -0
- package/lib/{interfaces → mocha}/scenarioConfig.js +58 -34
- package/lib/mocha/suite.js +89 -0
- package/lib/mocha/test.js +184 -0
- package/lib/mocha/types.d.ts +42 -0
- package/lib/mocha/ui.js +242 -0
- package/lib/output.js +141 -71
- package/lib/parser.js +54 -44
- package/lib/pause.js +173 -145
- package/lib/plugin/analyze.js +403 -0
- package/lib/plugin/{autoLogin.js → auth.js} +178 -79
- package/lib/plugin/autoDelay.js +36 -40
- package/lib/plugin/coverage.js +131 -78
- package/lib/plugin/customLocator.js +22 -21
- package/lib/plugin/customReporter.js +53 -0
- package/lib/plugin/enhancedRetryFailedStep.js +99 -0
- package/lib/plugin/heal.js +101 -110
- package/lib/plugin/htmlReporter.js +3648 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/pauseOnFail.js +12 -11
- package/lib/plugin/retryFailedStep.js +82 -47
- package/lib/plugin/screenshotOnFail.js +111 -92
- package/lib/plugin/stepByStepReport.js +159 -101
- package/lib/plugin/stepTimeout.js +20 -25
- package/lib/plugin/subtitles.js +38 -38
- package/lib/recorder.js +193 -130
- package/lib/rerun.js +94 -49
- package/lib/result.js +238 -0
- package/lib/retryCoordinator.js +207 -0
- package/lib/secret.js +20 -18
- package/lib/session.js +95 -89
- package/lib/step/base.js +239 -0
- package/lib/step/comment.js +10 -0
- package/lib/step/config.js +50 -0
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +50 -0
- package/lib/step/meta.js +99 -0
- package/lib/step/record.js +74 -0
- package/lib/step/retry.js +11 -0
- package/lib/step/section.js +55 -0
- package/lib/step.js +18 -329
- package/lib/steps.js +54 -0
- package/lib/store.js +38 -7
- package/lib/template/heal.js +3 -12
- package/lib/template/prompts/generatePageObject.js +31 -0
- package/lib/template/prompts/healStep.js +13 -0
- package/lib/template/prompts/writeStep.js +9 -0
- package/lib/test-server.js +334 -0
- package/lib/timeout.js +60 -0
- package/lib/transform.js +8 -8
- package/lib/translation.js +34 -21
- package/lib/utils/loaderCheck.js +124 -0
- package/lib/utils/mask_data.js +47 -0
- package/lib/utils/typescript.js +237 -0
- package/lib/utils.js +411 -228
- package/lib/workerStorage.js +37 -34
- package/lib/workers.js +532 -296
- package/package.json +124 -95
- package/translations/de-DE.js +5 -3
- package/translations/fr-FR.js +5 -4
- package/translations/index.js +22 -12
- package/translations/it-IT.js +4 -3
- package/translations/ja-JP.js +4 -3
- package/translations/nl-NL.js +76 -0
- package/translations/pl-PL.js +4 -3
- package/translations/pt-BR.js +4 -3
- package/translations/ru-RU.js +4 -3
- package/translations/utils.js +10 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/index.d.ts +546 -185
- package/typings/promiseBasedTypes.d.ts +150 -875
- package/typings/types.d.ts +547 -992
- package/lib/cli.js +0 -249
- package/lib/dirname.js +0 -5
- package/lib/helper/Expect.js +0 -425
- package/lib/helper/ExpectHelper.js +0 -399
- package/lib/helper/MockServer.js +0 -223
- package/lib/helper/Nightmare.js +0 -1411
- package/lib/helper/Protractor.js +0 -1835
- package/lib/helper/SoftExpectHelper.js +0 -381
- package/lib/helper/TestCafe.js +0 -1410
- package/lib/helper/clientscripts/nightmare.js +0 -213
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -63
- package/lib/interfaces/bdd.js +0 -98
- package/lib/interfaces/featureConfig.js +0 -69
- package/lib/interfaces/gherkin.js +0 -195
- package/lib/listener/artifacts.js +0 -19
- package/lib/listener/retry.js +0 -68
- package/lib/listener/timeout.js +0 -109
- package/lib/mochaFactory.js +0 -110
- package/lib/plugin/allure.js +0 -15
- package/lib/plugin/commentStep.js +0 -136
- package/lib/plugin/debugErrors.js +0 -67
- package/lib/plugin/eachElement.js +0 -127
- package/lib/plugin/fakerTransform.js +0 -49
- package/lib/plugin/retryTo.js +0 -121
- package/lib/plugin/selenoid.js +0 -371
- package/lib/plugin/standardActingHelpers.js +0 -9
- package/lib/plugin/tryTo.js +0 -105
- package/lib/plugin/wdio.js +0 -246
- package/lib/scenario.js +0 -222
- package/lib/ui.js +0 -238
- package/lib/within.js +0 -70
package/typings/types.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ declare namespace CodeceptJS {
|
|
|
113
113
|
*
|
|
114
114
|
* module.exports = new Factory()
|
|
115
115
|
* // no need to set id, it will be set by REST API
|
|
116
|
-
* .attr('author', () => faker.
|
|
116
|
+
* .attr('author', () => faker.person.findName())
|
|
117
117
|
* .attr('title', () => faker.lorem.sentence())
|
|
118
118
|
* .attr('body', () => faker.lorem.paragraph());
|
|
119
119
|
* ```
|
|
@@ -354,6 +354,17 @@ declare namespace CodeceptJS {
|
|
|
354
354
|
* ```
|
|
355
355
|
*/
|
|
356
356
|
runOnAndroid(caps: any, fn: any): void;
|
|
357
|
+
/**
|
|
358
|
+
* Execute code only in Web mode.
|
|
359
|
+
*
|
|
360
|
+
* ```js
|
|
361
|
+
* I.runInWeb(() => {
|
|
362
|
+
* I.waitForElement('#data');
|
|
363
|
+
* I.seeInCurrentUrl('/data');
|
|
364
|
+
* });
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
runInWeb(): void;
|
|
357
368
|
/**
|
|
358
369
|
* Returns app installation status.
|
|
359
370
|
*
|
|
@@ -597,17 +608,11 @@ declare namespace CodeceptJS {
|
|
|
597
608
|
* ```js
|
|
598
609
|
* // taps outside to hide keyboard per default
|
|
599
610
|
* I.hideDeviceKeyboard();
|
|
600
|
-
* I.hideDeviceKeyboard('tapOutside');
|
|
601
|
-
*
|
|
602
|
-
* // or by pressing key
|
|
603
|
-
* I.hideDeviceKeyboard('pressKey', 'Done');
|
|
604
611
|
* ```
|
|
605
612
|
*
|
|
606
613
|
* Appium: support Android and iOS
|
|
607
|
-
* @param [strategy] - Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
|
|
608
|
-
* @param [key] - Optional key
|
|
609
614
|
*/
|
|
610
|
-
hideDeviceKeyboard(
|
|
615
|
+
hideDeviceKeyboard(): void;
|
|
611
616
|
/**
|
|
612
617
|
* Send a key event to the device.
|
|
613
618
|
* List of keys: https://developer.android.com/reference/android/view/KeyEvent.html
|
|
@@ -651,6 +656,19 @@ declare namespace CodeceptJS {
|
|
|
651
656
|
* Shortcut for `makeTouchAction`
|
|
652
657
|
*/
|
|
653
658
|
tap(locator: any): Promise<void>;
|
|
659
|
+
/**
|
|
660
|
+
* Perform a swipe on the screen or an element.
|
|
661
|
+
*
|
|
662
|
+
* ```js
|
|
663
|
+
* let locator = "#io.selendroid.testapp:id/LinearLayout1";
|
|
664
|
+
* I.swipe(locator, 800, 1200, 1000);
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* [See complete reference](http://webdriver.io/api/mobile/swipe.html)
|
|
668
|
+
* @param [speed = 1000] - (optional), 1000 by default
|
|
669
|
+
* @returns Appium: support Android and iOS
|
|
670
|
+
*/
|
|
671
|
+
swipe(locator: CodeceptJS.LocatorOrString, xoffset: number, yoffset: number, speed?: number): Promise<void>;
|
|
654
672
|
/**
|
|
655
673
|
* Perform a swipe on the screen.
|
|
656
674
|
*
|
|
@@ -1185,236 +1203,6 @@ declare namespace CodeceptJS {
|
|
|
1185
1203
|
*/
|
|
1186
1204
|
waitForText(text: string, sec?: number, context?: CodeceptJS.LocatorOrString): void;
|
|
1187
1205
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* This helper allows performing assertions based on Chai.
|
|
1190
|
-
*
|
|
1191
|
-
* ### Examples
|
|
1192
|
-
*
|
|
1193
|
-
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1194
|
-
*
|
|
1195
|
-
* ```js
|
|
1196
|
-
* // inside codecept.conf.js
|
|
1197
|
-
* {
|
|
1198
|
-
* helpers: {
|
|
1199
|
-
* Playwright: {...},
|
|
1200
|
-
* ExpectHelper: {},
|
|
1201
|
-
* }
|
|
1202
|
-
* }
|
|
1203
|
-
* ```
|
|
1204
|
-
*
|
|
1205
|
-
* ## Methods
|
|
1206
|
-
*/
|
|
1207
|
-
// @ts-ignore
|
|
1208
|
-
// @ts-ignore
|
|
1209
|
-
// @ts-ignore
|
|
1210
|
-
// @ts-ignore
|
|
1211
|
-
class ExpectHelper {
|
|
1212
|
-
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1213
|
-
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1214
|
-
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1215
|
-
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1216
|
-
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1217
|
-
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1218
|
-
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1219
|
-
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1220
|
-
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1221
|
-
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1222
|
-
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1223
|
-
/**
|
|
1224
|
-
* @param [ajvOptions] - Pass AJV options
|
|
1225
|
-
*/
|
|
1226
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1227
|
-
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1228
|
-
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1229
|
-
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1230
|
-
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1231
|
-
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1232
|
-
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1233
|
-
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1234
|
-
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1235
|
-
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1236
|
-
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1237
|
-
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1238
|
-
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1239
|
-
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1240
|
-
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1241
|
-
/**
|
|
1242
|
-
* expects members of two arrays are deeply equal
|
|
1243
|
-
*/
|
|
1244
|
-
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1245
|
-
/**
|
|
1246
|
-
* expects an array to be a superset of another array
|
|
1247
|
-
*/
|
|
1248
|
-
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1249
|
-
/**
|
|
1250
|
-
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1251
|
-
*/
|
|
1252
|
-
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1253
|
-
/**
|
|
1254
|
-
* expects a JSON object matches a provided pattern
|
|
1255
|
-
*/
|
|
1256
|
-
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1257
|
-
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1258
|
-
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1259
|
-
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1260
|
-
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1261
|
-
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1262
|
-
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1263
|
-
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1264
|
-
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1265
|
-
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1266
|
-
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1267
|
-
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1268
|
-
/**
|
|
1269
|
-
* @param [ajvOptions] - Pass AJV options
|
|
1270
|
-
*/
|
|
1271
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1272
|
-
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1273
|
-
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1274
|
-
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1275
|
-
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1276
|
-
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1277
|
-
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1278
|
-
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1279
|
-
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1280
|
-
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1281
|
-
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1282
|
-
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1283
|
-
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1284
|
-
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1285
|
-
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1286
|
-
/**
|
|
1287
|
-
* expects members of two arrays are deeply equal
|
|
1288
|
-
*/
|
|
1289
|
-
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1290
|
-
/**
|
|
1291
|
-
* expects an array to be a superset of another array
|
|
1292
|
-
*/
|
|
1293
|
-
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1294
|
-
/**
|
|
1295
|
-
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1296
|
-
*/
|
|
1297
|
-
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1298
|
-
/**
|
|
1299
|
-
* expects a JSON object matches a provided pattern
|
|
1300
|
-
*/
|
|
1301
|
-
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1302
|
-
}
|
|
1303
|
-
/**
|
|
1304
|
-
* This helper allows performing assertions based on Chai.
|
|
1305
|
-
*
|
|
1306
|
-
* ### Examples
|
|
1307
|
-
*
|
|
1308
|
-
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1309
|
-
*
|
|
1310
|
-
* ```js
|
|
1311
|
-
* // inside codecept.conf.js
|
|
1312
|
-
* {
|
|
1313
|
-
* helpers: {
|
|
1314
|
-
* Playwright: {...},
|
|
1315
|
-
* ExpectHelper: {},
|
|
1316
|
-
* }
|
|
1317
|
-
* }
|
|
1318
|
-
* ```
|
|
1319
|
-
*
|
|
1320
|
-
* ## Methods
|
|
1321
|
-
*/
|
|
1322
|
-
// @ts-ignore
|
|
1323
|
-
// @ts-ignore
|
|
1324
|
-
// @ts-ignore
|
|
1325
|
-
// @ts-ignore
|
|
1326
|
-
class ExpectHelper {
|
|
1327
|
-
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1328
|
-
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1329
|
-
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1330
|
-
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1331
|
-
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1332
|
-
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1333
|
-
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1334
|
-
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1335
|
-
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1336
|
-
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1337
|
-
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1338
|
-
/**
|
|
1339
|
-
* @param [ajvOptions] - Pass AJV options
|
|
1340
|
-
*/
|
|
1341
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1342
|
-
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1343
|
-
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1344
|
-
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1345
|
-
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1346
|
-
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1347
|
-
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1348
|
-
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1349
|
-
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1350
|
-
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1351
|
-
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1352
|
-
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1353
|
-
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1354
|
-
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1355
|
-
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1356
|
-
/**
|
|
1357
|
-
* expects members of two arrays are deeply equal
|
|
1358
|
-
*/
|
|
1359
|
-
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1360
|
-
/**
|
|
1361
|
-
* expects an array to be a superset of another array
|
|
1362
|
-
*/
|
|
1363
|
-
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1364
|
-
/**
|
|
1365
|
-
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1366
|
-
*/
|
|
1367
|
-
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1368
|
-
/**
|
|
1369
|
-
* expects a JSON object matches a provided pattern
|
|
1370
|
-
*/
|
|
1371
|
-
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1372
|
-
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1373
|
-
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1374
|
-
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1375
|
-
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1376
|
-
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1377
|
-
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1378
|
-
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1379
|
-
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1380
|
-
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1381
|
-
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1382
|
-
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1383
|
-
/**
|
|
1384
|
-
* @param [ajvOptions] - Pass AJV options
|
|
1385
|
-
*/
|
|
1386
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1387
|
-
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1388
|
-
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1389
|
-
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1390
|
-
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1391
|
-
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1392
|
-
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1393
|
-
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1394
|
-
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1395
|
-
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1396
|
-
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1397
|
-
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1398
|
-
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1399
|
-
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1400
|
-
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1401
|
-
/**
|
|
1402
|
-
* expects members of two arrays are deeply equal
|
|
1403
|
-
*/
|
|
1404
|
-
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1405
|
-
/**
|
|
1406
|
-
* expects an array to be a superset of another array
|
|
1407
|
-
*/
|
|
1408
|
-
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1409
|
-
/**
|
|
1410
|
-
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1411
|
-
*/
|
|
1412
|
-
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1413
|
-
/**
|
|
1414
|
-
* expects a JSON object matches a provided pattern
|
|
1415
|
-
*/
|
|
1416
|
-
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1417
|
-
}
|
|
1418
1206
|
/**
|
|
1419
1207
|
* Helper for testing filesystem.
|
|
1420
1208
|
* Can be easily used to check file structures:
|
|
@@ -1664,7 +1452,7 @@ declare namespace CodeceptJS {
|
|
|
1664
1452
|
* input: { ...buildObj },
|
|
1665
1453
|
* }))
|
|
1666
1454
|
* // 'attr'-id can be left out depending on the GraphQl resolvers
|
|
1667
|
-
* .attr('name', () => faker.
|
|
1455
|
+
* .attr('name', () => faker.person.findName())
|
|
1668
1456
|
* .attr('email', () => faker.interact.email())
|
|
1669
1457
|
* ```
|
|
1670
1458
|
* For more options see [rosie documentation](https://github.com/rosiejs/rosie).
|
|
@@ -1941,13 +1729,14 @@ declare namespace CodeceptJS {
|
|
|
1941
1729
|
*/
|
|
1942
1730
|
seeResponseContainsKeys(keys: any[]): void;
|
|
1943
1731
|
/**
|
|
1944
|
-
* Executes a callback function passing in `response` object and
|
|
1732
|
+
* Executes a callback function passing in `response` object and assert
|
|
1945
1733
|
* Use it to perform custom checks of response data
|
|
1946
1734
|
*
|
|
1947
1735
|
* ```js
|
|
1948
|
-
* I.seeResponseValidByCallback(({ data, status
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1736
|
+
* I.seeResponseValidByCallback(({ data, status }) => {
|
|
1737
|
+
* assert.strictEqual(status, 200);
|
|
1738
|
+
* assert('user' in data);
|
|
1739
|
+
* assert('company' in data);
|
|
1951
1740
|
* });
|
|
1952
1741
|
* ```
|
|
1953
1742
|
*/
|
|
@@ -1989,199 +1778,6 @@ declare namespace CodeceptJS {
|
|
|
1989
1778
|
*/
|
|
1990
1779
|
seeResponseMatchesJsonSchema(fnOrSchema: any): void;
|
|
1991
1780
|
}
|
|
1992
|
-
/**
|
|
1993
|
-
* ## Configuration
|
|
1994
|
-
*
|
|
1995
|
-
* This helper should be configured in codecept.conf.(js|ts)
|
|
1996
|
-
* @property [port = 9393] - Mock server port
|
|
1997
|
-
* @property [host = "0.0.0.0"] - Mock server host
|
|
1998
|
-
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1999
|
-
*/
|
|
2000
|
-
// @ts-ignore
|
|
2001
|
-
// @ts-ignore
|
|
2002
|
-
// @ts-ignore
|
|
2003
|
-
// @ts-ignore
|
|
2004
|
-
type MockServerConfig = {
|
|
2005
|
-
port?: number;
|
|
2006
|
-
host?: string;
|
|
2007
|
-
httpsOpts?: any;
|
|
2008
|
-
};
|
|
2009
|
-
/**
|
|
2010
|
-
* MockServer
|
|
2011
|
-
*
|
|
2012
|
-
* The MockServer Helper in CodeceptJS empowers you to mock any server or service via HTTP or HTTPS, making it an excellent tool for simulating REST endpoints and other HTTP-based APIs.
|
|
2013
|
-
*
|
|
2014
|
-
* <!-- configuration -->
|
|
2015
|
-
*
|
|
2016
|
-
* #### Examples
|
|
2017
|
-
*
|
|
2018
|
-
* You can seamlessly integrate MockServer with other helpers like REST or Playwright. Here's a configuration example inside the `codecept.conf.js` file:
|
|
2019
|
-
*
|
|
2020
|
-
* ```javascript
|
|
2021
|
-
* {
|
|
2022
|
-
* helpers: {
|
|
2023
|
-
* REST: {...},
|
|
2024
|
-
* MockServer: {
|
|
2025
|
-
* // default mock server config
|
|
2026
|
-
* port: 9393,
|
|
2027
|
-
* host: '0.0.0.0',
|
|
2028
|
-
* httpsOpts: {
|
|
2029
|
-
* key: '',
|
|
2030
|
-
* cert: '',
|
|
2031
|
-
* },
|
|
2032
|
-
* },
|
|
2033
|
-
* }
|
|
2034
|
-
* }
|
|
2035
|
-
* ```
|
|
2036
|
-
*
|
|
2037
|
-
* #### Adding Interactions
|
|
2038
|
-
*
|
|
2039
|
-
* Interactions add behavior to the mock server. Use the `I.addInteractionToMockServer()` method to include interactions. It takes an interaction object as an argument, containing request and response details.
|
|
2040
|
-
*
|
|
2041
|
-
* ```javascript
|
|
2042
|
-
* I.addInteractionToMockServer({
|
|
2043
|
-
* request: {
|
|
2044
|
-
* method: 'GET',
|
|
2045
|
-
* path: '/api/hello'
|
|
2046
|
-
* },
|
|
2047
|
-
* response: {
|
|
2048
|
-
* status: 200,
|
|
2049
|
-
* body: {
|
|
2050
|
-
* 'say': 'hello to mock server'
|
|
2051
|
-
* }
|
|
2052
|
-
* }
|
|
2053
|
-
* });
|
|
2054
|
-
* ```
|
|
2055
|
-
*
|
|
2056
|
-
* #### Request Matching
|
|
2057
|
-
*
|
|
2058
|
-
* When a real request is sent to the mock server, it matches the received request with the interactions. If a match is found, it returns the specified response; otherwise, a 404 status code is returned.
|
|
2059
|
-
*
|
|
2060
|
-
* - Strong match on HTTP Method, Path, Query Params & JSON body.
|
|
2061
|
-
* - Loose match on Headers.
|
|
2062
|
-
*
|
|
2063
|
-
* ##### Strong Match on Query Params
|
|
2064
|
-
*
|
|
2065
|
-
* You can send different responses based on query parameters:
|
|
2066
|
-
*
|
|
2067
|
-
* ```javascript
|
|
2068
|
-
* I.addInteractionToMockServer({
|
|
2069
|
-
* request: {
|
|
2070
|
-
* method: 'GET',
|
|
2071
|
-
* path: '/api/users',
|
|
2072
|
-
* queryParams: {
|
|
2073
|
-
* id: 1
|
|
2074
|
-
* }
|
|
2075
|
-
* },
|
|
2076
|
-
* response: {
|
|
2077
|
-
* status: 200,
|
|
2078
|
-
* body: 'user 1'
|
|
2079
|
-
* }
|
|
2080
|
-
* });
|
|
2081
|
-
*
|
|
2082
|
-
* I.addInteractionToMockServer({
|
|
2083
|
-
* request: {
|
|
2084
|
-
* method: 'GET',
|
|
2085
|
-
* path: '/api/users',
|
|
2086
|
-
* queryParams: {
|
|
2087
|
-
* id: 2
|
|
2088
|
-
* }
|
|
2089
|
-
* },
|
|
2090
|
-
* response: {
|
|
2091
|
-
* status: 200,
|
|
2092
|
-
* body: 'user 2'
|
|
2093
|
-
* }
|
|
2094
|
-
* });
|
|
2095
|
-
* ```
|
|
2096
|
-
*
|
|
2097
|
-
* - GET to `/api/users?id=1` will return 'user 1'.
|
|
2098
|
-
* - GET to `/api/users?id=2` will return 'user 2'.
|
|
2099
|
-
* - For all other requests, it returns a 404 status code.
|
|
2100
|
-
*
|
|
2101
|
-
* ##### Loose Match on Body
|
|
2102
|
-
*
|
|
2103
|
-
* When `strict` is set to false, it performs a loose match on query params and response body:
|
|
2104
|
-
*
|
|
2105
|
-
* ```javascript
|
|
2106
|
-
* I.addInteractionToMockServer({
|
|
2107
|
-
* strict: false,
|
|
2108
|
-
* request: {
|
|
2109
|
-
* method: 'POST',
|
|
2110
|
-
* path: '/api/users',
|
|
2111
|
-
* body: {
|
|
2112
|
-
* name: 'john'
|
|
2113
|
-
* }
|
|
2114
|
-
* },
|
|
2115
|
-
* response: {
|
|
2116
|
-
* status: 200
|
|
2117
|
-
* }
|
|
2118
|
-
* });
|
|
2119
|
-
* ```
|
|
2120
|
-
*
|
|
2121
|
-
* - POST to `/api/users` with the body containing `name` as 'john' will return a 200 status code.
|
|
2122
|
-
* - POST to `/api/users` without the `name` property in the body will return a 404 status code.
|
|
2123
|
-
*
|
|
2124
|
-
* Happy testing with MockServer in CodeceptJS! 🚀
|
|
2125
|
-
*
|
|
2126
|
-
* ## Methods
|
|
2127
|
-
*/
|
|
2128
|
-
// @ts-ignore
|
|
2129
|
-
// @ts-ignore
|
|
2130
|
-
// @ts-ignore
|
|
2131
|
-
// @ts-ignore
|
|
2132
|
-
class MockServer {
|
|
2133
|
-
/**
|
|
2134
|
-
* Start the mock server
|
|
2135
|
-
* @param [port] - start the mock server with given port
|
|
2136
|
-
* @returns void
|
|
2137
|
-
*/
|
|
2138
|
-
startMockServer(port?: number): any;
|
|
2139
|
-
/**
|
|
2140
|
-
* Stop the mock server
|
|
2141
|
-
* @returns void
|
|
2142
|
-
*/
|
|
2143
|
-
stopMockServer(): any;
|
|
2144
|
-
/**
|
|
2145
|
-
* An interaction adds behavior to the mock server
|
|
2146
|
-
*
|
|
2147
|
-
*
|
|
2148
|
-
* ```js
|
|
2149
|
-
* I.addInteractionToMockServer({
|
|
2150
|
-
* request: {
|
|
2151
|
-
* method: 'GET',
|
|
2152
|
-
* path: '/api/hello'
|
|
2153
|
-
* },
|
|
2154
|
-
* response: {
|
|
2155
|
-
* status: 200,
|
|
2156
|
-
* body: {
|
|
2157
|
-
* 'say': 'hello to mock server'
|
|
2158
|
-
* }
|
|
2159
|
-
* }
|
|
2160
|
-
* });
|
|
2161
|
-
* ```
|
|
2162
|
-
* ```js
|
|
2163
|
-
* // with query params
|
|
2164
|
-
* I.addInteractionToMockServer({
|
|
2165
|
-
* request: {
|
|
2166
|
-
* method: 'GET',
|
|
2167
|
-
* path: '/api/hello',
|
|
2168
|
-
* queryParams: {
|
|
2169
|
-
* id: 2
|
|
2170
|
-
* }
|
|
2171
|
-
* },
|
|
2172
|
-
* response: {
|
|
2173
|
-
* status: 200,
|
|
2174
|
-
* body: {
|
|
2175
|
-
* 'say': 'hello to mock server'
|
|
2176
|
-
* }
|
|
2177
|
-
* }
|
|
2178
|
-
* });
|
|
2179
|
-
* ```
|
|
2180
|
-
* @param interaction - add behavior to the mock server
|
|
2181
|
-
* @returns void
|
|
2182
|
-
*/
|
|
2183
|
-
addInteractionToMockServer(interaction: CodeceptJS.MockInteraction | any): any;
|
|
2184
|
-
}
|
|
2185
1781
|
/**
|
|
2186
1782
|
* Nightmare helper wraps [Nightmare](https://github.com/segmentio/nightmare) library to provide
|
|
2187
1783
|
* fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
|
|
@@ -2969,7 +2565,7 @@ declare namespace CodeceptJS {
|
|
|
2969
2565
|
*
|
|
2970
2566
|
* ```js
|
|
2971
2567
|
* I.clearCookie();
|
|
2972
|
-
* I.clearCookie('test');
|
|
2568
|
+
* I.clearCookie('test');
|
|
2973
2569
|
* ```
|
|
2974
2570
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
2975
2571
|
*/
|
|
@@ -3184,46 +2780,6 @@ declare namespace CodeceptJS {
|
|
|
3184
2780
|
*/
|
|
3185
2781
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
3186
2782
|
}
|
|
3187
|
-
/**
|
|
3188
|
-
* OpenAI Helper for CodeceptJS.
|
|
3189
|
-
*
|
|
3190
|
-
* 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.
|
|
3191
|
-
* This helper should be enabled with any web helpers like Playwright or Puppeteer or WebDrvier to ensure the HTML context is available.
|
|
3192
|
-
*
|
|
3193
|
-
* ## Configuration
|
|
3194
|
-
*
|
|
3195
|
-
* This helper should be configured in codecept.json or codecept.conf.js
|
|
3196
|
-
*
|
|
3197
|
-
* * `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.
|
|
3198
|
-
*/
|
|
3199
|
-
class OpenAI {
|
|
3200
|
-
/**
|
|
3201
|
-
* Asks the OpenAI GPT language model a question based on the provided prompt within the context of the current page's HTML.
|
|
3202
|
-
*
|
|
3203
|
-
* ```js
|
|
3204
|
-
* I.askGptOnPage('what does this page do?');
|
|
3205
|
-
* ```
|
|
3206
|
-
* @param prompt - The question or prompt to ask the GPT model.
|
|
3207
|
-
* @returns - A Promise that resolves to the generated responses from the GPT model, joined by newlines.
|
|
3208
|
-
*/
|
|
3209
|
-
askGptOnPage(prompt: string): Promise<string>;
|
|
3210
|
-
/**
|
|
3211
|
-
* 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.
|
|
3212
|
-
*
|
|
3213
|
-
* ```js
|
|
3214
|
-
* I.askGptOnPageFragment('describe features of this screen', '.screen');
|
|
3215
|
-
* ```
|
|
3216
|
-
* @param prompt - The question or prompt to ask the GPT-3.5 model.
|
|
3217
|
-
* @param locator - The locator or selector used to identify the HTML fragment on the page.
|
|
3218
|
-
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3219
|
-
*/
|
|
3220
|
-
askGptOnPageFragment(prompt: string, locator: string): Promise<string>;
|
|
3221
|
-
/**
|
|
3222
|
-
* Send a general request to ChatGPT and return response.
|
|
3223
|
-
* @returns - A Promise that resolves to the generated response from the GPT model.
|
|
3224
|
-
*/
|
|
3225
|
-
askGptGeneralPrompt(prompt: string): Promise<string>;
|
|
3226
|
-
}
|
|
3227
2783
|
/**
|
|
3228
2784
|
* ## Configuration
|
|
3229
2785
|
*
|
|
@@ -3267,11 +2823,16 @@ declare namespace CodeceptJS {
|
|
|
3267
2823
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
3268
2824
|
* @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).
|
|
3269
2825
|
* @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).
|
|
2826
|
+
* @property [customLocatorStrategies] - custom locator strategies. An object with keys as strategy names and values as JavaScript functions. Example: `{ byRole: (selector, root) => { return root.querySelector(`[role="${selector}"]`) } }`
|
|
2827
|
+
* @property [storageState] - Playwright storage state (path to JSON file or object)
|
|
2828
|
+
* passed directly to `browser.newContext`.
|
|
2829
|
+
* If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
|
|
2830
|
+
* those cookies are used instead and the configured `storageState` is ignored (no merge).
|
|
2831
|
+
* May include session cookies, auth tokens, localStorage and (if captured with
|
|
2832
|
+
* `grabStorageState({ indexedDB: true })`) IndexedDB data; treat as sensitive and do not commit.
|
|
3270
2833
|
*/
|
|
3271
2834
|
// @ts-ignore
|
|
3272
2835
|
// @ts-ignore
|
|
3273
|
-
// @ts-ignore
|
|
3274
|
-
// @ts-ignore
|
|
3275
2836
|
type PlaywrightConfig = {
|
|
3276
2837
|
url?: string;
|
|
3277
2838
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -3309,6 +2870,8 @@ declare namespace CodeceptJS {
|
|
|
3309
2870
|
highlightElement?: boolean;
|
|
3310
2871
|
recordHar?: any;
|
|
3311
2872
|
testIdAttribute?: string;
|
|
2873
|
+
customLocatorStrategies?: any;
|
|
2874
|
+
storageState?: string | any;
|
|
3312
2875
|
};
|
|
3313
2876
|
/**
|
|
3314
2877
|
* Uses [Playwright](https://github.com/microsoft/playwright) library to run tests inside:
|
|
@@ -4249,7 +3812,7 @@ declare namespace CodeceptJS {
|
|
|
4249
3812
|
*/
|
|
4250
3813
|
pressKeyUp(key: string): void;
|
|
4251
3814
|
/**
|
|
4252
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
3815
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
4253
3816
|
*
|
|
4254
3817
|
* Presses a key in the browser (on a focused element).
|
|
4255
3818
|
*
|
|
@@ -4671,13 +4234,34 @@ declare namespace CodeceptJS {
|
|
|
4671
4234
|
* @returns attribute value
|
|
4672
4235
|
*/
|
|
4673
4236
|
grabCookie(name?: string): any;
|
|
4237
|
+
/**
|
|
4238
|
+
* Grab the current storage state (cookies, localStorage, etc.) via Playwright's `browserContext.storageState()`.
|
|
4239
|
+
* Returns the raw object that Playwright provides.
|
|
4240
|
+
*
|
|
4241
|
+
* Security: The returned object can contain authentication tokens, session cookies
|
|
4242
|
+
* and (when `indexedDB: true` is used) data that may include user PII. Treat it as a secret.
|
|
4243
|
+
* Avoid committing it to source control and prefer storing it in a protected secrets store / CI artifact vault.
|
|
4244
|
+
* @param [options.indexedDB] - set to true to include IndexedDB in snapshot (Playwright >=1.51)
|
|
4245
|
+
*
|
|
4246
|
+
* ```js
|
|
4247
|
+
* // basic usage
|
|
4248
|
+
* const state = await I.grabStorageState();
|
|
4249
|
+
* require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
4250
|
+
*
|
|
4251
|
+
* // include IndexedDB when using Firebase Auth, etc.
|
|
4252
|
+
* const stateWithIDB = await I.grabStorageState({ indexedDB: true });
|
|
4253
|
+
* ```
|
|
4254
|
+
*/
|
|
4255
|
+
grabStorageState(options?: {
|
|
4256
|
+
indexedDB?: boolean;
|
|
4257
|
+
}): void;
|
|
4674
4258
|
/**
|
|
4675
4259
|
* Clears a cookie by name,
|
|
4676
4260
|
* if none provided clears all cookies.
|
|
4677
4261
|
*
|
|
4678
4262
|
* ```js
|
|
4679
4263
|
* I.clearCookie();
|
|
4680
|
-
* I.clearCookie('test');
|
|
4264
|
+
* I.clearCookie('test');
|
|
4681
4265
|
* ```
|
|
4682
4266
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
4683
4267
|
*/
|
|
@@ -5122,7 +4706,7 @@ declare namespace CodeceptJS {
|
|
|
5122
4706
|
/**
|
|
5123
4707
|
* Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
5124
4708
|
*
|
|
5125
|
-
* See [Playwright's reference](https://playwright.dev/docs/api/class-page
|
|
4709
|
+
* See [Playwright's reference](https://playwright.dev/docs/api/class-page#page-wait-for-navigation)
|
|
5126
4710
|
*/
|
|
5127
4711
|
waitForNavigation(options: any): void;
|
|
5128
4712
|
/**
|
|
@@ -6350,7 +5934,7 @@ declare namespace CodeceptJS {
|
|
|
6350
5934
|
*
|
|
6351
5935
|
* ```js
|
|
6352
5936
|
* I.clearCookie();
|
|
6353
|
-
* I.clearCookie('test');
|
|
5937
|
+
* I.clearCookie('test');
|
|
6354
5938
|
* ```
|
|
6355
5939
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
6356
5940
|
*/
|
|
@@ -6788,7 +6372,7 @@ declare namespace CodeceptJS {
|
|
|
6788
6372
|
* @property [keepBrowserState = false] - keep browser state between tests when `restart` is set to false.
|
|
6789
6373
|
* @property [keepCookies = false] - keep cookies between tests when `restart` is set to false.
|
|
6790
6374
|
* @property [waitForAction = 100] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
6791
|
-
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/
|
|
6375
|
+
* @property [waitForNavigation = load] - when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md). Array values are accepted as well.
|
|
6792
6376
|
* @property [pressKeyDelay = 10] - delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
6793
6377
|
* @property [getPageTimeout = 30000] - config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
6794
6378
|
* @property [waitForTimeout = 1000] - default wait* timeout in ms.
|
|
@@ -6796,13 +6380,11 @@ declare namespace CodeceptJS {
|
|
|
6796
6380
|
* @property [userAgent] - user-agent string.
|
|
6797
6381
|
* @property [manualStart = false] - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
6798
6382
|
* @property [browser = chrome] - can be changed to `firefox` when using [puppeteer-firefox](https://codecept.io/helpers/Puppeteer-firefox).
|
|
6799
|
-
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/
|
|
6383
|
+
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md).
|
|
6800
6384
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6801
6385
|
*/
|
|
6802
6386
|
// @ts-ignore
|
|
6803
6387
|
// @ts-ignore
|
|
6804
|
-
// @ts-ignore
|
|
6805
|
-
// @ts-ignore
|
|
6806
6388
|
type PuppeteerConfig = {
|
|
6807
6389
|
url: string;
|
|
6808
6390
|
basicAuth?: any;
|
|
@@ -6816,7 +6398,7 @@ declare namespace CodeceptJS {
|
|
|
6816
6398
|
keepBrowserState?: boolean;
|
|
6817
6399
|
keepCookies?: boolean;
|
|
6818
6400
|
waitForAction?: number;
|
|
6819
|
-
waitForNavigation?: string;
|
|
6401
|
+
waitForNavigation?: string | string[];
|
|
6820
6402
|
pressKeyDelay?: number;
|
|
6821
6403
|
getPageTimeout?: number;
|
|
6822
6404
|
waitForTimeout?: number;
|
|
@@ -6828,7 +6410,7 @@ declare namespace CodeceptJS {
|
|
|
6828
6410
|
highlightElement?: boolean;
|
|
6829
6411
|
};
|
|
6830
6412
|
/**
|
|
6831
|
-
* Uses [Google Chrome's Puppeteer](https://github.com/
|
|
6413
|
+
* Uses [Google Chrome's Puppeteer](https://github.com/puppeteer/puppeteer) library to run tests inside headless Chrome.
|
|
6832
6414
|
* Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
6833
6415
|
* This helper works with a browser out of the box with no additional tools required to install.
|
|
6834
6416
|
*
|
|
@@ -7242,6 +6824,17 @@ declare namespace CodeceptJS {
|
|
|
7242
6824
|
* {{ react }}
|
|
7243
6825
|
*/
|
|
7244
6826
|
_locate(): void;
|
|
6827
|
+
/**
|
|
6828
|
+
* Get single element by different locator types, including strict locator
|
|
6829
|
+
* Should be used in custom helpers:
|
|
6830
|
+
*
|
|
6831
|
+
* ```js
|
|
6832
|
+
* const element = await this.helpers['Puppeteer']._locateElement({name: 'password'});
|
|
6833
|
+
* ```
|
|
6834
|
+
*
|
|
6835
|
+
* {{ react }}
|
|
6836
|
+
*/
|
|
6837
|
+
_locateElement(): void;
|
|
7245
6838
|
/**
|
|
7246
6839
|
* Find a checkbox by providing human-readable text:
|
|
7247
6840
|
* NOTE: Assumes the checkable element exists
|
|
@@ -7278,6 +6871,17 @@ declare namespace CodeceptJS {
|
|
|
7278
6871
|
* @returns WebElement of being used Web helper
|
|
7279
6872
|
*/
|
|
7280
6873
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6874
|
+
/**
|
|
6875
|
+
* Grab WebElement for given locator
|
|
6876
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
6877
|
+
*
|
|
6878
|
+
* ```js
|
|
6879
|
+
* const webElement = await I.grabWebElement('#button');
|
|
6880
|
+
* ```
|
|
6881
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
6882
|
+
* @returns WebElement of being used Web helper
|
|
6883
|
+
*/
|
|
6884
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
7281
6885
|
/**
|
|
7282
6886
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
7283
6887
|
*
|
|
@@ -7598,7 +7202,7 @@ declare namespace CodeceptJS {
|
|
|
7598
7202
|
*/
|
|
7599
7203
|
pressKeyUp(key: string): void;
|
|
7600
7204
|
/**
|
|
7601
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([
|
|
7205
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313](https://github.com/puppeteer/puppeteer/issues/1313)).
|
|
7602
7206
|
*
|
|
7603
7207
|
* Presses a key in the browser (on a focused element).
|
|
7604
7208
|
*
|
|
@@ -8051,7 +7655,7 @@ declare namespace CodeceptJS {
|
|
|
8051
7655
|
*
|
|
8052
7656
|
* ```js
|
|
8053
7657
|
* I.clearCookie();
|
|
8054
|
-
* I.clearCookie('test');
|
|
7658
|
+
* I.clearCookie('test');
|
|
8055
7659
|
* ```
|
|
8056
7660
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
8057
7661
|
*/
|
|
@@ -8524,7 +8128,7 @@ declare namespace CodeceptJS {
|
|
|
8524
8128
|
/**
|
|
8525
8129
|
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
8526
8130
|
*
|
|
8527
|
-
* See [Puppeteer's reference](https://github.com/
|
|
8131
|
+
* See [Puppeteer's reference](https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md)
|
|
8528
8132
|
*/
|
|
8529
8133
|
waitForNavigation(opts: any): void;
|
|
8530
8134
|
/**
|
|
@@ -8733,6 +8337,22 @@ declare namespace CodeceptJS {
|
|
|
8733
8337
|
*/
|
|
8734
8338
|
flushWebSocketMessages(): void;
|
|
8735
8339
|
}
|
|
8340
|
+
/**
|
|
8341
|
+
* Find elements using Puppeteer's native element discovery methods
|
|
8342
|
+
* Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for multiple elements
|
|
8343
|
+
* @param matcher - Puppeteer context to search within
|
|
8344
|
+
* @param locator - Locator specification
|
|
8345
|
+
* @returns Array of ElementHandle objects
|
|
8346
|
+
*/
|
|
8347
|
+
function findElements(matcher: any, locator: any | string): Promise<any[]>;
|
|
8348
|
+
/**
|
|
8349
|
+
* Find a single element using Puppeteer's native element discovery methods
|
|
8350
|
+
* Note: Puppeteer Locator API doesn't have .first() method like Playwright
|
|
8351
|
+
* @param matcher - Puppeteer context to search within
|
|
8352
|
+
* @param locator - Locator specification
|
|
8353
|
+
* @returns Single ElementHandle object
|
|
8354
|
+
*/
|
|
8355
|
+
function findElement(matcher: any, locator: any | string): Promise<object>;
|
|
8736
8356
|
/**
|
|
8737
8357
|
* ## Configuration
|
|
8738
8358
|
* @property [endpoint] - API base URL
|
|
@@ -8747,8 +8367,6 @@ declare namespace CodeceptJS {
|
|
|
8747
8367
|
*/
|
|
8748
8368
|
// @ts-ignore
|
|
8749
8369
|
// @ts-ignore
|
|
8750
|
-
// @ts-ignore
|
|
8751
|
-
// @ts-ignore
|
|
8752
8370
|
type RESTConfig = {
|
|
8753
8371
|
endpoint?: string;
|
|
8754
8372
|
prettyPrintJson?: boolean;
|
|
@@ -8874,6 +8492,16 @@ declare namespace CodeceptJS {
|
|
|
8874
8492
|
* @returns response
|
|
8875
8493
|
*/
|
|
8876
8494
|
sendGetRequest(url: any, headers?: any): Promise<any>;
|
|
8495
|
+
/**
|
|
8496
|
+
* Send HEAD request to REST API
|
|
8497
|
+
*
|
|
8498
|
+
* ```js
|
|
8499
|
+
* I.sendHeadRequest('/api/users.json');
|
|
8500
|
+
* ```
|
|
8501
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
8502
|
+
* @returns response
|
|
8503
|
+
*/
|
|
8504
|
+
sendHeadRequest(url: any, headers?: any): Promise<any>;
|
|
8877
8505
|
/**
|
|
8878
8506
|
* Sends POST request to API.
|
|
8879
8507
|
*
|
|
@@ -8929,263 +8557,30 @@ declare namespace CodeceptJS {
|
|
|
8929
8557
|
* @returns response
|
|
8930
8558
|
*/
|
|
8931
8559
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
8560
|
+
/**
|
|
8561
|
+
* Sends DELETE request to API with payload.
|
|
8562
|
+
*
|
|
8563
|
+
* ```js
|
|
8564
|
+
* I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
|
|
8565
|
+
* ```
|
|
8566
|
+
* @param [payload = {}] - the payload to be sent. By default it is sent as an empty object
|
|
8567
|
+
* @param [headers = {}] - the headers object to be sent. By default, it is sent as an empty object
|
|
8568
|
+
* @returns response
|
|
8569
|
+
*/
|
|
8570
|
+
sendDeleteRequestWithPayload(url: any, payload?: any, headers?: any): Promise<any>;
|
|
8932
8571
|
}
|
|
8933
8572
|
/**
|
|
8934
|
-
*
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
*
|
|
8573
|
+
* Client Functions
|
|
8574
|
+
*/
|
|
8575
|
+
function getPageUrl(): void;
|
|
8576
|
+
/**
|
|
8577
|
+
* Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
|
|
8578
|
+
* The browser version you want to use in tests must be installed on your system.
|
|
8939
8579
|
*
|
|
8940
|
-
*
|
|
8580
|
+
* Requires `testcafe` package to be installed.
|
|
8941
8581
|
*
|
|
8942
|
-
* ```js
|
|
8943
|
-
* // inside codecept.conf.js
|
|
8944
|
-
* {
|
|
8945
|
-
* helpers: {
|
|
8946
|
-
* Playwright: {...},
|
|
8947
|
-
* SoftExpectHelper: {},
|
|
8948
|
-
* }
|
|
8949
|
-
* }
|
|
8950
8582
|
* ```
|
|
8951
|
-
*
|
|
8952
|
-
* ```js
|
|
8953
|
-
* // in scenario
|
|
8954
|
-
* I.softExpectEqual('a', 'b')
|
|
8955
|
-
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
8956
|
-
* ```
|
|
8957
|
-
*
|
|
8958
|
-
* ## Methods
|
|
8959
|
-
*/
|
|
8960
|
-
class SoftAssertHelper {
|
|
8961
|
-
/**
|
|
8962
|
-
* Performs a soft assertion by executing the provided assertion function.
|
|
8963
|
-
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
8964
|
-
* @param assertionFn - The assertion function to execute.
|
|
8965
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8966
|
-
*/
|
|
8967
|
-
softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
|
|
8968
|
-
/**
|
|
8969
|
-
* Throws an error if any soft assertions have failed.
|
|
8970
|
-
* The error message contains all the accumulated failures.
|
|
8971
|
-
*/
|
|
8972
|
-
flushSoftAssertions(): void;
|
|
8973
|
-
/**
|
|
8974
|
-
* Softly asserts that two values are equal.
|
|
8975
|
-
* @param actualValue - The actual value.
|
|
8976
|
-
* @param expectedValue - The expected value.
|
|
8977
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8978
|
-
*/
|
|
8979
|
-
softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8980
|
-
/**
|
|
8981
|
-
* Softly asserts that two values are not equal.
|
|
8982
|
-
* @param actualValue - The actual value.
|
|
8983
|
-
* @param expectedValue - The expected value.
|
|
8984
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8985
|
-
*/
|
|
8986
|
-
softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8987
|
-
/**
|
|
8988
|
-
* Softly asserts that two values are deeply equal.
|
|
8989
|
-
* @param actualValue - The actual value.
|
|
8990
|
-
* @param expectedValue - The expected value.
|
|
8991
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8992
|
-
*/
|
|
8993
|
-
softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8994
|
-
/**
|
|
8995
|
-
* Softly asserts that two values are not deeply equal.
|
|
8996
|
-
* @param actualValue - The actual value.
|
|
8997
|
-
* @param expectedValue - The expected value.
|
|
8998
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8999
|
-
*/
|
|
9000
|
-
softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
9001
|
-
/**
|
|
9002
|
-
* Softly asserts that a value contains the expected value.
|
|
9003
|
-
* @param actualValue - The actual value.
|
|
9004
|
-
* @param expectedValueToContain - The value that should be contained within the actual value.
|
|
9005
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9006
|
-
*/
|
|
9007
|
-
softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
|
|
9008
|
-
/**
|
|
9009
|
-
* Softly asserts that a value does not contain the expected value.
|
|
9010
|
-
* @param actualValue - The actual value.
|
|
9011
|
-
* @param expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
9012
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9013
|
-
*/
|
|
9014
|
-
softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
|
|
9015
|
-
/**
|
|
9016
|
-
* Softly asserts that a value starts with the expected value.
|
|
9017
|
-
* @param actualValue - The actual value.
|
|
9018
|
-
* @param expectedValueToStartWith - The value that the actual value should start with.
|
|
9019
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9020
|
-
*/
|
|
9021
|
-
softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
|
|
9022
|
-
/**
|
|
9023
|
-
* Softly asserts that a value does not start with the expected value.
|
|
9024
|
-
* @param actualValue - The actual value.
|
|
9025
|
-
* @param expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
9026
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9027
|
-
*/
|
|
9028
|
-
softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
|
|
9029
|
-
/**
|
|
9030
|
-
* Softly asserts that a value ends with the expected value.
|
|
9031
|
-
* @param actualValue - The actual value.
|
|
9032
|
-
* @param expectedValueToEndWith - The value that the actual value should end with.
|
|
9033
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9034
|
-
*/
|
|
9035
|
-
softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
|
|
9036
|
-
/**
|
|
9037
|
-
* Softly asserts that a value does not end with the expected value.
|
|
9038
|
-
* @param actualValue - The actual value.
|
|
9039
|
-
* @param expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
9040
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9041
|
-
*/
|
|
9042
|
-
softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
|
|
9043
|
-
/**
|
|
9044
|
-
* Softly asserts that the target data matches the given JSON schema.
|
|
9045
|
-
* @param targetData - The data to validate.
|
|
9046
|
-
* @param jsonSchema - The JSON schema to validate against.
|
|
9047
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9048
|
-
*/
|
|
9049
|
-
softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
|
|
9050
|
-
/**
|
|
9051
|
-
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
9052
|
-
* @param targetData - The data to validate.
|
|
9053
|
-
* @param jsonSchema - The JSON schema to validate against.
|
|
9054
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9055
|
-
* @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
|
|
9056
|
-
*/
|
|
9057
|
-
softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
|
|
9058
|
-
/**
|
|
9059
|
-
* Softly asserts that the target data has the specified property.
|
|
9060
|
-
* @param targetData - The data to check.
|
|
9061
|
-
* @param propertyName - The property name to check for.
|
|
9062
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion
|
|
9063
|
-
* fails.
|
|
9064
|
-
*/
|
|
9065
|
-
softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9066
|
-
/**
|
|
9067
|
-
* Softly asserts that the target data has a property with the specified name.
|
|
9068
|
-
* @param targetData - The data to check.
|
|
9069
|
-
* @param propertyName - The property name to check for.
|
|
9070
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9071
|
-
*/
|
|
9072
|
-
softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9073
|
-
/**
|
|
9074
|
-
* Softly asserts that the target data is of a specific type.
|
|
9075
|
-
* @param targetData - The data to check.
|
|
9076
|
-
* @param type - The expected type (e.g., 'string', 'number').
|
|
9077
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9078
|
-
*/
|
|
9079
|
-
softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9080
|
-
/**
|
|
9081
|
-
* Softly asserts that the target data is of a specific type (alternative for articles).
|
|
9082
|
-
* @param targetData - The data to check.
|
|
9083
|
-
* @param type - The expected type (e.g., 'string', 'number').
|
|
9084
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9085
|
-
*/
|
|
9086
|
-
softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9087
|
-
/**
|
|
9088
|
-
* Softly asserts that the target data has a specified length.
|
|
9089
|
-
* @param targetData - The data to check.
|
|
9090
|
-
* @param length - The expected length.
|
|
9091
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9092
|
-
*/
|
|
9093
|
-
softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
|
|
9094
|
-
/**
|
|
9095
|
-
* Softly asserts that the target data is empty.
|
|
9096
|
-
* @param targetData - The data to check.
|
|
9097
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9098
|
-
*/
|
|
9099
|
-
softExpectEmpty(targetData: any, customErrorMsg?: string): void;
|
|
9100
|
-
/**
|
|
9101
|
-
* Softly asserts that the target data is true.
|
|
9102
|
-
* @param targetData - The data to check.
|
|
9103
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9104
|
-
*/
|
|
9105
|
-
softExpectTrue(targetData: any, customErrorMsg?: string): void;
|
|
9106
|
-
/**
|
|
9107
|
-
* Softly asserts that the target data is false.
|
|
9108
|
-
* @param targetData - The data to check.
|
|
9109
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9110
|
-
*/
|
|
9111
|
-
softExpectFalse(targetData: any, customErrorMsg?: string): void;
|
|
9112
|
-
/**
|
|
9113
|
-
* Softly asserts that the target data is above a specified value.
|
|
9114
|
-
* @param targetData - The data to check.
|
|
9115
|
-
* @param aboveThan - The value that the target data should be above.
|
|
9116
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9117
|
-
*/
|
|
9118
|
-
softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
|
|
9119
|
-
/**
|
|
9120
|
-
* Softly asserts that the target data is below a specified value.
|
|
9121
|
-
* @param targetData - The data to check.
|
|
9122
|
-
* @param belowThan - The value that the target data should be below.
|
|
9123
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9124
|
-
*/
|
|
9125
|
-
softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
|
|
9126
|
-
/**
|
|
9127
|
-
* Softly asserts that the length of the target data is above a specified value.
|
|
9128
|
-
* @param targetData - The data to check.
|
|
9129
|
-
* @param lengthAboveThan - The length that the target data should be above.
|
|
9130
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9131
|
-
*/
|
|
9132
|
-
softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
|
|
9133
|
-
/**
|
|
9134
|
-
* Softly asserts that the length of the target data is below a specified value.
|
|
9135
|
-
* @param targetData - The data to check.
|
|
9136
|
-
* @param lengthBelowThan - The length that the target data should be below.
|
|
9137
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9138
|
-
*/
|
|
9139
|
-
softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
|
|
9140
|
-
/**
|
|
9141
|
-
* Softly asserts that two values are equal, ignoring case.
|
|
9142
|
-
* @param actualValue - The actual string value.
|
|
9143
|
-
* @param expectedValue - The expected string value.
|
|
9144
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9145
|
-
*/
|
|
9146
|
-
softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
|
|
9147
|
-
/**
|
|
9148
|
-
* Softly asserts that two arrays have deep equality, considering members in any order.
|
|
9149
|
-
* @param actualValue - The actual array.
|
|
9150
|
-
* @param expectedValue - The expected array.
|
|
9151
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9152
|
-
*/
|
|
9153
|
-
softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
|
|
9154
|
-
/**
|
|
9155
|
-
* Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
9156
|
-
* @param superset - The array that should contain the expected members.
|
|
9157
|
-
* @param set - The array with members that should be included.
|
|
9158
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9159
|
-
*/
|
|
9160
|
-
softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
|
|
9161
|
-
/**
|
|
9162
|
-
* Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
9163
|
-
* @param actualValue - The actual object.
|
|
9164
|
-
* @param expectedValue - The expected object.
|
|
9165
|
-
* @param fieldsToExclude - The fields to exclude from the comparison.
|
|
9166
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9167
|
-
*/
|
|
9168
|
-
softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
|
|
9169
|
-
/**
|
|
9170
|
-
* Softly asserts that a value matches the expected pattern.
|
|
9171
|
-
* @param actualValue - The actual value.
|
|
9172
|
-
* @param expectedPattern - The pattern the value should match.
|
|
9173
|
-
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9174
|
-
*/
|
|
9175
|
-
softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
|
|
9176
|
-
}
|
|
9177
|
-
/**
|
|
9178
|
-
* Client Functions
|
|
9179
|
-
*/
|
|
9180
|
-
function getPageUrl(): void;
|
|
9181
|
-
/**
|
|
9182
|
-
* Uses [TestCafe](https://github.com/DevExpress/testcafe) library to run cross-browser tests.
|
|
9183
|
-
* The browser version you want to use in tests must be installed on your system.
|
|
9184
|
-
*
|
|
9185
|
-
* Requires `testcafe` package to be installed.
|
|
9186
|
-
*
|
|
9187
|
-
* ```
|
|
9188
|
-
* npm i testcafe --save-dev
|
|
8583
|
+
* npm i testcafe --save-dev
|
|
9189
8584
|
* ```
|
|
9190
8585
|
*
|
|
9191
8586
|
* ## Configuration
|
|
@@ -10048,7 +9443,7 @@ declare namespace CodeceptJS {
|
|
|
10048
9443
|
*
|
|
10049
9444
|
* ```js
|
|
10050
9445
|
* I.clearCookie();
|
|
10051
|
-
* I.clearCookie('test');
|
|
9446
|
+
* I.clearCookie('test');
|
|
10052
9447
|
* ```
|
|
10053
9448
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
10054
9449
|
*/
|
|
@@ -10166,6 +9561,7 @@ declare namespace CodeceptJS {
|
|
|
10166
9561
|
* This helper should be configured in codecept.conf.js
|
|
10167
9562
|
* @property url - base url of website to be tested.
|
|
10168
9563
|
* @property browser - Browser in which to perform testing.
|
|
9564
|
+
* @property [bidiProtocol = false] - WebDriver Bidi Protocol. Default: false. More info: https://webdriver.io/docs/api/webdriverBidi/
|
|
10169
9565
|
* @property [basicAuth] - (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
10170
9566
|
* @property [host = localhost] - WebDriver host to connect.
|
|
10171
9567
|
* @property [port = 4444] - WebDriver port to connect.
|
|
@@ -10185,15 +9581,13 @@ declare namespace CodeceptJS {
|
|
|
10185
9581
|
* @property [timeouts] - [WebDriver timeouts](http://webdriver.io/docs/timeouts.html) defined as hash.
|
|
10186
9582
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
10187
9583
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
10188
|
-
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
10189
9584
|
*/
|
|
10190
9585
|
// @ts-ignore
|
|
10191
9586
|
// @ts-ignore
|
|
10192
|
-
// @ts-ignore
|
|
10193
|
-
// @ts-ignore
|
|
10194
9587
|
type WebDriverConfig = {
|
|
10195
9588
|
url: string;
|
|
10196
9589
|
browser: string;
|
|
9590
|
+
bidiProtocol?: boolean;
|
|
10197
9591
|
basicAuth?: string;
|
|
10198
9592
|
host?: string;
|
|
10199
9593
|
port?: number;
|
|
@@ -10213,7 +9607,6 @@ declare namespace CodeceptJS {
|
|
|
10213
9607
|
timeouts?: any;
|
|
10214
9608
|
highlightElement?: boolean;
|
|
10215
9609
|
logLevel?: string;
|
|
10216
|
-
devtoolsProtocol?: boolean;
|
|
10217
9610
|
};
|
|
10218
9611
|
/**
|
|
10219
9612
|
* WebDriver helper which wraps [webdriverio](http://webdriver.io/) library to
|
|
@@ -10319,7 +9712,6 @@ declare namespace CodeceptJS {
|
|
|
10319
9712
|
* WebDriver : {
|
|
10320
9713
|
* url: "http://localhost",
|
|
10321
9714
|
* browser: "chrome",
|
|
10322
|
-
* devtoolsProtocol: true,
|
|
10323
9715
|
* desiredCapabilities: {
|
|
10324
9716
|
* chromeOptions: {
|
|
10325
9717
|
* args: [ "--headless", "--disable-gpu", "--no-sandbox" ]
|
|
@@ -10662,6 +10054,17 @@ declare namespace CodeceptJS {
|
|
|
10662
10054
|
* @returns WebElement of being used Web helper
|
|
10663
10055
|
*/
|
|
10664
10056
|
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
10057
|
+
/**
|
|
10058
|
+
* Grab WebElement for given locator
|
|
10059
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
10060
|
+
*
|
|
10061
|
+
* ```js
|
|
10062
|
+
* const webElement = await I.grabWebElement('#button');
|
|
10063
|
+
* ```
|
|
10064
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
10065
|
+
* @returns WebElement of being used Web helper
|
|
10066
|
+
*/
|
|
10067
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
10665
10068
|
/**
|
|
10666
10069
|
* Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
|
|
10667
10070
|
*
|
|
@@ -11540,7 +10943,7 @@ declare namespace CodeceptJS {
|
|
|
11540
10943
|
*
|
|
11541
10944
|
* ```js
|
|
11542
10945
|
* I.clearCookie();
|
|
11543
|
-
* I.clearCookie('test');
|
|
10946
|
+
* I.clearCookie('test');
|
|
11544
10947
|
* ```
|
|
11545
10948
|
* @param [cookie = null] - (optional, `null` by default) cookie name
|
|
11546
10949
|
*/
|
|
@@ -12123,34 +11526,6 @@ declare namespace CodeceptJS {
|
|
|
12123
11526
|
* @returns scroll position
|
|
12124
11527
|
*/
|
|
12125
11528
|
grabPageScrollPosition(): Promise<PageScrollPosition>;
|
|
12126
|
-
/**
|
|
12127
|
-
* This method is **deprecated**.
|
|
12128
|
-
*
|
|
12129
|
-
*
|
|
12130
|
-
* Set the current geo location
|
|
12131
|
-
*
|
|
12132
|
-
*
|
|
12133
|
-
* ```js
|
|
12134
|
-
* I.setGeoLocation(121.21, 11.56);
|
|
12135
|
-
* I.setGeoLocation(121.21, 11.56, 10);
|
|
12136
|
-
* ```
|
|
12137
|
-
* @param latitude - to set.
|
|
12138
|
-
* @param longitude - to set
|
|
12139
|
-
* @param [altitude] - (optional, null by default) to set
|
|
12140
|
-
* @returns automatically synchronized promise through #recorder
|
|
12141
|
-
*/
|
|
12142
|
-
setGeoLocation(latitude: number, longitude: number, altitude?: number): void;
|
|
12143
|
-
/**
|
|
12144
|
-
* This method is **deprecated**.
|
|
12145
|
-
*
|
|
12146
|
-
* Return the current geo location
|
|
12147
|
-
* Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
12148
|
-
*
|
|
12149
|
-
* ```js
|
|
12150
|
-
* let geoLocation = await I.grabGeoLocation();
|
|
12151
|
-
* ```
|
|
12152
|
-
*/
|
|
12153
|
-
grabGeoLocation(): Promise<{ latitude: number; longitude: number; altitude: number; }>;
|
|
12154
11529
|
/**
|
|
12155
11530
|
* Grab the width, height, location of given locator.
|
|
12156
11531
|
* Provide `width` or `height`as second param to get your desired prop.
|
|
@@ -12177,123 +11552,15 @@ declare namespace CodeceptJS {
|
|
|
12177
11552
|
/**
|
|
12178
11553
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
12179
11554
|
*/
|
|
12180
|
-
|
|
11555
|
+
runOnIOS(caps: any, fn: any): void;
|
|
12181
11556
|
/**
|
|
12182
11557
|
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
12183
11558
|
*/
|
|
12184
|
-
|
|
12185
|
-
/**
|
|
12186
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
12187
|
-
*
|
|
12188
|
-
* Resets all recorded network requests.
|
|
12189
|
-
*
|
|
12190
|
-
* ```js
|
|
12191
|
-
* I.flushNetworkTraffics();
|
|
12192
|
-
* ```
|
|
12193
|
-
*/
|
|
12194
|
-
flushNetworkTraffics(): void;
|
|
12195
|
-
/**
|
|
12196
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
12197
|
-
*
|
|
12198
|
-
* Stops recording of network traffic. Recorded traffic is not flashed.
|
|
12199
|
-
*
|
|
12200
|
-
* ```js
|
|
12201
|
-
* I.stopRecordingTraffic();
|
|
12202
|
-
* ```
|
|
12203
|
-
*/
|
|
12204
|
-
stopRecordingTraffic(): void;
|
|
12205
|
-
/**
|
|
12206
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
12207
|
-
*
|
|
12208
|
-
* Starts recording the network traffics.
|
|
12209
|
-
* This also resets recorded network requests.
|
|
12210
|
-
*
|
|
12211
|
-
* ```js
|
|
12212
|
-
* I.startRecordingTraffic();
|
|
12213
|
-
* ```
|
|
12214
|
-
* @returns automatically synchronized promise through #recorder
|
|
12215
|
-
*/
|
|
12216
|
-
startRecordingTraffic(): void;
|
|
12217
|
-
/**
|
|
12218
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
12219
|
-
*
|
|
12220
|
-
* Grab the recording network traffics
|
|
12221
|
-
*
|
|
12222
|
-
* ```js
|
|
12223
|
-
* const traffics = await I.grabRecordedNetworkTraffics();
|
|
12224
|
-
* expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
12225
|
-
* expect(traffics[0].response.status).to.equal(200);
|
|
12226
|
-
* expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
12227
|
-
* ```
|
|
12228
|
-
* @returns recorded network traffics
|
|
12229
|
-
*/
|
|
12230
|
-
grabRecordedNetworkTraffics(): any[];
|
|
12231
|
-
/**
|
|
12232
|
-
* _Note:_ Only works when devtoolsProtocol is enabled.
|
|
12233
|
-
*
|
|
12234
|
-
* Verifies that a certain request is part of network traffic.
|
|
12235
|
-
*
|
|
12236
|
-
* ```js
|
|
12237
|
-
* // checking the request url contains certain query strings
|
|
12238
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
12239
|
-
* I.startRecordingTraffic();
|
|
12240
|
-
* await I.seeTraffic({
|
|
12241
|
-
* name: 'sentry event',
|
|
12242
|
-
* url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600',
|
|
12243
|
-
* parameters: {
|
|
12244
|
-
* width: '1919',
|
|
12245
|
-
* height: '1138',
|
|
12246
|
-
* },
|
|
12247
|
-
* });
|
|
12248
|
-
* ```
|
|
12249
|
-
*
|
|
12250
|
-
* ```js
|
|
12251
|
-
* // checking the request url contains certain post data
|
|
12252
|
-
* I.amOnPage('https://openai.com/blog/chatgpt');
|
|
12253
|
-
* I.startRecordingTraffic();
|
|
12254
|
-
* await I.seeTraffic({
|
|
12255
|
-
* name: 'event',
|
|
12256
|
-
* url: 'https://cloudflareinsights.com/cdn-cgi/rum',
|
|
12257
|
-
* requestPostData: {
|
|
12258
|
-
* st: 2,
|
|
12259
|
-
* },
|
|
12260
|
-
* });
|
|
12261
|
-
* ```
|
|
12262
|
-
* @param opts - options when checking the traffic network.
|
|
12263
|
-
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
12264
|
-
* @param opts.url - Expected URL of request in network traffic
|
|
12265
|
-
* @param [opts.parameters] - Expected parameters of that request in network traffic
|
|
12266
|
-
* @param [opts.requestPostData] - Expected that request contains post data in network traffic
|
|
12267
|
-
* @param [opts.timeout] - Timeout to wait for request in seconds. Default is 10 seconds.
|
|
12268
|
-
* @returns automatically synchronized promise through #recorder
|
|
12269
|
-
*/
|
|
12270
|
-
seeTraffic(opts: {
|
|
12271
|
-
name: string;
|
|
12272
|
-
url: string;
|
|
12273
|
-
parameters?: any;
|
|
12274
|
-
requestPostData?: any;
|
|
12275
|
-
timeout?: number;
|
|
12276
|
-
}): void;
|
|
11559
|
+
runOnAndroid(caps: any, fn: any): void;
|
|
12277
11560
|
/**
|
|
12278
|
-
*
|
|
12279
|
-
*
|
|
12280
|
-
* Verifies that a certain request is not part of network traffic.
|
|
12281
|
-
*
|
|
12282
|
-
* Examples:
|
|
12283
|
-
*
|
|
12284
|
-
* ```js
|
|
12285
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call', url: 'https://api.example.com' });
|
|
12286
|
-
* I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.example.com.*user/ });
|
|
12287
|
-
* ```
|
|
12288
|
-
* @param opts - options when checking the traffic network.
|
|
12289
|
-
* @param opts.name - A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
12290
|
-
* @param opts.url - Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
12291
|
-
* @returns automatically synchronized promise through #recorder
|
|
11561
|
+
* Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
|
|
12292
11562
|
*/
|
|
12293
|
-
|
|
12294
|
-
name: string;
|
|
12295
|
-
url: string | RegExp;
|
|
12296
|
-
}): void;
|
|
11563
|
+
runInWeb(): void;
|
|
12297
11564
|
}
|
|
12298
11565
|
interface ActorStatic {
|
|
12299
11566
|
/**
|
|
@@ -12333,19 +11600,31 @@ declare namespace CodeceptJS {
|
|
|
12333
11600
|
/**
|
|
12334
11601
|
* Executes bootstrap.
|
|
12335
11602
|
*/
|
|
12336
|
-
bootstrap(): void
|
|
11603
|
+
bootstrap(): Promise<void>;
|
|
12337
11604
|
/**
|
|
12338
11605
|
* Executes teardown.
|
|
12339
11606
|
*/
|
|
12340
|
-
teardown(): void
|
|
11607
|
+
teardown(): Promise<void>;
|
|
12341
11608
|
/**
|
|
12342
11609
|
* Loads tests by pattern or by config.tests
|
|
12343
11610
|
*/
|
|
12344
11611
|
loadTests(pattern?: string): void;
|
|
11612
|
+
/**
|
|
11613
|
+
* Apply sharding to test files based on shard configuration
|
|
11614
|
+
* @param testFiles - Array of test file paths
|
|
11615
|
+
* @param shardConfig - Shard configuration in format "index/total" (e.g., "1/4")
|
|
11616
|
+
* @returns - Filtered array of test files for this shard
|
|
11617
|
+
*/
|
|
11618
|
+
_applySharding(testFiles: string[], shardConfig: string): string[];
|
|
12345
11619
|
/**
|
|
12346
11620
|
* Run a specific test or all loaded tests.
|
|
12347
11621
|
*/
|
|
12348
11622
|
run(test?: string): Promise<void>;
|
|
11623
|
+
/**
|
|
11624
|
+
* Returns the version string of CodeceptJS.
|
|
11625
|
+
* @returns The version string.
|
|
11626
|
+
*/
|
|
11627
|
+
static version(): string;
|
|
12349
11628
|
}
|
|
12350
11629
|
/**
|
|
12351
11630
|
* Current configuration
|
|
@@ -12387,10 +11666,113 @@ declare namespace CodeceptJS {
|
|
|
12387
11666
|
[key: string]: any;
|
|
12388
11667
|
};
|
|
12389
11668
|
}
|
|
11669
|
+
/**
|
|
11670
|
+
* Statistics for a test result.
|
|
11671
|
+
* @property passes - Number of passed tests.
|
|
11672
|
+
* @property failures - Number of failed tests.
|
|
11673
|
+
* @property tests - Total number of tests.
|
|
11674
|
+
* @property pending - Number of pending tests.
|
|
11675
|
+
* @property failedHooks - Number of failed hooks.
|
|
11676
|
+
* @property start - Start time of the test run.
|
|
11677
|
+
* @property end - End time of the test run.
|
|
11678
|
+
* @property duration - Duration of the test run, in milliseconds.
|
|
11679
|
+
*/
|
|
11680
|
+
type Stats = {
|
|
11681
|
+
passes: number;
|
|
11682
|
+
failures: number;
|
|
11683
|
+
tests: number;
|
|
11684
|
+
pending: number;
|
|
11685
|
+
failedHooks: number;
|
|
11686
|
+
start: Date;
|
|
11687
|
+
end: Date;
|
|
11688
|
+
duration: number;
|
|
11689
|
+
};
|
|
11690
|
+
/**
|
|
11691
|
+
* Result of a test run. Will be emitted for example in "event.all.result" events.
|
|
11692
|
+
*/
|
|
11693
|
+
class Result {
|
|
11694
|
+
/**
|
|
11695
|
+
* Resets all collected stats, tests, and failure reports.
|
|
11696
|
+
*/
|
|
11697
|
+
reset(): void;
|
|
11698
|
+
/**
|
|
11699
|
+
* Sets the start time to the current time.
|
|
11700
|
+
*/
|
|
11701
|
+
start(): void;
|
|
11702
|
+
/**
|
|
11703
|
+
* Sets the end time to the current time.
|
|
11704
|
+
*/
|
|
11705
|
+
finish(): void;
|
|
11706
|
+
/**
|
|
11707
|
+
* Whether this result contains any failed tests.
|
|
11708
|
+
*/
|
|
11709
|
+
readonly hasFailed: boolean;
|
|
11710
|
+
/**
|
|
11711
|
+
* All collected tests.
|
|
11712
|
+
*/
|
|
11713
|
+
readonly tests: CodeceptJS.Test[];
|
|
11714
|
+
/**
|
|
11715
|
+
* The failure reports (array of strings per failed test).
|
|
11716
|
+
*/
|
|
11717
|
+
readonly failures: string[][];
|
|
11718
|
+
/**
|
|
11719
|
+
* The test statistics.
|
|
11720
|
+
*/
|
|
11721
|
+
readonly stats: Stats;
|
|
11722
|
+
/**
|
|
11723
|
+
* The start time of the test run.
|
|
11724
|
+
*/
|
|
11725
|
+
readonly startTime: Date;
|
|
11726
|
+
/**
|
|
11727
|
+
* Adds a test to this result.
|
|
11728
|
+
*/
|
|
11729
|
+
addTest(test: CodeceptJS.Test): void;
|
|
11730
|
+
/**
|
|
11731
|
+
* Adds failure reports to this result.
|
|
11732
|
+
*/
|
|
11733
|
+
addFailures(newFailures: string[][]): void;
|
|
11734
|
+
/**
|
|
11735
|
+
* Whether this result contains any failed tests.
|
|
11736
|
+
*/
|
|
11737
|
+
readonly hasFailures: boolean;
|
|
11738
|
+
/**
|
|
11739
|
+
* The duration of the test run, in milliseconds.
|
|
11740
|
+
*/
|
|
11741
|
+
readonly duration: number;
|
|
11742
|
+
/**
|
|
11743
|
+
* All failed tests.
|
|
11744
|
+
*/
|
|
11745
|
+
failedTests: CodeceptJS.Test[];
|
|
11746
|
+
/**
|
|
11747
|
+
* All passed tests.
|
|
11748
|
+
*/
|
|
11749
|
+
readonly passedTests: CodeceptJS.Test[];
|
|
11750
|
+
/**
|
|
11751
|
+
* All skipped tests.
|
|
11752
|
+
*/
|
|
11753
|
+
readonly skippedTests: CodeceptJS.Test[];
|
|
11754
|
+
/**
|
|
11755
|
+
* @returns The JSON representation of this result.
|
|
11756
|
+
*/
|
|
11757
|
+
simplify(): any;
|
|
11758
|
+
/**
|
|
11759
|
+
* Saves this result to a JSON file.
|
|
11760
|
+
* @param [fileName] - Path to the JSON file, relative to `output_dir`. Defaults to "result.json".
|
|
11761
|
+
*/
|
|
11762
|
+
save(fileName?: string): void;
|
|
11763
|
+
/**
|
|
11764
|
+
* Adds stats to this result.
|
|
11765
|
+
*/
|
|
11766
|
+
addStats(newStats?: Partial<Stats>): void;
|
|
11767
|
+
}
|
|
12390
11768
|
/**
|
|
12391
11769
|
* Dependency Injection Container
|
|
12392
11770
|
*/
|
|
12393
11771
|
class Container {
|
|
11772
|
+
/**
|
|
11773
|
+
* Get the standard acting helpers of CodeceptJS Container
|
|
11774
|
+
*/
|
|
11775
|
+
static STANDARD_ACTING_HELPERS: any;
|
|
12394
11776
|
/**
|
|
12395
11777
|
* Create container with all required helpers and support objects
|
|
12396
11778
|
*/
|
|
@@ -12415,6 +11797,10 @@ declare namespace CodeceptJS {
|
|
|
12415
11797
|
* Get Mocha instance
|
|
12416
11798
|
*/
|
|
12417
11799
|
static mocha(): any;
|
|
11800
|
+
/**
|
|
11801
|
+
* Get result
|
|
11802
|
+
*/
|
|
11803
|
+
static result(): Result;
|
|
12418
11804
|
/**
|
|
12419
11805
|
* Append new services to container
|
|
12420
11806
|
*/
|
|
@@ -12431,6 +11817,7 @@ declare namespace CodeceptJS {
|
|
|
12431
11817
|
}, newPlugins: {
|
|
12432
11818
|
[key: string]: any;
|
|
12433
11819
|
}): void;
|
|
11820
|
+
static started(fn: ((...params: any[]) => any) | null): Promise<void>;
|
|
12434
11821
|
/**
|
|
12435
11822
|
* Share data across worker threads
|
|
12436
11823
|
* @param options - set {local: true} to not share among workers
|
|
@@ -12440,7 +11827,7 @@ declare namespace CodeceptJS {
|
|
|
12440
11827
|
/**
|
|
12441
11828
|
* Method collect own property and prototype
|
|
12442
11829
|
*/
|
|
12443
|
-
function
|
|
11830
|
+
function loadTranslation(): void;
|
|
12444
11831
|
/**
|
|
12445
11832
|
* Datatable class to provide data driven testing
|
|
12446
11833
|
*/
|
|
@@ -12478,6 +11865,63 @@ declare namespace CodeceptJS {
|
|
|
12478
11865
|
*/
|
|
12479
11866
|
transpose(): void;
|
|
12480
11867
|
}
|
|
11868
|
+
/**
|
|
11869
|
+
* - Designed for use in CodeceptJS tests as a "soft assertion."
|
|
11870
|
+
* Unlike standard assertions, it does not stop the test execution on failure.
|
|
11871
|
+
* - Starts a new recorder session named 'hopeThat' and manages state restoration.
|
|
11872
|
+
* - Logs errors and attaches them as notes to the test, enabling post-test reporting of soft assertion failures.
|
|
11873
|
+
* - Resets the `store.hopeThat` flag after the execution, ensuring clean state for subsequent operations.
|
|
11874
|
+
* @example
|
|
11875
|
+
* const { hopeThat } = require('codeceptjs/effects')
|
|
11876
|
+
* await hopeThat(() => {
|
|
11877
|
+
* I.see('Welcome'); // Perform a soft assertion
|
|
11878
|
+
* });
|
|
11879
|
+
* @param callback - The callback function containing the logic to validate.
|
|
11880
|
+
* This function should perform the desired assertion or condition check.
|
|
11881
|
+
* @returns A promise resolving to `true` if the assertion or condition was successful,
|
|
11882
|
+
* or `false` if an error occurred.
|
|
11883
|
+
*/
|
|
11884
|
+
function hopeThat(callback: (...params: any[]) => any): Promise<boolean | any>;
|
|
11885
|
+
/**
|
|
11886
|
+
* - This function is designed for use in CodeceptJS tests to handle intermittent or flaky test steps.
|
|
11887
|
+
* - Starts a new recorder session for each retry attempt, ensuring proper state management and error handling.
|
|
11888
|
+
* - Logs errors and retries the callback until it either succeeds or the maximum number of attempts is reached.
|
|
11889
|
+
* - Restores the session state after each attempt, whether successful or not.
|
|
11890
|
+
* @example
|
|
11891
|
+
* const { retryTo } = require('codeceptjs/effects')
|
|
11892
|
+
* await retryTo((tries) => {
|
|
11893
|
+
* if (tries < 3) {
|
|
11894
|
+
* I.see('Non-existent element'); // Simulates a failure
|
|
11895
|
+
* } else {
|
|
11896
|
+
* I.see('Welcome'); // Succeeds on the 3rd attempt
|
|
11897
|
+
* }
|
|
11898
|
+
* }, 5, 300); // Retry up to 5 times, with a 300ms interval
|
|
11899
|
+
* @param callback - The function to execute, which will be retried upon failure.
|
|
11900
|
+
* Receives the current retry count as an argument.
|
|
11901
|
+
* @param maxTries - The maximum number of attempts to retry the callback.
|
|
11902
|
+
* @param [pollInterval = 200] - The delay (in milliseconds) between retry attempts.
|
|
11903
|
+
* @returns A promise that resolves when the callback executes successfully, or rejects after reaching the maximum retries.
|
|
11904
|
+
*/
|
|
11905
|
+
function retryTo(callback: (...params: any[]) => any, maxTries: number, pollInterval?: number): Promise<void | any>;
|
|
11906
|
+
/**
|
|
11907
|
+
* - Useful for scenarios where certain steps are optional or their failure should not interrupt the test flow.
|
|
11908
|
+
* - Starts a new recorder session named 'tryTo' for isolation and error handling.
|
|
11909
|
+
* - Captures errors during execution and logs them for debugging purposes.
|
|
11910
|
+
* - Ensures the `store.tryTo` flag is reset after execution to maintain a clean state.
|
|
11911
|
+
* @example
|
|
11912
|
+
* const { tryTo } = require('codeceptjs/effects')
|
|
11913
|
+
* const wasSuccessful = await tryTo(() => {
|
|
11914
|
+
* I.see('Welcome'); // Attempt to find an element on the page
|
|
11915
|
+
* });
|
|
11916
|
+
*
|
|
11917
|
+
* if (!wasSuccessful) {
|
|
11918
|
+
* I.say('Optional step failed, but test continues.');
|
|
11919
|
+
* }
|
|
11920
|
+
* @param callback - The function to execute, which may succeed or fail.
|
|
11921
|
+
* This function contains the logic to be attempted.
|
|
11922
|
+
* @returns A promise resolving to `true` if the step succeeds, or `false` if it fails.
|
|
11923
|
+
*/
|
|
11924
|
+
function tryTo(callback: (...params: any[]) => any): Promise<boolean | any>;
|
|
12481
11925
|
namespace event {
|
|
12482
11926
|
const dispatcher: NodeJS.EventEmitter;
|
|
12483
11927
|
const test: {
|
|
@@ -12496,6 +11940,8 @@ declare namespace CodeceptJS {
|
|
|
12496
11940
|
const hook: {
|
|
12497
11941
|
started: 'hook.start';
|
|
12498
11942
|
passed: 'hook.passed';
|
|
11943
|
+
failed: 'hook.failed';
|
|
11944
|
+
finished: 'hook.finished';
|
|
12499
11945
|
};
|
|
12500
11946
|
const step: {
|
|
12501
11947
|
started: 'step.start';
|
|
@@ -12554,76 +12000,6 @@ declare namespace CodeceptJS {
|
|
|
12554
12000
|
var store: typeof CodeceptJS.store;
|
|
12555
12001
|
var locator: typeof CodeceptJS.Locator;
|
|
12556
12002
|
}
|
|
12557
|
-
function addStep(step: any, fn: any): void;
|
|
12558
|
-
class FeatureConfig {
|
|
12559
|
-
/**
|
|
12560
|
-
* Retry this suite for x times
|
|
12561
|
-
*/
|
|
12562
|
-
retry(retries: number): this;
|
|
12563
|
-
/**
|
|
12564
|
-
* Set timeout for this suite
|
|
12565
|
-
*/
|
|
12566
|
-
timeout(timeout: number): this;
|
|
12567
|
-
/**
|
|
12568
|
-
* Configures a helper.
|
|
12569
|
-
* Helper name can be omitted and values will be applied to first helper.
|
|
12570
|
-
*/
|
|
12571
|
-
config(helper: string | {
|
|
12572
|
-
[key: string]: any;
|
|
12573
|
-
}, obj?: {
|
|
12574
|
-
[key: string]: any;
|
|
12575
|
-
}): this;
|
|
12576
|
-
/**
|
|
12577
|
-
* Append a tag name to scenario title
|
|
12578
|
-
*/
|
|
12579
|
-
tag(tagName: string): this;
|
|
12580
|
-
}
|
|
12581
|
-
class ScenarioConfig {
|
|
12582
|
-
/**
|
|
12583
|
-
* Declares that test throws error.
|
|
12584
|
-
* Can pass an Error object or regex matching expected message.
|
|
12585
|
-
*/
|
|
12586
|
-
throws(err: any): this;
|
|
12587
|
-
/**
|
|
12588
|
-
* Declares that test should fail.
|
|
12589
|
-
* If test passes - throws an error.
|
|
12590
|
-
* Can pass an Error object or regex matching expected message.
|
|
12591
|
-
*/
|
|
12592
|
-
fails(): this;
|
|
12593
|
-
/**
|
|
12594
|
-
* Retry this test for x times
|
|
12595
|
-
*/
|
|
12596
|
-
retry(retries: number): this;
|
|
12597
|
-
/**
|
|
12598
|
-
* Set timeout for this test
|
|
12599
|
-
*/
|
|
12600
|
-
timeout(timeout: number): this;
|
|
12601
|
-
/**
|
|
12602
|
-
* Pass in additional objects to inject into test
|
|
12603
|
-
*/
|
|
12604
|
-
inject(obj: {
|
|
12605
|
-
[key: string]: any;
|
|
12606
|
-
}): this;
|
|
12607
|
-
/**
|
|
12608
|
-
* Configures a helper.
|
|
12609
|
-
* Helper name can be omitted and values will be applied to first helper.
|
|
12610
|
-
*/
|
|
12611
|
-
config(helper: string | {
|
|
12612
|
-
[key: string]: any;
|
|
12613
|
-
}, obj?: {
|
|
12614
|
-
[key: string]: any;
|
|
12615
|
-
}): this;
|
|
12616
|
-
/**
|
|
12617
|
-
* Append a tag name to scenario title
|
|
12618
|
-
*/
|
|
12619
|
-
tag(tagName: string): this;
|
|
12620
|
-
/**
|
|
12621
|
-
* Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
|
|
12622
|
-
*/
|
|
12623
|
-
injectDependencies(dependencies: {
|
|
12624
|
-
[key: string]: any;
|
|
12625
|
-
}): this;
|
|
12626
|
-
}
|
|
12627
12003
|
class Locator {
|
|
12628
12004
|
constructor(locator: CodeceptJS.LocatorOrString, defaultType?: string);
|
|
12629
12005
|
toString(): string;
|
|
@@ -12686,7 +12062,7 @@ declare namespace CodeceptJS {
|
|
|
12686
12062
|
inside(locator: CodeceptJS.LocatorOrString): Locator;
|
|
12687
12063
|
after(locator: CodeceptJS.LocatorOrString): Locator;
|
|
12688
12064
|
before(locator: CodeceptJS.LocatorOrString): Locator;
|
|
12689
|
-
static build(locator
|
|
12065
|
+
static build(locator?: CodeceptJS.LocatorOrString): Locator;
|
|
12690
12066
|
/**
|
|
12691
12067
|
* Filters to modify locators
|
|
12692
12068
|
*/
|
|
@@ -12741,6 +12117,7 @@ declare namespace CodeceptJS {
|
|
|
12741
12117
|
function skipped(test: Mocha.Test): void;
|
|
12742
12118
|
}
|
|
12743
12119
|
namespace scenario {
|
|
12120
|
+
function started(test: Mocha.Test): void;
|
|
12744
12121
|
function passed(test: Mocha.Test): void;
|
|
12745
12122
|
function failed(test: Mocha.Test): void;
|
|
12746
12123
|
}
|
|
@@ -12817,6 +12194,10 @@ declare namespace CodeceptJS {
|
|
|
12817
12194
|
* Get a state of current queue and tasks
|
|
12818
12195
|
*/
|
|
12819
12196
|
toString(): string;
|
|
12197
|
+
/**
|
|
12198
|
+
* Get current session ID
|
|
12199
|
+
*/
|
|
12200
|
+
getCurrentSessionId(): string | null;
|
|
12820
12201
|
}
|
|
12821
12202
|
interface RecorderSession {
|
|
12822
12203
|
running: boolean;
|
|
@@ -12832,24 +12213,50 @@ declare namespace CodeceptJS {
|
|
|
12832
12213
|
function session(sessionName: CodeceptJS.LocatorOrString, config: ((...params: any[]) => any) | {
|
|
12833
12214
|
[key: string]: any;
|
|
12834
12215
|
}, fn?: (...params: any[]) => any): any;
|
|
12216
|
+
/**
|
|
12217
|
+
* StepConfig is a configuration object for a step.
|
|
12218
|
+
* It is used to create a new step that is a combination of other steps.
|
|
12219
|
+
*/
|
|
12220
|
+
class StepConfig {
|
|
12221
|
+
config: any;
|
|
12222
|
+
/**
|
|
12223
|
+
* Set the options for the step.
|
|
12224
|
+
* @param opts - The options for the step.
|
|
12225
|
+
* @returns - The step configuration object.
|
|
12226
|
+
*/
|
|
12227
|
+
opts(opts: any): StepConfig;
|
|
12228
|
+
/**
|
|
12229
|
+
* Set the timeout for the step.
|
|
12230
|
+
* @param timeout - The timeout for the step.
|
|
12231
|
+
* @returns - The step configuration object.
|
|
12232
|
+
*/
|
|
12233
|
+
timeout(timeout: number): StepConfig;
|
|
12234
|
+
/**
|
|
12235
|
+
* Set the retry for the step.
|
|
12236
|
+
* @param retry - The retry for the step.
|
|
12237
|
+
* @returns - The step configuration object.
|
|
12238
|
+
*/
|
|
12239
|
+
retry(retry: number): StepConfig;
|
|
12240
|
+
}
|
|
12835
12241
|
/**
|
|
12836
12242
|
* Each command in test executed through `I.` object is wrapped in Step.
|
|
12837
12243
|
* Step allows logging executed commands and triggers hook before and after step execution.
|
|
12838
12244
|
*/
|
|
12839
12245
|
class Step {
|
|
12840
|
-
constructor(
|
|
12841
|
-
actor: string;
|
|
12842
|
-
helper: CodeceptJS.Helper;
|
|
12246
|
+
constructor(name: string);
|
|
12843
12247
|
name: string;
|
|
12844
|
-
|
|
12248
|
+
timeouts: Map<number, number>;
|
|
12249
|
+
args: any[];
|
|
12250
|
+
opts: Record<string, any>;
|
|
12251
|
+
actor: string;
|
|
12845
12252
|
status: string;
|
|
12846
|
-
suffix: string;
|
|
12847
12253
|
prefix: string;
|
|
12848
12254
|
comment: string;
|
|
12849
|
-
|
|
12850
|
-
metaStep: MetaStep;
|
|
12255
|
+
metaStep: any;
|
|
12851
12256
|
stack: string;
|
|
12852
|
-
|
|
12257
|
+
helper: any;
|
|
12258
|
+
helperMethod: string;
|
|
12259
|
+
timeout: any;
|
|
12853
12260
|
/**
|
|
12854
12261
|
* @param timeout - timeout in milliseconds or 0 if no timeout
|
|
12855
12262
|
* @param order - order defines the priority of timeout, timeouts set with lower order override those set with higher order.
|
|
@@ -12858,27 +12265,43 @@ declare namespace CodeceptJS {
|
|
|
12858
12265
|
setTimeout(timeout: number, order: number): void;
|
|
12859
12266
|
setTrace(): void;
|
|
12860
12267
|
setArguments(args: any[]): void;
|
|
12861
|
-
run(...args: any[]): any;
|
|
12862
12268
|
setStatus(status: string): void;
|
|
12863
12269
|
humanize(): string;
|
|
12864
12270
|
humanizeArgs(): string;
|
|
12865
12271
|
line(): string;
|
|
12866
12272
|
toString(): string;
|
|
12273
|
+
toCliStyled(): string;
|
|
12867
12274
|
toCode(): string;
|
|
12868
12275
|
hasBDDAncestor(): boolean;
|
|
12869
|
-
static MetaStep: typeof MetaStep;
|
|
12870
|
-
}
|
|
12871
|
-
class MetaStep extends Step {
|
|
12872
|
-
isBDD(): boolean;
|
|
12873
|
-
run(): any;
|
|
12874
12276
|
}
|
|
12875
12277
|
/**
|
|
12876
12278
|
* global values for current session
|
|
12877
12279
|
*/
|
|
12878
12280
|
namespace store {
|
|
12281
|
+
/**
|
|
12282
|
+
* If we are in --debug mode
|
|
12283
|
+
*/
|
|
12879
12284
|
var debugMode: boolean;
|
|
12285
|
+
/**
|
|
12286
|
+
* Is timeouts enabled
|
|
12287
|
+
*/
|
|
12880
12288
|
var timeouts: boolean;
|
|
12289
|
+
/**
|
|
12290
|
+
* If auto-retries are enabled by retryFailedStep plugin
|
|
12291
|
+
* tryTo effect disables them
|
|
12292
|
+
*/
|
|
12293
|
+
var autoRetries: boolean;
|
|
12294
|
+
/**
|
|
12295
|
+
* Tests are executed via dry-run
|
|
12296
|
+
*/
|
|
12881
12297
|
var dryRun: boolean;
|
|
12298
|
+
/**
|
|
12299
|
+
* If we are in pause mode
|
|
12300
|
+
*/
|
|
12301
|
+
var onPause: boolean;
|
|
12302
|
+
var currentTest: CodeceptJS.Test | null;
|
|
12303
|
+
var currentStep: CodeceptJS.Step | null;
|
|
12304
|
+
var currentSuite: CodeceptJS.Suite | null;
|
|
12882
12305
|
}
|
|
12883
12306
|
/**
|
|
12884
12307
|
* Describe a "suite" with the given `title`
|
|
@@ -12888,6 +12311,10 @@ declare namespace CodeceptJS {
|
|
|
12888
12311
|
function Feature(title: string, opts?: {
|
|
12889
12312
|
[key: string]: any;
|
|
12890
12313
|
}): FeatureConfig;
|
|
12314
|
+
/**
|
|
12315
|
+
* Exclusive test suite - runs only this feature.
|
|
12316
|
+
*/
|
|
12317
|
+
const only: CodeceptJS.IFeature;
|
|
12891
12318
|
/**
|
|
12892
12319
|
* Pending test suite.
|
|
12893
12320
|
*/
|
|
@@ -12900,6 +12327,139 @@ declare namespace CodeceptJS {
|
|
|
12900
12327
|
* Pending test case with message: 'Test not implemented!'.
|
|
12901
12328
|
*/
|
|
12902
12329
|
const todo: CodeceptJS.IScenario;
|
|
12330
|
+
/**
|
|
12331
|
+
* Configuration for a Feature.
|
|
12332
|
+
* Can inject values and add custom configuration.
|
|
12333
|
+
*/
|
|
12334
|
+
class FeatureConfig {
|
|
12335
|
+
constructor(suite: CodeceptJS.Suite);
|
|
12336
|
+
/**
|
|
12337
|
+
* Set metadata for this suite
|
|
12338
|
+
*/
|
|
12339
|
+
meta(key: string, value: string): this;
|
|
12340
|
+
/**
|
|
12341
|
+
* Retry this test for number of times
|
|
12342
|
+
*/
|
|
12343
|
+
retry(retries: number): this;
|
|
12344
|
+
/**
|
|
12345
|
+
* Set timeout for this test
|
|
12346
|
+
*/
|
|
12347
|
+
timeout(timeout: number): this;
|
|
12348
|
+
/**
|
|
12349
|
+
* Configures a helper.
|
|
12350
|
+
* Helper name can be omitted and values will be applied to first helper.
|
|
12351
|
+
*/
|
|
12352
|
+
config(helper: string | {
|
|
12353
|
+
[key: string]: any;
|
|
12354
|
+
} | FeatureConfigCallback, obj?: {
|
|
12355
|
+
[key: string]: any;
|
|
12356
|
+
}): this;
|
|
12357
|
+
/**
|
|
12358
|
+
* Append a tag name to scenario title
|
|
12359
|
+
*/
|
|
12360
|
+
tag(tagName: string): this;
|
|
12361
|
+
}
|
|
12362
|
+
type FeatureConfigCallback = (suite: CodeceptJS.Suite) => {
|
|
12363
|
+
[key: string]: any;
|
|
12364
|
+
};
|
|
12365
|
+
class ScenarioConfig {
|
|
12366
|
+
constructor(test: CodeceptJS.Test);
|
|
12367
|
+
/**
|
|
12368
|
+
* Declares that test throws error.
|
|
12369
|
+
* Can pass an Error object or regex matching expected message.
|
|
12370
|
+
*/
|
|
12371
|
+
throws(err: any): this;
|
|
12372
|
+
/**
|
|
12373
|
+
* Declares that test should fail.
|
|
12374
|
+
* If test passes - throws an error.
|
|
12375
|
+
* Can pass an Error object or regex matching expected message.
|
|
12376
|
+
*/
|
|
12377
|
+
fails(): this;
|
|
12378
|
+
/**
|
|
12379
|
+
* Retry this test for x times
|
|
12380
|
+
*/
|
|
12381
|
+
retry(retries: number): this;
|
|
12382
|
+
/**
|
|
12383
|
+
* Set metadata for this test
|
|
12384
|
+
*/
|
|
12385
|
+
meta(key: string, value: string): this;
|
|
12386
|
+
/**
|
|
12387
|
+
* Set timeout for this test
|
|
12388
|
+
*/
|
|
12389
|
+
timeout(timeout: number): this;
|
|
12390
|
+
/**
|
|
12391
|
+
* Pass in additional objects to inject into test
|
|
12392
|
+
*/
|
|
12393
|
+
inject(obj: {
|
|
12394
|
+
[key: string]: any;
|
|
12395
|
+
}): this;
|
|
12396
|
+
/**
|
|
12397
|
+
* Configures a helper.
|
|
12398
|
+
* Helper name can be omitted and values will be applied to first helper.
|
|
12399
|
+
*/
|
|
12400
|
+
config(helper: string | {
|
|
12401
|
+
[key: string]: any;
|
|
12402
|
+
} | ScenarioConfigCallback, obj?: {
|
|
12403
|
+
[key: string]: any;
|
|
12404
|
+
}): this;
|
|
12405
|
+
/**
|
|
12406
|
+
* Append a tag name to scenario title
|
|
12407
|
+
*/
|
|
12408
|
+
tag(tagName: string): this;
|
|
12409
|
+
/**
|
|
12410
|
+
* Dynamically injects dependencies, see https://codecept.io/pageobjects/#dynamic-injection
|
|
12411
|
+
*/
|
|
12412
|
+
injectDependencies(dependencies: {
|
|
12413
|
+
[key: string]: any;
|
|
12414
|
+
}): this;
|
|
12415
|
+
}
|
|
12416
|
+
type ScenarioConfigCallback = (test: CodeceptJS.Test) => {
|
|
12417
|
+
[key: string]: any;
|
|
12418
|
+
};
|
|
12419
|
+
function addStep(step: any, fn: any): void;
|
|
12420
|
+
/**
|
|
12421
|
+
* Creates a new Hook instance
|
|
12422
|
+
* @property suite - The test suite this hook belongs to
|
|
12423
|
+
* @property test - The test object associated with this hook
|
|
12424
|
+
* @property runnable - The current test being executed
|
|
12425
|
+
* @property ctx - The context object
|
|
12426
|
+
* @property err - The error that occurred during hook execution, if any
|
|
12427
|
+
* @param context - The context object containing suite and test information
|
|
12428
|
+
* @param context.suite - The test suite
|
|
12429
|
+
* @param context.test - The test object
|
|
12430
|
+
* @param context.ctx - The context object
|
|
12431
|
+
* @param error - The error object if hook execution failed
|
|
12432
|
+
*/
|
|
12433
|
+
class Hook {
|
|
12434
|
+
constructor(context: {
|
|
12435
|
+
suite: any;
|
|
12436
|
+
test: any;
|
|
12437
|
+
ctx: any;
|
|
12438
|
+
}, error: Error);
|
|
12439
|
+
/**
|
|
12440
|
+
* The test suite this hook belongs to
|
|
12441
|
+
*/
|
|
12442
|
+
suite: any;
|
|
12443
|
+
/**
|
|
12444
|
+
* The test object associated with this hook
|
|
12445
|
+
*/
|
|
12446
|
+
test: any;
|
|
12447
|
+
/**
|
|
12448
|
+
* The current test being executed
|
|
12449
|
+
*/
|
|
12450
|
+
runnable: any;
|
|
12451
|
+
/**
|
|
12452
|
+
* The context object
|
|
12453
|
+
*/
|
|
12454
|
+
ctx: any;
|
|
12455
|
+
/**
|
|
12456
|
+
* The error that occurred during hook execution, if any
|
|
12457
|
+
*/
|
|
12458
|
+
err: Error | null;
|
|
12459
|
+
}
|
|
12460
|
+
/**
|
|
12461
|
+
* TODO: move to effects
|
|
12462
|
+
*/
|
|
12903
12463
|
function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
|
|
12904
12464
|
/**
|
|
12905
12465
|
* This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
|
|
@@ -13501,22 +13061,17 @@ declare namespace CodeceptJS {
|
|
|
13501
13061
|
}
|
|
13502
13062
|
|
|
13503
13063
|
/**
|
|
13504
|
-
*
|
|
13505
|
-
*/
|
|
13506
|
-
declare var testOrSuite: any;
|
|
13507
|
-
|
|
13508
|
-
/**
|
|
13509
|
-
* 0-9 - designated for override of timeouts set from code, 5 is used by stepTimeout plugin when stepTimeout.config.overrideStepLimits=true
|
|
13064
|
+
* corresponding helper
|
|
13510
13065
|
*/
|
|
13511
|
-
declare var
|
|
13066
|
+
declare var helper: CodeceptJS.Helper;
|
|
13512
13067
|
|
|
13513
13068
|
/**
|
|
13514
|
-
*
|
|
13069
|
+
* name of method to be executed
|
|
13515
13070
|
*/
|
|
13516
|
-
declare var
|
|
13071
|
+
declare var helperMethod: string;
|
|
13517
13072
|
|
|
13518
13073
|
/**
|
|
13519
|
-
*
|
|
13074
|
+
* hide children steps from output
|
|
13520
13075
|
*/
|
|
13521
|
-
declare var
|
|
13076
|
+
declare var collsapsed: boolean;
|
|
13522
13077
|
|