codeceptjs 2.3.4 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/README.md +28 -6
- package/bin/codecept.js +42 -0
- package/docs/advanced.md +45 -1
- package/docs/angular.md +3 -3
- package/docs/basics.md +162 -118
- package/docs/bdd.md +30 -5
- package/docs/best.md +8 -6
- package/docs/books.md +6 -1
- package/docs/build/Appium.js +95 -85
- package/docs/build/FileSystem.js +48 -3
- package/docs/build/GraphQL.js +3 -2
- package/docs/build/GraphQLDataFactory.js +1 -0
- package/docs/build/Mochawesome.js +3 -2
- package/docs/build/MockRequest.js +23 -5
- package/docs/build/Nightmare.js +87 -128
- package/docs/build/Protractor.js +107 -155
- package/docs/build/Puppeteer.js +190 -174
- package/docs/build/REST.js +13 -9
- package/docs/build/SeleniumWebdriver.js +0 -17
- package/docs/build/TestCafe.js +164 -158
- package/docs/build/WebDriver.js +236 -211
- package/docs/build/WebDriverIO.js +218 -187
- package/docs/changelog.md +57 -1
- package/docs/commands.md +41 -2
- package/docs/community-helpers.md +12 -1
- package/docs/configuration.md +5 -2
- package/docs/continuous-integration.md +22 -0
- package/docs/{helpers.md → custom-helpers.md} +16 -10
- package/docs/data.md +7 -6
- package/docs/detox.md +6 -6
- package/docs/email.md +4 -2
- package/docs/examples.md +22 -3
- package/docs/helpers/ApiDataFactory.md +15 -13
- package/docs/helpers/Appium.md +1011 -468
- package/docs/helpers/Detox.md +33 -26
- package/docs/helpers/FileSystem.md +43 -13
- package/docs/helpers/GraphQL.md +17 -15
- package/docs/helpers/GraphQLDataFactory.md +15 -13
- package/docs/helpers/Mochawesome.md +3 -1
- package/docs/helpers/MockRequest.md +37 -19
- package/docs/helpers/Nightmare.md +129 -240
- package/docs/helpers/Polly.md +1 -1
- package/docs/helpers/Protractor.md +157 -298
- package/docs/helpers/Puppeteer.md +216 -335
- package/docs/helpers/REST.md +29 -24
- package/docs/helpers/TestCafe.md +137 -235
- package/docs/helpers/WebDriver.md +250 -347
- package/docs/hooks.md +14 -10
- package/docs/index.md +112 -0
- package/docs/installation.md +3 -1
- package/docs/locators.md +19 -8
- package/docs/mobile-react-native-locators.md +2 -2
- package/docs/mobile.md +5 -3
- package/docs/nightmare.md +2 -1
- package/docs/pageobjects.md +4 -2
- package/docs/parallel.md +4 -2
- package/docs/plugins.md +41 -15
- package/docs/puppeteer.md +8 -6
- package/docs/quickstart.md +130 -0
- package/docs/react.md +4 -2
- package/docs/reports.md +6 -4
- package/docs/testcafe.md +10 -8
- package/docs/translation.md +4 -2
- package/docs/ui.md +56 -0
- package/docs/videos.md +11 -2
- package/docs/visual.md +7 -5
- package/docs/vue.md +121 -0
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +2 -2
- package/docs/webapi/dontSee.mustache +1 -2
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +2 -1
- package/docs/webapi/executeScript.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/grabAttributeFrom.mustache +1 -1
- package/docs/webapi/grabBrowserLogs.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +2 -2
- package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
- package/docs/webapi/grabHTMLFrom.mustache +1 -1
- package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/grabPageScrollPosition.mustache +1 -1
- package/docs/webapi/grabTextFrom.mustache +2 -2
- package/docs/webapi/grabValueFrom.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +10 -0
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +8 -0
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/waitForClickable.mustache +10 -0
- package/docs/webapi/waitForDetached.mustache +2 -2
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +2 -2
- package/docs/webapi/waitForFunction.mustache +2 -2
- package/docs/webapi/waitForInvisible.mustache +2 -2
- package/docs/webapi/waitForText.mustache +2 -2
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +2 -2
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/waitToHide.mustache +2 -2
- package/docs/webapi/waitUntil.mustache +3 -2
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/docs/webdriver.md +20 -18
- package/docs/wiki/.git/FETCH_HEAD +1 -0
- package/docs/wiki/.git/HEAD +1 -0
- package/docs/wiki/.git/ORIG_HEAD +1 -0
- package/docs/wiki/.git/config +11 -0
- package/docs/wiki/.git/description +1 -0
- package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
- package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
- package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
- package/docs/wiki/.git/hooks/post-update.sample +8 -0
- package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
- package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
- package/docs/wiki/.git/hooks/pre-push.sample +53 -0
- package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
- package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
- package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
- package/docs/wiki/.git/hooks/update.sample +128 -0
- package/docs/wiki/.git/index +0 -0
- package/docs/wiki/.git/info/exclude +6 -0
- package/docs/wiki/.git/logs/HEAD +4 -0
- package/docs/wiki/.git/logs/refs/heads/master +4 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
- package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
- package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
- package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
- package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
- package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
- package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
- package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
- package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
- package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
- package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
- package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
- package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
- package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
- package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
- package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
- package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
- package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
- package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
- package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
- package/docs/wiki/.git/packed-refs +2 -0
- package/docs/wiki/.git/refs/heads/master +1 -0
- package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
- package/docs/wiki/.git/refs/remotes/origin/master +1 -0
- package/docs/wiki/Books-&-Posts.md +27 -0
- package/docs/wiki/Community-Helpers.md +41 -0
- package/docs/wiki/Examples.md +138 -0
- package/docs/wiki/Home.md +11 -0
- package/docs/wiki/Release-process.md +25 -0
- package/docs/wiki/Roadmap.md +23 -0
- package/docs/wiki/Videos.md +19 -0
- package/lib/actor.js +18 -1
- package/lib/assert/error.js +3 -3
- package/lib/codecept.js +9 -6
- package/lib/command/configMigrate.js +7 -6
- package/lib/command/definitions.js +98 -350
- package/lib/command/generate.js +22 -17
- package/lib/command/gherkin/init.js +2 -1
- package/lib/command/gherkin/snippets.js +6 -6
- package/lib/command/gherkin/steps.js +0 -1
- package/lib/command/info.js +40 -0
- package/lib/command/init.js +54 -41
- package/lib/command/run-multiple.js +5 -4
- package/lib/command/run-rerun.js +39 -0
- package/lib/command/run-workers.js +4 -6
- package/lib/command/run.js +8 -18
- package/lib/command/utils.js +23 -2
- package/lib/command/workers/runTests.js +1 -2
- package/lib/config.js +10 -4
- package/lib/container.js +31 -6
- package/lib/data/dataTableArgument.js +31 -0
- package/lib/data/table.js +4 -0
- package/lib/event.js +65 -1
- package/lib/helper/Appium.js +52 -38
- package/lib/helper/FileSystem.js +48 -3
- package/lib/helper/GraphQL.js +3 -2
- package/lib/helper/GraphQLDataFactory.js +1 -0
- package/lib/helper/Mochawesome.js +3 -2
- package/lib/helper/MockRequest.js +23 -5
- package/lib/helper/Nightmare.js +5 -6
- package/lib/helper/Protractor.js +7 -8
- package/lib/helper/Puppeteer.js +76 -20
- package/lib/helper/REST.js +13 -9
- package/lib/helper/SeleniumWebdriver.js +0 -17
- package/lib/helper/TestCafe.js +84 -36
- package/lib/helper/WebDriver.js +113 -59
- package/lib/helper/WebDriverIO.js +43 -59
- package/lib/helper/clientscripts/nightmare.js +66 -4
- package/lib/helper/scripts/isElementClickable.js +24 -0
- package/lib/helper.js +34 -10
- package/lib/history.js +1 -1
- package/lib/hooks.js +2 -1
- package/lib/index.js +19 -0
- package/lib/interfaces/bdd.js +4 -0
- package/lib/interfaces/featureConfig.js +10 -3
- package/lib/interfaces/gherkin.js +6 -2
- package/lib/interfaces/scenarioConfig.js +17 -6
- package/lib/listener/config.js +1 -1
- package/lib/listener/exit.js +6 -0
- package/lib/listener/steps.js +0 -1
- package/lib/listener/trace.js +0 -1
- package/lib/locator.js +67 -2
- package/lib/output.js +53 -0
- package/lib/parser.js +2 -71
- package/lib/pause.js +3 -2
- package/lib/plugin/allure.js +41 -22
- package/lib/plugin/autoLogin.js +4 -1
- package/lib/plugin/pauseOnFail.js +38 -0
- package/lib/plugin/puppeteerCoverage.js +8 -7
- package/lib/plugin/screenshotOnFail.js +13 -8
- package/lib/plugin/stepByStepReport.js +7 -6
- package/lib/plugin/wdio.js +2 -1
- package/lib/recorder.js +85 -7
- package/lib/rerun.js +81 -0
- package/lib/secret.js +6 -0
- package/lib/session.js +9 -2
- package/lib/step.js +37 -2
- package/lib/store.js +5 -1
- package/lib/ui.js +34 -8
- package/lib/utils.js +6 -13
- package/lib/within.js +5 -0
- package/package.json +49 -29
- package/typings/Mocha.d.ts +21 -0
- package/typings/Protractor.d.ts +16 -0
- package/typings/index.d.ts +169 -0
- package/typings/jsdoc.conf.js +34 -0
- package/typings/jsdoc.namespace.js +29 -0
- package/typings/types.d.ts +9827 -0
- package/typings/utils.d.ts +7 -0
- package/docs/acceptance.md +0 -409
- package/docs/api/codecept.md +0 -75
- package/docs/api/config.md +0 -49
- package/docs/api/container.md +0 -66
- package/docs/api/helper.md +0 -116
- package/docs/api/output.md +0 -67
- package/docs/api/recorder.md +0 -63
- package/docs/helpers/SeleniumWebdriver.md +0 -92
- package/docs/helpers/WebDriverIO.md +0 -1671
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
permalink: /helpers/Puppeteer
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
3
5
|
title: Puppeteer
|
|
4
6
|
---
|
|
5
7
|
|
|
@@ -7,7 +9,7 @@ title: Puppeteer
|
|
|
7
9
|
|
|
8
10
|
## Puppeteer
|
|
9
11
|
|
|
10
|
-
Extends Helper
|
|
12
|
+
**Extends Helper**
|
|
11
13
|
|
|
12
14
|
Uses [Google Chrome's Puppeteer][1] library to run tests inside headless Chrome.
|
|
13
15
|
Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
@@ -22,6 +24,7 @@ Requires `puppeteer` package to be installed.
|
|
|
22
24
|
This helper should be configured in codecept.json or codecept.conf.js
|
|
23
25
|
|
|
24
26
|
- `url`: base url of website to be tested
|
|
27
|
+
- `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
25
28
|
- `show`: - show Google Chrome window for debug.
|
|
26
29
|
- `restart`: - restart browser between tests.
|
|
27
30
|
- `disableScreenshots`: - don't save screenshot on failure.
|
|
@@ -33,7 +36,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
33
36
|
- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][3]. Array values are accepted as well.
|
|
34
37
|
- `pressKeyDelay`: . Delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
35
38
|
- `getPageTimeout` config option to set maximum navigation time in milliseconds.
|
|
36
|
-
- `waitForTimeout`: (optional) default wait
|
|
39
|
+
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
37
40
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
38
41
|
- `userAgent`: (optional) user-agent string.
|
|
39
42
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
@@ -98,6 +101,20 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
98
101
|
}
|
|
99
102
|
```
|
|
100
103
|
|
|
104
|
+
#### Example #5: Target URL with provided basic authentication
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
{
|
|
108
|
+
helpers: {
|
|
109
|
+
Puppeteer : {
|
|
110
|
+
url: 'http://localhost',
|
|
111
|
+
basicAuth: {username: 'username', password: 'password'},
|
|
112
|
+
show: true
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
101
118
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
102
119
|
|
|
103
120
|
## Access From Helpers
|
|
@@ -118,7 +135,7 @@ await page.url(); // Get the url of the current page
|
|
|
118
135
|
|
|
119
136
|
- `config`
|
|
120
137
|
|
|
121
|
-
###
|
|
138
|
+
### _addPopupListener
|
|
122
139
|
|
|
123
140
|
Add the 'dialog' event listener to a page
|
|
124
141
|
|
|
@@ -126,11 +143,11 @@ Add the 'dialog' event listener to a page
|
|
|
126
143
|
|
|
127
144
|
- `page`
|
|
128
145
|
|
|
129
|
-
###
|
|
146
|
+
### _getPageUrl
|
|
130
147
|
|
|
131
148
|
Gets page URL including hash.
|
|
132
149
|
|
|
133
|
-
###
|
|
150
|
+
### _locate
|
|
134
151
|
|
|
135
152
|
Get elements by different locator types, including strict locator
|
|
136
153
|
Should be used in custom helpers:
|
|
@@ -149,7 +166,7 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
149
166
|
|
|
150
167
|
- `locator`
|
|
151
168
|
|
|
152
|
-
###
|
|
169
|
+
### _locateCheckable
|
|
153
170
|
|
|
154
171
|
Find a checkbox by providing human readable text:
|
|
155
172
|
NOTE: Assumes the checkable element exists
|
|
@@ -163,7 +180,7 @@ this.helpers['Puppeteer']._locateCheckable('I agree with terms and conditions').
|
|
|
163
180
|
- `locator`
|
|
164
181
|
- `providedContext`
|
|
165
182
|
|
|
166
|
-
###
|
|
183
|
+
### _locateClickable
|
|
167
184
|
|
|
168
185
|
Find a clickable element by providing human readable text:
|
|
169
186
|
|
|
@@ -175,7 +192,7 @@ this.helpers['Puppeteer']._locateClickable('Next page').then // ...
|
|
|
175
192
|
|
|
176
193
|
- `locator`
|
|
177
194
|
|
|
178
|
-
###
|
|
195
|
+
### _locateFields
|
|
179
196
|
|
|
180
197
|
Find field elements by providing human readable text:
|
|
181
198
|
|
|
@@ -187,13 +204,13 @@ this.helpers['Puppeteer']._locateFields('Your email').then // ...
|
|
|
187
204
|
|
|
188
205
|
- `locator`
|
|
189
206
|
|
|
190
|
-
###
|
|
207
|
+
### _setPage
|
|
191
208
|
|
|
192
209
|
Set current page
|
|
193
210
|
|
|
194
211
|
#### Parameters
|
|
195
212
|
|
|
196
|
-
- `page` [object][6] page to set
|
|
213
|
+
- `page` **[object][6]** page to set
|
|
197
214
|
|
|
198
215
|
### acceptPopup
|
|
199
216
|
|
|
@@ -236,9 +253,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
236
253
|
|
|
237
254
|
#### Parameters
|
|
238
255
|
|
|
239
|
-
- `url` [string][8] url path or global url.
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
- `url` **[string][8]** url path or global url.
|
|
242
257
|
|
|
243
258
|
### appendField
|
|
244
259
|
|
|
@@ -251,10 +266,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
251
266
|
|
|
252
267
|
#### Parameters
|
|
253
268
|
|
|
254
|
-
- `field` ([string][8]
|
|
255
|
-
- `value` [string][8] text value to append.
|
|
256
|
-
|
|
257
|
-
|
|
269
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator
|
|
270
|
+
- `value` **[string][8]** text value to append.
|
|
258
271
|
|
|
259
272
|
|
|
260
273
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -273,10 +286,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
273
286
|
|
|
274
287
|
#### Parameters
|
|
275
288
|
|
|
276
|
-
- `locator` ([string][8]
|
|
277
|
-
- `pathToFile` [string][8] local file path relative to codecept.json config file.
|
|
278
|
-
|
|
279
|
-
|
|
289
|
+
- `locator` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
290
|
+
- `pathToFile` **[string][8]** local file path relative to codecept.json config file.
|
|
280
291
|
|
|
281
292
|
### cancelPopup
|
|
282
293
|
|
|
@@ -297,10 +308,8 @@ I.checkOption('agree', '//form');
|
|
|
297
308
|
|
|
298
309
|
#### Parameters
|
|
299
310
|
|
|
300
|
-
- `field` ([string][8]
|
|
301
|
-
- `context` [string][8] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
- `field` **([string][8] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
312
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
304
313
|
|
|
305
314
|
### clearCookie
|
|
306
315
|
|
|
@@ -315,9 +324,7 @@ I.clearCookie('test');
|
|
|
315
324
|
#### Parameters
|
|
316
325
|
|
|
317
326
|
- `name`
|
|
318
|
-
- `cookie` [string][8] (optional, `null` by default) cookie name
|
|
319
|
-
|
|
320
|
-
|
|
327
|
+
- `cookie` **[string][8]?** (optional, `null` by default) cookie name
|
|
321
328
|
|
|
322
329
|
### clearField
|
|
323
330
|
|
|
@@ -332,9 +339,7 @@ I.clearField('#email');
|
|
|
332
339
|
#### Parameters
|
|
333
340
|
|
|
334
341
|
- `field`
|
|
335
|
-
- `editable` ([string][8]
|
|
336
|
-
|
|
337
|
-
|
|
342
|
+
- `editable` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
338
343
|
|
|
339
344
|
### click
|
|
340
345
|
|
|
@@ -353,7 +358,7 @@ I.click('Submit');
|
|
|
353
358
|
// CSS button
|
|
354
359
|
I.click('#form input[type=submit]');
|
|
355
360
|
// XPath
|
|
356
|
-
I.click('//form
|
|
361
|
+
I.click('//form/*[@type=submit]');
|
|
357
362
|
// link in context
|
|
358
363
|
I.click('Logout', '#nav');
|
|
359
364
|
// using strict locator
|
|
@@ -362,10 +367,8 @@ I.click({css: 'nav a.login'});
|
|
|
362
367
|
|
|
363
368
|
#### Parameters
|
|
364
369
|
|
|
365
|
-
- `locator` ([string][8]
|
|
366
|
-
- `context` ([string][8]
|
|
367
|
-
|
|
368
|
-
|
|
370
|
+
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
371
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
369
372
|
|
|
370
373
|
|
|
371
374
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -381,10 +384,8 @@ I.clickLink('Logout', '#nav');
|
|
|
381
384
|
|
|
382
385
|
#### Parameters
|
|
383
386
|
|
|
384
|
-
- `locator` ([string][8]
|
|
385
|
-
- `context` ([string][8]
|
|
386
|
-
|
|
387
|
-
|
|
387
|
+
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
388
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
388
389
|
|
|
389
390
|
|
|
390
391
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -418,9 +419,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
418
419
|
|
|
419
420
|
#### Parameters
|
|
420
421
|
|
|
421
|
-
- `text` [string][8] which is not present.
|
|
422
|
-
- `context` ([string][8]
|
|
423
|
-
|
|
422
|
+
- `text` **[string][8]** which is not present.
|
|
423
|
+
- `context` **([string][8] | [object][6])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
424
424
|
|
|
425
425
|
|
|
426
426
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -438,9 +438,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
438
438
|
|
|
439
439
|
#### Parameters
|
|
440
440
|
|
|
441
|
-
- `field` ([string][8]
|
|
442
|
-
|
|
443
|
-
|
|
441
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
444
442
|
|
|
445
443
|
### dontSeeCookie
|
|
446
444
|
|
|
@@ -452,9 +450,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
452
450
|
|
|
453
451
|
#### Parameters
|
|
454
452
|
|
|
455
|
-
- `name` [string][8] cookie name.
|
|
456
|
-
|
|
457
|
-
|
|
453
|
+
- `name` **[string][8]** cookie name.
|
|
458
454
|
|
|
459
455
|
### dontSeeCurrentUrlEquals
|
|
460
456
|
|
|
@@ -468,9 +464,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
468
464
|
|
|
469
465
|
#### Parameters
|
|
470
466
|
|
|
471
|
-
- `url` [string][8] value to check.
|
|
472
|
-
|
|
473
|
-
|
|
467
|
+
- `url` **[string][8]** value to check.
|
|
474
468
|
|
|
475
469
|
### dontSeeElement
|
|
476
470
|
|
|
@@ -482,9 +476,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
482
476
|
|
|
483
477
|
#### Parameters
|
|
484
478
|
|
|
485
|
-
- `locator` ([string][8]
|
|
486
|
-
|
|
487
|
-
|
|
479
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|Strict locator.
|
|
488
480
|
|
|
489
481
|
|
|
490
482
|
|
|
@@ -501,9 +493,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
501
493
|
|
|
502
494
|
#### Parameters
|
|
503
495
|
|
|
504
|
-
- `locator` ([string][8]
|
|
505
|
-
|
|
506
|
-
|
|
496
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|Strict locator.
|
|
507
497
|
|
|
508
498
|
### dontSeeInCurrentUrl
|
|
509
499
|
|
|
@@ -511,9 +501,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
511
501
|
|
|
512
502
|
#### Parameters
|
|
513
503
|
|
|
514
|
-
- `url` [string][8] value to check.
|
|
515
|
-
|
|
516
|
-
|
|
504
|
+
- `url` **[string][8]** value to check.
|
|
517
505
|
|
|
518
506
|
### dontSeeInField
|
|
519
507
|
|
|
@@ -527,10 +515,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
527
515
|
|
|
528
516
|
#### Parameters
|
|
529
517
|
|
|
530
|
-
- `field` ([string][8]
|
|
531
|
-
- `value` [string][8] value to check.
|
|
532
|
-
|
|
533
|
-
|
|
518
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
519
|
+
- `value` **[string][8]** value to check.
|
|
534
520
|
|
|
535
521
|
### dontSeeInSource
|
|
536
522
|
|
|
@@ -543,9 +529,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
543
529
|
#### Parameters
|
|
544
530
|
|
|
545
531
|
- `text`
|
|
546
|
-
- `value` [string][8] to check.
|
|
547
|
-
|
|
548
|
-
|
|
532
|
+
- `value` **[string][8]** to check.
|
|
549
533
|
|
|
550
534
|
### dontSeeInTitle
|
|
551
535
|
|
|
@@ -557,9 +541,7 @@ I.dontSeeInTitle('Error');
|
|
|
557
541
|
|
|
558
542
|
#### Parameters
|
|
559
543
|
|
|
560
|
-
- `text` [string][8] value to check.
|
|
561
|
-
|
|
562
|
-
|
|
544
|
+
- `text` **[string][8]** value to check.
|
|
563
545
|
|
|
564
546
|
### doubleClick
|
|
565
547
|
|
|
@@ -575,10 +557,8 @@ I.doubleClick('.btn.edit');
|
|
|
575
557
|
|
|
576
558
|
#### Parameters
|
|
577
559
|
|
|
578
|
-
- `locator` ([string][8]
|
|
579
|
-
- `context` ([string][8]
|
|
580
|
-
|
|
581
|
-
|
|
560
|
+
- `locator` **([string][8] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
561
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
582
562
|
|
|
583
563
|
|
|
584
564
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -586,7 +566,7 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
586
566
|
|
|
587
567
|
### downloadFile
|
|
588
568
|
|
|
589
|
-
This method is deprecated
|
|
569
|
+
This method is **deprecated**.
|
|
590
570
|
|
|
591
571
|
Please use `handleDownloads()` instead.
|
|
592
572
|
|
|
@@ -605,10 +585,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
605
585
|
|
|
606
586
|
#### Parameters
|
|
607
587
|
|
|
608
|
-
- `srcElement` ([string][8]
|
|
609
|
-
- `destElement` ([string][8]
|
|
610
|
-
|
|
611
|
-
|
|
588
|
+
- `srcElement` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
589
|
+
- `destElement` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
612
590
|
|
|
613
591
|
### dragSlider
|
|
614
592
|
|
|
@@ -622,10 +600,8 @@ I.dragSlider('#slider', -70);
|
|
|
622
600
|
|
|
623
601
|
#### Parameters
|
|
624
602
|
|
|
625
|
-
- `locator` ([string][8]
|
|
626
|
-
- `offsetX` [number][9] position to drag.
|
|
627
|
-
|
|
628
|
-
|
|
603
|
+
- `locator` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
604
|
+
- `offsetX` **[number][9]** position to drag.
|
|
629
605
|
|
|
630
606
|
|
|
631
607
|
|
|
@@ -657,7 +633,10 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
657
633
|
|
|
658
634
|
#### Parameters
|
|
659
635
|
|
|
660
|
-
- `fn` ([string][8]
|
|
636
|
+
- `fn` **([string][8] | [function][11])** function to be executed in browser context.
|
|
637
|
+
- `args` **...any** to be passed to function.
|
|
638
|
+
|
|
639
|
+
Returns **[Promise][12]<any>** Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
661
640
|
|
|
662
641
|
### executeScript
|
|
663
642
|
|
|
@@ -687,7 +666,10 @@ let date = await I.executeScript(function(el) {
|
|
|
687
666
|
|
|
688
667
|
#### Parameters
|
|
689
668
|
|
|
690
|
-
- `fn` ([string][8]
|
|
669
|
+
- `fn` **([string][8] | [function][11])** function to be executed in browser context.
|
|
670
|
+
- `args` **...any** to be passed to function.
|
|
671
|
+
|
|
672
|
+
Returns **[Promise][12]<any>** If a function returns a Promise It will wait for it resolution.
|
|
691
673
|
|
|
692
674
|
### fillField
|
|
693
675
|
|
|
@@ -707,11 +689,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
707
689
|
|
|
708
690
|
#### Parameters
|
|
709
691
|
|
|
710
|
-
- `field` ([string][8]
|
|
711
|
-
- `value` [string][8] text value to fill.
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
692
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
693
|
+
- `value` **[string][8]** text value to fill.
|
|
715
694
|
|
|
716
695
|
|
|
717
696
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -721,7 +700,7 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
721
700
|
|
|
722
701
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
723
702
|
An array as a result will be returned if there are more than one matched element.
|
|
724
|
-
Resumes test execution, so should be used inside async with `await
|
|
703
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
725
704
|
|
|
726
705
|
```js
|
|
727
706
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
@@ -729,12 +708,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
729
708
|
|
|
730
709
|
#### Parameters
|
|
731
710
|
|
|
732
|
-
- `locator` ([string][8]
|
|
733
|
-
- `attr` [string][8] attribute name.
|
|
734
|
-
|
|
735
|
-
Returns [Promise][12]<[string][8]> attribute value
|
|
736
|
-
|
|
711
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
712
|
+
- `attr` **[string][8]** attribute name.
|
|
737
713
|
|
|
714
|
+
Returns **[Promise][12]<[string][8]>** attribute value
|
|
738
715
|
|
|
739
716
|
|
|
740
717
|
|
|
@@ -750,12 +727,13 @@ let logs = await I.grabBrowserLogs();
|
|
|
750
727
|
console.log(JSON.stringify(logs))
|
|
751
728
|
```
|
|
752
729
|
|
|
730
|
+
Returns **[Promise][12]<[Array][13]<any>>**
|
|
731
|
+
|
|
753
732
|
### grabCookie
|
|
754
733
|
|
|
755
734
|
Gets a cookie object by name.
|
|
756
735
|
If none provided gets all cookies.
|
|
757
|
-
|
|
758
|
-
- Resumes test execution, so should be used inside async with `await` operator.
|
|
736
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
759
737
|
|
|
760
738
|
```js
|
|
761
739
|
let cookie = await I.grabCookie('auth');
|
|
@@ -764,16 +742,14 @@ assert(cookie.value, '123456');
|
|
|
764
742
|
|
|
765
743
|
#### Parameters
|
|
766
744
|
|
|
767
|
-
- `name`
|
|
768
|
-
|
|
769
|
-
Returns [Promise][12]<[string][8]> attribute value
|
|
745
|
+
- `name` **[string][8]?** cookie name.
|
|
770
746
|
|
|
771
|
-
Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
747
|
+
Returns **[Promise][12]<[string][8]>** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
772
748
|
|
|
773
749
|
### grabCssPropertyFrom
|
|
774
750
|
|
|
775
751
|
Grab CSS property for given locator
|
|
776
|
-
Resumes test execution, so should be used inside an async function with `await
|
|
752
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
777
753
|
|
|
778
754
|
```js
|
|
779
755
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
@@ -781,12 +757,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
781
757
|
|
|
782
758
|
#### Parameters
|
|
783
759
|
|
|
784
|
-
- `locator` ([string][8]
|
|
785
|
-
- `cssProperty` [string][8] CSS property name.
|
|
786
|
-
|
|
787
|
-
Returns [Promise][12]<[string][8]> CSS value
|
|
788
|
-
|
|
760
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
761
|
+
- `cssProperty` **[string][8]** CSS property name.
|
|
789
762
|
|
|
763
|
+
Returns **[Promise][12]<[string][8]>** CSS value
|
|
790
764
|
|
|
791
765
|
|
|
792
766
|
|
|
@@ -803,9 +777,7 @@ let url = await I.grabCurrentUrl();
|
|
|
803
777
|
console.log(`Current URL is [${url}]`);
|
|
804
778
|
```
|
|
805
779
|
|
|
806
|
-
Returns [Promise][12]<[string][8]
|
|
807
|
-
|
|
808
|
-
|
|
780
|
+
Returns **[Promise][12]<[string][8]>** current URL
|
|
809
781
|
|
|
810
782
|
### grabDataFromPerformanceTiming
|
|
811
783
|
|
|
@@ -816,7 +788,7 @@ The returned data will contain following things in ms:
|
|
|
816
788
|
- domInteractive,
|
|
817
789
|
- domContentLoadedEventEnd,
|
|
818
790
|
- loadEventEnd
|
|
819
|
-
Resumes test execution, so should be used inside an async function with `await
|
|
791
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
820
792
|
|
|
821
793
|
```js
|
|
822
794
|
await I.amOnPage('https://example.com');
|
|
@@ -830,14 +802,11 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
830
802
|
}
|
|
831
803
|
```
|
|
832
804
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
805
|
### grabElementBoundingRect
|
|
837
806
|
|
|
838
807
|
Grab the width, height, location of given locator.
|
|
839
808
|
Provide `width` or `height`as second param to get your desired prop.
|
|
840
|
-
Resumes test execution, so should be used inside an async function with `await
|
|
809
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
841
810
|
|
|
842
811
|
Returns an object with `x`, `y`, `width`, `height` keys.
|
|
843
812
|
|
|
@@ -855,18 +824,16 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
855
824
|
|
|
856
825
|
#### Parameters
|
|
857
826
|
|
|
858
|
-
- `locator` ([string][8]
|
|
827
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
859
828
|
- `prop`
|
|
860
|
-
- `elementSize` [string][8] x, y, width or height of the given element.
|
|
861
|
-
|
|
862
|
-
Returns [object][6] Element bounding rectangle
|
|
863
|
-
|
|
829
|
+
- `elementSize` **[string][8]** x, y, width or height of the given element.
|
|
864
830
|
|
|
831
|
+
Returns **[object][6]** Element bounding rectangle
|
|
865
832
|
|
|
866
833
|
### grabHTMLFrom
|
|
867
834
|
|
|
868
835
|
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
869
|
-
Resumes test execution, so should be used inside async function with `await
|
|
836
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
870
837
|
If more than one element is found - an array of HTMLs returned.
|
|
871
838
|
|
|
872
839
|
```js
|
|
@@ -875,11 +842,10 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
875
842
|
|
|
876
843
|
#### Parameters
|
|
877
844
|
|
|
878
|
-
- `locator`
|
|
879
|
-
|
|
880
|
-
Returns [Promise][12]<[string][8]> HTML code for an element
|
|
881
|
-
|
|
845
|
+
- `locator`
|
|
846
|
+
- `element` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
882
847
|
|
|
848
|
+
Returns **[Promise][12]<[string][8]>** HTML code for an element
|
|
883
849
|
|
|
884
850
|
### grabNumberOfOpenTabs
|
|
885
851
|
|
|
@@ -889,9 +855,7 @@ Grab number of open tabs.
|
|
|
889
855
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
890
856
|
```
|
|
891
857
|
|
|
892
|
-
Returns [Promise][12]<[number][9]
|
|
893
|
-
|
|
894
|
-
|
|
858
|
+
Returns **[Promise][12]<[number][9]>** number of open tabs
|
|
895
859
|
|
|
896
860
|
### grabNumberOfVisibleElements
|
|
897
861
|
|
|
@@ -903,11 +867,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
903
867
|
|
|
904
868
|
#### Parameters
|
|
905
869
|
|
|
906
|
-
- `locator` ([string][8]
|
|
907
|
-
|
|
908
|
-
Returns [Promise][12]<[number][9]> number of visible elements
|
|
909
|
-
|
|
870
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
910
871
|
|
|
872
|
+
Returns **[Promise][12]<[number][9]>** number of visible elements
|
|
911
873
|
|
|
912
874
|
|
|
913
875
|
|
|
@@ -917,15 +879,13 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
917
879
|
### grabPageScrollPosition
|
|
918
880
|
|
|
919
881
|
Retrieves a page scroll position and returns it to test.
|
|
920
|
-
Resumes test execution, so should be used inside an async function with `await
|
|
882
|
+
Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
921
883
|
|
|
922
884
|
```js
|
|
923
885
|
let { x, y } = await I.grabPageScrollPosition();
|
|
924
886
|
```
|
|
925
887
|
|
|
926
|
-
Returns [Promise][12]<[
|
|
927
|
-
|
|
928
|
-
|
|
888
|
+
Returns **[Promise][12]<[Object][6]<[string][8], any>>** scroll position
|
|
929
889
|
|
|
930
890
|
### grabPopupText
|
|
931
891
|
|
|
@@ -935,6 +895,8 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
935
895
|
await I.grabPopupText();
|
|
936
896
|
```
|
|
937
897
|
|
|
898
|
+
Returns **[Promise][12]<([string][8] | null)>**
|
|
899
|
+
|
|
938
900
|
### grabSource
|
|
939
901
|
|
|
940
902
|
Retrieves page source and returns it to test.
|
|
@@ -944,14 +906,12 @@ Resumes test execution, so should be used inside an async function.
|
|
|
944
906
|
let pageSource = await I.grabSource();
|
|
945
907
|
```
|
|
946
908
|
|
|
947
|
-
Returns [Promise][12]<[string][8]
|
|
948
|
-
|
|
949
|
-
|
|
909
|
+
Returns **[Promise][12]<[string][8]>** source code
|
|
950
910
|
|
|
951
911
|
### grabTextFrom
|
|
952
912
|
|
|
953
913
|
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
954
|
-
Resumes test execution, so should be used inside async with `await
|
|
914
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
955
915
|
|
|
956
916
|
```js
|
|
957
917
|
let pin = await I.grabTextFrom('#pin');
|
|
@@ -961,11 +921,9 @@ If multiple elements found returns an array of texts.
|
|
|
961
921
|
|
|
962
922
|
#### Parameters
|
|
963
923
|
|
|
964
|
-
- `locator`
|
|
965
|
-
|
|
966
|
-
Returns [Promise][12]<[string][8]> attribute value
|
|
967
|
-
|
|
924
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
968
925
|
|
|
926
|
+
Returns **[Promise][12]<([string][8] | [Array][13]<[string][8]>)>** attribute value
|
|
969
927
|
|
|
970
928
|
|
|
971
929
|
|
|
@@ -975,20 +933,18 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
975
933
|
### grabTitle
|
|
976
934
|
|
|
977
935
|
Retrieves a page title and returns it to test.
|
|
978
|
-
Resumes test execution, so should be used inside async with `await
|
|
936
|
+
Resumes test execution, so **should be used inside async with `await`** operator.
|
|
979
937
|
|
|
980
938
|
```js
|
|
981
939
|
let title = await I.grabTitle();
|
|
982
940
|
```
|
|
983
941
|
|
|
984
|
-
Returns [Promise][12]<[string][8]
|
|
985
|
-
|
|
986
|
-
|
|
942
|
+
Returns **[Promise][12]<[string][8]>** title
|
|
987
943
|
|
|
988
944
|
### grabValueFrom
|
|
989
945
|
|
|
990
946
|
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
991
|
-
Resumes test execution, so should be used inside async function with `await
|
|
947
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
992
948
|
|
|
993
949
|
```js
|
|
994
950
|
let email = await I.grabValueFrom('input[name=email]');
|
|
@@ -996,16 +952,14 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
996
952
|
|
|
997
953
|
#### Parameters
|
|
998
954
|
|
|
999
|
-
- `locator` ([string][8]
|
|
1000
|
-
|
|
1001
|
-
Returns [Promise][12]<[string][8]> attribute value
|
|
1002
|
-
|
|
955
|
+
- `locator` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1003
956
|
|
|
957
|
+
Returns **[Promise][12]<[string][8]>** attribute value
|
|
1004
958
|
|
|
1005
959
|
### handleDownloads
|
|
1006
960
|
|
|
1007
961
|
Sets a directory to where save files. Allows to test file downloads.
|
|
1008
|
-
Should be used with [FileSystem helper][
|
|
962
|
+
Should be used with [FileSystem helper][14] to check that file were downloaded correctly.
|
|
1009
963
|
|
|
1010
964
|
By default files are saved to `output/downloads`.
|
|
1011
965
|
This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
@@ -1019,7 +973,7 @@ I.seeFile('avatar.jpg');
|
|
|
1019
973
|
|
|
1020
974
|
#### Parameters
|
|
1021
975
|
|
|
1022
|
-
- `downloadPath` [string][8] change this parameter to set another directory for saving
|
|
976
|
+
- `downloadPath` **[string][8]** change this parameter to set another directory for saving
|
|
1023
977
|
|
|
1024
978
|
### haveRequestHeaders
|
|
1025
979
|
|
|
@@ -1033,7 +987,7 @@ I.haveRequestHeaders({
|
|
|
1033
987
|
|
|
1034
988
|
#### Parameters
|
|
1035
989
|
|
|
1036
|
-
- `customHeaders` [object][6] headers to set
|
|
990
|
+
- `customHeaders` **[object][6]** headers to set
|
|
1037
991
|
|
|
1038
992
|
### moveCursorTo
|
|
1039
993
|
|
|
@@ -1047,12 +1001,9 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1047
1001
|
|
|
1048
1002
|
#### Parameters
|
|
1049
1003
|
|
|
1050
|
-
- `locator` ([string][8]
|
|
1051
|
-
- `offsetX` [number][9] (optional, `0` by default) X-axis offset.
|
|
1052
|
-
- `offsetY` [number][9] (optional, `0` by default) Y-axis offset.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1004
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1005
|
+
- `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
|
|
1006
|
+
- `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
|
|
1056
1007
|
|
|
1057
1008
|
|
|
1058
1009
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1070,7 +1021,7 @@ I.openNewTab();
|
|
|
1070
1021
|
|
|
1071
1022
|
Presses a key in the browser (on a focused element).
|
|
1072
1023
|
|
|
1073
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1024
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][15].
|
|
1074
1025
|
|
|
1075
1026
|
```js
|
|
1076
1027
|
I.pressKey('Backspace');
|
|
@@ -1129,9 +1080,7 @@ Some of the supported key names are:
|
|
|
1129
1080
|
|
|
1130
1081
|
#### Parameters
|
|
1131
1082
|
|
|
1132
|
-
- `key` ([string][8]
|
|
1133
|
-
|
|
1134
|
-
_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313][16]).
|
|
1083
|
+
- `key` **([string][8] | [Array][13]<[string][8]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313][16]).
|
|
1135
1084
|
|
|
1136
1085
|
### pressKeyDown
|
|
1137
1086
|
|
|
@@ -1147,9 +1096,7 @@ I.pressKeyUp('Control');
|
|
|
1147
1096
|
|
|
1148
1097
|
#### Parameters
|
|
1149
1098
|
|
|
1150
|
-
- `key` [string][8] name of key to press down.
|
|
1151
|
-
|
|
1152
|
-
|
|
1099
|
+
- `key` **[string][8]** name of key to press down.
|
|
1153
1100
|
|
|
1154
1101
|
### pressKeyUp
|
|
1155
1102
|
|
|
@@ -1165,9 +1112,7 @@ I.pressKeyUp('Control');
|
|
|
1165
1112
|
|
|
1166
1113
|
#### Parameters
|
|
1167
1114
|
|
|
1168
|
-
- `key` [string][8] name of key to release.
|
|
1169
|
-
|
|
1170
|
-
|
|
1115
|
+
- `key` **[string][8]** name of key to release.
|
|
1171
1116
|
|
|
1172
1117
|
### refreshPage
|
|
1173
1118
|
|
|
@@ -1177,9 +1122,6 @@ Reload the current page.
|
|
|
1177
1122
|
I.refreshPage();
|
|
1178
1123
|
```
|
|
1179
1124
|
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
1125
|
### resizeWindow
|
|
1184
1126
|
|
|
1185
1127
|
Resize the current window to provided width and height.
|
|
@@ -1187,10 +1129,8 @@ First parameter can be set to `maximize`.
|
|
|
1187
1129
|
|
|
1188
1130
|
#### Parameters
|
|
1189
1131
|
|
|
1190
|
-
- `width` [number][9] width in pixels or `maximize`.
|
|
1191
|
-
- `height` [number][9] height in pixels.
|
|
1192
|
-
|
|
1193
|
-
Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
1132
|
+
- `width` **[number][9]** width in pixels or `maximize`.
|
|
1133
|
+
- `height` **[number][9]** height in pixels.Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
1194
1134
|
Puppeteer does not control the window of a browser so it can't adjust its real size.
|
|
1195
1135
|
It also can't maximize a window.
|
|
1196
1136
|
|
|
@@ -1209,10 +1149,8 @@ I.rightClick('Click me', '.context');
|
|
|
1209
1149
|
|
|
1210
1150
|
#### Parameters
|
|
1211
1151
|
|
|
1212
|
-
- `locator` ([string][8]
|
|
1213
|
-
- `context` ([string][8]
|
|
1214
|
-
|
|
1215
|
-
|
|
1152
|
+
- `locator` **([string][8] | [object][6])** clickable element located by CSS|XPath|strict locator.
|
|
1153
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1216
1154
|
|
|
1217
1155
|
|
|
1218
1156
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1231,10 +1169,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1231
1169
|
|
|
1232
1170
|
#### Parameters
|
|
1233
1171
|
|
|
1234
|
-
- `fileName` [string][8] file name to save.
|
|
1235
|
-
- `fullPage` [boolean][18] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1236
|
-
|
|
1237
|
-
|
|
1172
|
+
- `fileName` **[string][8]** file name to save.
|
|
1173
|
+
- `fullPage` **[boolean][18]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1238
1174
|
|
|
1239
1175
|
### scrollPageToBottom
|
|
1240
1176
|
|
|
@@ -1244,9 +1180,6 @@ Scroll page to the bottom.
|
|
|
1244
1180
|
I.scrollPageToBottom();
|
|
1245
1181
|
```
|
|
1246
1182
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
1183
|
### scrollPageToTop
|
|
1251
1184
|
|
|
1252
1185
|
Scroll page to the top.
|
|
@@ -1255,9 +1188,6 @@ Scroll page to the top.
|
|
|
1255
1188
|
I.scrollPageToTop();
|
|
1256
1189
|
```
|
|
1257
1190
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
1191
|
### scrollTo
|
|
1262
1192
|
|
|
1263
1193
|
Scrolls to element matched by locator.
|
|
@@ -1270,11 +1200,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1270
1200
|
|
|
1271
1201
|
#### Parameters
|
|
1272
1202
|
|
|
1273
|
-
- `locator` ([string][8]
|
|
1274
|
-
- `offsetX` [number][9] (optional, `0` by default) X-axis offset.
|
|
1275
|
-
- `offsetY` [number][9] (optional, `0` by default) Y-axis offset.
|
|
1276
|
-
|
|
1277
|
-
|
|
1203
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1204
|
+
- `offsetX` **[number][9]** (optional, `0` by default) X-axis offset.
|
|
1205
|
+
- `offsetY` **[number][9]** (optional, `0` by default) Y-axis offset.
|
|
1278
1206
|
|
|
1279
1207
|
### see
|
|
1280
1208
|
|
|
@@ -1289,10 +1217,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1289
1217
|
|
|
1290
1218
|
#### Parameters
|
|
1291
1219
|
|
|
1292
|
-
- `text` [string][8] expected on page.
|
|
1293
|
-
- `context` ([string][8]
|
|
1294
|
-
|
|
1295
|
-
|
|
1220
|
+
- `text` **[string][8]** expected on page.
|
|
1221
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1296
1222
|
|
|
1297
1223
|
|
|
1298
1224
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1308,10 +1234,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1308
1234
|
|
|
1309
1235
|
#### Parameters
|
|
1310
1236
|
|
|
1311
|
-
- `locator` ([string][8]
|
|
1312
|
-
- `attributes` [object][6] attributes and their values to check.
|
|
1313
|
-
|
|
1314
|
-
|
|
1237
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1238
|
+
- `attributes` **[object][6]** attributes and their values to check.
|
|
1315
1239
|
|
|
1316
1240
|
|
|
1317
1241
|
|
|
@@ -1330,9 +1254,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1330
1254
|
|
|
1331
1255
|
#### Parameters
|
|
1332
1256
|
|
|
1333
|
-
- `field` ([string][8]
|
|
1334
|
-
|
|
1335
|
-
|
|
1257
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1336
1258
|
|
|
1337
1259
|
### seeCookie
|
|
1338
1260
|
|
|
@@ -1344,9 +1266,7 @@ I.seeCookie('Auth');
|
|
|
1344
1266
|
|
|
1345
1267
|
#### Parameters
|
|
1346
1268
|
|
|
1347
|
-
- `name` [string][8] cookie name.
|
|
1348
|
-
|
|
1349
|
-
|
|
1269
|
+
- `name` **[string][8]** cookie name.
|
|
1350
1270
|
|
|
1351
1271
|
### seeCssPropertiesOnElements
|
|
1352
1272
|
|
|
@@ -1358,10 +1278,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1358
1278
|
|
|
1359
1279
|
#### Parameters
|
|
1360
1280
|
|
|
1361
|
-
- `locator` ([string][8]
|
|
1362
|
-
- `cssProperties` [object][6] object with CSS properties and their values to check.
|
|
1363
|
-
|
|
1364
|
-
|
|
1281
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1282
|
+
- `cssProperties` **[object][6]** object with CSS properties and their values to check.
|
|
1365
1283
|
|
|
1366
1284
|
|
|
1367
1285
|
|
|
@@ -1381,9 +1299,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1381
1299
|
|
|
1382
1300
|
#### Parameters
|
|
1383
1301
|
|
|
1384
|
-
- `url` [string][8] value to check.
|
|
1385
|
-
|
|
1386
|
-
|
|
1302
|
+
- `url` **[string][8]** value to check.
|
|
1387
1303
|
|
|
1388
1304
|
### seeElement
|
|
1389
1305
|
|
|
@@ -1396,9 +1312,7 @@ I.seeElement('#modal');
|
|
|
1396
1312
|
|
|
1397
1313
|
#### Parameters
|
|
1398
1314
|
|
|
1399
|
-
- `locator` ([string][8]
|
|
1400
|
-
|
|
1401
|
-
|
|
1315
|
+
- `locator` **([string][8] | [object][6])** located by CSS|XPath|strict locator.
|
|
1402
1316
|
|
|
1403
1317
|
|
|
1404
1318
|
|
|
@@ -1416,9 +1330,7 @@ I.seeElementInDOM('#modal');
|
|
|
1416
1330
|
|
|
1417
1331
|
#### Parameters
|
|
1418
1332
|
|
|
1419
|
-
- `locator` ([string][8]
|
|
1420
|
-
|
|
1421
|
-
|
|
1333
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1422
1334
|
|
|
1423
1335
|
### seeInCurrentUrl
|
|
1424
1336
|
|
|
@@ -1430,9 +1342,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1430
1342
|
|
|
1431
1343
|
#### Parameters
|
|
1432
1344
|
|
|
1433
|
-
- `url` [string][8] a fragment to check
|
|
1434
|
-
|
|
1435
|
-
|
|
1345
|
+
- `url` **[string][8]** a fragment to check
|
|
1436
1346
|
|
|
1437
1347
|
### seeInField
|
|
1438
1348
|
|
|
@@ -1448,10 +1358,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1448
1358
|
|
|
1449
1359
|
#### Parameters
|
|
1450
1360
|
|
|
1451
|
-
- `field` ([string][8]
|
|
1452
|
-
- `value` [string][8] value to check.
|
|
1453
|
-
|
|
1454
|
-
|
|
1361
|
+
- `field` **([string][8] | [object][6])** located by label|name|CSS|XPath|strict locator.
|
|
1362
|
+
- `value` **[string][8]** value to check.
|
|
1455
1363
|
|
|
1456
1364
|
### seeInPopup
|
|
1457
1365
|
|
|
@@ -1472,9 +1380,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1472
1380
|
|
|
1473
1381
|
#### Parameters
|
|
1474
1382
|
|
|
1475
|
-
- `text` [string][8] value to check.
|
|
1476
|
-
|
|
1477
|
-
|
|
1383
|
+
- `text` **[string][8]** value to check.
|
|
1478
1384
|
|
|
1479
1385
|
### seeInTitle
|
|
1480
1386
|
|
|
@@ -1486,9 +1392,7 @@ I.seeInTitle('Home Page');
|
|
|
1486
1392
|
|
|
1487
1393
|
#### Parameters
|
|
1488
1394
|
|
|
1489
|
-
- `text` [string][8] text value to check.
|
|
1490
|
-
|
|
1491
|
-
|
|
1395
|
+
- `text` **[string][8]** text value to check.
|
|
1492
1396
|
|
|
1493
1397
|
### seeNumberOfElements
|
|
1494
1398
|
|
|
@@ -1501,10 +1405,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1501
1405
|
|
|
1502
1406
|
#### Parameters
|
|
1503
1407
|
|
|
1504
|
-
- `locator` ([string][8]
|
|
1505
|
-
- `num` [number][9] number of elements.
|
|
1506
|
-
|
|
1507
|
-
|
|
1408
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1409
|
+
- `num` **[number][9]** number of elements.
|
|
1508
1410
|
|
|
1509
1411
|
|
|
1510
1412
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1521,10 +1423,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1521
1423
|
|
|
1522
1424
|
#### Parameters
|
|
1523
1425
|
|
|
1524
|
-
- `locator` ([string][8]
|
|
1525
|
-
- `num` [number][9] number of elements.
|
|
1526
|
-
|
|
1527
|
-
|
|
1426
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1427
|
+
- `num` **[number][9]** number of elements.
|
|
1528
1428
|
|
|
1529
1429
|
|
|
1530
1430
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
@@ -1540,8 +1440,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1540
1440
|
|
|
1541
1441
|
#### Parameters
|
|
1542
1442
|
|
|
1543
|
-
- `text`
|
|
1544
|
-
- `context`
|
|
1443
|
+
- `text` **[string][8]** element value to check.
|
|
1444
|
+
- `context` **([string][8] | [object][6]?)** element located by CSS|XPath|strict locator.
|
|
1545
1445
|
|
|
1546
1446
|
### seeTitleEquals
|
|
1547
1447
|
|
|
@@ -1578,10 +1478,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1578
1478
|
|
|
1579
1479
|
#### Parameters
|
|
1580
1480
|
|
|
1581
|
-
- `select` ([string][8]
|
|
1582
|
-
- `option` ([string][8]
|
|
1583
|
-
|
|
1584
|
-
|
|
1481
|
+
- `select` **([string][8] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1482
|
+
- `option` **([string][8] | [Array][13]<any>)** visible text or value of option.
|
|
1585
1483
|
|
|
1586
1484
|
### setCookie
|
|
1587
1485
|
|
|
@@ -1593,9 +1491,7 @@ I.setCookie({name: 'auth', value: true});
|
|
|
1593
1491
|
|
|
1594
1492
|
#### Parameters
|
|
1595
1493
|
|
|
1596
|
-
- `cookie` [object][6] a cookie object.
|
|
1597
|
-
|
|
1598
|
-
|
|
1494
|
+
- `cookie` **[object][6]** a cookie object.
|
|
1599
1495
|
|
|
1600
1496
|
### switchTo
|
|
1601
1497
|
|
|
@@ -1608,9 +1504,7 @@ I.switchTo(); // switch back to main page
|
|
|
1608
1504
|
|
|
1609
1505
|
#### Parameters
|
|
1610
1506
|
|
|
1611
|
-
- `locator` ([string][8]
|
|
1612
|
-
|
|
1613
|
-
|
|
1507
|
+
- `locator` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1614
1508
|
|
|
1615
1509
|
### switchToNextTab
|
|
1616
1510
|
|
|
@@ -1623,7 +1517,7 @@ I.switchToNextTab(2);
|
|
|
1623
1517
|
|
|
1624
1518
|
#### Parameters
|
|
1625
1519
|
|
|
1626
|
-
- `num` [number][9]
|
|
1520
|
+
- `num` **[number][9]**
|
|
1627
1521
|
|
|
1628
1522
|
### switchToPreviousTab
|
|
1629
1523
|
|
|
@@ -1636,7 +1530,7 @@ I.switchToPreviousTab(2);
|
|
|
1636
1530
|
|
|
1637
1531
|
#### Parameters
|
|
1638
1532
|
|
|
1639
|
-
- `num` [number][9]
|
|
1533
|
+
- `num` **[number][9]**
|
|
1640
1534
|
|
|
1641
1535
|
### uncheckOption
|
|
1642
1536
|
|
|
@@ -1653,10 +1547,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1653
1547
|
|
|
1654
1548
|
#### Parameters
|
|
1655
1549
|
|
|
1656
|
-
- `field` ([string][8]
|
|
1657
|
-
- `context` [string][8] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1658
|
-
|
|
1659
|
-
|
|
1550
|
+
- `field` **([string][8] | [object][6])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1551
|
+
- `context` **([string][8]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1660
1552
|
|
|
1661
1553
|
### wait
|
|
1662
1554
|
|
|
@@ -1668,9 +1560,23 @@ I.wait(2); // wait 2 secs
|
|
|
1668
1560
|
|
|
1669
1561
|
#### Parameters
|
|
1670
1562
|
|
|
1671
|
-
- `sec` [number][9] number of second to wait.
|
|
1672
|
-
|
|
1563
|
+
- `sec` **[number][9]** number of second to wait.
|
|
1673
1564
|
|
|
1565
|
+
### waitForClickable
|
|
1566
|
+
|
|
1567
|
+
Waits for element to be clickable (by default waits for 1sec).
|
|
1568
|
+
Element can be located by CSS or XPath.
|
|
1569
|
+
|
|
1570
|
+
```js
|
|
1571
|
+
I.waitForClickable('.btn.continue');
|
|
1572
|
+
I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
1573
|
+
```
|
|
1574
|
+
|
|
1575
|
+
#### Parameters
|
|
1576
|
+
|
|
1577
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1578
|
+
- `waitTimeout`
|
|
1579
|
+
- `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
|
|
1674
1580
|
|
|
1675
1581
|
### waitForDetached
|
|
1676
1582
|
|
|
@@ -1683,10 +1589,8 @@ I.waitForDetached('#popup');
|
|
|
1683
1589
|
|
|
1684
1590
|
#### Parameters
|
|
1685
1591
|
|
|
1686
|
-
- `locator` ([string][8]
|
|
1687
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1688
|
-
|
|
1689
|
-
|
|
1592
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1593
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1690
1594
|
|
|
1691
1595
|
### waitForElement
|
|
1692
1596
|
|
|
@@ -1700,10 +1604,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1700
1604
|
|
|
1701
1605
|
#### Parameters
|
|
1702
1606
|
|
|
1703
|
-
- `locator` ([string][8]
|
|
1704
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1705
|
-
|
|
1706
|
-
|
|
1607
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1608
|
+
- `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
|
|
1707
1609
|
|
|
1708
1610
|
|
|
1709
1611
|
|
|
@@ -1717,10 +1619,8 @@ Element can be located by CSS or XPath.
|
|
|
1717
1619
|
|
|
1718
1620
|
#### Parameters
|
|
1719
1621
|
|
|
1720
|
-
- `locator` ([string][8]
|
|
1721
|
-
- `sec`
|
|
1722
|
-
|
|
1723
|
-
|
|
1622
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1623
|
+
- `sec` **[number][9]** (optional) time in seconds to wait, 1 by default.
|
|
1724
1624
|
|
|
1725
1625
|
### waitForFunction
|
|
1726
1626
|
|
|
@@ -1739,11 +1639,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1739
1639
|
|
|
1740
1640
|
#### Parameters
|
|
1741
1641
|
|
|
1742
|
-
- `fn` ([string][8]
|
|
1743
|
-
- `argsOrSec` ([
|
|
1744
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1745
|
-
|
|
1746
|
-
|
|
1642
|
+
- `fn` **([string][8] | [function][11])** to be executed in browser context.
|
|
1643
|
+
- `argsOrSec` **([Array][13]<any> | [number][9])?** (optional, `1` by default) arguments for function or seconds.
|
|
1644
|
+
- `sec` **[number][9]?** (optional, `1` by default) time in seconds to wait
|
|
1747
1645
|
|
|
1748
1646
|
### waitForInvisible
|
|
1749
1647
|
|
|
@@ -1756,10 +1654,8 @@ I.waitForInvisible('#popup');
|
|
|
1756
1654
|
|
|
1757
1655
|
#### Parameters
|
|
1758
1656
|
|
|
1759
|
-
- `locator` ([string][8]
|
|
1760
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1761
|
-
|
|
1762
|
-
|
|
1657
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1658
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1763
1659
|
|
|
1764
1660
|
### waitForNavigation
|
|
1765
1661
|
|
|
@@ -1769,7 +1665,7 @@ See [Pupeteer's reference][3]
|
|
|
1769
1665
|
|
|
1770
1666
|
#### Parameters
|
|
1771
1667
|
|
|
1772
|
-
- `opts` any
|
|
1668
|
+
- `opts` **any**
|
|
1773
1669
|
|
|
1774
1670
|
### waitForRequest
|
|
1775
1671
|
|
|
@@ -1782,8 +1678,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1782
1678
|
|
|
1783
1679
|
#### Parameters
|
|
1784
1680
|
|
|
1785
|
-
- `urlOrPredicate` ([string][8]
|
|
1786
|
-
- `sec` [number][9]
|
|
1681
|
+
- `urlOrPredicate` **([string][8] | [function][11])**
|
|
1682
|
+
- `sec` **[number][9]?** seconds to wait
|
|
1787
1683
|
|
|
1788
1684
|
### waitForResponse
|
|
1789
1685
|
|
|
@@ -1796,8 +1692,8 @@ I.waitForResponse(request => request.url() === 'http://example.com' && request.m
|
|
|
1796
1692
|
|
|
1797
1693
|
#### Parameters
|
|
1798
1694
|
|
|
1799
|
-
- `urlOrPredicate` ([string][8]
|
|
1800
|
-
- `sec` [number][9]
|
|
1695
|
+
- `urlOrPredicate` **([string][8] | [function][11])**
|
|
1696
|
+
- `sec` **[number][9]?** number of seconds to wait
|
|
1801
1697
|
|
|
1802
1698
|
### waitForText
|
|
1803
1699
|
|
|
@@ -1812,11 +1708,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1812
1708
|
|
|
1813
1709
|
#### Parameters
|
|
1814
1710
|
|
|
1815
|
-
- `text` [string][8] to wait for.
|
|
1816
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1817
|
-
- `context` ([string][8]
|
|
1818
|
-
|
|
1819
|
-
|
|
1711
|
+
- `text` **[string][8]** to wait for.
|
|
1712
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1713
|
+
- `context` **([string][8] | [object][6])?** (optional) element located by CSS|XPath|strict locator.
|
|
1820
1714
|
|
|
1821
1715
|
### waitForValue
|
|
1822
1716
|
|
|
@@ -1828,11 +1722,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1828
1722
|
|
|
1829
1723
|
#### Parameters
|
|
1830
1724
|
|
|
1831
|
-
- `field` ([string][8]
|
|
1832
|
-
- `value` [string][8] expected value.
|
|
1833
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1834
|
-
|
|
1835
|
-
|
|
1725
|
+
- `field` **([string][8] | [object][6])** input field.
|
|
1726
|
+
- `value` **[string][8]** expected value.
|
|
1727
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1836
1728
|
|
|
1837
1729
|
### waitForVisible
|
|
1838
1730
|
|
|
@@ -1845,10 +1737,8 @@ I.waitForVisible('#popup');
|
|
|
1845
1737
|
|
|
1846
1738
|
#### Parameters
|
|
1847
1739
|
|
|
1848
|
-
- `locator` ([string][8]
|
|
1849
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to
|
|
1850
|
-
|
|
1851
|
-
This method accepts [React selectors][19].
|
|
1740
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1741
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to waitThis method accepts [React selectors][19].
|
|
1852
1742
|
|
|
1853
1743
|
### waitInUrl
|
|
1854
1744
|
|
|
@@ -1860,10 +1750,8 @@ I.waitInUrl('/info', 2);
|
|
|
1860
1750
|
|
|
1861
1751
|
#### Parameters
|
|
1862
1752
|
|
|
1863
|
-
- `urlPart` [string][8] value to check.
|
|
1864
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1865
|
-
|
|
1866
|
-
|
|
1753
|
+
- `urlPart` **[string][8]** value to check.
|
|
1754
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1867
1755
|
|
|
1868
1756
|
### waitNumberOfVisibleElements
|
|
1869
1757
|
|
|
@@ -1875,16 +1763,14 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1875
1763
|
|
|
1876
1764
|
#### Parameters
|
|
1877
1765
|
|
|
1878
|
-
- `locator` ([string][8]
|
|
1879
|
-
- `num` [number][9] number of elements.
|
|
1880
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1881
|
-
|
|
1882
|
-
|
|
1766
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1767
|
+
- `num` **[number][9]** number of elements.
|
|
1768
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1883
1769
|
|
|
1884
1770
|
|
|
1885
1771
|
|
|
1886
1772
|
This action supports [React locators](https://codecept.io/react#locators)
|
|
1887
|
-
|
|
1773
|
+
|
|
1888
1774
|
|
|
1889
1775
|
### waitToHide
|
|
1890
1776
|
|
|
@@ -1897,10 +1783,8 @@ I.waitToHide('#popup');
|
|
|
1897
1783
|
|
|
1898
1784
|
#### Parameters
|
|
1899
1785
|
|
|
1900
|
-
- `locator` ([string][8]
|
|
1901
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1902
|
-
|
|
1903
|
-
|
|
1786
|
+
- `locator` **([string][8] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1787
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1904
1788
|
|
|
1905
1789
|
### waitUntil
|
|
1906
1790
|
|
|
@@ -1913,11 +1797,10 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1913
1797
|
|
|
1914
1798
|
#### Parameters
|
|
1915
1799
|
|
|
1916
|
-
- `fn` ([function][11]
|
|
1917
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1918
|
-
- `timeoutMsg` [string][8] message to show in case of timeout fail.
|
|
1919
|
-
|
|
1920
|
-
|
|
1800
|
+
- `fn` **([function][11] | [string][8])** function which is executed in browser context.
|
|
1801
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1802
|
+
- `timeoutMsg` **[string][8]** message to show in case of timeout fail.
|
|
1803
|
+
- `interval` **[number][9]?**
|
|
1921
1804
|
|
|
1922
1805
|
### waitUrlEquals
|
|
1923
1806
|
|
|
@@ -1930,10 +1813,8 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1930
1813
|
|
|
1931
1814
|
#### Parameters
|
|
1932
1815
|
|
|
1933
|
-
- `urlPart` [string][8] value to check.
|
|
1934
|
-
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1935
|
-
|
|
1936
|
-
|
|
1816
|
+
- `urlPart` **[string][8]** value to check.
|
|
1817
|
+
- `sec` **[number][9]** (optional, `1` by default) time in seconds to wait
|
|
1937
1818
|
|
|
1938
1819
|
[1]: https://github.com/GoogleChrome/puppeteer
|
|
1939
1820
|
|
|
@@ -1959,11 +1840,11 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1959
1840
|
|
|
1960
1841
|
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1961
1842
|
|
|
1962
|
-
[13]: https://
|
|
1843
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1963
1844
|
|
|
1964
|
-
[14]:
|
|
1845
|
+
[14]: https://codecept.io/helpers/FileSystem
|
|
1965
1846
|
|
|
1966
|
-
[15]:
|
|
1847
|
+
[15]: #fillfield
|
|
1967
1848
|
|
|
1968
1849
|
[16]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
1969
1850
|
|