codeceptjs 4.0.0-rc.22 → 4.0.0-rc.24
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 +9 -10
- package/docs/ai.md +3 -51
- package/docs/architecture.md +16 -0
- package/docs/bootstrap.md +1 -1
- package/docs/continuous-integration.md +16 -44
- package/docs/custom-helpers.md +1 -1
- package/docs/detox.md +1 -1
- package/docs/docker.md +1 -30
- package/docs/examples.md +0 -1
- package/docs/helpers/Appium.md +16 -2
- package/docs/helpers/Playwright.md +161 -160
- package/docs/helpers/Puppeteer.md +143 -250
- package/docs/helpers/WebDriver.md +134 -177
- package/docs/hooks.md +11 -1
- package/docs/index.md +1 -1
- package/docs/installation.md +2 -19
- package/docs/locators.md +1 -1
- package/docs/migrate-from-cypress.md +98 -0
- package/docs/migrate-from-java.md +108 -0
- package/docs/migrate-from-protractor.md +101 -0
- package/docs/migrate-from-testcafe.md +99 -0
- package/docs/migration-4.md +195 -8
- package/docs/plugins/aiTrace.md +49 -0
- package/docs/plugins/analyze.md +66 -0
- package/docs/plugins/auth.md +241 -0
- package/docs/plugins/autoDelay.md +48 -0
- package/docs/plugins/browser.md +41 -0
- package/docs/plugins/coverage.md +39 -0
- package/docs/plugins/customLocator.md +119 -0
- package/docs/plugins/customReporter.md +16 -0
- package/docs/plugins/expose.md +75 -0
- package/docs/plugins/heal.md +44 -0
- package/docs/plugins/junitReporter.md +51 -0
- package/docs/plugins/pageInfo.md +34 -0
- package/docs/plugins/pause.md +43 -0
- package/docs/plugins/pauseOnFail.md +18 -0
- package/docs/plugins/retryFailedStep.md +75 -0
- package/docs/plugins/screencast.md +55 -0
- package/docs/plugins/screenshot.md +58 -0
- package/docs/plugins/screenshotOnFail.md +18 -0
- package/docs/plugins/stepTimeout.md +65 -0
- package/docs/plugins.md +40 -862
- package/docs/reports.md +18 -4
- package/docs/retry.md +48 -18
- package/docs/store.md +94 -0
- package/docs/timeouts.md +1 -1
- package/docs/tutorial.md +207 -155
- package/docs/webdriver.md +6 -73
- package/lib/actor.js +1 -36
- package/lib/command/run-multiple.js +1 -2
- package/lib/heal.js +2 -2
- package/lib/helper/Playwright.js +1 -15
- package/lib/helper/Puppeteer.js +0 -103
- package/lib/helper/WebDriver.js +1 -28
- package/lib/helper/extras/PlaywrightLocator.js +10 -0
- package/lib/locator.js +0 -13
- package/lib/plugin/aiTrace.js +4 -3
- package/lib/plugin/analyze.js +3 -4
- package/lib/plugin/junitReporter.js +1 -1
- package/lib/plugin/pauseOnFail.js +3 -1
- package/lib/plugin/retryFailedStep.js +11 -10
- package/lib/plugin/screencast.js +1 -1
- package/lib/plugin/screenshot.js +2 -7
- package/lib/plugin/screenshotOnFail.js +3 -1
- package/lib/plugin/stepTimeout.js +3 -2
- package/lib/recorder.js +1 -1
- package/lib/step/base.js +7 -7
- package/lib/step/comment.js +2 -2
- package/lib/step/helper.js +4 -4
- package/lib/step/meta.js +3 -3
- package/lib/step/record.js +3 -3
- package/lib/workers.js +0 -4
- package/package.json +3 -4
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockServer.md +0 -212
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/SoftExpectHelper.md +0 -352
- package/docs/react.md +0 -70
- package/lib/helper/Mochawesome.js +0 -96
- package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -61
- package/lib/helper/extras/React.js +0 -65
|
@@ -45,39 +45,39 @@ Type: [object][6]
|
|
|
45
45
|
|
|
46
46
|
* `url` **[string][9]?** base url of website to be tested
|
|
47
47
|
* `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
48
|
-
* `show` **[boolean][
|
|
49
|
-
* `restart` **([string][9] | [boolean][
|
|
48
|
+
* `show` **[boolean][27]?** show browser window.
|
|
49
|
+
* `restart` **([string][9] | [boolean][27])?** restart strategy between tests. Possible values:* 'context' or **false** - restarts [browser context][44] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
50
50
|
* 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
51
|
-
* `timeout` **[number][
|
|
52
|
-
* `disableScreenshots` **[boolean][
|
|
51
|
+
* `timeout` **[number][18]?** * [timeout][45] in ms of all Playwright actions .
|
|
52
|
+
* `disableScreenshots` **[boolean][27]?** don't save screenshot on failure.
|
|
53
53
|
* `emulate` **any?** browser in device emulation mode.
|
|
54
|
-
* `video` **[boolean][
|
|
55
|
-
* `keepVideoForPassedTests` **[boolean][
|
|
56
|
-
* `trace` **[boolean][
|
|
57
|
-
* `keepTraceForPassedTests` **[boolean][
|
|
58
|
-
* `fullPageScreenshots` **[boolean][
|
|
59
|
-
* `uniqueScreenshotNames` **[boolean][
|
|
60
|
-
* `keepBrowserState` **[boolean][
|
|
61
|
-
* `keepCookies` **[boolean][
|
|
62
|
-
* `waitForAction` **[number][
|
|
63
|
-
* `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][
|
|
64
|
-
* `pressKeyDelay` **[number][
|
|
65
|
-
* `getPageTimeout` **[number][
|
|
66
|
-
* `waitForTimeout` **[number][
|
|
54
|
+
* `video` **[boolean][27]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
55
|
+
* `keepVideoForPassedTests` **[boolean][27]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
56
|
+
* `trace` **[boolean][27]?** record [tracing information][46] with screenshots and snapshots.
|
|
57
|
+
* `keepTraceForPassedTests` **[boolean][27]?** save trace for passed tests.
|
|
58
|
+
* `fullPageScreenshots` **[boolean][27]?** make full page screenshots on failure.
|
|
59
|
+
* `uniqueScreenshotNames` **[boolean][27]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
60
|
+
* `keepBrowserState` **[boolean][27]?** keep browser state between tests when `restart` is set to 'session'.
|
|
61
|
+
* `keepCookies` **[boolean][27]?** keep cookies between tests when `restart` is set to 'session'.
|
|
62
|
+
* `waitForAction` **[number][18]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
63
|
+
* `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][43].
|
|
64
|
+
* `pressKeyDelay` **[number][18]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
65
|
+
* `getPageTimeout` **[number][18]?** config option to set maximum navigation time in milliseconds.
|
|
66
|
+
* `waitForTimeout` **[number][18]?** default wait* timeout in ms. Default: 1000.
|
|
67
67
|
* `basicAuth` **[object][6]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
68
68
|
* `windowSize` **[string][9]?** default window size. Set a dimension like `640x480`.
|
|
69
69
|
* `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
70
70
|
* `userAgent` **[string][9]?** user-agent string.
|
|
71
71
|
* `locale` **[string][9]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
72
|
-
* `manualStart` **[boolean][
|
|
72
|
+
* `manualStart` **[boolean][27]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
73
73
|
* `chromium` **[object][6]?** pass additional chromium options
|
|
74
74
|
* `firefox` **[object][6]?** pass additional firefox options
|
|
75
75
|
* `electron` **[object][6]?** (pass additional electron options
|
|
76
76
|
* `channel` **any?** (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge][47].
|
|
77
77
|
* `ignoreLog` **[Array][10]<[string][9]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][48].
|
|
78
|
-
* `ignoreHTTPSErrors` **[boolean][
|
|
79
|
-
* `bypassCSP` **[boolean][
|
|
80
|
-
* `highlightElement` **[boolean][
|
|
78
|
+
* `ignoreHTTPSErrors` **[boolean][27]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
79
|
+
* `bypassCSP` **[boolean][27]?** bypass Content Security Policy or CSP
|
|
80
|
+
* `highlightElement` **[boolean][27]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
81
81
|
* `recordHar` **[object][6]?** record HAR and will be saved to `output/har`. See more of [HAR options][3].
|
|
82
82
|
* `testIdAttribute` **[string][9]?** locate elements based on the testIdAttribute. See more of [locate by test id][49].
|
|
83
83
|
* `storageState` **([string][9] | [object][6])?** Playwright storage state (path to JSON file or object)
|
|
@@ -635,13 +635,17 @@ I.click('//form/*[@type=submit]');
|
|
|
635
635
|
I.click('Logout', '#nav');
|
|
636
636
|
// using strict locator
|
|
637
637
|
I.click({css: 'nav a.login'});
|
|
638
|
+
// using ARIA role locator
|
|
639
|
+
I.click({role: 'button', name: 'Submit'});
|
|
638
640
|
```
|
|
639
641
|
|
|
642
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][16].
|
|
643
|
+
|
|
640
644
|
#### Parameters
|
|
641
645
|
|
|
642
646
|
* `locator` **([string][9] | [object][6])** (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
643
647
|
* `context` **([string][9]? | [object][6] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
644
|
-
* `options` **any?** [Additional options][
|
|
648
|
+
* `options` **any?** [Additional options][17] for click available as 3rd argument.
|
|
645
649
|
|
|
646
650
|
#### Examples
|
|
647
651
|
|
|
@@ -657,15 +661,6 @@ I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
|
657
661
|
|
|
658
662
|
Returns **void** automatically synchronized promise through #recorder
|
|
659
663
|
|
|
660
|
-
### clickLink
|
|
661
|
-
|
|
662
|
-
Clicks link and waits for navigation (deprecated)
|
|
663
|
-
|
|
664
|
-
#### Parameters
|
|
665
|
-
|
|
666
|
-
* `locator`  
|
|
667
|
-
* `context`
|
|
668
|
-
|
|
669
664
|
### clickXY
|
|
670
665
|
|
|
671
666
|
Performs click at specific coordinates.
|
|
@@ -682,11 +677,11 @@ I.clickXY('#someElement', 50, 30);
|
|
|
682
677
|
|
|
683
678
|
#### Parameters
|
|
684
679
|
|
|
685
|
-
* `locator` **([string][9] | [object][6] | [number][
|
|
686
|
-
* `x` **[number][
|
|
687
|
-
* `y` **[number][
|
|
680
|
+
* `locator` **([string][9] | [object][6] | [number][18])** Element to click on or X coordinate if no element.
|
|
681
|
+
* `x` **[number][18]?** X coordinate relative to element, or Y coordinate if locator is a number.
|
|
682
|
+
* `y` **[number][18]?** Y coordinate relative to element.
|
|
688
683
|
|
|
689
|
-
Returns **[Promise][
|
|
684
|
+
Returns **[Promise][19]<void>** 
|
|
690
685
|
|
|
691
686
|
### closeCurrentTab
|
|
692
687
|
|
|
@@ -934,7 +929,7 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
934
929
|
|
|
935
930
|
* `srcElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
936
931
|
* `destElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
937
|
-
* `options` **any?** [Additional options][
|
|
932
|
+
* `options` **any?** [Additional options][20] can be passed as 3rd argument.
|
|
938
933
|
|
|
939
934
|
Returns **void** automatically synchronized promise through #recorder
|
|
940
935
|
|
|
@@ -951,7 +946,7 @@ I.dragSlider('#slider', -70);
|
|
|
951
946
|
#### Parameters
|
|
952
947
|
|
|
953
948
|
* `locator` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
954
|
-
* `offsetX` **[number][
|
|
949
|
+
* `offsetX` **[number][18]** position to drag.
|
|
955
950
|
|
|
956
951
|
Returns **void** automatically synchronized promise through #recorder
|
|
957
952
|
|
|
@@ -980,10 +975,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
980
975
|
|
|
981
976
|
#### Parameters
|
|
982
977
|
|
|
983
|
-
* `fn` **([string][9] | [function][
|
|
978
|
+
* `fn` **([string][9] | [function][21])** function to be executed in browser context.
|
|
984
979
|
* `arg` **any?** optional argument to pass to the function
|
|
985
980
|
|
|
986
|
-
Returns **[Promise][
|
|
981
|
+
Returns **[Promise][19]<any>** 
|
|
987
982
|
|
|
988
983
|
### fillField
|
|
989
984
|
|
|
@@ -1001,10 +996,14 @@ I.fillField('password', secret('123456'));
|
|
|
1001
996
|
I.fillField('form#login input[name=username]', 'John');
|
|
1002
997
|
// or by strict locator
|
|
1003
998
|
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
999
|
+
// by ARIA role locator
|
|
1000
|
+
I.fillField({role: 'textbox', name: 'Email'}, 'hello@world.com');
|
|
1004
1001
|
// within a context
|
|
1005
1002
|
I.fillField('Name', 'John', '#section2');
|
|
1006
1003
|
```
|
|
1007
1004
|
|
|
1005
|
+
> ℹ️ ARIA role locators (`{role, name}`) match fields by their accessible name and survive markup refactors. See [Locators][16].
|
|
1006
|
+
|
|
1008
1007
|
#### Parameters
|
|
1009
1008
|
|
|
1010
1009
|
* `field` **([string][9] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
@@ -1040,7 +1039,7 @@ I.see('#add-to-cart-bnt');
|
|
|
1040
1039
|
#### Parameters
|
|
1041
1040
|
|
|
1042
1041
|
* `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1043
|
-
* `options` **any?** Playwright only: [Additional options][
|
|
1042
|
+
* `options` **any?** Playwright only: [Additional options][22] for available options object as 2nd argument.
|
|
1044
1043
|
|
|
1045
1044
|
Returns **void** automatically synchronized promise through #recorder
|
|
1046
1045
|
|
|
@@ -1080,7 +1079,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1080
1079
|
|
|
1081
1080
|
### grabAriaSnapshot
|
|
1082
1081
|
|
|
1083
|
-
Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`][
|
|
1082
|
+
Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`][23].
|
|
1084
1083
|
This method returns a YAML representation of the accessibility tree that can be used for assertions.
|
|
1085
1084
|
If no locator is provided, it captures the snapshot of the entire page body.
|
|
1086
1085
|
|
|
@@ -1092,13 +1091,13 @@ const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
|
1092
1091
|
expect(formSnapshot).toContain('textbox "Email"');
|
|
1093
1092
|
```
|
|
1094
1093
|
|
|
1095
|
-
[Learn more about ARIA snapshots][
|
|
1094
|
+
[Learn more about ARIA snapshots][24]
|
|
1096
1095
|
|
|
1097
1096
|
#### Parameters
|
|
1098
1097
|
|
|
1099
1098
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator. Defaults to body element.
|
|
1100
1099
|
|
|
1101
|
-
Returns **[Promise][
|
|
1100
|
+
Returns **[Promise][19]<[string][9]>** YAML representation of the accessibility tree
|
|
1102
1101
|
|
|
1103
1102
|
### grabAttributeFrom
|
|
1104
1103
|
|
|
@@ -1115,7 +1114,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
1115
1114
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1116
1115
|
* `attr` **[string][9]** attribute name.
|
|
1117
1116
|
|
|
1118
|
-
Returns **[Promise][
|
|
1117
|
+
Returns **[Promise][19]<[string][9]>** attribute value
|
|
1119
1118
|
|
|
1120
1119
|
### grabAttributeFromAll
|
|
1121
1120
|
|
|
@@ -1131,7 +1130,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1131
1130
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1132
1131
|
* `attr` **[string][9]** attribute name.
|
|
1133
1132
|
|
|
1134
|
-
Returns **[Promise][
|
|
1133
|
+
Returns **[Promise][19]<[Array][10]<[string][9]>>** attribute value
|
|
1135
1134
|
|
|
1136
1135
|
### grabBrowserLogs
|
|
1137
1136
|
|
|
@@ -1143,9 +1142,9 @@ const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l
|
|
|
1143
1142
|
console.log(JSON.stringify(errors));
|
|
1144
1143
|
```
|
|
1145
1144
|
|
|
1146
|
-
[Learn more about console messages][
|
|
1145
|
+
[Learn more about console messages][25]
|
|
1147
1146
|
|
|
1148
|
-
Returns **[Promise][
|
|
1147
|
+
Returns **[Promise][19]<[Array][10]<any>>** 
|
|
1149
1148
|
|
|
1150
1149
|
### grabCheckedElementStatus
|
|
1151
1150
|
|
|
@@ -1154,9 +1153,9 @@ Return the checked status of given element.
|
|
|
1154
1153
|
#### Parameters
|
|
1155
1154
|
|
|
1156
1155
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1157
|
-
* `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-checked][
|
|
1156
|
+
* `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-checked][26]
|
|
1158
1157
|
|
|
1159
|
-
Returns **[Promise][
|
|
1158
|
+
Returns **[Promise][19]<[boolean][27]>** 
|
|
1160
1159
|
|
|
1161
1160
|
### grabCookie
|
|
1162
1161
|
|
|
@@ -1192,7 +1191,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1192
1191
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1193
1192
|
* `cssProperty` **[string][9]** CSS property name.
|
|
1194
1193
|
|
|
1195
|
-
Returns **[Promise][
|
|
1194
|
+
Returns **[Promise][19]<[string][9]>** CSS value
|
|
1196
1195
|
|
|
1197
1196
|
### grabCssPropertyFromAll
|
|
1198
1197
|
|
|
@@ -1208,7 +1207,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1208
1207
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1209
1208
|
* `cssProperty` **[string][9]** CSS property name.
|
|
1210
1209
|
|
|
1211
|
-
Returns **[Promise][
|
|
1210
|
+
Returns **[Promise][19]<[Array][10]<[string][9]>>** CSS value
|
|
1212
1211
|
|
|
1213
1212
|
### grabCurrentUrl
|
|
1214
1213
|
|
|
@@ -1220,7 +1219,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1220
1219
|
console.log(`Current URL is [${url}]`);
|
|
1221
1220
|
```
|
|
1222
1221
|
|
|
1223
|
-
Returns **[Promise][
|
|
1222
|
+
Returns **[Promise][19]<[string][9]>** current URL
|
|
1224
1223
|
|
|
1225
1224
|
### grabDataFromPerformanceTiming
|
|
1226
1225
|
|
|
@@ -1254,9 +1253,9 @@ Return the disabled status of given element.
|
|
|
1254
1253
|
#### Parameters
|
|
1255
1254
|
|
|
1256
1255
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1257
|
-
* `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-disabled][
|
|
1256
|
+
* `options` **[object][6]?** See [https://playwright.dev/docs/api/class-locator#locator-is-disabled][28]
|
|
1258
1257
|
|
|
1259
|
-
Returns **[Promise][
|
|
1258
|
+
Returns **[Promise][19]<[boolean][27]>** 
|
|
1260
1259
|
|
|
1261
1260
|
### grabElementBoundingRect
|
|
1262
1261
|
|
|
@@ -1284,7 +1283,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1284
1283
|
* `prop`  
|
|
1285
1284
|
* `elementSize` **[string][9]?** x, y, width or height of the given element.
|
|
1286
1285
|
|
|
1287
|
-
Returns **([Promise][
|
|
1286
|
+
Returns **([Promise][19]<DOMRect> | [Promise][19]<[number][18]>)** Element bounding rectangle
|
|
1288
1287
|
|
|
1289
1288
|
### grabHTMLFrom
|
|
1290
1289
|
|
|
@@ -1301,7 +1300,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1301
1300
|
* `locator`  
|
|
1302
1301
|
* `element` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1303
1302
|
|
|
1304
|
-
Returns **[Promise][
|
|
1303
|
+
Returns **[Promise][19]<[string][9]>** HTML code for an element
|
|
1305
1304
|
|
|
1306
1305
|
### grabHTMLFromAll
|
|
1307
1306
|
|
|
@@ -1317,7 +1316,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1317
1316
|
* `locator`  
|
|
1318
1317
|
* `element` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1319
1318
|
|
|
1320
|
-
Returns **[Promise][
|
|
1319
|
+
Returns **[Promise][19]<[Array][10]<[string][9]>>** HTML code for an element
|
|
1321
1320
|
|
|
1322
1321
|
### grabMetrics
|
|
1323
1322
|
|
|
@@ -1372,7 +1371,7 @@ const metrics = await I.grabMetrics();
|
|
|
1372
1371
|
|
|
1373
1372
|
```
|
|
1374
1373
|
|
|
1375
|
-
Returns **[Promise][
|
|
1374
|
+
Returns **[Promise][19]<[Array][10]<[Object][6]>>** 
|
|
1376
1375
|
|
|
1377
1376
|
### grabNumberOfOpenTabs
|
|
1378
1377
|
|
|
@@ -1383,7 +1382,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1383
1382
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1384
1383
|
```
|
|
1385
1384
|
|
|
1386
|
-
Returns **[Promise][
|
|
1385
|
+
Returns **[Promise][19]<[number][18]>** number of open tabs
|
|
1387
1386
|
|
|
1388
1387
|
### grabNumberOfVisibleElements
|
|
1389
1388
|
|
|
@@ -1398,7 +1397,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1398
1397
|
|
|
1399
1398
|
* `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1400
1399
|
|
|
1401
|
-
Returns **[Promise][
|
|
1400
|
+
Returns **[Promise][19]<[number][18]>** number of visible elements
|
|
1402
1401
|
|
|
1403
1402
|
### grabPageScrollPosition
|
|
1404
1403
|
|
|
@@ -1409,7 +1408,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1409
1408
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1410
1409
|
```
|
|
1411
1410
|
|
|
1412
|
-
Returns **[Promise][
|
|
1411
|
+
Returns **[Promise][19]<PageScrollPosition>** scroll position
|
|
1413
1412
|
|
|
1414
1413
|
### grabPopupText
|
|
1415
1414
|
|
|
@@ -1419,7 +1418,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1419
1418
|
await I.grabPopupText();
|
|
1420
1419
|
```
|
|
1421
1420
|
|
|
1422
|
-
Returns **[Promise][
|
|
1421
|
+
Returns **[Promise][19]<([string][9] | null)>** 
|
|
1423
1422
|
|
|
1424
1423
|
### grabRecordedNetworkTraffics
|
|
1425
1424
|
|
|
@@ -1443,7 +1442,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1443
1442
|
let pageSource = await I.grabSource();
|
|
1444
1443
|
```
|
|
1445
1444
|
|
|
1446
|
-
Returns **[Promise][
|
|
1445
|
+
Returns **[Promise][19]<[string][9]>** source code
|
|
1447
1446
|
|
|
1448
1447
|
### grabStorageState
|
|
1449
1448
|
|
|
@@ -1458,7 +1457,7 @@ Avoid committing it to source control and prefer storing it in a protected secre
|
|
|
1458
1457
|
|
|
1459
1458
|
* `options` **[object][6]?**
|
|
1460
1459
|
|
|
1461
|
-
* `options.indexedDB` **[boolean][
|
|
1460
|
+
* `options.indexedDB` **[boolean][27]?** set to true to include IndexedDB in snapshot (Playwright >=1.51)```js
|
|
1462
1461
|
// basic usage
|
|
1463
1462
|
const state = await I.grabStorageState();
|
|
1464
1463
|
require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
@@ -1482,7 +1481,7 @@ If multiple elements found returns first element.
|
|
|
1482
1481
|
|
|
1483
1482
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1484
1483
|
|
|
1485
|
-
Returns **[Promise][
|
|
1484
|
+
Returns **[Promise][19]<[string][9]>** attribute value
|
|
1486
1485
|
|
|
1487
1486
|
### grabTextFromAll
|
|
1488
1487
|
|
|
@@ -1497,7 +1496,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1497
1496
|
|
|
1498
1497
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1499
1498
|
|
|
1500
|
-
Returns **[Promise][
|
|
1499
|
+
Returns **[Promise][19]<[Array][10]<[string][9]>>** attribute value
|
|
1501
1500
|
|
|
1502
1501
|
### grabTitle
|
|
1503
1502
|
|
|
@@ -1508,7 +1507,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1508
1507
|
let title = await I.grabTitle();
|
|
1509
1508
|
```
|
|
1510
1509
|
|
|
1511
|
-
Returns **[Promise][
|
|
1510
|
+
Returns **[Promise][19]<[string][9]>** title
|
|
1512
1511
|
|
|
1513
1512
|
### grabTrafficUrl
|
|
1514
1513
|
|
|
@@ -1525,7 +1524,7 @@ I.grabTrafficUrl(/session.*start/);
|
|
|
1525
1524
|
|
|
1526
1525
|
* `urlMatch` **([string][9] | [RegExp][11])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
1527
1526
|
|
|
1528
|
-
Returns **[Promise][
|
|
1527
|
+
Returns **[Promise][19]<any>** 
|
|
1529
1528
|
|
|
1530
1529
|
### grabValueFrom
|
|
1531
1530
|
|
|
@@ -1541,7 +1540,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1541
1540
|
|
|
1542
1541
|
* `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1543
1542
|
|
|
1544
|
-
Returns **[Promise][
|
|
1543
|
+
Returns **[Promise][19]<[string][9]>** attribute value
|
|
1545
1544
|
|
|
1546
1545
|
### grabValueFromAll
|
|
1547
1546
|
|
|
@@ -1556,7 +1555,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1556
1555
|
|
|
1557
1556
|
* `locator` **([string][9] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1558
1557
|
|
|
1559
|
-
Returns **[Promise][
|
|
1558
|
+
Returns **[Promise][19]<[Array][10]<[string][9]>>** attribute value
|
|
1560
1559
|
|
|
1561
1560
|
### grabWebElement
|
|
1562
1561
|
|
|
@@ -1571,7 +1570,7 @@ const webElement = await I.grabWebElement('#button');
|
|
|
1571
1570
|
|
|
1572
1571
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1573
1572
|
|
|
1574
|
-
Returns **[Promise][
|
|
1573
|
+
Returns **[Promise][19]<any>** WebElement of being used Web helper
|
|
1575
1574
|
|
|
1576
1575
|
### grabWebElements
|
|
1577
1576
|
|
|
@@ -1586,7 +1585,7 @@ const webElements = await I.grabWebElements('#button');
|
|
|
1586
1585
|
|
|
1587
1586
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1588
1587
|
|
|
1589
|
-
Returns **[Promise][
|
|
1588
|
+
Returns **[Promise][19]<any>** WebElement of being used Web helper
|
|
1590
1589
|
|
|
1591
1590
|
### grabWebSocketMessages
|
|
1592
1591
|
|
|
@@ -1599,7 +1598,7 @@ Returns **[Array][10]<any>** 
|
|
|
1599
1598
|
Handles a file download. A file name is required to save the file on disk.
|
|
1600
1599
|
Files are saved to "output" directory.
|
|
1601
1600
|
|
|
1602
|
-
Should be used with [FileSystem helper][
|
|
1601
|
+
Should be used with [FileSystem helper][29] to check that file were downloaded correctly.
|
|
1603
1602
|
|
|
1604
1603
|
```js
|
|
1605
1604
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1613,11 +1612,11 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1613
1612
|
|
|
1614
1613
|
* `fileName` **[string][9]** set filename for downloaded file
|
|
1615
1614
|
|
|
1616
|
-
Returns **[Promise][
|
|
1615
|
+
Returns **[Promise][19]<void>** 
|
|
1617
1616
|
|
|
1618
1617
|
### makeApiRequest
|
|
1619
1618
|
|
|
1620
|
-
Performs [api request][
|
|
1619
|
+
Performs [api request][30] using
|
|
1621
1620
|
the cookies from the current browser session.
|
|
1622
1621
|
|
|
1623
1622
|
```js
|
|
@@ -1634,22 +1633,22 @@ I.makeApiRequest('PATCH', )
|
|
|
1634
1633
|
* `url` **[string][9]** endpoint
|
|
1635
1634
|
* `options` **[object][6]** request options depending on method used
|
|
1636
1635
|
|
|
1637
|
-
Returns **[Promise][
|
|
1636
|
+
Returns **[Promise][19]<[object][6]>** response
|
|
1638
1637
|
|
|
1639
1638
|
### mockRoute
|
|
1640
1639
|
|
|
1641
|
-
Mocks network request using [`browserContext.route`][
|
|
1640
|
+
Mocks network request using [`browserContext.route`][31] of Playwright
|
|
1642
1641
|
|
|
1643
1642
|
```js
|
|
1644
1643
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1645
1644
|
```
|
|
1646
1645
|
|
|
1647
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1646
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][32]
|
|
1648
1647
|
|
|
1649
1648
|
#### Parameters
|
|
1650
1649
|
|
|
1651
1650
|
* `url` **([string][9] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
1652
|
-
* `handler` **[function][
|
|
1651
|
+
* `handler` **[function][21]?** a function to process request
|
|
1653
1652
|
|
|
1654
1653
|
### mockTraffic
|
|
1655
1654
|
|
|
@@ -1687,8 +1686,8 @@ I.moveCursorTo('#submit', '.container');
|
|
|
1687
1686
|
#### Parameters
|
|
1688
1687
|
|
|
1689
1688
|
* `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1690
|
-
* `offsetX` **([number][
|
|
1691
|
-
* `offsetY` **[number][
|
|
1689
|
+
* `offsetX` **([number][18] | [string][9] | [object][6])** (optional, `0` by default) X-axis offset or context locator.
|
|
1690
|
+
* `offsetY` **[number][18]** (optional, `0` by default) Y-axis offset.
|
|
1692
1691
|
|
|
1693
1692
|
Returns **void** automatically synchronized promise through #recorder
|
|
1694
1693
|
|
|
@@ -1700,7 +1699,7 @@ Open new tab and automatically switched to new tab
|
|
|
1700
1699
|
I.openNewTab();
|
|
1701
1700
|
```
|
|
1702
1701
|
|
|
1703
|
-
You can pass in [page options][
|
|
1702
|
+
You can pass in [page options][33] to emulate device on this page
|
|
1704
1703
|
|
|
1705
1704
|
```js
|
|
1706
1705
|
// enable mobile
|
|
@@ -1713,11 +1712,11 @@ I.openNewTab({ isMobile: true });
|
|
|
1713
1712
|
|
|
1714
1713
|
### pressKey
|
|
1715
1714
|
|
|
1716
|
-
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][
|
|
1715
|
+
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][34]).
|
|
1717
1716
|
|
|
1718
1717
|
Presses a key in the browser (on a focused element).
|
|
1719
1718
|
|
|
1720
|
-
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1719
|
+
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][35].
|
|
1721
1720
|
|
|
1722
1721
|
```js
|
|
1723
1722
|
I.pressKey('Backspace');
|
|
@@ -1784,7 +1783,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1784
1783
|
|
|
1785
1784
|
Presses a key in the browser and leaves it in a down state.
|
|
1786
1785
|
|
|
1787
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1786
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][36]).
|
|
1788
1787
|
|
|
1789
1788
|
```js
|
|
1790
1789
|
I.pressKeyDown('Control');
|
|
@@ -1802,7 +1801,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1802
1801
|
|
|
1803
1802
|
Releases a key in the browser which was previously set to a down state.
|
|
1804
1803
|
|
|
1805
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1804
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][36]).
|
|
1806
1805
|
|
|
1807
1806
|
```js
|
|
1808
1807
|
I.pressKeyDown('Control');
|
|
@@ -1842,7 +1841,7 @@ Replaying from HAR
|
|
|
1842
1841
|
#### Parameters
|
|
1843
1842
|
|
|
1844
1843
|
* `harFilePath` **[string][9]** Path to recorded HAR file
|
|
1845
|
-
* `opts` **[object][6]?** [Options for replaying from HAR][
|
|
1844
|
+
* `opts` **[object][6]?** [Options for replaying from HAR][37]
|
|
1846
1845
|
|
|
1847
1846
|
Returns **any** Promise<void>
|
|
1848
1847
|
|
|
@@ -1865,8 +1864,8 @@ First parameter can be set to `maximize`.
|
|
|
1865
1864
|
|
|
1866
1865
|
#### Parameters
|
|
1867
1866
|
|
|
1868
|
-
* `width` **[number][
|
|
1869
|
-
* `height` **[number][
|
|
1867
|
+
* `width` **[number][18]** width in pixels or `maximize`.
|
|
1868
|
+
* `height` **[number][18]** height in pixels.
|
|
1870
1869
|
|
|
1871
1870
|
Returns **void** automatically synchronized promise through #recorder
|
|
1872
1871
|
|
|
@@ -1920,7 +1919,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1920
1919
|
#### Parameters
|
|
1921
1920
|
|
|
1922
1921
|
* `fileName` **[string][9]** file name to save.
|
|
1923
|
-
* `fullPage` **[boolean][
|
|
1922
|
+
* `fullPage` **[boolean][27]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1924
1923
|
|
|
1925
1924
|
Returns **void** automatically synchronized promise through #recorder
|
|
1926
1925
|
|
|
@@ -1957,8 +1956,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1957
1956
|
#### Parameters
|
|
1958
1957
|
|
|
1959
1958
|
* `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
1960
|
-
* `offsetX` **[number][
|
|
1961
|
-
* `offsetY` **[number][
|
|
1959
|
+
* `offsetX` **[number][18]** (optional, `0` by default) X-axis offset.
|
|
1960
|
+
* `offsetY` **[number][18]** (optional, `0` by default) Y-axis offset.
|
|
1962
1961
|
|
|
1963
1962
|
Returns **void** automatically synchronized promise through #recorder
|
|
1964
1963
|
|
|
@@ -2083,8 +2082,12 @@ The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
|
2083
2082
|
```js
|
|
2084
2083
|
I.seeElement('#modal');
|
|
2085
2084
|
I.seeElement('#modal', '#container');
|
|
2085
|
+
// using ARIA role locator
|
|
2086
|
+
I.seeElement({role: 'dialog'});
|
|
2086
2087
|
```
|
|
2087
2088
|
|
|
2089
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][16].
|
|
2090
|
+
|
|
2088
2091
|
#### Parameters
|
|
2089
2092
|
|
|
2090
2093
|
* `locator` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
|
|
@@ -2200,7 +2203,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
2200
2203
|
#### Parameters
|
|
2201
2204
|
|
|
2202
2205
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2203
|
-
* `num` **[number][
|
|
2206
|
+
* `num` **[number][18]** number of elements.
|
|
2204
2207
|
|
|
2205
2208
|
Returns **void** automatically synchronized promise through #recorder
|
|
2206
2209
|
|
|
@@ -2216,7 +2219,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
2216
2219
|
#### Parameters
|
|
2217
2220
|
|
|
2218
2221
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2219
|
-
* `num` **[number][
|
|
2222
|
+
* `num` **[number][18]** number of elements.
|
|
2220
2223
|
|
|
2221
2224
|
Returns **void** automatically synchronized promise through #recorder
|
|
2222
2225
|
|
|
@@ -2288,7 +2291,7 @@ await I.seeTraffic({
|
|
|
2288
2291
|
* `opts.url` **[string][9]** Expected URL of request in network traffic
|
|
2289
2292
|
* `opts.parameters` **[Object][6]?** Expected parameters of that request in network traffic
|
|
2290
2293
|
* `opts.requestPostData` **[Object][6]?** Expected that request contains post data in network traffic
|
|
2291
|
-
* `opts.timeout` **[number][
|
|
2294
|
+
* `opts.timeout` **[number][18]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
2292
2295
|
|
|
2293
2296
|
Returns **void** automatically synchronized promise through #recorder
|
|
2294
2297
|
|
|
@@ -2397,7 +2400,7 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
2397
2400
|
#### Parameters
|
|
2398
2401
|
|
|
2399
2402
|
* `url` **([string][9] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
2400
|
-
* `handler` **[function][
|
|
2403
|
+
* `handler` **[function][21]?** a function to process request
|
|
2401
2404
|
|
|
2402
2405
|
### stopRecordingTraffic
|
|
2403
2406
|
|
|
@@ -2443,7 +2446,7 @@ I.switchToNextTab(2);
|
|
|
2443
2446
|
|
|
2444
2447
|
#### Parameters
|
|
2445
2448
|
|
|
2446
|
-
* `num` **[number][
|
|
2449
|
+
* `num` **[number][18]**
|
|
2447
2450
|
|
|
2448
2451
|
### switchToPreviousTab
|
|
2449
2452
|
|
|
@@ -2456,13 +2459,13 @@ I.switchToPreviousTab(2);
|
|
|
2456
2459
|
|
|
2457
2460
|
#### Parameters
|
|
2458
2461
|
|
|
2459
|
-
* `num` **[number][
|
|
2462
|
+
* `num` **[number][18]**
|
|
2460
2463
|
|
|
2461
2464
|
### type
|
|
2462
2465
|
|
|
2463
2466
|
Types out the given text into an active field.
|
|
2464
2467
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
2465
|
-
*Note:* Should be used when [`fillField`][
|
|
2468
|
+
*Note:* Should be used when [`fillField`][35] is not an option.
|
|
2466
2469
|
|
|
2467
2470
|
```js
|
|
2468
2471
|
// passing in a string
|
|
@@ -2481,14 +2484,14 @@ I.type(secret('123456'));
|
|
|
2481
2484
|
#### Parameters
|
|
2482
2485
|
|
|
2483
2486
|
* `keys`  
|
|
2484
|
-
* `delay` **[number][
|
|
2487
|
+
* `delay` **[number][18]?** (optional) delay in ms between key presses
|
|
2485
2488
|
* `key` **([string][9] | [Array][10]<[string][9]>)** or array of keys to type.
|
|
2486
2489
|
|
|
2487
2490
|
Returns **void** automatically synchronized promise through #recorder
|
|
2488
2491
|
|
|
2489
2492
|
### uncheckOption
|
|
2490
2493
|
|
|
2491
|
-
[Additional options][
|
|
2494
|
+
[Additional options][38] for uncheck available as 3rd argument.
|
|
2492
2495
|
|
|
2493
2496
|
Examples:
|
|
2494
2497
|
|
|
@@ -2525,7 +2528,7 @@ Use Playwright API inside a test.
|
|
|
2525
2528
|
First argument is a description of an action.
|
|
2526
2529
|
Second argument is async function that gets this helper as parameter.
|
|
2527
2530
|
|
|
2528
|
-
{ [`page`][
|
|
2531
|
+
{ [`page`][39], [`browserContext`][40] [`browser`][41] } objects from Playwright API are available.
|
|
2529
2532
|
|
|
2530
2533
|
```js
|
|
2531
2534
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -2536,7 +2539,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
2536
2539
|
#### Parameters
|
|
2537
2540
|
|
|
2538
2541
|
* `description` **[string][9]** used to show in logs.
|
|
2539
|
-
* `fn` **[function][
|
|
2542
|
+
* `fn` **[function][21]** async function that executed with Playwright helper as arguments
|
|
2540
2543
|
|
|
2541
2544
|
### wait
|
|
2542
2545
|
|
|
@@ -2548,7 +2551,7 @@ I.wait(2); // wait 2 secs
|
|
|
2548
2551
|
|
|
2549
2552
|
#### Parameters
|
|
2550
2553
|
|
|
2551
|
-
* `sec` **[number][
|
|
2554
|
+
* `sec` **[number][18]** number of second to wait.
|
|
2552
2555
|
|
|
2553
2556
|
Returns **void** automatically synchronized promise through #recorder
|
|
2554
2557
|
|
|
@@ -2575,7 +2578,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2575
2578
|
|
|
2576
2579
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2577
2580
|
* `waitTimeout`  
|
|
2578
|
-
* `sec` **[number][
|
|
2581
|
+
* `sec` **[number][18]?** (optional, `1` by default) time in seconds to wait
|
|
2579
2582
|
|
|
2580
2583
|
Returns **void** automatically synchronized promise through #recorder
|
|
2581
2584
|
|
|
@@ -2590,7 +2593,7 @@ I.waitForCookie("token");
|
|
|
2590
2593
|
#### Parameters
|
|
2591
2594
|
|
|
2592
2595
|
* `name` **[string][9]** expected cookie name.
|
|
2593
|
-
* `sec` **[number][
|
|
2596
|
+
* `sec` **[number][18]** (optional, `3` by default) time in seconds to wait
|
|
2594
2597
|
|
|
2595
2598
|
Returns **void** automatically synchronized promise through #recorder
|
|
2596
2599
|
|
|
@@ -2606,7 +2609,7 @@ I.waitForDetached('#popup');
|
|
|
2606
2609
|
#### Parameters
|
|
2607
2610
|
|
|
2608
2611
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2609
|
-
* `sec` **[number][
|
|
2612
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2610
2613
|
|
|
2611
2614
|
Returns **void** automatically synchronized promise through #recorder
|
|
2612
2615
|
|
|
@@ -2618,7 +2621,7 @@ Element can be located by CSS or XPath.
|
|
|
2618
2621
|
#### Parameters
|
|
2619
2622
|
|
|
2620
2623
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2621
|
-
* `sec` **[number][
|
|
2624
|
+
* `sec` **[number][18]** (optional) time in seconds to wait, 1 by default.
|
|
2622
2625
|
|
|
2623
2626
|
Returns **void** automatically synchronized promise through #recorder
|
|
2624
2627
|
|
|
@@ -2635,7 +2638,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2635
2638
|
#### Parameters
|
|
2636
2639
|
|
|
2637
2640
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2638
|
-
* `sec` **[number][
|
|
2641
|
+
* `sec` **[number][18]?** (optional, `1` by default) time in seconds to wait
|
|
2639
2642
|
|
|
2640
2643
|
Returns **void** automatically synchronized promise through #recorder
|
|
2641
2644
|
|
|
@@ -2647,7 +2650,7 @@ Element can be located by CSS or XPath.
|
|
|
2647
2650
|
#### Parameters
|
|
2648
2651
|
|
|
2649
2652
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2650
|
-
* `sec` **[number][
|
|
2653
|
+
* `sec` **[number][18]** (optional) time in seconds to wait, 1 by default.
|
|
2651
2654
|
|
|
2652
2655
|
Returns **void** automatically synchronized promise through #recorder
|
|
2653
2656
|
|
|
@@ -2668,9 +2671,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2668
2671
|
|
|
2669
2672
|
#### Parameters
|
|
2670
2673
|
|
|
2671
|
-
* `fn` **([string][9] | [function][
|
|
2672
|
-
* `argsOrSec` **([Array][10]<any> | [number][
|
|
2673
|
-
* `sec` **[number][
|
|
2674
|
+
* `fn` **([string][9] | [function][21])** to be executed in browser context.
|
|
2675
|
+
* `argsOrSec` **([Array][10]<any> | [number][18])?** (optional, `1` by default) arguments for function or seconds.
|
|
2676
|
+
* `sec` **[number][18]?** (optional, `1` by default) time in seconds to wait
|
|
2674
2677
|
|
|
2675
2678
|
Returns **void** automatically synchronized promise through #recorder
|
|
2676
2679
|
|
|
@@ -2686,7 +2689,7 @@ I.waitForInvisible('#popup');
|
|
|
2686
2689
|
#### Parameters
|
|
2687
2690
|
|
|
2688
2691
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2689
|
-
* `sec` **[number][
|
|
2692
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2690
2693
|
|
|
2691
2694
|
Returns **void** automatically synchronized promise through #recorder
|
|
2692
2695
|
|
|
@@ -2694,7 +2697,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2694
2697
|
|
|
2695
2698
|
Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
2696
2699
|
|
|
2697
|
-
See [Playwright's reference][
|
|
2700
|
+
See [Playwright's reference][42]
|
|
2698
2701
|
|
|
2699
2702
|
#### Parameters
|
|
2700
2703
|
|
|
@@ -2710,8 +2713,8 @@ I.waitForNumberOfTabs(2);
|
|
|
2710
2713
|
|
|
2711
2714
|
#### Parameters
|
|
2712
2715
|
|
|
2713
|
-
* `expectedTabs` **[number][
|
|
2714
|
-
* `sec` **[number][
|
|
2716
|
+
* `expectedTabs` **[number][18]** expecting the number of tabs.
|
|
2717
|
+
* `sec` **[number][18]** number of secs to wait.
|
|
2715
2718
|
|
|
2716
2719
|
Returns **void** automatically synchronized promise through #recorder
|
|
2717
2720
|
|
|
@@ -2726,8 +2729,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2726
2729
|
|
|
2727
2730
|
#### Parameters
|
|
2728
2731
|
|
|
2729
|
-
* `urlOrPredicate` **([string][9] | [function][
|
|
2730
|
-
* `sec` **[number][
|
|
2732
|
+
* `urlOrPredicate` **([string][9] | [function][21])** 
|
|
2733
|
+
* `sec` **[number][18]?** seconds to wait
|
|
2731
2734
|
|
|
2732
2735
|
### waitForResponse
|
|
2733
2736
|
|
|
@@ -2740,8 +2743,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2740
2743
|
|
|
2741
2744
|
#### Parameters
|
|
2742
2745
|
|
|
2743
|
-
* `urlOrPredicate` **([string][9] | [function][
|
|
2744
|
-
* `sec` **[number][
|
|
2746
|
+
* `urlOrPredicate` **([string][9] | [function][21])** 
|
|
2747
|
+
* `sec` **[number][18]?** number of seconds to wait
|
|
2745
2748
|
|
|
2746
2749
|
### waitForText
|
|
2747
2750
|
|
|
@@ -2757,7 +2760,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2757
2760
|
#### Parameters
|
|
2758
2761
|
|
|
2759
2762
|
* `text` **[string][9]** to wait for.
|
|
2760
|
-
* `sec` **[number][
|
|
2763
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2761
2764
|
* `context` **([string][9] | [object][6])?** (optional) element located by CSS|XPath|strict locator.
|
|
2762
2765
|
|
|
2763
2766
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2766,7 +2769,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2766
2769
|
|
|
2767
2770
|
Waits for page navigates to a new URL or reloads. By default, it takes configured `waitForNavigation` option.
|
|
2768
2771
|
|
|
2769
|
-
See [Playwright's reference][
|
|
2772
|
+
See [Playwright's reference][43]
|
|
2770
2773
|
|
|
2771
2774
|
#### Parameters
|
|
2772
2775
|
|
|
@@ -2785,14 +2788,12 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2785
2788
|
|
|
2786
2789
|
* `field` **([string][9] | [object][6])** input field.
|
|
2787
2790
|
* `value` **[string][9]** expected value.
|
|
2788
|
-
* `sec` **[number][
|
|
2791
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2789
2792
|
|
|
2790
2793
|
Returns **void** automatically synchronized promise through #recorder
|
|
2791
2794
|
|
|
2792
2795
|
### waitForVisible
|
|
2793
2796
|
|
|
2794
|
-
This method accepts [React selectors][43].
|
|
2795
|
-
|
|
2796
2797
|
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
2797
2798
|
Element can be located by CSS or XPath.
|
|
2798
2799
|
|
|
@@ -2803,7 +2804,7 @@ I.waitForVisible('#popup');
|
|
|
2803
2804
|
#### Parameters
|
|
2804
2805
|
|
|
2805
2806
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2806
|
-
* `sec` **[number][
|
|
2807
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2807
2808
|
|
|
2808
2809
|
Returns **void** automatically synchronized promise through #recorder
|
|
2809
2810
|
|
|
@@ -2818,7 +2819,7 @@ I.waitInUrl('/info', 2);
|
|
|
2818
2819
|
#### Parameters
|
|
2819
2820
|
|
|
2820
2821
|
* `urlPart` **[string][9]** value to check.
|
|
2821
|
-
* `sec` **[number][
|
|
2822
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2822
2823
|
|
|
2823
2824
|
Returns **void** automatically synchronized promise through #recorder
|
|
2824
2825
|
|
|
@@ -2833,8 +2834,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2833
2834
|
#### Parameters
|
|
2834
2835
|
|
|
2835
2836
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2836
|
-
* `num` **[number][
|
|
2837
|
-
* `sec` **[number][
|
|
2837
|
+
* `num` **[number][18]** number of elements.
|
|
2838
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2838
2839
|
|
|
2839
2840
|
Returns **void** automatically synchronized promise through #recorder
|
|
2840
2841
|
|
|
@@ -2850,7 +2851,7 @@ I.waitToHide('#popup');
|
|
|
2850
2851
|
#### Parameters
|
|
2851
2852
|
|
|
2852
2853
|
* `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
|
|
2853
|
-
* `sec` **[number][
|
|
2854
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2854
2855
|
|
|
2855
2856
|
Returns **void** automatically synchronized promise through #recorder
|
|
2856
2857
|
|
|
@@ -2866,7 +2867,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2866
2867
|
#### Parameters
|
|
2867
2868
|
|
|
2868
2869
|
* `urlPart` **[string][9]** value to check.
|
|
2869
|
-
* `sec` **[number][
|
|
2870
|
+
* `sec` **[number][18]** (optional, `1` by default) time in seconds to wait
|
|
2870
2871
|
|
|
2871
2872
|
Returns **void** automatically synchronized promise through #recorder
|
|
2872
2873
|
|
|
@@ -2900,61 +2901,61 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2900
2901
|
|
|
2901
2902
|
[15]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2902
2903
|
|
|
2903
|
-
[16]:
|
|
2904
|
+
[16]: /locators#aria-locators
|
|
2904
2905
|
|
|
2905
|
-
[17]: https://
|
|
2906
|
+
[17]: https://playwright.dev/docs/api/class-page#page-click
|
|
2906
2907
|
|
|
2907
|
-
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2908
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2908
2909
|
|
|
2909
|
-
[19]: https://
|
|
2910
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2910
2911
|
|
|
2911
|
-
[20]: https://
|
|
2912
|
+
[20]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2912
2913
|
|
|
2913
|
-
[21]: https://
|
|
2914
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2914
2915
|
|
|
2915
|
-
[22]: https://playwright.dev/docs/api/class-locator#locator-
|
|
2916
|
+
[22]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2916
2917
|
|
|
2917
|
-
[23]: https://playwright.dev/docs/aria-
|
|
2918
|
+
[23]: https://playwright.dev/docs/api/class-locator#locator-aria-snapshot
|
|
2918
2919
|
|
|
2919
|
-
[24]: https://playwright.dev/docs/
|
|
2920
|
+
[24]: https://playwright.dev/docs/aria-snapshots
|
|
2920
2921
|
|
|
2921
|
-
[25]: https://playwright.dev/docs/api/class-
|
|
2922
|
+
[25]: https://playwright.dev/docs/api/class-consolemessage
|
|
2922
2923
|
|
|
2923
|
-
[26]: https://
|
|
2924
|
+
[26]: https://playwright.dev/docs/api/class-locator#locator-is-checked
|
|
2924
2925
|
|
|
2925
|
-
[27]: https://
|
|
2926
|
+
[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2926
2927
|
|
|
2927
|
-
[28]: https://
|
|
2928
|
+
[28]: https://playwright.dev/docs/api/class-locator#locator-is-disabled
|
|
2928
2929
|
|
|
2929
|
-
[29]: https://
|
|
2930
|
+
[29]: https://codecept.io/helpers/FileSystem
|
|
2930
2931
|
|
|
2931
|
-
[30]: https://playwright.dev/docs/api/class-
|
|
2932
|
+
[30]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2932
2933
|
|
|
2933
|
-
[31]: https://playwright.dev/docs/
|
|
2934
|
+
[31]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2934
2935
|
|
|
2935
|
-
[32]: https://
|
|
2936
|
+
[32]: https://playwright.dev/docs/network#handle-requests
|
|
2936
2937
|
|
|
2937
|
-
[33]: https://github.com/
|
|
2938
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2938
2939
|
|
|
2939
|
-
[34]:
|
|
2940
|
+
[34]: https://github.com/puppeteer/puppeteer/issues/1313
|
|
2940
2941
|
|
|
2941
|
-
[35]: #
|
|
2942
|
+
[35]: #fillfield
|
|
2942
2943
|
|
|
2943
|
-
[36]:
|
|
2944
|
+
[36]: #click
|
|
2944
2945
|
|
|
2945
|
-
[37]: https://playwright.dev/docs/api/class-
|
|
2946
|
+
[37]: https://playwright.dev/docs/api/class-page#page-route-from-har
|
|
2946
2947
|
|
|
2947
|
-
[38]: https://
|
|
2948
|
+
[38]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2948
2949
|
|
|
2949
|
-
[39]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-
|
|
2950
|
+
[39]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2950
2951
|
|
|
2951
|
-
[40]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-
|
|
2952
|
+
[40]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2952
2953
|
|
|
2953
|
-
[41]: https://
|
|
2954
|
+
[41]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2954
2955
|
|
|
2955
|
-
[42]: https://playwright.dev/docs/api/class-page#page-wait-for-
|
|
2956
|
+
[42]: https://playwright.dev/docs/api/class-page#page-wait-for-navigation
|
|
2956
2957
|
|
|
2957
|
-
[43]: https://
|
|
2958
|
+
[43]: https://playwright.dev/docs/api/class-page#page-wait-for-url
|
|
2958
2959
|
|
|
2959
2960
|
[44]: https://playwright.dev/docs/api/class-browsercontext
|
|
2960
2961
|
|