codeceptjs 2.1.3 → 2.2.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 +125 -37
- package/README.md +15 -22
- package/bin/codecept.js +4 -1
- package/docs/acceptance.md +44 -1
- package/docs/advanced.md +1 -1
- package/docs/angular.md +6 -9
- package/docs/basics.md +388 -75
- package/docs/bdd.md +4 -3
- package/docs/best.md +1 -1
- package/docs/books.md +31 -0
- package/docs/build/Appium.js +215 -176
- package/docs/build/Nightmare.js +618 -489
- package/docs/build/Polly.js +189 -0
- package/docs/build/Protractor.js +747 -608
- package/docs/build/Puppeteer.js +914 -633
- package/docs/build/REST.js +1 -1
- package/docs/build/TestCafe.js +1835 -0
- package/docs/build/WebDriver.js +861 -805
- package/docs/build/WebDriverIO.js +616 -617
- package/docs/changelog.md +410 -316
- package/docs/commands.md +6 -6
- package/docs/community-helpers.md +2 -0
- package/docs/detox.md +235 -0
- package/docs/examples.md +23 -0
- package/docs/helpers/ApiDataFactory.md +11 -10
- package/docs/helpers/Appium.md +130 -61
- package/docs/helpers/Detox.md +579 -0
- package/docs/helpers/FileSystem.md +2 -1
- package/docs/helpers/Mochawesome.md +1 -0
- package/docs/helpers/Nightmare.md +348 -128
- package/docs/helpers/Polly.md +85 -0
- package/docs/helpers/Protractor.md +451 -184
- package/docs/helpers/Puppeteer-firefox.md +55 -0
- package/docs/helpers/Puppeteer.md +619 -183
- package/docs/helpers/REST.md +17 -16
- package/docs/helpers/SeleniumWebdriver.md +9 -8
- package/docs/helpers/TestCafe.md +1168 -0
- package/docs/helpers/WebDriver.md +600 -291
- package/docs/helpers/WebDriverIO.md +393 -278
- package/docs/helpers.md +37 -18
- package/docs/locators.md +2 -0
- package/docs/mobile-react-native-locators.md +64 -0
- package/docs/mobile.md +5 -0
- package/docs/plugins.md +54 -13
- package/docs/puppeteer.md +74 -26
- package/docs/quickstart.md +47 -12
- package/docs/react.md +67 -0
- package/docs/reports.md +1 -1
- package/docs/{webapi/_keys.mustache → shared/keys.mustache} +0 -0
- package/docs/shared/react.mustache +1 -0
- package/docs/testcafe.md +157 -0
- package/docs/videos.md +19 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +2 -2
- package/docs/webapi/attachFile.mustache +2 -2
- package/docs/webapi/checkOption.mustache +2 -2
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +2 -2
- package/docs/webapi/clickLink.mustache +3 -3
- package/docs/webapi/dontSee.mustache +6 -3
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +7 -1
- package/docs/webapi/dontSeeCookie.mustache +5 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +6 -1
- package/docs/webapi/dontSeeElement.mustache +5 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +5 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +7 -2
- package/docs/webapi/dontSeeInSource.mustache +5 -1
- package/docs/webapi/dontSeeInTitle.mustache +5 -1
- package/docs/webapi/doubleClick.mustache +2 -2
- package/docs/webapi/downloadFile.mustache +2 -2
- package/docs/webapi/dragAndDrop.mustache +2 -2
- package/docs/webapi/dragSlider.mustache +2 -2
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +2 -2
- package/docs/webapi/grabAttributeFrom.mustache +3 -2
- package/docs/webapi/grabBrowserLogs.mustache +3 -1
- package/docs/webapi/grabCookie.mustache +2 -1
- package/docs/webapi/grabCssPropertyFrom.mustache +3 -2
- package/docs/webapi/grabCurrentUrl.mustache +3 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +19 -0
- package/docs/webapi/grabHTMLFrom.mustache +2 -1
- package/docs/webapi/grabNumberOfOpenTabs.mustache +4 -2
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -2
- package/docs/webapi/grabPageScrollPosition.mustache +3 -1
- package/docs/webapi/grabSource.mustache +3 -1
- package/docs/webapi/grabTextFrom.mustache +2 -1
- package/docs/webapi/grabTitle.mustache +3 -1
- package/docs/webapi/grabValueFrom.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +3 -3
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +2 -2
- package/docs/webapi/rightClick.mustache +2 -2
- package/docs/webapi/saveScreenshot.mustache +3 -3
- package/docs/webapi/say.mustache +2 -2
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +3 -3
- package/docs/webapi/see.mustache +2 -2
- package/docs/webapi/seeAttributesOnElements.mustache +3 -3
- package/docs/webapi/seeCheckboxIsChecked.mustache +2 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -2
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +2 -2
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +5 -1
- package/docs/webapi/seeNumberOfElements.mustache +10 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +2 -2
- package/docs/webapi/selectOption.mustache +2 -2
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/switchTo.mustache +6 -1
- package/docs/webapi/uncheckOption.mustache +2 -2
- package/docs/webapi/wait.mustache +1 -2
- package/docs/webapi/waitForDetached.mustache +3 -3
- package/docs/webapi/waitForElement.mustache +2 -2
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +3 -3
- package/docs/webapi/waitForInvisible.mustache +3 -3
- package/docs/webapi/waitForText.mustache +3 -3
- package/docs/webapi/waitForValue.mustache +3 -3
- package/docs/webapi/waitForVisible.mustache +3 -3
- package/docs/webapi/waitInUrl.mustache +2 -2
- package/docs/webapi/waitNumberOfVisibleElements.mustache +3 -3
- package/docs/webapi/waitToHide.mustache +3 -3
- package/docs/webapi/waitUntil.mustache +3 -3
- package/docs/webapi/waitUrlEquals.mustache +2 -2
- package/docs/webdriver.md +453 -0
- package/lib/codecept.js +11 -9
- package/lib/command/definitions.js +183 -30
- package/lib/command/gherkin/snippets.js +29 -9
- package/lib/command/init.js +31 -9
- package/lib/command/run-multiple.js +46 -59
- package/lib/command/utils.js +1 -1
- package/lib/container.js +30 -4
- package/lib/data/dataScenarioConfig.js +18 -0
- package/lib/helper/Appium.js +24 -24
- package/lib/helper/Nightmare.js +81 -84
- package/lib/helper/Polly.js +189 -0
- package/lib/helper/Protractor.js +96 -86
- package/lib/helper/Puppeteer.js +238 -113
- package/lib/helper/REST.js +1 -1
- package/lib/helper/TestCafe.js +1257 -0
- package/lib/helper/WebDriver.js +217 -277
- package/lib/helper/WebDriverIO.js +75 -75
- package/lib/helper/clientscripts/nightmare.js +8 -0
- package/lib/helper/extras/React.js +55 -0
- package/lib/helper/testcafe/testControllerHolder.js +42 -0
- package/lib/helper/testcafe/testcafe-utils.js +63 -0
- package/lib/history.js +39 -0
- package/lib/hooks.js +25 -1
- package/lib/interfaces/gherkin.js +17 -1
- package/lib/interfaces/scenarioConfig.js +2 -2
- package/lib/listener/config.js +3 -3
- package/lib/locator.js +6 -0
- package/lib/pause.js +22 -1
- package/lib/plugin/allure.js +63 -0
- package/lib/plugin/autoLogin.js +65 -16
- package/lib/plugin/puppeteerCoverage.js +6 -1
- package/lib/plugin/stepByStepReport.js +4 -3
- package/lib/scenario.js +23 -17
- package/lib/step.js +5 -2
- package/lib/ui.js +1 -1
- package/lib/utils.js +70 -20
- package/package.json +20 -19
- package/translations/de-DE.js +69 -0
- package/translations/index.js +1 -0
- package/docs/video.md +0 -26
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
id: Puppeteer
|
|
3
3
|
title: Puppeteer
|
|
4
4
|
---
|
|
5
|
+
|
|
5
6
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
6
7
|
|
|
7
8
|
## Puppeteer
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Extends Helper
|
|
10
11
|
|
|
11
12
|
Uses [Google Chrome's Puppeteer][1] library to run tests inside headless Chrome.
|
|
12
13
|
Browser control is executed via DevTools Protocol (instead of Selenium).
|
|
@@ -14,26 +15,30 @@ This helper works with a browser out of the box with no additional tools require
|
|
|
14
15
|
|
|
15
16
|
Requires `puppeteer` package to be installed.
|
|
16
17
|
|
|
18
|
+
> Experiemental Firefox support [can be activated][2].
|
|
19
|
+
|
|
17
20
|
## Configuration
|
|
18
21
|
|
|
19
22
|
This helper should be configured in codecept.json or codecept.conf.js
|
|
20
23
|
|
|
21
24
|
- `url`: base url of website to be tested
|
|
22
|
-
- `show`:
|
|
23
|
-
- `restart`:
|
|
24
|
-
- `disableScreenshots`:
|
|
25
|
-
- `fullPageScreenshots`
|
|
26
|
-
- `uniqueScreenshotNames`:
|
|
27
|
-
- `keepBrowserState`:
|
|
28
|
-
- `keepCookies`:
|
|
25
|
+
- `show`: - show Google Chrome window for debug.
|
|
26
|
+
- `restart`: - restart browser between tests.
|
|
27
|
+
- `disableScreenshots`: - don't save screenshot on failure.
|
|
28
|
+
- `fullPageScreenshots` - make full page screenshots on failure.
|
|
29
|
+
- `uniqueScreenshotNames`: - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
30
|
+
- `keepBrowserState`: - keep browser state between tests when `restart` is set to false.
|
|
31
|
+
- `keepCookies`: - keep cookies between tests when `restart` is set to false.
|
|
29
32
|
- `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
30
|
-
- `waitForNavigation`:
|
|
31
|
-
- `
|
|
32
|
-
- `
|
|
33
|
+
- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][3]. Array values are accepted as well.
|
|
34
|
+
- `pressKeyDelay`: . Delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
35
|
+
- `getPageTimeout` config option to set maximum navigation time in milliseconds.
|
|
36
|
+
- `waitForTimeout`: (optional) default wait\ timeout in ms. Default: 1000.
|
|
33
37
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
34
38
|
- `userAgent`: (optional) user-agent string.
|
|
35
|
-
- `manualStart`:
|
|
36
|
-
- `
|
|
39
|
+
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
40
|
+
- `browser`: - can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
41
|
+
- `chrome`: (optional) pass additional [Puppeteer run options][4].
|
|
37
42
|
|
|
38
43
|
#### Example #1: Wait for 0 network connections.
|
|
39
44
|
|
|
@@ -78,7 +83,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
78
83
|
}
|
|
79
84
|
```
|
|
80
85
|
|
|
81
|
-
#### Example #4: Connect to remote browser by specifying [websocket endpoint][
|
|
86
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][5]
|
|
82
87
|
|
|
83
88
|
```json
|
|
84
89
|
{
|
|
@@ -134,6 +139,12 @@ Should be used in custom helpers:
|
|
|
134
139
|
const elements = await this.helpers['Puppeteer']._locate({name: 'password'});
|
|
135
140
|
```
|
|
136
141
|
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
146
|
+
|
|
147
|
+
|
|
137
148
|
#### Parameters
|
|
138
149
|
|
|
139
150
|
- `locator`
|
|
@@ -150,7 +161,7 @@ this.helpers['Puppeteer']._locateCheckable('I agree with terms and conditions').
|
|
|
150
161
|
#### Parameters
|
|
151
162
|
|
|
152
163
|
- `locator`
|
|
153
|
-
- `providedContext`
|
|
164
|
+
- `providedContext`
|
|
154
165
|
|
|
155
166
|
### \_locateClickable
|
|
156
167
|
|
|
@@ -182,13 +193,13 @@ Set current page
|
|
|
182
193
|
|
|
183
194
|
#### Parameters
|
|
184
195
|
|
|
185
|
-
- `page`
|
|
196
|
+
- `page` [object][6] page to set
|
|
186
197
|
|
|
187
198
|
### acceptPopup
|
|
188
199
|
|
|
189
200
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
190
201
|
Don't confuse popups with modal windows, as created by [various
|
|
191
|
-
libraries][
|
|
202
|
+
libraries][7].
|
|
192
203
|
|
|
193
204
|
### amAcceptingPopups
|
|
194
205
|
|
|
@@ -226,7 +237,9 @@ I.amOnPage('/login'); // opens a login page
|
|
|
226
237
|
|
|
227
238
|
#### Parameters
|
|
228
239
|
|
|
229
|
-
- `url`
|
|
240
|
+
- `url` [string][8] url path or global url.
|
|
241
|
+
|
|
242
|
+
|
|
230
243
|
|
|
231
244
|
### appendField
|
|
232
245
|
|
|
@@ -239,8 +252,14 @@ I.appendField('#myTextField', 'appended');
|
|
|
239
252
|
|
|
240
253
|
#### Parameters
|
|
241
254
|
|
|
242
|
-
- `field`
|
|
243
|
-
- `value`
|
|
255
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator
|
|
256
|
+
- `value` [string][8] text value to append.
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
262
|
+
|
|
244
263
|
|
|
245
264
|
### attachFile
|
|
246
265
|
|
|
@@ -255,8 +274,10 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
255
274
|
|
|
256
275
|
#### Parameters
|
|
257
276
|
|
|
258
|
-
- `locator`
|
|
259
|
-
- `pathToFile`
|
|
277
|
+
- `locator` ([string][8] \| [object][6]) field located by label|name|CSS|XPath|strict locator.
|
|
278
|
+
- `pathToFile` [string][8] local file path relative to codecept.json config file.
|
|
279
|
+
|
|
280
|
+
|
|
260
281
|
|
|
261
282
|
### cancelPopup
|
|
262
283
|
|
|
@@ -277,8 +298,10 @@ I.checkOption('agree', '//form');
|
|
|
277
298
|
|
|
278
299
|
#### Parameters
|
|
279
300
|
|
|
280
|
-
- `field`
|
|
281
|
-
- `context`
|
|
301
|
+
- `field` ([string][8] \| [object][6]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
302
|
+
- `context` [string][8] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
303
|
+
|
|
304
|
+
|
|
282
305
|
|
|
283
306
|
### clearCookie
|
|
284
307
|
|
|
@@ -293,7 +316,9 @@ I.clearCookie('test');
|
|
|
293
316
|
#### Parameters
|
|
294
317
|
|
|
295
318
|
- `name`
|
|
296
|
-
- `cookie`
|
|
319
|
+
- `cookie` [string][8] (optional, `null` by default) cookie name
|
|
320
|
+
|
|
321
|
+
|
|
297
322
|
|
|
298
323
|
### clearField
|
|
299
324
|
|
|
@@ -307,7 +332,10 @@ I.clearField('#email');
|
|
|
307
332
|
|
|
308
333
|
#### Parameters
|
|
309
334
|
|
|
310
|
-
- `field`
|
|
335
|
+
- `field`
|
|
336
|
+
- `editable` ([string][8] \| [object][6]) field located by label|name|CSS|XPath|strict locator.
|
|
337
|
+
|
|
338
|
+
|
|
311
339
|
|
|
312
340
|
### click
|
|
313
341
|
|
|
@@ -326,7 +354,7 @@ I.click('Submit');
|
|
|
326
354
|
// CSS button
|
|
327
355
|
I.click('#form input[type=submit]');
|
|
328
356
|
// XPath
|
|
329
|
-
I.click('//form
|
|
357
|
+
I.click('//form/[@type=submit]');
|
|
330
358
|
// link in context
|
|
331
359
|
I.click('Logout', '#nav');
|
|
332
360
|
// using strict locator
|
|
@@ -335,21 +363,33 @@ I.click({css: 'nav a.login'});
|
|
|
335
363
|
|
|
336
364
|
#### Parameters
|
|
337
365
|
|
|
338
|
-
- `locator`
|
|
339
|
-
- `context`
|
|
366
|
+
- `locator` ([string][8] \| [object][6]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
367
|
+
- `context` ([string][8] \| [object][6]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
373
|
+
|
|
340
374
|
|
|
341
375
|
### clickLink
|
|
342
376
|
|
|
343
377
|
Performs a click on a link and waits for navigation before moving on.
|
|
344
378
|
|
|
345
379
|
```js
|
|
346
|
-
I.
|
|
380
|
+
I.clickLink('Logout', '#nav');
|
|
347
381
|
```
|
|
348
382
|
|
|
349
383
|
#### Parameters
|
|
350
384
|
|
|
351
|
-
- `locator`
|
|
352
|
-
- `context`
|
|
385
|
+
- `locator` ([string][8] \| [object][6]) clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
386
|
+
- `context` ([string][8] \| [object][6]) (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
392
|
+
|
|
353
393
|
|
|
354
394
|
### closeCurrentTab
|
|
355
395
|
|
|
@@ -373,54 +413,98 @@ Opposite to `see`. Checks that a text is not present on a page.
|
|
|
373
413
|
Use context parameter to narrow down the search.
|
|
374
414
|
|
|
375
415
|
```js
|
|
376
|
-
I.dontSee('Login'); // assume we are already logged in
|
|
416
|
+
I.dontSee('Login'); // assume we are already logged in.
|
|
417
|
+
I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
377
418
|
```
|
|
378
419
|
|
|
379
420
|
#### Parameters
|
|
380
421
|
|
|
381
|
-
- `text`
|
|
382
|
-
- `context`
|
|
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
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
428
|
+
|
|
383
429
|
|
|
384
430
|
### dontSeeCheckboxIsChecked
|
|
385
431
|
|
|
386
432
|
Verifies that the specified checkbox is not checked.
|
|
387
433
|
|
|
434
|
+
```js
|
|
435
|
+
I.dontSeeeCheckboxIsChedcked('#agree'); // located by ID
|
|
436
|
+
I.dontSeeeCheckboxIsChedcked('I agree to terms'); // located by label
|
|
437
|
+
I.dontSeeeCheckboxIsChedcked('agree'); // located by name
|
|
438
|
+
```
|
|
439
|
+
|
|
388
440
|
#### Parameters
|
|
389
441
|
|
|
390
|
-
- `field`
|
|
442
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
443
|
+
|
|
444
|
+
|
|
391
445
|
|
|
392
446
|
### dontSeeCookie
|
|
393
447
|
|
|
394
448
|
Checks that cookie with given name does not exist.
|
|
395
449
|
|
|
450
|
+
```js
|
|
451
|
+
I.dontSeeCookie('auth'); // no auth cookie
|
|
452
|
+
```
|
|
453
|
+
|
|
396
454
|
#### Parameters
|
|
397
455
|
|
|
398
|
-
- `name`
|
|
456
|
+
- `name` [string][8] cookie name.
|
|
457
|
+
|
|
458
|
+
|
|
399
459
|
|
|
400
460
|
### dontSeeCurrentUrlEquals
|
|
401
461
|
|
|
402
462
|
Checks that current url is not equal to provided one.
|
|
403
463
|
If a relative url provided, a configured url will be prepended to it.
|
|
404
464
|
|
|
465
|
+
```js
|
|
466
|
+
I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
|
|
467
|
+
I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
|
|
468
|
+
```
|
|
469
|
+
|
|
405
470
|
#### Parameters
|
|
406
471
|
|
|
407
|
-
- `url`
|
|
472
|
+
- `url` [string][8] value to check.
|
|
473
|
+
|
|
474
|
+
|
|
408
475
|
|
|
409
476
|
### dontSeeElement
|
|
410
477
|
|
|
411
478
|
Opposite to `seeElement`. Checks that element is not visible (or in DOM)
|
|
412
479
|
|
|
480
|
+
```js
|
|
481
|
+
I.dontSeeElement('.modal'); // modal is not shown
|
|
482
|
+
```
|
|
483
|
+
|
|
413
484
|
#### Parameters
|
|
414
485
|
|
|
415
|
-
- `locator`
|
|
486
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|Strict locator.
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
493
|
+
|
|
416
494
|
|
|
417
495
|
### dontSeeElementInDOM
|
|
418
496
|
|
|
419
497
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
420
498
|
|
|
499
|
+
```js
|
|
500
|
+
I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
501
|
+
```
|
|
502
|
+
|
|
421
503
|
#### Parameters
|
|
422
504
|
|
|
423
|
-
- `locator`
|
|
505
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|Strict locator.
|
|
506
|
+
|
|
507
|
+
|
|
424
508
|
|
|
425
509
|
### dontSeeInCurrentUrl
|
|
426
510
|
|
|
@@ -428,33 +512,55 @@ Checks that current url does not contain a provided fragment.
|
|
|
428
512
|
|
|
429
513
|
#### Parameters
|
|
430
514
|
|
|
431
|
-
- `url`
|
|
515
|
+
- `url` [string][8] value to check.
|
|
516
|
+
|
|
517
|
+
|
|
432
518
|
|
|
433
519
|
### dontSeeInField
|
|
434
520
|
|
|
435
521
|
Checks that value of input field or textare doesn't equal to given value
|
|
436
522
|
Opposite to `seeInField`.
|
|
437
523
|
|
|
524
|
+
```js
|
|
525
|
+
I.dontSeeInField('email', 'user@user.com'); // field by name
|
|
526
|
+
I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
527
|
+
```
|
|
528
|
+
|
|
438
529
|
#### Parameters
|
|
439
530
|
|
|
440
|
-
- `field`
|
|
441
|
-
- `value`
|
|
531
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
532
|
+
- `value` [string][8] value to check.
|
|
533
|
+
|
|
534
|
+
|
|
442
535
|
|
|
443
536
|
### dontSeeInSource
|
|
444
537
|
|
|
445
538
|
Checks that the current page does not contains the given string in its raw source code.
|
|
446
539
|
|
|
540
|
+
```js
|
|
541
|
+
I.dontSeeInSource('<!--'); // no comments in source
|
|
542
|
+
```
|
|
543
|
+
|
|
447
544
|
#### Parameters
|
|
448
545
|
|
|
449
|
-
- `text`
|
|
546
|
+
- `text`
|
|
547
|
+
- `value` [string][8] to check.
|
|
548
|
+
|
|
549
|
+
|
|
450
550
|
|
|
451
551
|
### dontSeeInTitle
|
|
452
552
|
|
|
453
553
|
Checks that title does not contain text.
|
|
454
554
|
|
|
555
|
+
```js
|
|
556
|
+
I.dontSeeInTitle('Error');
|
|
557
|
+
```
|
|
558
|
+
|
|
455
559
|
#### Parameters
|
|
456
560
|
|
|
457
|
-
- `text`
|
|
561
|
+
- `text` [string][8] value to check.
|
|
562
|
+
|
|
563
|
+
|
|
458
564
|
|
|
459
565
|
### doubleClick
|
|
460
566
|
|
|
@@ -470,24 +576,25 @@ I.doubleClick('.btn.edit');
|
|
|
470
576
|
|
|
471
577
|
#### Parameters
|
|
472
578
|
|
|
473
|
-
- `locator`
|
|
474
|
-
- `context`
|
|
579
|
+
- `locator` ([string][8] \| [object][6]) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
580
|
+
- `context` ([string][8] \| [object][6]) (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
586
|
+
|
|
475
587
|
|
|
476
588
|
### downloadFile
|
|
477
589
|
|
|
478
|
-
|
|
479
|
-
File is downloaded by default to output folder.
|
|
480
|
-
If no custom file name is provided, the default name will be used
|
|
590
|
+
This method is depreacted.
|
|
481
591
|
|
|
482
|
-
|
|
483
|
-
I.downloadFile('td[class="text-right file-link"] a', 'thisIsCustomName');
|
|
484
|
-
```
|
|
592
|
+
Please use `handleDownloads()` instead.
|
|
485
593
|
|
|
486
594
|
#### Parameters
|
|
487
595
|
|
|
488
|
-
- `locator`
|
|
596
|
+
- `locator`
|
|
489
597
|
- `customName`
|
|
490
|
-
- `string` custom file name.
|
|
491
598
|
|
|
492
599
|
### dragAndDrop
|
|
493
600
|
|
|
@@ -499,8 +606,10 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
499
606
|
|
|
500
607
|
#### Parameters
|
|
501
608
|
|
|
502
|
-
- `srcElement`
|
|
503
|
-
- `destElement`
|
|
609
|
+
- `srcElement` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
610
|
+
- `destElement` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
611
|
+
|
|
612
|
+
|
|
504
613
|
|
|
505
614
|
### dragSlider
|
|
506
615
|
|
|
@@ -514,19 +623,26 @@ I.dragSlider('#slider', -70);
|
|
|
514
623
|
|
|
515
624
|
#### Parameters
|
|
516
625
|
|
|
517
|
-
- `locator`
|
|
518
|
-
- `offsetX`
|
|
626
|
+
- `locator` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
627
|
+
- `offsetX` [number][9] position to drag.
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
634
|
+
|
|
519
635
|
|
|
520
636
|
### executeAsyncScript
|
|
521
637
|
|
|
522
638
|
Executes async script on page.
|
|
523
639
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
524
640
|
|
|
525
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
641
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][10].
|
|
526
642
|
|
|
527
643
|
```js
|
|
528
644
|
I.executeAsyncScript(function(done) {
|
|
529
|
-
Vue.nextTick(done); // waiting for next tick
|
|
645
|
+
Vue.nextTick(done); // waiting for next tick
|
|
530
646
|
});
|
|
531
647
|
```
|
|
532
648
|
|
|
@@ -535,14 +651,14 @@ Additional arguments can be passed as well, while `done` function is always last
|
|
|
535
651
|
|
|
536
652
|
```js
|
|
537
653
|
let val = await I.executeAsyncScript(function(url, done) {
|
|
538
|
-
// in browser context
|
|
539
|
-
$.ajax(url, { success: (data) => done(data); }
|
|
654
|
+
// in browser context
|
|
655
|
+
$.ajax(url, { success: (data) => done(data); }
|
|
540
656
|
}, 'http://ajax.callback.url/');
|
|
541
657
|
```
|
|
542
658
|
|
|
543
659
|
#### Parameters
|
|
544
660
|
|
|
545
|
-
- `fn`
|
|
661
|
+
- `fn` ([string][8] \| [function][11]) function to be executed in browser context.
|
|
546
662
|
|
|
547
663
|
### executeScript
|
|
548
664
|
|
|
@@ -556,8 +672,8 @@ Example with jQuery DatePicker:
|
|
|
556
672
|
```js
|
|
557
673
|
// change date of jQuery DatePicker
|
|
558
674
|
I.executeScript(function() {
|
|
559
|
-
// now we are inside browser context
|
|
560
|
-
$('date').datetimepicker('setDate', new Date());
|
|
675
|
+
// now we are inside browser context
|
|
676
|
+
$('date').datetimepicker('setDate', new Date());
|
|
561
677
|
});
|
|
562
678
|
```
|
|
563
679
|
|
|
@@ -565,14 +681,14 @@ Can return values. Don't forget to use `await` to get them.
|
|
|
565
681
|
|
|
566
682
|
```js
|
|
567
683
|
let date = await I.executeScript(function(el) {
|
|
568
|
-
// only basic types can be returned
|
|
569
|
-
return $(el).datetimepicker('getDate').toString();
|
|
684
|
+
// only basic types can be returned
|
|
685
|
+
return $(el).datetimepicker('getDate').toString();
|
|
570
686
|
}, '#date'); // passing jquery selector
|
|
571
687
|
```
|
|
572
688
|
|
|
573
689
|
#### Parameters
|
|
574
690
|
|
|
575
|
-
- `fn`
|
|
691
|
+
- `fn` ([string][8] \| [function][11]) function to be executed in browser context.
|
|
576
692
|
|
|
577
693
|
### fillField
|
|
578
694
|
|
|
@@ -592,14 +708,21 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
592
708
|
|
|
593
709
|
#### Parameters
|
|
594
710
|
|
|
595
|
-
- `field`
|
|
596
|
-
- `value`
|
|
711
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
712
|
+
- `value` [string][8] text value to fill.
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
719
|
+
|
|
597
720
|
|
|
598
721
|
### grabAttributeFrom
|
|
599
722
|
|
|
600
723
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
601
724
|
An array as a result will be returned if there are more than one matched element.
|
|
602
|
-
Resumes test execution, so
|
|
725
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
603
726
|
|
|
604
727
|
```js
|
|
605
728
|
let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
@@ -607,8 +730,17 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
607
730
|
|
|
608
731
|
#### Parameters
|
|
609
732
|
|
|
610
|
-
- `locator`
|
|
611
|
-
- `attr`
|
|
733
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
734
|
+
- `attr` [string][8] attribute name.
|
|
735
|
+
|
|
736
|
+
Returns [Promise][12]<[string][8]> attribute value
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
743
|
+
|
|
612
744
|
|
|
613
745
|
### grabBrowserLogs
|
|
614
746
|
|
|
@@ -623,7 +755,8 @@ console.log(JSON.stringify(logs))
|
|
|
623
755
|
|
|
624
756
|
Gets a cookie object by name.
|
|
625
757
|
If none provided gets all cookies.
|
|
626
|
-
|
|
758
|
+
|
|
759
|
+
- Resumes test execution, so should be used inside async with `await` operator.
|
|
627
760
|
|
|
628
761
|
```js
|
|
629
762
|
let cookie = await I.grabCookie('auth');
|
|
@@ -632,12 +765,16 @@ assert(cookie.value, '123456');
|
|
|
632
765
|
|
|
633
766
|
#### Parameters
|
|
634
767
|
|
|
635
|
-
- `name`
|
|
768
|
+
- `name` cookie name.
|
|
769
|
+
|
|
770
|
+
Returns [Promise][12]<[string][8]> attribute value
|
|
771
|
+
|
|
772
|
+
Returns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
636
773
|
|
|
637
774
|
### grabCssPropertyFrom
|
|
638
775
|
|
|
639
776
|
Grab CSS property for given locator
|
|
640
|
-
Resumes test execution, so
|
|
777
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
641
778
|
|
|
642
779
|
```js
|
|
643
780
|
const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
@@ -645,8 +782,17 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
645
782
|
|
|
646
783
|
#### Parameters
|
|
647
784
|
|
|
648
|
-
- `locator`
|
|
649
|
-
- `cssProperty`
|
|
785
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
786
|
+
- `cssProperty` [string][8] CSS property name.
|
|
787
|
+
|
|
788
|
+
Returns [Promise][12]<[string][8]> CSS value
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
795
|
+
|
|
650
796
|
|
|
651
797
|
### grabCurrentUrl
|
|
652
798
|
|
|
@@ -658,10 +804,40 @@ let url = await I.grabCurrentUrl();
|
|
|
658
804
|
console.log(`Current URL is [${url}]`);
|
|
659
805
|
```
|
|
660
806
|
|
|
807
|
+
Returns [Promise][12]<[string][8]> current URL
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
### grabDataFromPerformanceTiming
|
|
812
|
+
|
|
813
|
+
Grab the data from performance timing using Navigation Timing API.
|
|
814
|
+
The returned data will contain following things in ms:
|
|
815
|
+
|
|
816
|
+
- responseEnd,
|
|
817
|
+
- domInteractive,
|
|
818
|
+
- domContentLoadedEventEnd,
|
|
819
|
+
- loadEventEnd
|
|
820
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
821
|
+
|
|
822
|
+
```js
|
|
823
|
+
await I.amOnPage('https://example.com');
|
|
824
|
+
let data = await I.grabDataFromPerformanceTiming();
|
|
825
|
+
//Returned data
|
|
826
|
+
{ // all results are in [ms]
|
|
827
|
+
responseEnd: 23,
|
|
828
|
+
domInteractive: 44,
|
|
829
|
+
domContentLoadedEventEnd: 196,
|
|
830
|
+
loadEventEnd: 241
|
|
831
|
+
}
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
661
837
|
### grabHTMLFrom
|
|
662
838
|
|
|
663
839
|
Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
|
|
664
|
-
Resumes test execution, so
|
|
840
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
665
841
|
If more than one element is found - an array of HTMLs returned.
|
|
666
842
|
|
|
667
843
|
```js
|
|
@@ -672,35 +848,56 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
672
848
|
|
|
673
849
|
- `locator` element located by CSS|XPath|strict locator.
|
|
674
850
|
|
|
851
|
+
Returns [Promise][12]<[string][8]> HTML code for an element
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
675
855
|
### grabNumberOfOpenTabs
|
|
676
856
|
|
|
677
857
|
Grab number of open tabs.
|
|
678
858
|
|
|
679
859
|
```js
|
|
680
|
-
I.grabNumberOfOpenTabs();
|
|
860
|
+
let tabs = await I.grabNumberOfOpenTabs();
|
|
681
861
|
```
|
|
682
862
|
|
|
863
|
+
Returns [Promise][12]<[number][9]> number of open tabs
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
|
|
683
867
|
### grabNumberOfVisibleElements
|
|
684
868
|
|
|
685
869
|
Grab number of visible elements by locator.
|
|
686
870
|
|
|
687
871
|
```js
|
|
688
|
-
I.grabNumberOfVisibleElements('p');
|
|
872
|
+
let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
689
873
|
```
|
|
690
874
|
|
|
691
875
|
#### Parameters
|
|
692
876
|
|
|
693
|
-
- `locator`
|
|
877
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
878
|
+
|
|
879
|
+
Returns [Promise][12]<[number][9]> number of visible elements
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
886
|
+
|
|
694
887
|
|
|
695
888
|
### grabPageScrollPosition
|
|
696
889
|
|
|
697
890
|
Retrieves a page scroll position and returns it to test.
|
|
698
|
-
Resumes test execution, so
|
|
891
|
+
Resumes test execution, so should be used inside an async function with `await` operator.
|
|
699
892
|
|
|
700
893
|
```js
|
|
701
894
|
let { x, y } = await I.grabPageScrollPosition();
|
|
702
895
|
```
|
|
703
896
|
|
|
897
|
+
Returns [Promise][12]<[object][6]> scroll position
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
704
901
|
### grabPopupText
|
|
705
902
|
|
|
706
903
|
Grab the text within the popup. If no popup is visible then it will return null
|
|
@@ -718,10 +915,14 @@ Resumes test execution, so should be used inside an async function.
|
|
|
718
915
|
let pageSource = await I.grabSource();
|
|
719
916
|
```
|
|
720
917
|
|
|
918
|
+
Returns [Promise][12]<[string][8]> source code
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
721
922
|
### grabTextFrom
|
|
722
923
|
|
|
723
924
|
Retrieves a text from an element located by CSS or XPath and returns it to test.
|
|
724
|
-
Resumes test execution, so
|
|
925
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
725
926
|
|
|
726
927
|
```js
|
|
727
928
|
let pin = await I.grabTextFrom('#pin');
|
|
@@ -733,19 +934,32 @@ If multiple elements found returns an array of texts.
|
|
|
733
934
|
|
|
734
935
|
- `locator` element located by CSS|XPath|strict locator.
|
|
735
936
|
|
|
937
|
+
Returns [Promise][12]<[string][8]> attribute value
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
944
|
+
|
|
945
|
+
|
|
736
946
|
### grabTitle
|
|
737
947
|
|
|
738
948
|
Retrieves a page title and returns it to test.
|
|
739
|
-
Resumes test execution, so
|
|
949
|
+
Resumes test execution, so should be used inside async with `await` operator.
|
|
740
950
|
|
|
741
951
|
```js
|
|
742
952
|
let title = await I.grabTitle();
|
|
743
953
|
```
|
|
744
954
|
|
|
955
|
+
Returns [Promise][12]<[string][8]> title
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
745
959
|
### grabValueFrom
|
|
746
960
|
|
|
747
961
|
Retrieves a value from a form element located by CSS or XPath and returns it to test.
|
|
748
|
-
Resumes test execution, so
|
|
962
|
+
Resumes test execution, so should be used inside async function with `await` operator.
|
|
749
963
|
|
|
750
964
|
```js
|
|
751
965
|
let email = await I.grabValueFrom('input[name=email]');
|
|
@@ -753,7 +967,30 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
753
967
|
|
|
754
968
|
#### Parameters
|
|
755
969
|
|
|
756
|
-
- `locator`
|
|
970
|
+
- `locator` ([string][8] \| [object][6]) field located by label|name|CSS|XPath|strict locator.
|
|
971
|
+
|
|
972
|
+
Returns [Promise][12]<[string][8]> attribute value
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
### handleDownloads
|
|
977
|
+
|
|
978
|
+
Sets a directory to where save files. Allows to test file downloads.
|
|
979
|
+
Should be used with [FileSystem helper][13] to check that file were downloaded correctly.
|
|
980
|
+
|
|
981
|
+
By default files are saved to `output/downloads`.
|
|
982
|
+
This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
983
|
+
|
|
984
|
+
```js
|
|
985
|
+
I.handleDownloads();
|
|
986
|
+
I.click('Download Avatar');
|
|
987
|
+
I.amInPath('output/downloads');
|
|
988
|
+
I.seeFile('avatar.jpg');
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
#### Parameters
|
|
992
|
+
|
|
993
|
+
- `downloadPath` [string][8] change this parameter to set another directory for saving
|
|
757
994
|
|
|
758
995
|
### haveRequestHeaders
|
|
759
996
|
|
|
@@ -767,7 +1004,7 @@ I.haveRequestHeaders({
|
|
|
767
1004
|
|
|
768
1005
|
#### Parameters
|
|
769
1006
|
|
|
770
|
-
- `customHeaders`
|
|
1007
|
+
- `customHeaders` [object][6] headers to set
|
|
771
1008
|
|
|
772
1009
|
### moveCursorTo
|
|
773
1010
|
|
|
@@ -781,9 +1018,16 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
781
1018
|
|
|
782
1019
|
#### Parameters
|
|
783
1020
|
|
|
784
|
-
- `locator`
|
|
785
|
-
- `offsetX`
|
|
786
|
-
- `offsetY`
|
|
1021
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
1022
|
+
- `offsetX` [number][9] (optional, `0` by default) X-axis offset.
|
|
1023
|
+
- `offsetY` [number][9] (optional, `0` by default) Y-axis offset.
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1030
|
+
|
|
787
1031
|
|
|
788
1032
|
### openNewTab
|
|
789
1033
|
|
|
@@ -796,7 +1040,7 @@ I.openNewTab();
|
|
|
796
1040
|
### pressKey
|
|
797
1041
|
|
|
798
1042
|
Presses a key on a focused element.
|
|
799
|
-
Special keys like 'Enter', 'Control', [etc][
|
|
1043
|
+
Special keys like 'Enter', 'Control', [etc][14]
|
|
800
1044
|
will be replaced with corresponding unicode.
|
|
801
1045
|
If modifier key is used (Control, Command, Alt, Shift) in array, it will be released afterwards.
|
|
802
1046
|
|
|
@@ -807,7 +1051,42 @@ I.pressKey(['Control','a']);
|
|
|
807
1051
|
|
|
808
1052
|
#### Parameters
|
|
809
1053
|
|
|
810
|
-
- `key`
|
|
1054
|
+
- `key` ([string][8] \| [array][15]) key or array of keys to press.
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
[Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
|
|
1060
|
+
|
|
1061
|
+
- `'Add'`,
|
|
1062
|
+
- `'Alt'`,
|
|
1063
|
+
- `'ArrowDown'` or `'Down arrow'`,
|
|
1064
|
+
- `'ArrowLeft'` or `'Left arrow'`,
|
|
1065
|
+
- `'ArrowRight'` or `'Right arrow'`,
|
|
1066
|
+
- `'ArrowUp'` or `'Up arrow'`,
|
|
1067
|
+
- `'Backspace'`,
|
|
1068
|
+
- `'Command'`,
|
|
1069
|
+
- `'Control'`,
|
|
1070
|
+
- `'Del'`,
|
|
1071
|
+
- `'Divide'`,
|
|
1072
|
+
- `'End'`,
|
|
1073
|
+
- `'Enter'`,
|
|
1074
|
+
- `'Equals'`,
|
|
1075
|
+
- `'Escape'`,
|
|
1076
|
+
- `'F1 to F12'`,
|
|
1077
|
+
- `'Home'`,
|
|
1078
|
+
- `'Insert'`,
|
|
1079
|
+
- `'Meta'`,
|
|
1080
|
+
- `'Multiply'`,
|
|
1081
|
+
- `'Numpad 0'` to `'Numpad 9'`,
|
|
1082
|
+
- `'Pagedown'` or `'PageDown'`,
|
|
1083
|
+
- `'Pageup'` or `'PageUp'`,
|
|
1084
|
+
- `'Pause'`,
|
|
1085
|
+
- `'Semicolon'`,
|
|
1086
|
+
- `'Shift'`,
|
|
1087
|
+
- `'Space'`,
|
|
1088
|
+
- `'Subtract'`,
|
|
1089
|
+
- `'Tab'`.
|
|
811
1090
|
|
|
812
1091
|
### refreshPage
|
|
813
1092
|
|
|
@@ -817,6 +1096,9 @@ Reload the current page.
|
|
|
817
1096
|
I.refreshPage();
|
|
818
1097
|
```
|
|
819
1098
|
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
820
1102
|
### resizeWindow
|
|
821
1103
|
|
|
822
1104
|
Resize the current window to provided width and height.
|
|
@@ -824,8 +1106,10 @@ First parameter can be set to `maximize`.
|
|
|
824
1106
|
|
|
825
1107
|
#### Parameters
|
|
826
1108
|
|
|
827
|
-
- `width`
|
|
828
|
-
- `height`
|
|
1109
|
+
- `width` [number][9] width in pixels or `maximize`.
|
|
1110
|
+
- `height` [number][9] height in pixels.
|
|
1111
|
+
|
|
1112
|
+
Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
829
1113
|
Puppeteer does not control the window of a browser so it can't adjust its real size.
|
|
830
1114
|
It also can't maximize a window.
|
|
831
1115
|
|
|
@@ -844,13 +1128,19 @@ I.rightClick('Click me', '.context');
|
|
|
844
1128
|
|
|
845
1129
|
#### Parameters
|
|
846
1130
|
|
|
847
|
-
- `locator`
|
|
848
|
-
- `context`
|
|
1131
|
+
- `locator` ([string][8] \| [object][6]) clickable element located by CSS|XPath|strict locator.
|
|
1132
|
+
- `context` ([string][8] \| [object][6]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1138
|
+
|
|
849
1139
|
|
|
850
1140
|
### saveScreenshot
|
|
851
1141
|
|
|
852
1142
|
Saves a screenshot to ouput folder (set in codecept.json or codecept.conf.js).
|
|
853
|
-
Filename is relative to output folder.
|
|
1143
|
+
Filename is relative to output folder.
|
|
854
1144
|
Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
|
|
855
1145
|
|
|
856
1146
|
```js
|
|
@@ -860,8 +1150,10 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
860
1150
|
|
|
861
1151
|
#### Parameters
|
|
862
1152
|
|
|
863
|
-
- `fileName`
|
|
864
|
-
- `fullPage`
|
|
1153
|
+
- `fileName` [string][8] file name to save.
|
|
1154
|
+
- `fullPage` [boolean][16] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1155
|
+
|
|
1156
|
+
|
|
865
1157
|
|
|
866
1158
|
### scrollPageToBottom
|
|
867
1159
|
|
|
@@ -871,6 +1163,9 @@ Scroll page to the bottom.
|
|
|
871
1163
|
I.scrollPageToBottom();
|
|
872
1164
|
```
|
|
873
1165
|
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
874
1169
|
### scrollPageToTop
|
|
875
1170
|
|
|
876
1171
|
Scroll page to the top.
|
|
@@ -879,6 +1174,9 @@ Scroll page to the top.
|
|
|
879
1174
|
I.scrollPageToTop();
|
|
880
1175
|
```
|
|
881
1176
|
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
|
|
882
1180
|
### scrollTo
|
|
883
1181
|
|
|
884
1182
|
Scrolls to element matched by locator.
|
|
@@ -891,9 +1189,11 @@ I.scrollTo('#submit', 5, 5);
|
|
|
891
1189
|
|
|
892
1190
|
#### Parameters
|
|
893
1191
|
|
|
894
|
-
- `locator`
|
|
895
|
-
- `offsetX`
|
|
896
|
-
- `offsetY`
|
|
1192
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
1193
|
+
- `offsetX` [number][9] (optional, `0` by default) X-axis offset.
|
|
1194
|
+
- `offsetY` [number][9] (optional, `0` by default) Y-axis offset.
|
|
1195
|
+
|
|
1196
|
+
|
|
897
1197
|
|
|
898
1198
|
### see
|
|
899
1199
|
|
|
@@ -908,21 +1208,34 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
908
1208
|
|
|
909
1209
|
#### Parameters
|
|
910
1210
|
|
|
911
|
-
- `text`
|
|
912
|
-
- `context`
|
|
1211
|
+
- `text` [string][8] expected on page.
|
|
1212
|
+
- `context` ([string][8] \| [object][6]) (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1218
|
+
|
|
913
1219
|
|
|
914
1220
|
### seeAttributesOnElements
|
|
915
1221
|
|
|
916
1222
|
Checks that all elements with given locator have given attributes.
|
|
917
1223
|
|
|
918
1224
|
```js
|
|
919
|
-
I.seeAttributesOnElements('//form', {
|
|
1225
|
+
I.seeAttributesOnElements('//form', { method: "post"});
|
|
920
1226
|
```
|
|
921
1227
|
|
|
922
1228
|
#### Parameters
|
|
923
1229
|
|
|
924
|
-
- `locator`
|
|
925
|
-
- `attributes`
|
|
1230
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
1231
|
+
- `attributes` [object][6] attributes and their values to check.
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1238
|
+
|
|
926
1239
|
|
|
927
1240
|
### seeCheckboxIsChecked
|
|
928
1241
|
|
|
@@ -936,7 +1249,9 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
936
1249
|
|
|
937
1250
|
#### Parameters
|
|
938
1251
|
|
|
939
|
-
- `field`
|
|
1252
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
1253
|
+
|
|
1254
|
+
|
|
940
1255
|
|
|
941
1256
|
### seeCookie
|
|
942
1257
|
|
|
@@ -948,7 +1263,9 @@ I.seeCookie('Auth');
|
|
|
948
1263
|
|
|
949
1264
|
#### Parameters
|
|
950
1265
|
|
|
951
|
-
- `name`
|
|
1266
|
+
- `name` [string][8] cookie name.
|
|
1267
|
+
|
|
1268
|
+
|
|
952
1269
|
|
|
953
1270
|
### seeCssPropertiesOnElements
|
|
954
1271
|
|
|
@@ -960,8 +1277,15 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
960
1277
|
|
|
961
1278
|
#### Parameters
|
|
962
1279
|
|
|
963
|
-
- `locator`
|
|
964
|
-
- `cssProperties`
|
|
1280
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
1281
|
+
- `cssProperties` [object][6] object with CSS properties and their values to check.
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1288
|
+
|
|
965
1289
|
|
|
966
1290
|
### seeCurrentUrlEquals
|
|
967
1291
|
|
|
@@ -976,7 +1300,9 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
976
1300
|
|
|
977
1301
|
#### Parameters
|
|
978
1302
|
|
|
979
|
-
- `url`
|
|
1303
|
+
- `url` [string][8] value to check.
|
|
1304
|
+
|
|
1305
|
+
|
|
980
1306
|
|
|
981
1307
|
### seeElement
|
|
982
1308
|
|
|
@@ -989,7 +1315,14 @@ I.seeElement('#modal');
|
|
|
989
1315
|
|
|
990
1316
|
#### Parameters
|
|
991
1317
|
|
|
992
|
-
- `locator`
|
|
1318
|
+
- `locator` ([string][8] \| [object][6]) located by CSS|XPath|strict locator.
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1325
|
+
|
|
993
1326
|
|
|
994
1327
|
### seeElementInDOM
|
|
995
1328
|
|
|
@@ -1002,7 +1335,9 @@ I.seeElementInDOM('#modal');
|
|
|
1002
1335
|
|
|
1003
1336
|
#### Parameters
|
|
1004
1337
|
|
|
1005
|
-
- `locator`
|
|
1338
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1339
|
+
|
|
1340
|
+
|
|
1006
1341
|
|
|
1007
1342
|
### seeInCurrentUrl
|
|
1008
1343
|
|
|
@@ -1014,7 +1349,9 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1014
1349
|
|
|
1015
1350
|
#### Parameters
|
|
1016
1351
|
|
|
1017
|
-
- `url`
|
|
1352
|
+
- `url` [string][8] a fragment to check
|
|
1353
|
+
|
|
1354
|
+
|
|
1018
1355
|
|
|
1019
1356
|
### seeInField
|
|
1020
1357
|
|
|
@@ -1030,8 +1367,10 @@ I.seeInField('#searchform input','Search');
|
|
|
1030
1367
|
|
|
1031
1368
|
#### Parameters
|
|
1032
1369
|
|
|
1033
|
-
- `field`
|
|
1034
|
-
- `value`
|
|
1370
|
+
- `field` ([string][8] \| [object][6]) located by label|name|CSS|XPath|strict locator.
|
|
1371
|
+
- `value` [string][8] value to check.
|
|
1372
|
+
|
|
1373
|
+
|
|
1035
1374
|
|
|
1036
1375
|
### seeInPopup
|
|
1037
1376
|
|
|
@@ -1052,19 +1391,27 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1052
1391
|
|
|
1053
1392
|
#### Parameters
|
|
1054
1393
|
|
|
1055
|
-
- `text`
|
|
1394
|
+
- `text` [string][8] value to check.
|
|
1395
|
+
|
|
1396
|
+
|
|
1056
1397
|
|
|
1057
1398
|
### seeInTitle
|
|
1058
1399
|
|
|
1059
1400
|
Checks that title contains text.
|
|
1060
1401
|
|
|
1402
|
+
```js
|
|
1403
|
+
I.seeInTitle('Home Page');
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1061
1406
|
#### Parameters
|
|
1062
1407
|
|
|
1063
|
-
- `text`
|
|
1408
|
+
- `text` [string][8] text value to check.
|
|
1409
|
+
|
|
1410
|
+
|
|
1064
1411
|
|
|
1065
1412
|
### seeNumberOfElements
|
|
1066
1413
|
|
|
1067
|
-
|
|
1414
|
+
Asserts that an element appears a given number of times in the DOM.
|
|
1068
1415
|
Element is located by label or name or CSS or XPath.
|
|
1069
1416
|
|
|
1070
1417
|
```js
|
|
@@ -1073,8 +1420,14 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1073
1420
|
|
|
1074
1421
|
#### Parameters
|
|
1075
1422
|
|
|
1076
|
-
- `
|
|
1077
|
-
- `num`
|
|
1423
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1424
|
+
- `num` [number][9] number of elements.
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
1429
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1430
|
+
|
|
1078
1431
|
|
|
1079
1432
|
### seeNumberOfVisibleElements
|
|
1080
1433
|
|
|
@@ -1087,8 +1440,14 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1087
1440
|
|
|
1088
1441
|
#### Parameters
|
|
1089
1442
|
|
|
1090
|
-
- `locator`
|
|
1091
|
-
- `num`
|
|
1443
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1444
|
+
- `num` [number][9] number of elements.
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1450
|
+
|
|
1092
1451
|
|
|
1093
1452
|
### seeTextEquals
|
|
1094
1453
|
|
|
@@ -1101,7 +1460,7 @@ I.seeTextEquals('text', 'h1');
|
|
|
1101
1460
|
#### Parameters
|
|
1102
1461
|
|
|
1103
1462
|
- `text`
|
|
1104
|
-
- `context`
|
|
1463
|
+
- `context`
|
|
1105
1464
|
|
|
1106
1465
|
### seeTitleEquals
|
|
1107
1466
|
|
|
@@ -1138,8 +1497,10 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1138
1497
|
|
|
1139
1498
|
#### Parameters
|
|
1140
1499
|
|
|
1141
|
-
- `select`
|
|
1142
|
-
- `option`
|
|
1500
|
+
- `select` ([string][8] \| [object][6]) field located by label|name|CSS|XPath|strict locator.
|
|
1501
|
+
- `option` ([string][8] \| [array][15]) visible text or value of option.
|
|
1502
|
+
|
|
1503
|
+
|
|
1143
1504
|
|
|
1144
1505
|
### setCookie
|
|
1145
1506
|
|
|
@@ -1151,15 +1512,24 @@ I.setCookie({name: 'auth', value: true});
|
|
|
1151
1512
|
|
|
1152
1513
|
#### Parameters
|
|
1153
1514
|
|
|
1154
|
-
- `cookie`
|
|
1515
|
+
- `cookie` [object][6] a cookie object.
|
|
1516
|
+
|
|
1517
|
+
|
|
1155
1518
|
|
|
1156
1519
|
### switchTo
|
|
1157
1520
|
|
|
1158
1521
|
Switches frame or in case of null locator reverts to parent.
|
|
1159
1522
|
|
|
1523
|
+
```js
|
|
1524
|
+
I.switchTo('iframe'); // switch to first iframe
|
|
1525
|
+
I.switchTo(); // switch back to main page
|
|
1526
|
+
```
|
|
1527
|
+
|
|
1160
1528
|
#### Parameters
|
|
1161
1529
|
|
|
1162
|
-
- `locator`
|
|
1530
|
+
- `locator` ([string][8] \| [object][6]) (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1531
|
+
|
|
1532
|
+
|
|
1163
1533
|
|
|
1164
1534
|
### switchToNextTab
|
|
1165
1535
|
|
|
@@ -1172,7 +1542,7 @@ I.switchToNextTab(2);
|
|
|
1172
1542
|
|
|
1173
1543
|
#### Parameters
|
|
1174
1544
|
|
|
1175
|
-
- `num`
|
|
1545
|
+
- `num` [number][9]
|
|
1176
1546
|
|
|
1177
1547
|
### switchToPreviousTab
|
|
1178
1548
|
|
|
@@ -1185,7 +1555,7 @@ I.switchToPreviousTab(2);
|
|
|
1185
1555
|
|
|
1186
1556
|
#### Parameters
|
|
1187
1557
|
|
|
1188
|
-
- `num`
|
|
1558
|
+
- `num` [number][9]
|
|
1189
1559
|
|
|
1190
1560
|
### uncheckOption
|
|
1191
1561
|
|
|
@@ -1202,8 +1572,10 @@ I.uncheckOption('agree', '//form');
|
|
|
1202
1572
|
|
|
1203
1573
|
#### Parameters
|
|
1204
1574
|
|
|
1205
|
-
- `field`
|
|
1206
|
-
- `context`
|
|
1575
|
+
- `field` ([string][8] \| [object][6]) checkbox located by label | name | CSS | XPath | strict locator.
|
|
1576
|
+
- `context` [string][8] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1577
|
+
|
|
1578
|
+
|
|
1207
1579
|
|
|
1208
1580
|
### wait
|
|
1209
1581
|
|
|
@@ -1215,19 +1587,25 @@ I.wait(2); // wait 2 secs
|
|
|
1215
1587
|
|
|
1216
1588
|
#### Parameters
|
|
1217
1589
|
|
|
1218
|
-
- `sec`
|
|
1590
|
+
- `sec` [number][9] number of second to wait.
|
|
1591
|
+
|
|
1592
|
+
|
|
1219
1593
|
|
|
1220
1594
|
### waitForDetached
|
|
1221
1595
|
|
|
1222
1596
|
Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
|
|
1223
1597
|
Element can be located by CSS or XPath.
|
|
1224
1598
|
|
|
1225
|
-
|
|
1599
|
+
```js
|
|
1600
|
+
I.waitForDetached('#popup');
|
|
1601
|
+
```
|
|
1226
1602
|
|
|
1227
1603
|
#### Parameters
|
|
1228
1604
|
|
|
1229
|
-
- `locator`
|
|
1230
|
-
- `sec`
|
|
1605
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1606
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1607
|
+
|
|
1608
|
+
|
|
1231
1609
|
|
|
1232
1610
|
### waitForElement
|
|
1233
1611
|
|
|
@@ -1241,8 +1619,15 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1241
1619
|
|
|
1242
1620
|
#### Parameters
|
|
1243
1621
|
|
|
1244
|
-
- `locator`
|
|
1245
|
-
- `sec`
|
|
1622
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1623
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1630
|
+
|
|
1246
1631
|
|
|
1247
1632
|
### waitForEnabled
|
|
1248
1633
|
|
|
@@ -1251,8 +1636,10 @@ Element can be located by CSS or XPath.
|
|
|
1251
1636
|
|
|
1252
1637
|
#### Parameters
|
|
1253
1638
|
|
|
1254
|
-
- `locator`
|
|
1639
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1255
1640
|
- `sec` (optional) time in seconds to wait, 1 by default.
|
|
1641
|
+
|
|
1642
|
+
|
|
1256
1643
|
|
|
1257
1644
|
### waitForFunction
|
|
1258
1645
|
|
|
@@ -1271,31 +1658,37 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1271
1658
|
|
|
1272
1659
|
#### Parameters
|
|
1273
1660
|
|
|
1274
|
-
- `fn`
|
|
1275
|
-
- `argsOrSec`
|
|
1276
|
-
- `sec`
|
|
1661
|
+
- `fn` ([string][8] \| [function][11]) to be executed in browser context.
|
|
1662
|
+
- `argsOrSec` ([array][15] \| [number][9]) (optional, `1` by default) arguments for function or seconds.
|
|
1663
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1664
|
+
|
|
1665
|
+
|
|
1277
1666
|
|
|
1278
1667
|
### waitForInvisible
|
|
1279
1668
|
|
|
1280
1669
|
Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
|
|
1281
1670
|
Element can be located by CSS or XPath.
|
|
1282
1671
|
|
|
1283
|
-
|
|
1672
|
+
```js
|
|
1673
|
+
I.waitForInvisible('#popup');
|
|
1674
|
+
```
|
|
1284
1675
|
|
|
1285
1676
|
#### Parameters
|
|
1286
1677
|
|
|
1287
|
-
- `locator`
|
|
1288
|
-
- `sec`
|
|
1678
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1679
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1680
|
+
|
|
1681
|
+
|
|
1289
1682
|
|
|
1290
1683
|
### waitForNavigation
|
|
1291
1684
|
|
|
1292
1685
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1293
1686
|
|
|
1294
|
-
See [Pupeteer's reference][
|
|
1687
|
+
See [Pupeteer's reference][3]
|
|
1295
1688
|
|
|
1296
1689
|
#### Parameters
|
|
1297
1690
|
|
|
1298
|
-
- `opts`
|
|
1691
|
+
- `opts` any
|
|
1299
1692
|
|
|
1300
1693
|
### waitForRequest
|
|
1301
1694
|
|
|
@@ -1308,8 +1701,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1308
1701
|
|
|
1309
1702
|
#### Parameters
|
|
1310
1703
|
|
|
1311
|
-
- `urlOrPredicate`
|
|
1312
|
-
- `sec`
|
|
1704
|
+
- `urlOrPredicate` ([string][8] \| [function][11])
|
|
1705
|
+
- `sec` [number][9]? seconds to wait
|
|
1313
1706
|
|
|
1314
1707
|
### waitForResponse
|
|
1315
1708
|
|
|
@@ -1322,8 +1715,8 @@ I.waitForResponse(request => request.url() === 'http://example.com' && request.m
|
|
|
1322
1715
|
|
|
1323
1716
|
#### Parameters
|
|
1324
1717
|
|
|
1325
|
-
- `urlOrPredicate`
|
|
1326
|
-
- `sec`
|
|
1718
|
+
- `urlOrPredicate` ([string][8] \| [function][11])
|
|
1719
|
+
- `sec` [number][9]? number of seconds to wait
|
|
1327
1720
|
|
|
1328
1721
|
### waitForText
|
|
1329
1722
|
|
|
@@ -1338,9 +1731,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1338
1731
|
|
|
1339
1732
|
#### Parameters
|
|
1340
1733
|
|
|
1341
|
-
- `text`
|
|
1342
|
-
- `sec`
|
|
1343
|
-
- `context`
|
|
1734
|
+
- `text` [string][8] to wait for.
|
|
1735
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1736
|
+
- `context` ([string][8] \| [object][6]) (optional) element located by CSS|XPath|strict locator.
|
|
1737
|
+
|
|
1738
|
+
|
|
1344
1739
|
|
|
1345
1740
|
### waitForValue
|
|
1346
1741
|
|
|
@@ -1352,21 +1747,27 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1352
1747
|
|
|
1353
1748
|
#### Parameters
|
|
1354
1749
|
|
|
1355
|
-
- `field`
|
|
1356
|
-
- `value`
|
|
1357
|
-
- `sec`
|
|
1750
|
+
- `field` ([string][8] \| [object][6]) input field.
|
|
1751
|
+
- `value` [string][8] expected value.
|
|
1752
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1753
|
+
|
|
1754
|
+
|
|
1358
1755
|
|
|
1359
1756
|
### waitForVisible
|
|
1360
1757
|
|
|
1361
1758
|
Waits for an element to become visible on a page (by default waits for 1sec).
|
|
1362
1759
|
Element can be located by CSS or XPath.
|
|
1363
1760
|
|
|
1364
|
-
|
|
1761
|
+
```js
|
|
1762
|
+
I.waitForVisible('#popup');
|
|
1763
|
+
```
|
|
1365
1764
|
|
|
1366
1765
|
#### Parameters
|
|
1367
1766
|
|
|
1368
|
-
- `locator`
|
|
1369
|
-
- `sec`
|
|
1767
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1768
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1769
|
+
|
|
1770
|
+
This method accepts [React selectors][17].
|
|
1370
1771
|
|
|
1371
1772
|
### waitInUrl
|
|
1372
1773
|
|
|
@@ -1378,8 +1779,10 @@ I.waitInUrl('/info', 2);
|
|
|
1378
1779
|
|
|
1379
1780
|
#### Parameters
|
|
1380
1781
|
|
|
1381
|
-
- `urlPart`
|
|
1382
|
-
- `sec`
|
|
1782
|
+
- `urlPart` [string][8] value to check.
|
|
1783
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1784
|
+
|
|
1785
|
+
|
|
1383
1786
|
|
|
1384
1787
|
### waitNumberOfVisibleElements
|
|
1385
1788
|
|
|
@@ -1391,21 +1794,32 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1391
1794
|
|
|
1392
1795
|
#### Parameters
|
|
1393
1796
|
|
|
1394
|
-
- `locator`
|
|
1395
|
-
- `num`
|
|
1396
|
-
- `sec`
|
|
1797
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1798
|
+
- `num` [number][9] number of elements.
|
|
1799
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1800
|
+
|
|
1801
|
+
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
This action supports [React locators](https://codecept.io/react#locators)
|
|
1806
|
+
|
|
1397
1807
|
|
|
1398
1808
|
### waitToHide
|
|
1399
1809
|
|
|
1400
1810
|
Waits for an element to hide (by default waits for 1sec).
|
|
1401
1811
|
Element can be located by CSS or XPath.
|
|
1402
1812
|
|
|
1403
|
-
|
|
1813
|
+
```js
|
|
1814
|
+
I.waitToHide('#popup');
|
|
1815
|
+
```
|
|
1404
1816
|
|
|
1405
1817
|
#### Parameters
|
|
1406
1818
|
|
|
1407
|
-
- `locator`
|
|
1408
|
-
- `sec`
|
|
1819
|
+
- `locator` ([string][8] \| [object][6]) element located by CSS|XPath|strict locator.
|
|
1820
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1821
|
+
|
|
1822
|
+
|
|
1409
1823
|
|
|
1410
1824
|
### waitUntil
|
|
1411
1825
|
|
|
@@ -1418,9 +1832,11 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1418
1832
|
|
|
1419
1833
|
#### Parameters
|
|
1420
1834
|
|
|
1421
|
-
- `fn`
|
|
1422
|
-
- `sec`
|
|
1423
|
-
- `timeoutMsg`
|
|
1835
|
+
- `fn` ([function][11] \| [string][8]) function which is executed in browser context.
|
|
1836
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1837
|
+
- `timeoutMsg` [string][8] message to show in case of timeout fail.
|
|
1838
|
+
|
|
1839
|
+
|
|
1424
1840
|
|
|
1425
1841
|
### waitUrlEquals
|
|
1426
1842
|
|
|
@@ -1433,21 +1849,41 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1433
1849
|
|
|
1434
1850
|
#### Parameters
|
|
1435
1851
|
|
|
1436
|
-
- `urlPart`
|
|
1437
|
-
- `sec`
|
|
1852
|
+
- `urlPart` [string][8] value to check.
|
|
1853
|
+
- `sec` [number][9] (optional, `1` by default) time in seconds to wait
|
|
1854
|
+
|
|
1855
|
+
|
|
1438
1856
|
|
|
1439
1857
|
[1]: https://github.com/GoogleChrome/puppeteer
|
|
1440
1858
|
|
|
1441
|
-
[2]: https://
|
|
1859
|
+
[2]: https://codecept.io/helpers/Puppeteer-firefox
|
|
1860
|
+
|
|
1861
|
+
[3]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions
|
|
1862
|
+
|
|
1863
|
+
[4]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
|
|
1864
|
+
|
|
1865
|
+
[5]: https://chromedevtools.github.io/devtools-protocol/#how-do-i-access-the-browser-target
|
|
1866
|
+
|
|
1867
|
+
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1868
|
+
|
|
1869
|
+
[7]: http://jster.net/category/windows-modals-popups
|
|
1870
|
+
|
|
1871
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1872
|
+
|
|
1873
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1874
|
+
|
|
1875
|
+
[10]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
1876
|
+
|
|
1877
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1442
1878
|
|
|
1443
|
-
[
|
|
1879
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1444
1880
|
|
|
1445
|
-
[
|
|
1881
|
+
[13]: https://codecept.io/helpers/FileSystem
|
|
1446
1882
|
|
|
1447
|
-
[
|
|
1883
|
+
[14]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
|
|
1448
1884
|
|
|
1449
|
-
[
|
|
1885
|
+
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1450
1886
|
|
|
1451
|
-
[
|
|
1887
|
+
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1452
1888
|
|
|
1453
|
-
[
|
|
1889
|
+
[17]: https://codecept.io/react
|