codeceptjs 3.5.9 → 3.5.11
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 +14 -16
- package/docs/build/Appium.js +49 -49
- package/docs/build/Expect.js +33 -33
- package/docs/build/Nightmare.js +50 -50
- package/docs/build/Playwright.js +239 -133
- package/docs/build/Protractor.js +59 -59
- package/docs/build/Puppeteer.js +127 -107
- package/docs/build/TestCafe.js +48 -48
- package/docs/build/WebDriver.js +112 -93
- package/docs/helpers/Appium.md +3 -3
- package/docs/helpers/Expect.md +33 -33
- package/docs/helpers/Playwright.md +431 -325
- package/docs/helpers/Puppeteer.md +50 -24
- package/docs/helpers/WebDriver.md +41 -13
- package/docs/internal-api.md +1 -0
- package/docs/parallel.md +114 -2
- package/docs/plugins.md +7 -5
- package/docs/react.md +2 -1
- package/docs/vue.md +22 -0
- package/docs/webapi/grabWebElement.mustache +9 -0
- package/docs/webapi/grabWebElements.mustache +9 -0
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/lib/ai.js +12 -3
- package/lib/colorUtils.js +10 -0
- package/lib/command/run-multiple.js +1 -1
- package/lib/command/run-workers.js +30 -4
- package/lib/command/workers/runTests.js +39 -0
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +13 -13
- package/lib/helper/Expect.js +33 -33
- package/lib/helper/Playwright.js +125 -37
- package/lib/helper/Puppeteer.js +49 -38
- package/lib/helper/WebDriver.js +29 -19
- package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
- package/lib/html.js +3 -3
- package/lib/interfaces/gherkin.js +8 -1
- package/lib/interfaces/scenarioConfig.js +1 -0
- package/lib/locator.js +2 -2
- package/lib/pause.js +6 -3
- package/lib/plugin/autoLogin.js +4 -2
- package/lib/plugin/heal.js +40 -7
- package/lib/plugin/retryFailedStep.js +6 -1
- package/lib/plugin/stepByStepReport.js +2 -2
- package/lib/plugin/tryTo.js +5 -4
- package/lib/recorder.js +12 -5
- package/lib/ui.js +1 -0
- package/lib/workers.js +2 -0
- package/package.json +28 -25
- package/typings/index.d.ts +1 -1
- package/typings/promiseBasedTypes.d.ts +195 -76
- package/typings/types.d.ts +191 -145
- package/lib/helper/extras/PlaywrightReact.js +0 -9
|
@@ -458,7 +458,7 @@ declare namespace CodeceptJS {
|
|
|
458
458
|
* Switch to the specified context.
|
|
459
459
|
* @param context - the context to switch to
|
|
460
460
|
*/
|
|
461
|
-
|
|
461
|
+
switchToContext(context: any): Promise<any>;
|
|
462
462
|
/**
|
|
463
463
|
* Switches to web context.
|
|
464
464
|
* If no context is provided switches to the first detected web context
|
|
@@ -749,7 +749,7 @@ declare namespace CodeceptJS {
|
|
|
749
749
|
* ```js
|
|
750
750
|
* I.closeApp();
|
|
751
751
|
* ```
|
|
752
|
-
* @returns Appium: support
|
|
752
|
+
* @returns Appium: support both Android and iOS
|
|
753
753
|
*/
|
|
754
754
|
closeApp(): Promise<void>;
|
|
755
755
|
/**
|
|
@@ -972,9 +972,9 @@ declare namespace CodeceptJS {
|
|
|
972
972
|
* I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
973
973
|
* ```
|
|
974
974
|
* @param locator - located by CSS|XPath|strict locator.
|
|
975
|
-
* @param scrollIntoViewOptions -
|
|
975
|
+
* @param scrollIntoViewOptions - either alignToTop=true|false or scrollIntoViewOptions. See https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
|
|
976
976
|
*/
|
|
977
|
-
scrollIntoView(locator: LocatorOrString, scrollIntoViewOptions: ScrollIntoViewOptions): Promise<any>;
|
|
977
|
+
scrollIntoView(locator: LocatorOrString, scrollIntoViewOptions: ScrollIntoViewOptions | boolean): Promise<any>;
|
|
978
978
|
/**
|
|
979
979
|
* Verifies that the specified checkbox is checked.
|
|
980
980
|
*
|
|
@@ -1107,7 +1107,7 @@ declare namespace CodeceptJS {
|
|
|
1107
1107
|
* {
|
|
1108
1108
|
* helpers: {
|
|
1109
1109
|
* Playwright: {...},
|
|
1110
|
-
*
|
|
1110
|
+
* Expect: {},
|
|
1111
1111
|
* }
|
|
1112
1112
|
* }
|
|
1113
1113
|
* ```
|
|
@@ -1115,57 +1115,51 @@ declare namespace CodeceptJS {
|
|
|
1115
1115
|
* ## Methods
|
|
1116
1116
|
*/
|
|
1117
1117
|
class ExpectHelper {
|
|
1118
|
-
expectEqual(actualValue: any, expectedValue: any, customErrorMsg
|
|
1119
|
-
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg
|
|
1120
|
-
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg
|
|
1121
|
-
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg
|
|
1122
|
-
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg
|
|
1123
|
-
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg
|
|
1124
|
-
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg
|
|
1125
|
-
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg
|
|
1126
|
-
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg
|
|
1127
|
-
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg
|
|
1128
|
-
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg
|
|
1118
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1119
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1120
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1121
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1122
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1123
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1124
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1125
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1126
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1127
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1128
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1129
1129
|
/**
|
|
1130
1130
|
* @param ajvOptions - Pass AJV options
|
|
1131
1131
|
*/
|
|
1132
|
-
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg
|
|
1133
|
-
expectHasProperty(targetData: any, propertyName: any, customErrorMsg
|
|
1134
|
-
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg
|
|
1135
|
-
expectToBeA(targetData: any, type: any, customErrorMsg
|
|
1136
|
-
expectToBeAn(targetData: any, type: any, customErrorMsg
|
|
1137
|
-
expectMatchRegex(targetData: any, regex: any, customErrorMsg
|
|
1138
|
-
expectLengthOf(targetData: any, length: any, customErrorMsg
|
|
1139
|
-
expectEmpty(targetData: any, customErrorMsg
|
|
1140
|
-
expectTrue(targetData: any, customErrorMsg
|
|
1141
|
-
expectFalse(targetData: any, customErrorMsg
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
* @param belowThan - number | Date
|
|
1148
|
-
*/
|
|
1149
|
-
expectBelow(targetData: any, belowThan: any, customErrorMsg: any): Promise<any>;
|
|
1150
|
-
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg: any): Promise<any>;
|
|
1151
|
-
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg: any): Promise<any>;
|
|
1152
|
-
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg: any): Promise<any>;
|
|
1132
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions: any): Promise<any>;
|
|
1133
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1134
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1135
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1136
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1137
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1138
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1139
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1140
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1141
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1142
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1143
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1144
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1145
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1146
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1153
1147
|
/**
|
|
1154
1148
|
* expects members of two arrays are deeply equal
|
|
1155
1149
|
*/
|
|
1156
|
-
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg
|
|
1150
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1157
1151
|
/**
|
|
1158
1152
|
* expects an array to be a superset of another array
|
|
1159
1153
|
*/
|
|
1160
|
-
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg
|
|
1154
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1161
1155
|
/**
|
|
1162
1156
|
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1163
1157
|
*/
|
|
1164
|
-
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg
|
|
1158
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1165
1159
|
/**
|
|
1166
1160
|
* expects a JSON object matches a provided pattern
|
|
1167
1161
|
*/
|
|
1168
|
-
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg
|
|
1162
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1169
1163
|
}
|
|
1170
1164
|
/**
|
|
1171
1165
|
* Helper for testing filesystem.
|
|
@@ -2761,6 +2755,21 @@ declare namespace CodeceptJS {
|
|
|
2761
2755
|
* * `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
2762
2756
|
* * `keepTraceForPassedTests`: - save trace for passed tests
|
|
2763
2757
|
*
|
|
2758
|
+
* #### HAR Recording Customization
|
|
2759
|
+
*
|
|
2760
|
+
* A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded.
|
|
2761
|
+
* It contains information about the request and response headers, cookies, content, timings, and more. You can use HAR files to mock network requests in your tests.
|
|
2762
|
+
* HAR will be saved to `output/har`. More info could be found here https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har.
|
|
2763
|
+
*
|
|
2764
|
+
* ```
|
|
2765
|
+
* ...
|
|
2766
|
+
* recordHar: {
|
|
2767
|
+
* mode: 'minimal', // possible values: 'minimal'|'full'.
|
|
2768
|
+
* content: 'embed' // possible values: "omit"|"embed"|"attach".
|
|
2769
|
+
* }
|
|
2770
|
+
* ...
|
|
2771
|
+
* ```
|
|
2772
|
+
*
|
|
2764
2773
|
* #### Example #1: Wait for 0 network connections.
|
|
2765
2774
|
*
|
|
2766
2775
|
* ```js
|
|
@@ -2935,7 +2944,7 @@ declare namespace CodeceptJS {
|
|
|
2935
2944
|
* });
|
|
2936
2945
|
* ```
|
|
2937
2946
|
* @param description - used to show in logs.
|
|
2938
|
-
* @param fn - async function that executed with Playwright helper as
|
|
2947
|
+
* @param fn - async function that executed with Playwright helper as arguments
|
|
2939
2948
|
*/
|
|
2940
2949
|
usePlaywrightTo(description: string, fn: (...params: any[]) => any): Promise<any>;
|
|
2941
2950
|
/**
|
|
@@ -3020,6 +3029,18 @@ declare namespace CodeceptJS {
|
|
|
3020
3029
|
*/
|
|
3021
3030
|
amOnPage(url: string): Promise<any>;
|
|
3022
3031
|
/**
|
|
3032
|
+
* Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
3033
|
+
* Playwright does not control the window of a browser, so it can't adjust its real size.
|
|
3034
|
+
* It also can't maximize a window.
|
|
3035
|
+
*
|
|
3036
|
+
* Update configuration to change real window size on start:
|
|
3037
|
+
*
|
|
3038
|
+
* ```js
|
|
3039
|
+
* // inside codecept.conf.js
|
|
3040
|
+
* // @codeceptjs/configure package must be installed
|
|
3041
|
+
* { setWindowSize } = require('@codeceptjs/configure');
|
|
3042
|
+
* ````
|
|
3043
|
+
*
|
|
3023
3044
|
* Resize the current window to provided width and height.
|
|
3024
3045
|
* First parameter can be set to `maximize`.
|
|
3025
3046
|
* @param width - width in pixels or `maximize`.
|
|
@@ -3096,6 +3117,13 @@ declare namespace CodeceptJS {
|
|
|
3096
3117
|
*/
|
|
3097
3118
|
grabDisabledElementStatus(locator: CodeceptJS.LocatorOrString, options?: any): Promise<boolean>;
|
|
3098
3119
|
/**
|
|
3120
|
+
* ```js
|
|
3121
|
+
* // specify coordinates for source position
|
|
3122
|
+
* I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
3123
|
+
* ```
|
|
3124
|
+
*
|
|
3125
|
+
* > When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
|
|
3126
|
+
*
|
|
3099
3127
|
* Drag an item to a destination element.
|
|
3100
3128
|
*
|
|
3101
3129
|
* ```js
|
|
@@ -3104,13 +3132,6 @@ declare namespace CodeceptJS {
|
|
|
3104
3132
|
* @param srcElement - located by CSS|XPath|strict locator.
|
|
3105
3133
|
* @param destElement - located by CSS|XPath|strict locator.
|
|
3106
3134
|
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
|
|
3107
|
-
*
|
|
3108
|
-
* ```js
|
|
3109
|
-
* // specify coordinates for source position
|
|
3110
|
-
* I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
3111
|
-
* ```
|
|
3112
|
-
*
|
|
3113
|
-
* > When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
|
|
3114
3135
|
*/
|
|
3115
3136
|
dragAndDrop(srcElement: LocatorOrString, destElement: LocatorOrString, options?: any): Promise<any>;
|
|
3116
3137
|
/**
|
|
@@ -3135,6 +3156,21 @@ declare namespace CodeceptJS {
|
|
|
3135
3156
|
* ```
|
|
3136
3157
|
*/
|
|
3137
3158
|
refreshPage(): Promise<any>;
|
|
3159
|
+
/**
|
|
3160
|
+
* Replaying from HAR
|
|
3161
|
+
*
|
|
3162
|
+
* ```js
|
|
3163
|
+
* // Replay API requests from HAR.
|
|
3164
|
+
* // Either use a matching response from the HAR,
|
|
3165
|
+
* // or abort the request if nothing matches.
|
|
3166
|
+
* I.replayFromHar('./output/har/something.har', { url: "*\/**\/api/v1/fruits" });
|
|
3167
|
+
* I.amOnPage('https://demo.playwright.dev/api-mocking');
|
|
3168
|
+
* I.see('CodeceptJS');
|
|
3169
|
+
* ```
|
|
3170
|
+
* @param harFilePath - Path to recorded HAR file
|
|
3171
|
+
* @param [opts] - [Options for replaying from HAR](https://playwright.dev/docs/api/class-page#page-route-from-har)
|
|
3172
|
+
*/
|
|
3173
|
+
replayFromHar(harFilePath: string, opts?: any): Promise<any>;
|
|
3138
3174
|
/**
|
|
3139
3175
|
* Scroll page to the top.
|
|
3140
3176
|
*
|
|
@@ -3254,6 +3290,28 @@ declare namespace CodeceptJS {
|
|
|
3254
3290
|
* ```
|
|
3255
3291
|
*/
|
|
3256
3292
|
_locateFields(): Promise<any>;
|
|
3293
|
+
/**
|
|
3294
|
+
* Grab WebElements for given locator
|
|
3295
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
3296
|
+
*
|
|
3297
|
+
* ```js
|
|
3298
|
+
* const webElements = await I.grabWebElements('#button');
|
|
3299
|
+
* ```
|
|
3300
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
3301
|
+
* @returns WebElement of being used Web helper
|
|
3302
|
+
*/
|
|
3303
|
+
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
3304
|
+
/**
|
|
3305
|
+
* Grab WebElement for given locator
|
|
3306
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
3307
|
+
*
|
|
3308
|
+
* ```js
|
|
3309
|
+
* const webElement = await I.grabWebElement('#button');
|
|
3310
|
+
* ```
|
|
3311
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
3312
|
+
* @returns WebElement of being used Web helper
|
|
3313
|
+
*/
|
|
3314
|
+
grabWebElement(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
3257
3315
|
/**
|
|
3258
3316
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
3259
3317
|
*
|
|
@@ -3389,12 +3447,7 @@ declare namespace CodeceptJS {
|
|
|
3389
3447
|
* // using strict locator
|
|
3390
3448
|
* I.click({css: 'nav a.login'});
|
|
3391
3449
|
* ```
|
|
3392
|
-
* @
|
|
3393
|
-
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
3394
|
-
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
3395
|
-
*
|
|
3396
|
-
* Examples:
|
|
3397
|
-
*
|
|
3450
|
+
* @example
|
|
3398
3451
|
* ```js
|
|
3399
3452
|
* // click on element at position
|
|
3400
3453
|
* I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
@@ -3402,6 +3455,9 @@ declare namespace CodeceptJS {
|
|
|
3402
3455
|
* // make ctrl-click
|
|
3403
3456
|
* I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
3404
3457
|
* ```
|
|
3458
|
+
* @param locator - clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
3459
|
+
* @param [context = null] - (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
3460
|
+
* @param [options] - [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
3405
3461
|
*/
|
|
3406
3462
|
click(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString | null, options?: any): Promise<any>;
|
|
3407
3463
|
/**
|
|
@@ -3467,6 +3523,16 @@ declare namespace CodeceptJS {
|
|
|
3467
3523
|
*/
|
|
3468
3524
|
rightClick(locator: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
3469
3525
|
/**
|
|
3526
|
+
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
3527
|
+
*
|
|
3528
|
+
* Examples:
|
|
3529
|
+
*
|
|
3530
|
+
* ```js
|
|
3531
|
+
* // click on element at position
|
|
3532
|
+
* I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
3533
|
+
* ```
|
|
3534
|
+
* > ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
3535
|
+
*
|
|
3470
3536
|
* Selects a checkbox or radio button.
|
|
3471
3537
|
* Element is located by label or name or CSS or XPath.
|
|
3472
3538
|
*
|
|
@@ -3482,6 +3548,16 @@ declare namespace CodeceptJS {
|
|
|
3482
3548
|
*/
|
|
3483
3549
|
checkOption(field: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
3484
3550
|
/**
|
|
3551
|
+
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck) for uncheck available as 3rd argument.
|
|
3552
|
+
*
|
|
3553
|
+
* Examples:
|
|
3554
|
+
*
|
|
3555
|
+
* ```js
|
|
3556
|
+
* // click on element at position
|
|
3557
|
+
* I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
3558
|
+
* ```
|
|
3559
|
+
* > ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
3560
|
+
*
|
|
3485
3561
|
* Unselects a checkbox or radio button.
|
|
3486
3562
|
* Element is located by label or name or CSS or XPath.
|
|
3487
3563
|
*
|
|
@@ -3545,6 +3621,8 @@ declare namespace CodeceptJS {
|
|
|
3545
3621
|
*/
|
|
3546
3622
|
pressKeyUp(key: string): Promise<any>;
|
|
3547
3623
|
/**
|
|
3624
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
3625
|
+
*
|
|
3548
3626
|
* Presses a key in the browser (on a focused element).
|
|
3549
3627
|
*
|
|
3550
3628
|
* _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`](#fillfield).
|
|
@@ -3929,6 +4007,8 @@ declare namespace CodeceptJS {
|
|
|
3929
4007
|
*/
|
|
3930
4008
|
dontSeeCookie(name: string): Promise<any>;
|
|
3931
4009
|
/**
|
|
4010
|
+
* Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
4011
|
+
*
|
|
3932
4012
|
* Gets a cookie object by name.
|
|
3933
4013
|
* If none provided gets all cookies.
|
|
3934
4014
|
* Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
@@ -3963,8 +4043,8 @@ declare namespace CodeceptJS {
|
|
|
3963
4043
|
* ```js
|
|
3964
4044
|
* I.executeScript(({x, y}) => x + y, {x, y});
|
|
3965
4045
|
* ```
|
|
3966
|
-
* You can pass only one parameter into a function
|
|
3967
|
-
*
|
|
4046
|
+
* You can pass only one parameter into a function,
|
|
4047
|
+
* or you can pass in array or object.
|
|
3968
4048
|
*
|
|
3969
4049
|
* ```js
|
|
3970
4050
|
* I.executeScript(([x, y]) => x + y, [x, y]);
|
|
@@ -4233,6 +4313,8 @@ declare namespace CodeceptJS {
|
|
|
4233
4313
|
*/
|
|
4234
4314
|
waitForElement(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4235
4315
|
/**
|
|
4316
|
+
* This method accepts [React selectors](https://codecept.io/react).
|
|
4317
|
+
*
|
|
4236
4318
|
* Waits for an element to become visible on a page (by default waits for 1sec).
|
|
4237
4319
|
* Element can be located by CSS or XPath.
|
|
4238
4320
|
*
|
|
@@ -6136,6 +6218,10 @@ declare namespace CodeceptJS {
|
|
|
6136
6218
|
*/
|
|
6137
6219
|
amOnPage(url: string): Promise<any>;
|
|
6138
6220
|
/**
|
|
6221
|
+
* Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
6222
|
+
* Puppeteer does not control the window of a browser, so it can't adjust its real size.
|
|
6223
|
+
* It also can't maximize a window.
|
|
6224
|
+
*
|
|
6139
6225
|
* Resize the current window to provided width and height.
|
|
6140
6226
|
* First parameter can be set to `maximize`.
|
|
6141
6227
|
* @param width - width in pixels or `maximize`.
|
|
@@ -6305,7 +6391,7 @@ declare namespace CodeceptJS {
|
|
|
6305
6391
|
*/
|
|
6306
6392
|
_locate(): Promise<any>;
|
|
6307
6393
|
/**
|
|
6308
|
-
* Find a checkbox by providing human
|
|
6394
|
+
* Find a checkbox by providing human-readable text:
|
|
6309
6395
|
* NOTE: Assumes the checkable element exists
|
|
6310
6396
|
*
|
|
6311
6397
|
* ```js
|
|
@@ -6314,7 +6400,7 @@ declare namespace CodeceptJS {
|
|
|
6314
6400
|
*/
|
|
6315
6401
|
_locateCheckable(): Promise<any>;
|
|
6316
6402
|
/**
|
|
6317
|
-
* Find a clickable element by providing human
|
|
6403
|
+
* Find a clickable element by providing human-readable text:
|
|
6318
6404
|
*
|
|
6319
6405
|
* ```js
|
|
6320
6406
|
* this.helpers['Puppeteer']._locateClickable('Next page').then // ...
|
|
@@ -6322,13 +6408,24 @@ declare namespace CodeceptJS {
|
|
|
6322
6408
|
*/
|
|
6323
6409
|
_locateClickable(): Promise<any>;
|
|
6324
6410
|
/**
|
|
6325
|
-
* Find field elements by providing human
|
|
6411
|
+
* Find field elements by providing human-readable text:
|
|
6326
6412
|
*
|
|
6327
6413
|
* ```js
|
|
6328
6414
|
* this.helpers['Puppeteer']._locateFields('Your email').then // ...
|
|
6329
6415
|
* ```
|
|
6330
6416
|
*/
|
|
6331
6417
|
_locateFields(): Promise<any>;
|
|
6418
|
+
/**
|
|
6419
|
+
* Grab WebElements for given locator
|
|
6420
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
6421
|
+
*
|
|
6422
|
+
* ```js
|
|
6423
|
+
* const webElements = await I.grabWebElements('#button');
|
|
6424
|
+
* ```
|
|
6425
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
6426
|
+
* @returns WebElement of being used Web helper
|
|
6427
|
+
*/
|
|
6428
|
+
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
6332
6429
|
/**
|
|
6333
6430
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
6334
6431
|
*
|
|
@@ -6488,7 +6585,7 @@ declare namespace CodeceptJS {
|
|
|
6488
6585
|
* Sets a directory to where save files. Allows to test file downloads.
|
|
6489
6586
|
* Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
|
|
6490
6587
|
*
|
|
6491
|
-
* By default files are saved to `output/downloads`.
|
|
6588
|
+
* By default, files are saved to `output/downloads`.
|
|
6492
6589
|
* This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
6493
6590
|
*
|
|
6494
6591
|
* ```js
|
|
@@ -6615,6 +6712,8 @@ declare namespace CodeceptJS {
|
|
|
6615
6712
|
*/
|
|
6616
6713
|
pressKeyUp(key: string): Promise<any>;
|
|
6617
6714
|
/**
|
|
6715
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
6716
|
+
*
|
|
6618
6717
|
* Presses a key in the browser (on a focused element).
|
|
6619
6718
|
*
|
|
6620
6719
|
* _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`](#fillfield).
|
|
@@ -6766,6 +6865,8 @@ declare namespace CodeceptJS {
|
|
|
6766
6865
|
*/
|
|
6767
6866
|
dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): Promise<any>;
|
|
6768
6867
|
/**
|
|
6868
|
+
* > ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1](https://github.com/puppeteer/puppeteer/issues/5420), downgrade to 2.0.0 if you face it.
|
|
6869
|
+
*
|
|
6769
6870
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
6770
6871
|
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
6771
6872
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
@@ -7015,6 +7116,8 @@ declare namespace CodeceptJS {
|
|
|
7015
7116
|
*/
|
|
7016
7117
|
clearCookie(cookie?: string): Promise<any>;
|
|
7017
7118
|
/**
|
|
7119
|
+
* If a function returns a Promise, tt will wait for its resolution.
|
|
7120
|
+
*
|
|
7018
7121
|
* Executes sync script on a page.
|
|
7019
7122
|
* Pass arguments to function as additional parameters.
|
|
7020
7123
|
* Will return execution result to a test.
|
|
@@ -7040,12 +7143,10 @@ declare namespace CodeceptJS {
|
|
|
7040
7143
|
* @param fn - function to be executed in browser context.
|
|
7041
7144
|
* @param args - to be passed to function.
|
|
7042
7145
|
* @returns script return value
|
|
7043
|
-
*
|
|
7044
|
-
*
|
|
7045
|
-
* If a function returns a Promise It will wait for it resolution.
|
|
7046
7146
|
*/
|
|
7047
7147
|
executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
|
|
7048
7148
|
/**
|
|
7149
|
+
* Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
7049
7150
|
* Executes async script on page.
|
|
7050
7151
|
* Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
7051
7152
|
*
|
|
@@ -7069,9 +7170,6 @@ declare namespace CodeceptJS {
|
|
|
7069
7170
|
* @param fn - function to be executed in browser context.
|
|
7070
7171
|
* @param args - to be passed to function.
|
|
7071
7172
|
* @returns script return value
|
|
7072
|
-
*
|
|
7073
|
-
*
|
|
7074
|
-
* Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
7075
7173
|
*/
|
|
7076
7174
|
executeAsyncScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
|
|
7077
7175
|
/**
|
|
@@ -7440,9 +7538,9 @@ declare namespace CodeceptJS {
|
|
|
7440
7538
|
*/
|
|
7441
7539
|
waitForFunction(fn: string | ((...params: any[]) => any), argsOrSec?: any[] | number, sec?: number): Promise<any>;
|
|
7442
7540
|
/**
|
|
7443
|
-
* Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
7541
|
+
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
7444
7542
|
*
|
|
7445
|
-
* See [
|
|
7543
|
+
* See [Puppeteer's reference](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions)
|
|
7446
7544
|
*/
|
|
7447
7545
|
waitForNavigation(opts: any): Promise<any>;
|
|
7448
7546
|
/**
|
|
@@ -8951,6 +9049,17 @@ declare namespace CodeceptJS {
|
|
|
8951
9049
|
* @param locator - element located by CSS|XPath|strict locator.
|
|
8952
9050
|
*/
|
|
8953
9051
|
_locateFields(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9052
|
+
/**
|
|
9053
|
+
* Grab WebElements for given locator
|
|
9054
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
9055
|
+
*
|
|
9056
|
+
* ```js
|
|
9057
|
+
* const webElements = await I.grabWebElements('#button');
|
|
9058
|
+
* ```
|
|
9059
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
9060
|
+
* @returns WebElement of being used Web helper
|
|
9061
|
+
*/
|
|
9062
|
+
grabWebElements(locator: CodeceptJS.LocatorOrString): Promise<any>;
|
|
8954
9063
|
/**
|
|
8955
9064
|
* Set [WebDriver timeouts](https://webdriver.io/docs/timeouts.html) in realtime.
|
|
8956
9065
|
*
|
|
@@ -9144,6 +9253,8 @@ declare namespace CodeceptJS {
|
|
|
9144
9253
|
*/
|
|
9145
9254
|
selectOption(select: LocatorOrString, option: string | any[]): Promise<any>;
|
|
9146
9255
|
/**
|
|
9256
|
+
* Appium: not tested
|
|
9257
|
+
*
|
|
9147
9258
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
9148
9259
|
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
9149
9260
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
@@ -9157,6 +9268,7 @@ declare namespace CodeceptJS {
|
|
|
9157
9268
|
*/
|
|
9158
9269
|
attachFile(locator: CodeceptJS.LocatorOrString, pathToFile: string): Promise<any>;
|
|
9159
9270
|
/**
|
|
9271
|
+
* Appium: not tested
|
|
9160
9272
|
* Selects a checkbox or radio button.
|
|
9161
9273
|
* Element is located by label or name or CSS or XPath.
|
|
9162
9274
|
*
|
|
@@ -9172,6 +9284,7 @@ declare namespace CodeceptJS {
|
|
|
9172
9284
|
*/
|
|
9173
9285
|
checkOption(field: CodeceptJS.LocatorOrString, context?: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9174
9286
|
/**
|
|
9287
|
+
* Appium: not tested
|
|
9175
9288
|
* Unselects a checkbox or radio button.
|
|
9176
9289
|
* Element is located by label or name or CSS or XPath.
|
|
9177
9290
|
*
|
|
@@ -9404,6 +9517,7 @@ declare namespace CodeceptJS {
|
|
|
9404
9517
|
*/
|
|
9405
9518
|
dontSeeInField(field: CodeceptJS.LocatorOrString, value: CodeceptJS.StringOrSecret): Promise<any>;
|
|
9406
9519
|
/**
|
|
9520
|
+
* Appium: not tested
|
|
9407
9521
|
* Verifies that the specified checkbox is checked.
|
|
9408
9522
|
*
|
|
9409
9523
|
* ```js
|
|
@@ -9415,6 +9529,7 @@ declare namespace CodeceptJS {
|
|
|
9415
9529
|
*/
|
|
9416
9530
|
seeCheckboxIsChecked(field: CodeceptJS.LocatorOrString): Promise<any>;
|
|
9417
9531
|
/**
|
|
9532
|
+
* Appium: not tested
|
|
9418
9533
|
* Verifies that the specified checkbox is not checked.
|
|
9419
9534
|
*
|
|
9420
9535
|
* ```js
|
|
@@ -9605,6 +9720,8 @@ declare namespace CodeceptJS {
|
|
|
9605
9720
|
*/
|
|
9606
9721
|
dontSeeCurrentUrlEquals(url: string): Promise<any>;
|
|
9607
9722
|
/**
|
|
9723
|
+
* Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
|
|
9724
|
+
*
|
|
9608
9725
|
* Executes sync script on a page.
|
|
9609
9726
|
* Pass arguments to function as additional parameters.
|
|
9610
9727
|
* Will return execution result to a test.
|
|
@@ -9630,10 +9747,6 @@ declare namespace CodeceptJS {
|
|
|
9630
9747
|
* @param fn - function to be executed in browser context.
|
|
9631
9748
|
* @param args - to be passed to function.
|
|
9632
9749
|
* @returns script return value
|
|
9633
|
-
*
|
|
9634
|
-
*
|
|
9635
|
-
*
|
|
9636
|
-
* Wraps [execute](http://webdriver.io/api/protocol/execute.html) command.
|
|
9637
9750
|
*/
|
|
9638
9751
|
executeScript(fn: string | ((...params: any[]) => any), ...args: any[]): Promise<any>;
|
|
9639
9752
|
/**
|
|
@@ -9671,9 +9784,9 @@ declare namespace CodeceptJS {
|
|
|
9671
9784
|
* I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" });
|
|
9672
9785
|
* ```
|
|
9673
9786
|
* @param locator - located by CSS|XPath|strict locator.
|
|
9674
|
-
* @param scrollIntoViewOptions -
|
|
9787
|
+
* @param scrollIntoViewOptions - either alignToTop=true|false or scrollIntoViewOptions. See https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
|
|
9675
9788
|
*/
|
|
9676
|
-
scrollIntoView(locator: LocatorOrString, scrollIntoViewOptions: ScrollIntoViewOptions): Promise<any>;
|
|
9789
|
+
scrollIntoView(locator: LocatorOrString, scrollIntoViewOptions: ScrollIntoViewOptions | boolean): Promise<any>;
|
|
9677
9790
|
/**
|
|
9678
9791
|
* Scrolls to element matched by locator.
|
|
9679
9792
|
* Extra shift can be set with offsetX and offsetY options.
|
|
@@ -9725,6 +9838,7 @@ declare namespace CodeceptJS {
|
|
|
9725
9838
|
*/
|
|
9726
9839
|
saveScreenshot(fileName: string, fullPage?: boolean): Promise<any>;
|
|
9727
9840
|
/**
|
|
9841
|
+
* Uses Selenium's JSON [cookie format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
|
|
9728
9842
|
* Sets cookie(s).
|
|
9729
9843
|
*
|
|
9730
9844
|
* Can be a single cookie object or an array of cookies:
|
|
@@ -9789,7 +9903,7 @@ declare namespace CodeceptJS {
|
|
|
9789
9903
|
*/
|
|
9790
9904
|
acceptPopup(): Promise<any>;
|
|
9791
9905
|
/**
|
|
9792
|
-
* Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt
|
|
9906
|
+
* Dismisses the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`.
|
|
9793
9907
|
*/
|
|
9794
9908
|
cancelPopup(): Promise<any>;
|
|
9795
9909
|
/**
|
|
@@ -9832,6 +9946,8 @@ declare namespace CodeceptJS {
|
|
|
9832
9946
|
*/
|
|
9833
9947
|
pressKeyUp(key: string): Promise<any>;
|
|
9834
9948
|
/**
|
|
9949
|
+
* _Note:_ In case a text field or textarea is focused be aware that some browsers do not respect active modifier when combining modifier keys with other keys.
|
|
9950
|
+
*
|
|
9835
9951
|
* Presses a key in the browser (on a focused element).
|
|
9836
9952
|
*
|
|
9837
9953
|
* _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`](#fillfield).
|
|
@@ -9915,6 +10031,8 @@ declare namespace CodeceptJS {
|
|
|
9915
10031
|
*/
|
|
9916
10032
|
type(key: string | string[], delay?: number): Promise<any>;
|
|
9917
10033
|
/**
|
|
10034
|
+
* Appium: not tested in web, in apps doesn't work
|
|
10035
|
+
*
|
|
9918
10036
|
* Resize the current window to provided width and height.
|
|
9919
10037
|
* First parameter can be set to `maximize`.
|
|
9920
10038
|
* @param width - width in pixels or `maximize`.
|
|
@@ -9955,6 +10073,7 @@ declare namespace CodeceptJS {
|
|
|
9955
10073
|
*/
|
|
9956
10074
|
blur(locator: CodeceptJS.LocatorOrString, options?: any): Promise<any>;
|
|
9957
10075
|
/**
|
|
10076
|
+
* Appium: not tested
|
|
9958
10077
|
* Drag an item to a destination element.
|
|
9959
10078
|
*
|
|
9960
10079
|
* ```js
|