codeceptjs 3.3.0 → 3.3.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 +39 -1
- package/README.md +26 -0
- package/docs/api.md +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +26 -11
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +52 -23
- package/docs/build/Playwright.js +126 -48
- package/docs/build/Protractor.js +70 -32
- package/docs/build/Puppeteer.js +78 -35
- package/docs/build/REST.js +4 -1
- package/docs/build/TestCafe.js +53 -22
- package/docs/build/WebDriver.js +115 -65
- package/docs/changelog.md +39 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +113 -15
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/Nightmare.md +131 -29
- package/docs/helpers/Playwright.md +424 -215
- package/docs/helpers/Puppeteer.md +229 -92
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +166 -62
- package/docs/helpers/WebDriver.md +254 -103
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +7 -2
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +49 -13
- package/lib/helper/REST.js +4 -1
- package/lib/helper/WebDriver.js +6 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +3 -3
- package/typings/types.d.ts +558 -607
|
@@ -56,6 +56,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
56
56
|
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
57
57
|
- `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
58
58
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
59
|
+
- `colorScheme`: (optional) default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
59
60
|
- `userAgent`: (optional) user-agent string.
|
|
60
61
|
- `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
61
62
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
@@ -174,7 +175,7 @@ const { devices } = require('playwright');
|
|
|
174
175
|
}
|
|
175
176
|
```
|
|
176
177
|
|
|
177
|
-
#### Example #7: Launch test with a
|
|
178
|
+
#### Example #7: Launch test with a specific user locale
|
|
178
179
|
|
|
179
180
|
```js
|
|
180
181
|
{
|
|
@@ -187,6 +188,19 @@ const { devices } = require('playwright');
|
|
|
187
188
|
}
|
|
188
189
|
```
|
|
189
190
|
|
|
191
|
+
- #### Example #8: Launch test with a specific color scheme
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
{
|
|
195
|
+
helpers: {
|
|
196
|
+
Playwright : {
|
|
197
|
+
url: "http://localhost",
|
|
198
|
+
colorScheme: "dark",
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
190
204
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
191
205
|
|
|
192
206
|
## Access From Helpers
|
|
@@ -219,6 +233,9 @@ Add the 'dialog' event listener to a page
|
|
|
219
233
|
|
|
220
234
|
- `page`
|
|
221
235
|
|
|
236
|
+
Returns **[Promise][10]<any>** The popup listener handles the dialog with the predefined action when it appears on the page.
|
|
237
|
+
It also saves a reference to the object which is used in seeInPopup.
|
|
238
|
+
|
|
222
239
|
### _contextLocator
|
|
223
240
|
|
|
224
241
|
Grab Locator if called within Context
|
|
@@ -231,6 +248,8 @@ Grab Locator if called within Context
|
|
|
231
248
|
|
|
232
249
|
Gets page URL including hash.
|
|
233
250
|
|
|
251
|
+
Returns **[Promise][10]<any>**
|
|
252
|
+
|
|
234
253
|
### _locate
|
|
235
254
|
|
|
236
255
|
Get elements by different locator types, including strict locator
|
|
@@ -244,6 +263,8 @@ const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
|
244
263
|
|
|
245
264
|
- `locator`
|
|
246
265
|
|
|
266
|
+
Returns **[Promise][10]<any>**
|
|
267
|
+
|
|
247
268
|
### _locateCheckable
|
|
248
269
|
|
|
249
270
|
Find a checkbox by providing human readable text:
|
|
@@ -258,6 +279,8 @@ this.helpers['Playwright']._locateCheckable('I agree with terms and conditions')
|
|
|
258
279
|
- `locator`
|
|
259
280
|
- `providedContext`
|
|
260
281
|
|
|
282
|
+
Returns **[Promise][10]<any>**
|
|
283
|
+
|
|
261
284
|
### _locateClickable
|
|
262
285
|
|
|
263
286
|
Find a clickable element by providing human readable text:
|
|
@@ -270,6 +293,8 @@ this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
|
270
293
|
|
|
271
294
|
- `locator`
|
|
272
295
|
|
|
296
|
+
Returns **[Promise][10]<any>**
|
|
297
|
+
|
|
273
298
|
### _locateFields
|
|
274
299
|
|
|
275
300
|
Find field elements by providing human readable text:
|
|
@@ -282,19 +307,25 @@ this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
|
282
307
|
|
|
283
308
|
- `locator`
|
|
284
309
|
|
|
310
|
+
Returns **[Promise][10]<any>**
|
|
311
|
+
|
|
285
312
|
### _setPage
|
|
286
313
|
|
|
287
314
|
Set current page
|
|
288
315
|
|
|
289
316
|
#### Parameters
|
|
290
317
|
|
|
291
|
-
- `page` **[object][
|
|
318
|
+
- `page` **[object][11]** page to set
|
|
319
|
+
|
|
320
|
+
Returns **[Promise][10]<any>**
|
|
292
321
|
|
|
293
322
|
### acceptPopup
|
|
294
323
|
|
|
295
324
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
296
325
|
Don't confuse popups with modal windows, as created by [various
|
|
297
|
-
libraries][
|
|
326
|
+
libraries][12].
|
|
327
|
+
|
|
328
|
+
Returns **[Promise][10]<any>**
|
|
298
329
|
|
|
299
330
|
### amAcceptingPopups
|
|
300
331
|
|
|
@@ -307,6 +338,8 @@ I.click('#triggerPopup');
|
|
|
307
338
|
I.acceptPopup();
|
|
308
339
|
```
|
|
309
340
|
|
|
341
|
+
Returns **[Promise][10]<any>**
|
|
342
|
+
|
|
310
343
|
### amCancellingPopups
|
|
311
344
|
|
|
312
345
|
Set the automatic popup response to Cancel/Dismiss.
|
|
@@ -318,6 +351,8 @@ I.click('#triggerPopup');
|
|
|
318
351
|
I.cancelPopup();
|
|
319
352
|
```
|
|
320
353
|
|
|
354
|
+
Returns **[Promise][10]<any>**
|
|
355
|
+
|
|
321
356
|
### amOnPage
|
|
322
357
|
|
|
323
358
|
Opens a web page in a browser. Requires relative or absolute url.
|
|
@@ -331,7 +366,9 @@ I.amOnPage('/login'); // opens a login page
|
|
|
331
366
|
|
|
332
367
|
#### Parameters
|
|
333
368
|
|
|
334
|
-
- `url` **[string][
|
|
369
|
+
- `url` **[string][13]** url path or global url.
|
|
370
|
+
|
|
371
|
+
Returns **[Promise][10]<any>**
|
|
335
372
|
|
|
336
373
|
### appendField
|
|
337
374
|
|
|
@@ -344,8 +381,10 @@ I.appendField('#myTextField', 'appended');
|
|
|
344
381
|
|
|
345
382
|
#### Parameters
|
|
346
383
|
|
|
347
|
-
- `field` **([string][
|
|
348
|
-
- `value` **[string][
|
|
384
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator
|
|
385
|
+
- `value` **[string][13]** text value to append.
|
|
386
|
+
|
|
387
|
+
Returns **[Promise][10]<any>**
|
|
349
388
|
|
|
350
389
|
### attachFile
|
|
351
390
|
|
|
@@ -360,13 +399,17 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
360
399
|
|
|
361
400
|
#### Parameters
|
|
362
401
|
|
|
363
|
-
- `locator` **([string][
|
|
364
|
-
- `pathToFile` **[string][
|
|
402
|
+
- `locator` **([string][13] | [object][11])** field located by label|name|CSS|XPath|strict locator.
|
|
403
|
+
- `pathToFile` **[string][13]** local file path relative to codecept.json config file.
|
|
404
|
+
|
|
405
|
+
Returns **[Promise][10]<any>**
|
|
365
406
|
|
|
366
407
|
### cancelPopup
|
|
367
408
|
|
|
368
409
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
369
410
|
|
|
411
|
+
Returns **[Promise][10]<any>**
|
|
412
|
+
|
|
370
413
|
### checkOption
|
|
371
414
|
|
|
372
415
|
Selects a checkbox or radio button.
|
|
@@ -382,13 +425,15 @@ I.checkOption('agree', '//form');
|
|
|
382
425
|
|
|
383
426
|
#### Parameters
|
|
384
427
|
|
|
385
|
-
- `field` **([string][
|
|
386
|
-
- `context` **([string][
|
|
387
|
-
// click on element at position
|
|
388
|
-
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
389
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
428
|
+
- `field` **([string][13] | [object][11])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
429
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
390
430
|
- `options`
|
|
391
431
|
|
|
432
|
+
Returns **[Promise][10]<any>** [Additional options][14] for check available as 3rd argument.Examples:```js
|
|
433
|
+
// click on element at position
|
|
434
|
+
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
435
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
436
|
+
|
|
392
437
|
### clearCookie
|
|
393
438
|
|
|
394
439
|
Clears a cookie by name,
|
|
@@ -401,7 +446,9 @@ I.clearCookie('test');
|
|
|
401
446
|
|
|
402
447
|
#### Parameters
|
|
403
448
|
|
|
404
|
-
- `cookie` **[string][
|
|
449
|
+
- `cookie` **[string][13]?** (optional, `null` by default) cookie name
|
|
450
|
+
|
|
451
|
+
Returns **[Promise][10]<any>**
|
|
405
452
|
|
|
406
453
|
### clearField
|
|
407
454
|
|
|
@@ -416,7 +463,9 @@ I.clearField('#email');
|
|
|
416
463
|
#### Parameters
|
|
417
464
|
|
|
418
465
|
- `field`
|
|
419
|
-
- `editable` **([string][
|
|
466
|
+
- `editable` **([string][13] | [object][11])** field located by label|name|CSS|XPath|strict locator.
|
|
467
|
+
|
|
468
|
+
Returns **[Promise][10]<any>**
|
|
420
469
|
|
|
421
470
|
### click
|
|
422
471
|
|
|
@@ -444,15 +493,17 @@ I.click({css: 'nav a.login'});
|
|
|
444
493
|
|
|
445
494
|
#### Parameters
|
|
446
495
|
|
|
447
|
-
- `locator` **([string][
|
|
448
|
-
- `context` **([string][
|
|
496
|
+
- `locator` **([string][13] | [object][11])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
497
|
+
- `context` **([string][13]? | [object][11] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
498
|
+
- `opts` **any?** [Additional options][15] for click available as 3rd argument.Examples:```js
|
|
449
499
|
// click on element at position
|
|
450
500
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
451
501
|
|
|
452
502
|
// make ctrl-click
|
|
453
503
|
I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
454
504
|
```
|
|
455
|
-
|
|
505
|
+
|
|
506
|
+
Returns **[Promise][10]<any>**
|
|
456
507
|
|
|
457
508
|
### clickLink
|
|
458
509
|
|
|
@@ -463,6 +514,8 @@ Clicks link and waits for navigation (deprecated)
|
|
|
463
514
|
- `locator`
|
|
464
515
|
- `context`
|
|
465
516
|
|
|
517
|
+
Returns **[Promise][10]<any>**
|
|
518
|
+
|
|
466
519
|
### closeCurrentTab
|
|
467
520
|
|
|
468
521
|
Close current tab and switches to previous.
|
|
@@ -471,6 +524,8 @@ Close current tab and switches to previous.
|
|
|
471
524
|
I.closeCurrentTab();
|
|
472
525
|
```
|
|
473
526
|
|
|
527
|
+
Returns **[Promise][10]<any>**
|
|
528
|
+
|
|
474
529
|
### closeOtherTabs
|
|
475
530
|
|
|
476
531
|
Close all tabs except for the current one.
|
|
@@ -479,6 +534,8 @@ Close all tabs except for the current one.
|
|
|
479
534
|
I.closeOtherTabs();
|
|
480
535
|
```
|
|
481
536
|
|
|
537
|
+
Returns **[Promise][10]<any>**
|
|
538
|
+
|
|
482
539
|
### dontSee
|
|
483
540
|
|
|
484
541
|
Opposite to `see`. Checks that a text is not present on a page.
|
|
@@ -491,8 +548,10 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
491
548
|
|
|
492
549
|
#### Parameters
|
|
493
550
|
|
|
494
|
-
- `text` **[string][
|
|
495
|
-
- `context` **([string][
|
|
551
|
+
- `text` **[string][13]** which is not present.
|
|
552
|
+
- `context` **([string][13] | [object][11])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
553
|
+
|
|
554
|
+
Returns **[Promise][10]<any>**
|
|
496
555
|
|
|
497
556
|
### dontSeeCheckboxIsChecked
|
|
498
557
|
|
|
@@ -506,7 +565,9 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
506
565
|
|
|
507
566
|
#### Parameters
|
|
508
567
|
|
|
509
|
-
- `field` **([string][
|
|
568
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
569
|
+
|
|
570
|
+
Returns **[Promise][10]<any>**
|
|
510
571
|
|
|
511
572
|
### dontSeeCookie
|
|
512
573
|
|
|
@@ -518,7 +579,9 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
518
579
|
|
|
519
580
|
#### Parameters
|
|
520
581
|
|
|
521
|
-
- `name` **[string][
|
|
582
|
+
- `name` **[string][13]** cookie name.
|
|
583
|
+
|
|
584
|
+
Returns **[Promise][10]<any>**
|
|
522
585
|
|
|
523
586
|
### dontSeeCurrentUrlEquals
|
|
524
587
|
|
|
@@ -532,7 +595,9 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
532
595
|
|
|
533
596
|
#### Parameters
|
|
534
597
|
|
|
535
|
-
- `url` **[string][
|
|
598
|
+
- `url` **[string][13]** value to check.
|
|
599
|
+
|
|
600
|
+
Returns **[Promise][10]<any>**
|
|
536
601
|
|
|
537
602
|
### dontSeeElement
|
|
538
603
|
|
|
@@ -544,7 +609,9 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
544
609
|
|
|
545
610
|
#### Parameters
|
|
546
611
|
|
|
547
|
-
- `locator` **([string][
|
|
612
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|Strict locator.
|
|
613
|
+
|
|
614
|
+
Returns **[Promise][10]<any>**
|
|
548
615
|
|
|
549
616
|
### dontSeeElementInDOM
|
|
550
617
|
|
|
@@ -556,7 +623,9 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
556
623
|
|
|
557
624
|
#### Parameters
|
|
558
625
|
|
|
559
|
-
- `locator` **([string][
|
|
626
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|Strict locator.
|
|
627
|
+
|
|
628
|
+
Returns **[Promise][10]<any>**
|
|
560
629
|
|
|
561
630
|
### dontSeeInCurrentUrl
|
|
562
631
|
|
|
@@ -564,7 +633,9 @@ Checks that current url does not contain a provided fragment.
|
|
|
564
633
|
|
|
565
634
|
#### Parameters
|
|
566
635
|
|
|
567
|
-
- `url` **[string][
|
|
636
|
+
- `url` **[string][13]** value to check.
|
|
637
|
+
|
|
638
|
+
Returns **[Promise][10]<any>**
|
|
568
639
|
|
|
569
640
|
### dontSeeInField
|
|
570
641
|
|
|
@@ -578,8 +649,10 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
578
649
|
|
|
579
650
|
#### Parameters
|
|
580
651
|
|
|
581
|
-
- `field` **([string][
|
|
582
|
-
- `value` **[string][
|
|
652
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
653
|
+
- `value` **[string][13]** value to check.
|
|
654
|
+
|
|
655
|
+
Returns **[Promise][10]<any>**
|
|
583
656
|
|
|
584
657
|
### dontSeeInSource
|
|
585
658
|
|
|
@@ -592,7 +665,9 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
592
665
|
#### Parameters
|
|
593
666
|
|
|
594
667
|
- `text`
|
|
595
|
-
- `value` **[string][
|
|
668
|
+
- `value` **[string][13]** to check.
|
|
669
|
+
|
|
670
|
+
Returns **[Promise][10]<any>**
|
|
596
671
|
|
|
597
672
|
### dontSeeInTitle
|
|
598
673
|
|
|
@@ -604,7 +679,9 @@ I.dontSeeInTitle('Error');
|
|
|
604
679
|
|
|
605
680
|
#### Parameters
|
|
606
681
|
|
|
607
|
-
- `text` **[string][
|
|
682
|
+
- `text` **[string][13]** value to check.
|
|
683
|
+
|
|
684
|
+
Returns **[Promise][10]<any>**
|
|
608
685
|
|
|
609
686
|
### doubleClick
|
|
610
687
|
|
|
@@ -620,8 +697,10 @@ I.doubleClick('.btn.edit');
|
|
|
620
697
|
|
|
621
698
|
#### Parameters
|
|
622
699
|
|
|
623
|
-
- `locator` **([string][
|
|
624
|
-
- `context` **([string][
|
|
700
|
+
- `locator` **([string][13] | [object][11])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
701
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
702
|
+
|
|
703
|
+
Returns **[Promise][10]<any>**
|
|
625
704
|
|
|
626
705
|
### dragAndDrop
|
|
627
706
|
|
|
@@ -633,12 +712,14 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
633
712
|
|
|
634
713
|
#### Parameters
|
|
635
714
|
|
|
636
|
-
- `srcElement` **([string][
|
|
637
|
-
- `destElement` **([string][
|
|
715
|
+
- `srcElement` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
716
|
+
- `destElement` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
717
|
+
- `options` **any?** [Additional options][16] can be passed as 3rd argument.```js
|
|
638
718
|
// specify coordinates for source position
|
|
639
719
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
640
|
-
```> By default option `force: true` is set
|
|
641
|
-
|
|
720
|
+
```> By default option `force: true` is set
|
|
721
|
+
|
|
722
|
+
Returns **[Promise][10]<any>**
|
|
642
723
|
|
|
643
724
|
### dragSlider
|
|
644
725
|
|
|
@@ -652,8 +733,10 @@ I.dragSlider('#slider', -70);
|
|
|
652
733
|
|
|
653
734
|
#### Parameters
|
|
654
735
|
|
|
655
|
-
- `locator` **([string][
|
|
656
|
-
- `offsetX` **[number][
|
|
736
|
+
- `locator` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
737
|
+
- `offsetX` **[number][17]** position to drag.
|
|
738
|
+
|
|
739
|
+
Returns **[Promise][10]<any>**
|
|
657
740
|
|
|
658
741
|
### executeScript
|
|
659
742
|
|
|
@@ -680,10 +763,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
680
763
|
|
|
681
764
|
#### Parameters
|
|
682
765
|
|
|
683
|
-
- `fn` **([string][
|
|
766
|
+
- `fn` **([string][13] | [function][18])** function to be executed in browser context.
|
|
684
767
|
- `arg` **any?** optional argument to pass to the function
|
|
685
768
|
|
|
686
|
-
Returns **[Promise][
|
|
769
|
+
Returns **[Promise][10]<any>**
|
|
687
770
|
|
|
688
771
|
### fillField
|
|
689
772
|
|
|
@@ -703,8 +786,10 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
703
786
|
|
|
704
787
|
#### Parameters
|
|
705
788
|
|
|
706
|
-
- `field` **([string][
|
|
707
|
-
- `value` **([string][
|
|
789
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
790
|
+
- `value` **([string][13] | [object][11])** text value to fill.
|
|
791
|
+
|
|
792
|
+
Returns **[Promise][10]<any>**
|
|
708
793
|
|
|
709
794
|
### forceClick
|
|
710
795
|
|
|
@@ -735,8 +820,10 @@ I.forceClick({css: 'nav a.login'});
|
|
|
735
820
|
|
|
736
821
|
#### Parameters
|
|
737
822
|
|
|
738
|
-
- `locator` **([string][
|
|
739
|
-
- `context` **([string][
|
|
823
|
+
- `locator` **([string][13] | [object][11])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
824
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
825
|
+
|
|
826
|
+
Returns **[Promise][10]<any>**
|
|
740
827
|
|
|
741
828
|
### grabAttributeFrom
|
|
742
829
|
|
|
@@ -750,10 +837,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
750
837
|
|
|
751
838
|
#### Parameters
|
|
752
839
|
|
|
753
|
-
- `locator` **([string][
|
|
754
|
-
- `attr` **[string][
|
|
840
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
841
|
+
- `attr` **[string][13]** attribute name.
|
|
755
842
|
|
|
756
|
-
Returns **[Promise][
|
|
843
|
+
Returns **[Promise][10]<[string][13]>** attribute value
|
|
757
844
|
|
|
758
845
|
### grabAttributeFromAll
|
|
759
846
|
|
|
@@ -766,10 +853,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
766
853
|
|
|
767
854
|
#### Parameters
|
|
768
855
|
|
|
769
|
-
- `locator` **([string][
|
|
770
|
-
- `attr` **[string][
|
|
856
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
857
|
+
- `attr` **[string][13]** attribute name.
|
|
771
858
|
|
|
772
|
-
Returns **[Promise][
|
|
859
|
+
Returns **[Promise][10]<[Array][19]<[string][13]>>** attribute value
|
|
773
860
|
|
|
774
861
|
### grabBrowserLogs
|
|
775
862
|
|
|
@@ -780,7 +867,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
780
867
|
console.log(JSON.stringify(logs))
|
|
781
868
|
```
|
|
782
869
|
|
|
783
|
-
Returns **[Promise][
|
|
870
|
+
Returns **[Promise][10]<[Array][19]<any>>**
|
|
784
871
|
|
|
785
872
|
### grabCookie
|
|
786
873
|
|
|
@@ -795,9 +882,9 @@ assert(cookie.value, '123456');
|
|
|
795
882
|
|
|
796
883
|
#### Parameters
|
|
797
884
|
|
|
798
|
-
- `name` **[string][
|
|
885
|
+
- `name` **[string][13]?** cookie name.
|
|
799
886
|
|
|
800
|
-
Returns **([Promise][
|
|
887
|
+
Returns **([Promise][10]<[string][13]> | [Promise][10]<[Array][19]<[string][13]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
801
888
|
|
|
802
889
|
### grabCssPropertyFrom
|
|
803
890
|
|
|
@@ -811,10 +898,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
811
898
|
|
|
812
899
|
#### Parameters
|
|
813
900
|
|
|
814
|
-
- `locator` **([string][
|
|
815
|
-
- `cssProperty` **[string][
|
|
901
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
902
|
+
- `cssProperty` **[string][13]** CSS property name.
|
|
816
903
|
|
|
817
|
-
Returns **[Promise][
|
|
904
|
+
Returns **[Promise][10]<[string][13]>** CSS value
|
|
818
905
|
|
|
819
906
|
### grabCssPropertyFromAll
|
|
820
907
|
|
|
@@ -827,10 +914,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
827
914
|
|
|
828
915
|
#### Parameters
|
|
829
916
|
|
|
830
|
-
- `locator` **([string][
|
|
831
|
-
- `cssProperty` **[string][
|
|
917
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
918
|
+
- `cssProperty` **[string][13]** CSS property name.
|
|
832
919
|
|
|
833
|
-
Returns **[Promise][
|
|
920
|
+
Returns **[Promise][10]<[Array][19]<[string][13]>>** CSS value
|
|
834
921
|
|
|
835
922
|
### grabCurrentUrl
|
|
836
923
|
|
|
@@ -842,7 +929,7 @@ let url = await I.grabCurrentUrl();
|
|
|
842
929
|
console.log(`Current URL is [${url}]`);
|
|
843
930
|
```
|
|
844
931
|
|
|
845
|
-
Returns **[Promise][
|
|
932
|
+
Returns **[Promise][10]<[string][13]>** current URL
|
|
846
933
|
|
|
847
934
|
### grabDataFromPerformanceTiming
|
|
848
935
|
|
|
@@ -867,6 +954,8 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
867
954
|
}
|
|
868
955
|
```
|
|
869
956
|
|
|
957
|
+
Returns **[Promise][10]<any>**
|
|
958
|
+
|
|
870
959
|
### grabElementBoundingRect
|
|
871
960
|
|
|
872
961
|
Grab the width, height, location of given locator.
|
|
@@ -889,11 +978,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
889
978
|
|
|
890
979
|
#### Parameters
|
|
891
980
|
|
|
892
|
-
- `locator` **([string][
|
|
981
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
893
982
|
- `prop`
|
|
894
|
-
- `elementSize` **[string][
|
|
983
|
+
- `elementSize` **[string][13]?** x, y, width or height of the given element.
|
|
895
984
|
|
|
896
|
-
Returns **([Promise][
|
|
985
|
+
Returns **([Promise][10]<DOMRect> | [Promise][10]<[number][17]>)** Element bounding rectangle
|
|
897
986
|
|
|
898
987
|
### grabHTMLFrom
|
|
899
988
|
|
|
@@ -908,9 +997,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
908
997
|
#### Parameters
|
|
909
998
|
|
|
910
999
|
- `locator`
|
|
911
|
-
- `element` **([string][
|
|
1000
|
+
- `element` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
912
1001
|
|
|
913
|
-
Returns **[Promise][
|
|
1002
|
+
Returns **[Promise][10]<[string][13]>** HTML code for an element
|
|
914
1003
|
|
|
915
1004
|
### grabHTMLFromAll
|
|
916
1005
|
|
|
@@ -924,9 +1013,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
924
1013
|
#### Parameters
|
|
925
1014
|
|
|
926
1015
|
- `locator`
|
|
927
|
-
- `element` **([string][
|
|
1016
|
+
- `element` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
928
1017
|
|
|
929
|
-
Returns **[Promise][
|
|
1018
|
+
Returns **[Promise][10]<[Array][19]<[string][13]>>** HTML code for an element
|
|
930
1019
|
|
|
931
1020
|
### grabNumberOfOpenTabs
|
|
932
1021
|
|
|
@@ -937,7 +1026,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
937
1026
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
938
1027
|
```
|
|
939
1028
|
|
|
940
|
-
Returns **[Promise][
|
|
1029
|
+
Returns **[Promise][10]<[number][17]>** number of open tabs
|
|
941
1030
|
|
|
942
1031
|
### grabNumberOfVisibleElements
|
|
943
1032
|
|
|
@@ -950,9 +1039,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
950
1039
|
|
|
951
1040
|
#### Parameters
|
|
952
1041
|
|
|
953
|
-
- `locator` **([string][
|
|
1042
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
954
1043
|
|
|
955
|
-
Returns **[Promise][
|
|
1044
|
+
Returns **[Promise][10]<[number][17]>** number of visible elements
|
|
956
1045
|
|
|
957
1046
|
### grabPageScrollPosition
|
|
958
1047
|
|
|
@@ -963,7 +1052,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
963
1052
|
let { x, y } = await I.grabPageScrollPosition();
|
|
964
1053
|
```
|
|
965
1054
|
|
|
966
|
-
Returns **[Promise][
|
|
1055
|
+
Returns **[Promise][10]<PageScrollPosition>** scroll position
|
|
967
1056
|
|
|
968
1057
|
### grabPopupText
|
|
969
1058
|
|
|
@@ -973,7 +1062,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
973
1062
|
await I.grabPopupText();
|
|
974
1063
|
```
|
|
975
1064
|
|
|
976
|
-
Returns **[Promise][
|
|
1065
|
+
Returns **[Promise][10]<([string][13] | null)>**
|
|
977
1066
|
|
|
978
1067
|
### grabSource
|
|
979
1068
|
|
|
@@ -984,7 +1073,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
984
1073
|
let pageSource = await I.grabSource();
|
|
985
1074
|
```
|
|
986
1075
|
|
|
987
|
-
Returns **[Promise][
|
|
1076
|
+
Returns **[Promise][10]<[string][13]>** source code
|
|
988
1077
|
|
|
989
1078
|
### grabTextFrom
|
|
990
1079
|
|
|
@@ -999,9 +1088,9 @@ If multiple elements found returns first element.
|
|
|
999
1088
|
|
|
1000
1089
|
#### Parameters
|
|
1001
1090
|
|
|
1002
|
-
- `locator` **([string][
|
|
1091
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1003
1092
|
|
|
1004
|
-
Returns **[Promise][
|
|
1093
|
+
Returns **[Promise][10]<[string][13]>** attribute value
|
|
1005
1094
|
|
|
1006
1095
|
### grabTextFromAll
|
|
1007
1096
|
|
|
@@ -1014,9 +1103,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1014
1103
|
|
|
1015
1104
|
#### Parameters
|
|
1016
1105
|
|
|
1017
|
-
- `locator` **([string][
|
|
1106
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1018
1107
|
|
|
1019
|
-
Returns **[Promise][
|
|
1108
|
+
Returns **[Promise][10]<[Array][19]<[string][13]>>** attribute value
|
|
1020
1109
|
|
|
1021
1110
|
### grabTitle
|
|
1022
1111
|
|
|
@@ -1027,7 +1116,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1027
1116
|
let title = await I.grabTitle();
|
|
1028
1117
|
```
|
|
1029
1118
|
|
|
1030
|
-
Returns **[Promise][
|
|
1119
|
+
Returns **[Promise][10]<[string][13]>** title
|
|
1031
1120
|
|
|
1032
1121
|
### grabValueFrom
|
|
1033
1122
|
|
|
@@ -1041,9 +1130,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1041
1130
|
|
|
1042
1131
|
#### Parameters
|
|
1043
1132
|
|
|
1044
|
-
- `locator` **([string][
|
|
1133
|
+
- `locator` **([string][13] | [object][11])** field located by label|name|CSS|XPath|strict locator.
|
|
1045
1134
|
|
|
1046
|
-
Returns **[Promise][
|
|
1135
|
+
Returns **[Promise][10]<[string][13]>** attribute value
|
|
1047
1136
|
|
|
1048
1137
|
### grabValueFromAll
|
|
1049
1138
|
|
|
@@ -1056,9 +1145,9 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1056
1145
|
|
|
1057
1146
|
#### Parameters
|
|
1058
1147
|
|
|
1059
|
-
- `locator` **([string][
|
|
1148
|
+
- `locator` **([string][13] | [object][11])** field located by label|name|CSS|XPath|strict locator.
|
|
1060
1149
|
|
|
1061
|
-
Returns **[Promise][
|
|
1150
|
+
Returns **[Promise][10]<[Array][19]<[string][13]>>** attribute value
|
|
1062
1151
|
|
|
1063
1152
|
### handleDownloads
|
|
1064
1153
|
|
|
@@ -1076,7 +1165,9 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1076
1165
|
|
|
1077
1166
|
#### Parameters
|
|
1078
1167
|
|
|
1079
|
-
- `fileName` **[string][
|
|
1168
|
+
- `fileName` **[string][13]?** set filename for downloaded file
|
|
1169
|
+
|
|
1170
|
+
Returns **[Promise][10]<void>**
|
|
1080
1171
|
|
|
1081
1172
|
### haveRequestHeaders
|
|
1082
1173
|
|
|
@@ -1090,7 +1181,9 @@ I.haveRequestHeaders({
|
|
|
1090
1181
|
|
|
1091
1182
|
#### Parameters
|
|
1092
1183
|
|
|
1093
|
-
- `customHeaders` **[object][
|
|
1184
|
+
- `customHeaders` **[object][11]** headers to set
|
|
1185
|
+
|
|
1186
|
+
Returns **[Promise][10]<any>**
|
|
1094
1187
|
|
|
1095
1188
|
### makeApiRequest
|
|
1096
1189
|
|
|
@@ -1107,11 +1200,11 @@ I.makeApiRequest('PATCH', )
|
|
|
1107
1200
|
|
|
1108
1201
|
#### Parameters
|
|
1109
1202
|
|
|
1110
|
-
- `method` **[string][
|
|
1111
|
-
- `url` **[string][
|
|
1112
|
-
- `options` **[object][
|
|
1203
|
+
- `method` **[string][13]** HTTP method
|
|
1204
|
+
- `url` **[string][13]** endpoint
|
|
1205
|
+
- `options` **[object][11]** request options depending on method used
|
|
1113
1206
|
|
|
1114
|
-
Returns **[Promise][
|
|
1207
|
+
Returns **[Promise][10]<[object][11]>** response
|
|
1115
1208
|
|
|
1116
1209
|
### mockRoute
|
|
1117
1210
|
|
|
@@ -1125,8 +1218,10 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
|
|
|
1125
1218
|
|
|
1126
1219
|
#### Parameters
|
|
1127
1220
|
|
|
1128
|
-
- `url` **[string][
|
|
1129
|
-
- `handler` **[function][
|
|
1221
|
+
- `url` **([string][13] | [RegExp][24])?** URL, regex or pattern for to match URL
|
|
1222
|
+
- `handler` **[function][18]?** a function to process request
|
|
1223
|
+
|
|
1224
|
+
Returns **[Promise][10]<any>**
|
|
1130
1225
|
|
|
1131
1226
|
### moveCursorTo
|
|
1132
1227
|
|
|
@@ -1140,9 +1235,11 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1140
1235
|
|
|
1141
1236
|
#### Parameters
|
|
1142
1237
|
|
|
1143
|
-
- `locator` **([string][
|
|
1144
|
-
- `offsetX` **[number][
|
|
1145
|
-
- `offsetY` **[number][
|
|
1238
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
1239
|
+
- `offsetX` **[number][17]** (optional, `0` by default) X-axis offset.
|
|
1240
|
+
- `offsetY` **[number][17]** (optional, `0` by default) Y-axis offset.
|
|
1241
|
+
|
|
1242
|
+
Returns **[Promise][10]<any>**
|
|
1146
1243
|
|
|
1147
1244
|
### openNewTab
|
|
1148
1245
|
|
|
@@ -1152,7 +1249,7 @@ Open new tab and automatically switched to new tab
|
|
|
1152
1249
|
I.openNewTab();
|
|
1153
1250
|
```
|
|
1154
1251
|
|
|
1155
|
-
You can pass in [page options][
|
|
1252
|
+
You can pass in [page options][25] to emulate device on this page
|
|
1156
1253
|
|
|
1157
1254
|
```js
|
|
1158
1255
|
// enable mobile
|
|
@@ -1163,11 +1260,13 @@ I.openNewTab({ isMobile: true });
|
|
|
1163
1260
|
|
|
1164
1261
|
- `options`
|
|
1165
1262
|
|
|
1263
|
+
Returns **[Promise][10]<any>**
|
|
1264
|
+
|
|
1166
1265
|
### pressKey
|
|
1167
1266
|
|
|
1168
1267
|
Presses a key in the browser (on a focused element).
|
|
1169
1268
|
|
|
1170
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1269
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][26].
|
|
1171
1270
|
|
|
1172
1271
|
```js
|
|
1173
1272
|
I.pressKey('Backspace');
|
|
@@ -1226,13 +1325,15 @@ Some of the supported key names are:
|
|
|
1226
1325
|
|
|
1227
1326
|
#### Parameters
|
|
1228
1327
|
|
|
1229
|
-
- `key` **([string][
|
|
1328
|
+
- `key` **([string][13] | [Array][19]<[string][13]>)** key or array of keys to press.
|
|
1329
|
+
|
|
1330
|
+
Returns **[Promise][10]<any>** _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][27]).
|
|
1230
1331
|
|
|
1231
1332
|
### pressKeyDown
|
|
1232
1333
|
|
|
1233
1334
|
Presses a key in the browser and leaves it in a down state.
|
|
1234
1335
|
|
|
1235
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1336
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][28]).
|
|
1236
1337
|
|
|
1237
1338
|
```js
|
|
1238
1339
|
I.pressKeyDown('Control');
|
|
@@ -1242,13 +1343,15 @@ I.pressKeyUp('Control');
|
|
|
1242
1343
|
|
|
1243
1344
|
#### Parameters
|
|
1244
1345
|
|
|
1245
|
-
- `key` **[string][
|
|
1346
|
+
- `key` **[string][13]** name of key to press down.
|
|
1347
|
+
|
|
1348
|
+
Returns **[Promise][10]<any>**
|
|
1246
1349
|
|
|
1247
1350
|
### pressKeyUp
|
|
1248
1351
|
|
|
1249
1352
|
Releases a key in the browser which was previously set to a down state.
|
|
1250
1353
|
|
|
1251
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1354
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][28]).
|
|
1252
1355
|
|
|
1253
1356
|
```js
|
|
1254
1357
|
I.pressKeyDown('Control');
|
|
@@ -1258,7 +1361,9 @@ I.pressKeyUp('Control');
|
|
|
1258
1361
|
|
|
1259
1362
|
#### Parameters
|
|
1260
1363
|
|
|
1261
|
-
- `key` **[string][
|
|
1364
|
+
- `key` **[string][13]** name of key to release.
|
|
1365
|
+
|
|
1366
|
+
Returns **[Promise][10]<any>**
|
|
1262
1367
|
|
|
1263
1368
|
### refreshPage
|
|
1264
1369
|
|
|
@@ -1268,6 +1373,8 @@ Reload the current page.
|
|
|
1268
1373
|
I.refreshPage();
|
|
1269
1374
|
```
|
|
1270
1375
|
|
|
1376
|
+
Returns **[Promise][10]<any>**
|
|
1377
|
+
|
|
1271
1378
|
### resizeWindow
|
|
1272
1379
|
|
|
1273
1380
|
Resize the current window to provided width and height.
|
|
@@ -1275,14 +1382,16 @@ First parameter can be set to `maximize`.
|
|
|
1275
1382
|
|
|
1276
1383
|
#### Parameters
|
|
1277
1384
|
|
|
1278
|
-
- `width` **[number][
|
|
1279
|
-
- `height` **[number][
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1385
|
+
- `width` **[number][17]** width in pixels or `maximize`.
|
|
1386
|
+
- `height` **[number][17]** height in pixels.
|
|
1387
|
+
|
|
1388
|
+
Returns **[Promise][10]<any>** Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1389
|
+
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1390
|
+
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1391
|
+
// inside codecept.conf.js
|
|
1392
|
+
// @codeceptjs/configure package must be installed
|
|
1393
|
+
{ setWindowSize } = require('@codeceptjs/configure');
|
|
1394
|
+
```
|
|
1286
1395
|
|
|
1287
1396
|
### rightClick
|
|
1288
1397
|
|
|
@@ -1299,8 +1408,10 @@ I.rightClick('Click me', '.context');
|
|
|
1299
1408
|
|
|
1300
1409
|
#### Parameters
|
|
1301
1410
|
|
|
1302
|
-
- `locator` **([string][
|
|
1303
|
-
- `context` **([string][
|
|
1411
|
+
- `locator` **([string][13] | [object][11])** clickable element located by CSS|XPath|strict locator.
|
|
1412
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1413
|
+
|
|
1414
|
+
Returns **[Promise][10]<any>**
|
|
1304
1415
|
|
|
1305
1416
|
### saveElementScreenshot
|
|
1306
1417
|
|
|
@@ -1313,8 +1424,10 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1313
1424
|
|
|
1314
1425
|
#### Parameters
|
|
1315
1426
|
|
|
1316
|
-
- `locator` **([string][
|
|
1317
|
-
- `fileName` **[string][
|
|
1427
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1428
|
+
- `fileName` **[string][13]** file name to save.
|
|
1429
|
+
|
|
1430
|
+
Returns **[Promise][10]<any>**
|
|
1318
1431
|
|
|
1319
1432
|
### saveScreenshot
|
|
1320
1433
|
|
|
@@ -1329,8 +1442,10 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1329
1442
|
|
|
1330
1443
|
#### Parameters
|
|
1331
1444
|
|
|
1332
|
-
- `fileName` **[string][
|
|
1333
|
-
- `fullPage` **[boolean][
|
|
1445
|
+
- `fileName` **[string][13]** file name to save.
|
|
1446
|
+
- `fullPage` **[boolean][29]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1447
|
+
|
|
1448
|
+
Returns **[Promise][10]<any>**
|
|
1334
1449
|
|
|
1335
1450
|
### scrollPageToBottom
|
|
1336
1451
|
|
|
@@ -1340,6 +1455,8 @@ Scroll page to the bottom.
|
|
|
1340
1455
|
I.scrollPageToBottom();
|
|
1341
1456
|
```
|
|
1342
1457
|
|
|
1458
|
+
Returns **[Promise][10]<any>**
|
|
1459
|
+
|
|
1343
1460
|
### scrollPageToTop
|
|
1344
1461
|
|
|
1345
1462
|
Scroll page to the top.
|
|
@@ -1348,6 +1465,8 @@ Scroll page to the top.
|
|
|
1348
1465
|
I.scrollPageToTop();
|
|
1349
1466
|
```
|
|
1350
1467
|
|
|
1468
|
+
Returns **[Promise][10]<any>**
|
|
1469
|
+
|
|
1351
1470
|
### scrollTo
|
|
1352
1471
|
|
|
1353
1472
|
Scrolls to element matched by locator.
|
|
@@ -1360,9 +1479,11 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1360
1479
|
|
|
1361
1480
|
#### Parameters
|
|
1362
1481
|
|
|
1363
|
-
- `locator` **([string][
|
|
1364
|
-
- `offsetX` **[number][
|
|
1365
|
-
- `offsetY` **[number][
|
|
1482
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
1483
|
+
- `offsetX` **[number][17]** (optional, `0` by default) X-axis offset.
|
|
1484
|
+
- `offsetY` **[number][17]** (optional, `0` by default) Y-axis offset.
|
|
1485
|
+
|
|
1486
|
+
Returns **[Promise][10]<any>**
|
|
1366
1487
|
|
|
1367
1488
|
### see
|
|
1368
1489
|
|
|
@@ -1377,8 +1498,10 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1377
1498
|
|
|
1378
1499
|
#### Parameters
|
|
1379
1500
|
|
|
1380
|
-
- `text` **[string][
|
|
1381
|
-
- `context` **([string][
|
|
1501
|
+
- `text` **[string][13]** expected on page.
|
|
1502
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1503
|
+
|
|
1504
|
+
Returns **[Promise][10]<any>**
|
|
1382
1505
|
|
|
1383
1506
|
### seeAttributesOnElements
|
|
1384
1507
|
|
|
@@ -1390,8 +1513,10 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1390
1513
|
|
|
1391
1514
|
#### Parameters
|
|
1392
1515
|
|
|
1393
|
-
- `locator` **([string][
|
|
1394
|
-
- `attributes` **[object][
|
|
1516
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
1517
|
+
- `attributes` **[object][11]** attributes and their values to check.
|
|
1518
|
+
|
|
1519
|
+
Returns **[Promise][10]<any>**
|
|
1395
1520
|
|
|
1396
1521
|
### seeCheckboxIsChecked
|
|
1397
1522
|
|
|
@@ -1405,7 +1530,9 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1405
1530
|
|
|
1406
1531
|
#### Parameters
|
|
1407
1532
|
|
|
1408
|
-
- `field` **([string][
|
|
1533
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
1534
|
+
|
|
1535
|
+
Returns **[Promise][10]<any>**
|
|
1409
1536
|
|
|
1410
1537
|
### seeCookie
|
|
1411
1538
|
|
|
@@ -1417,7 +1544,9 @@ I.seeCookie('Auth');
|
|
|
1417
1544
|
|
|
1418
1545
|
#### Parameters
|
|
1419
1546
|
|
|
1420
|
-
- `name` **[string][
|
|
1547
|
+
- `name` **[string][13]** cookie name.
|
|
1548
|
+
|
|
1549
|
+
Returns **[Promise][10]<any>**
|
|
1421
1550
|
|
|
1422
1551
|
### seeCssPropertiesOnElements
|
|
1423
1552
|
|
|
@@ -1429,8 +1558,10 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1429
1558
|
|
|
1430
1559
|
#### Parameters
|
|
1431
1560
|
|
|
1432
|
-
- `locator` **([string][
|
|
1433
|
-
- `cssProperties` **[object][
|
|
1561
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
1562
|
+
- `cssProperties` **[object][11]** object with CSS properties and their values to check.
|
|
1563
|
+
|
|
1564
|
+
Returns **[Promise][10]<any>**
|
|
1434
1565
|
|
|
1435
1566
|
### seeCurrentUrlEquals
|
|
1436
1567
|
|
|
@@ -1445,7 +1576,9 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1445
1576
|
|
|
1446
1577
|
#### Parameters
|
|
1447
1578
|
|
|
1448
|
-
- `url` **[string][
|
|
1579
|
+
- `url` **[string][13]** value to check.
|
|
1580
|
+
|
|
1581
|
+
Returns **[Promise][10]<any>**
|
|
1449
1582
|
|
|
1450
1583
|
### seeElement
|
|
1451
1584
|
|
|
@@ -1458,7 +1591,9 @@ I.seeElement('#modal');
|
|
|
1458
1591
|
|
|
1459
1592
|
#### Parameters
|
|
1460
1593
|
|
|
1461
|
-
- `locator` **([string][
|
|
1594
|
+
- `locator` **([string][13] | [object][11])** located by CSS|XPath|strict locator.
|
|
1595
|
+
|
|
1596
|
+
Returns **[Promise][10]<any>**
|
|
1462
1597
|
|
|
1463
1598
|
### seeElementInDOM
|
|
1464
1599
|
|
|
@@ -1471,7 +1606,9 @@ I.seeElementInDOM('#modal');
|
|
|
1471
1606
|
|
|
1472
1607
|
#### Parameters
|
|
1473
1608
|
|
|
1474
|
-
- `locator` **([string][
|
|
1609
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1610
|
+
|
|
1611
|
+
Returns **[Promise][10]<any>**
|
|
1475
1612
|
|
|
1476
1613
|
### seeInCurrentUrl
|
|
1477
1614
|
|
|
@@ -1483,7 +1620,9 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1483
1620
|
|
|
1484
1621
|
#### Parameters
|
|
1485
1622
|
|
|
1486
|
-
- `url` **[string][
|
|
1623
|
+
- `url` **[string][13]** a fragment to check
|
|
1624
|
+
|
|
1625
|
+
Returns **[Promise][10]<any>**
|
|
1487
1626
|
|
|
1488
1627
|
### seeInField
|
|
1489
1628
|
|
|
@@ -1499,8 +1638,10 @@ I.seeInField('#searchform input','Search');
|
|
|
1499
1638
|
|
|
1500
1639
|
#### Parameters
|
|
1501
1640
|
|
|
1502
|
-
- `field` **([string][
|
|
1503
|
-
- `value` **[string][
|
|
1641
|
+
- `field` **([string][13] | [object][11])** located by label|name|CSS|XPath|strict locator.
|
|
1642
|
+
- `value` **[string][13]** value to check.
|
|
1643
|
+
|
|
1644
|
+
Returns **[Promise][10]<any>**
|
|
1504
1645
|
|
|
1505
1646
|
### seeInPopup
|
|
1506
1647
|
|
|
@@ -1513,7 +1654,9 @@ I.seeInPopup('Popup text');
|
|
|
1513
1654
|
|
|
1514
1655
|
#### Parameters
|
|
1515
1656
|
|
|
1516
|
-
- `text` **[string][
|
|
1657
|
+
- `text` **[string][13]** value to check.
|
|
1658
|
+
|
|
1659
|
+
Returns **[Promise][10]<any>**
|
|
1517
1660
|
|
|
1518
1661
|
### seeInSource
|
|
1519
1662
|
|
|
@@ -1525,7 +1668,9 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1525
1668
|
|
|
1526
1669
|
#### Parameters
|
|
1527
1670
|
|
|
1528
|
-
- `text` **[string][
|
|
1671
|
+
- `text` **[string][13]** value to check.
|
|
1672
|
+
|
|
1673
|
+
Returns **[Promise][10]<any>**
|
|
1529
1674
|
|
|
1530
1675
|
### seeInTitle
|
|
1531
1676
|
|
|
@@ -1537,7 +1682,9 @@ I.seeInTitle('Home Page');
|
|
|
1537
1682
|
|
|
1538
1683
|
#### Parameters
|
|
1539
1684
|
|
|
1540
|
-
- `text` **[string][
|
|
1685
|
+
- `text` **[string][13]** text value to check.
|
|
1686
|
+
|
|
1687
|
+
Returns **[Promise][10]<any>**
|
|
1541
1688
|
|
|
1542
1689
|
### seeNumberOfElements
|
|
1543
1690
|
|
|
@@ -1550,8 +1697,10 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1550
1697
|
|
|
1551
1698
|
#### Parameters
|
|
1552
1699
|
|
|
1553
|
-
- `locator` **([string][
|
|
1554
|
-
- `num` **[number][
|
|
1700
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1701
|
+
- `num` **[number][17]** number of elements.
|
|
1702
|
+
|
|
1703
|
+
Returns **[Promise][10]<any>**
|
|
1555
1704
|
|
|
1556
1705
|
### seeNumberOfVisibleElements
|
|
1557
1706
|
|
|
@@ -1564,8 +1713,10 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1564
1713
|
|
|
1565
1714
|
#### Parameters
|
|
1566
1715
|
|
|
1567
|
-
- `locator` **([string][
|
|
1568
|
-
- `num` **[number][
|
|
1716
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1717
|
+
- `num` **[number][17]** number of elements.
|
|
1718
|
+
|
|
1719
|
+
Returns **[Promise][10]<any>**
|
|
1569
1720
|
|
|
1570
1721
|
### seeTextEquals
|
|
1571
1722
|
|
|
@@ -1577,8 +1728,10 @@ I.seeTextEquals('text', 'h1');
|
|
|
1577
1728
|
|
|
1578
1729
|
#### Parameters
|
|
1579
1730
|
|
|
1580
|
-
- `text` **[string][
|
|
1581
|
-
- `context` **([string][
|
|
1731
|
+
- `text` **[string][13]** element value to check.
|
|
1732
|
+
- `context` **([string][13] | [object][11])?** element located by CSS|XPath|strict locator.
|
|
1733
|
+
|
|
1734
|
+
Returns **[Promise][10]<any>**
|
|
1582
1735
|
|
|
1583
1736
|
### seeTitleEquals
|
|
1584
1737
|
|
|
@@ -1590,7 +1743,9 @@ I.seeTitleEquals('Test title.');
|
|
|
1590
1743
|
|
|
1591
1744
|
#### Parameters
|
|
1592
1745
|
|
|
1593
|
-
- `text` **[string][
|
|
1746
|
+
- `text` **[string][13]** value to check.
|
|
1747
|
+
|
|
1748
|
+
Returns **[Promise][10]<any>**
|
|
1594
1749
|
|
|
1595
1750
|
### selectOption
|
|
1596
1751
|
|
|
@@ -1615,8 +1770,10 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1615
1770
|
|
|
1616
1771
|
#### Parameters
|
|
1617
1772
|
|
|
1618
|
-
- `select` **([string][
|
|
1619
|
-
- `option` **([string][
|
|
1773
|
+
- `select` **([string][13] | [object][11])** field located by label|name|CSS|XPath|strict locator.
|
|
1774
|
+
- `option` **([string][13] | [Array][19]<any>)** visible text or value of option.
|
|
1775
|
+
|
|
1776
|
+
Returns **[Promise][10]<any>**
|
|
1620
1777
|
|
|
1621
1778
|
### setCookie
|
|
1622
1779
|
|
|
@@ -1638,6 +1795,8 @@ I.setCookie([
|
|
|
1638
1795
|
|
|
1639
1796
|
- `cookie` **(Cookie | [Array][19]<Cookie>)** a cookie object or array of cookie objects.
|
|
1640
1797
|
|
|
1798
|
+
Returns **[Promise][10]<any>**
|
|
1799
|
+
|
|
1641
1800
|
### stopMockingRoute
|
|
1642
1801
|
|
|
1643
1802
|
Stops network mocking created by `mockRoute`.
|
|
@@ -1651,8 +1810,10 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1651
1810
|
|
|
1652
1811
|
#### Parameters
|
|
1653
1812
|
|
|
1654
|
-
- `url` **[string][
|
|
1655
|
-
- `handler` **[function][
|
|
1813
|
+
- `url` **([string][13] | [RegExp][24])?** URL, regex or pattern for to match URL
|
|
1814
|
+
- `handler` **[function][18]?** a function to process request
|
|
1815
|
+
|
|
1816
|
+
Returns **[Promise][10]<any>**
|
|
1656
1817
|
|
|
1657
1818
|
### switchTo
|
|
1658
1819
|
|
|
@@ -1665,7 +1826,9 @@ I.switchTo(); // switch back to main page
|
|
|
1665
1826
|
|
|
1666
1827
|
#### Parameters
|
|
1667
1828
|
|
|
1668
|
-
- `locator` **([string][
|
|
1829
|
+
- `locator` **([string][13]? | [object][11])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1830
|
+
|
|
1831
|
+
Returns **[Promise][10]<any>**
|
|
1669
1832
|
|
|
1670
1833
|
### switchToNextTab
|
|
1671
1834
|
|
|
@@ -1678,7 +1841,9 @@ I.switchToNextTab(2);
|
|
|
1678
1841
|
|
|
1679
1842
|
#### Parameters
|
|
1680
1843
|
|
|
1681
|
-
- `num` **[number][
|
|
1844
|
+
- `num` **[number][17]**
|
|
1845
|
+
|
|
1846
|
+
Returns **[Promise][10]<any>**
|
|
1682
1847
|
|
|
1683
1848
|
### switchToPreviousTab
|
|
1684
1849
|
|
|
@@ -1691,13 +1856,15 @@ I.switchToPreviousTab(2);
|
|
|
1691
1856
|
|
|
1692
1857
|
#### Parameters
|
|
1693
1858
|
|
|
1694
|
-
- `num` **[number][
|
|
1859
|
+
- `num` **[number][17]**
|
|
1860
|
+
|
|
1861
|
+
Returns **[Promise][10]<any>**
|
|
1695
1862
|
|
|
1696
1863
|
### type
|
|
1697
1864
|
|
|
1698
1865
|
Types out the given text into an active field.
|
|
1699
1866
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1700
|
-
_Note:_ Should be used when [`fillField`][
|
|
1867
|
+
_Note:_ Should be used when [`fillField`][26] is not an option.
|
|
1701
1868
|
|
|
1702
1869
|
```js
|
|
1703
1870
|
// passing in a string
|
|
@@ -1713,8 +1880,10 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1713
1880
|
#### Parameters
|
|
1714
1881
|
|
|
1715
1882
|
- `keys`
|
|
1716
|
-
- `delay` **[number][
|
|
1717
|
-
- `key` **([string][
|
|
1883
|
+
- `delay` **[number][17]?** (optional) delay in ms between key presses
|
|
1884
|
+
- `key` **([string][13] | [Array][19]<[string][13]>)** or array of keys to type.
|
|
1885
|
+
|
|
1886
|
+
Returns **[Promise][10]<any>**
|
|
1718
1887
|
|
|
1719
1888
|
### uncheckOption
|
|
1720
1889
|
|
|
@@ -1731,13 +1900,15 @@ I.uncheckOption('agree', '//form');
|
|
|
1731
1900
|
|
|
1732
1901
|
#### Parameters
|
|
1733
1902
|
|
|
1734
|
-
- `field` **([string][
|
|
1735
|
-
- `context` **([string][
|
|
1736
|
-
// click on element at position
|
|
1737
|
-
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1738
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
1903
|
+
- `field` **([string][13] | [object][11])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1904
|
+
- `context` **([string][13]? | [object][11])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1739
1905
|
- `options`
|
|
1740
1906
|
|
|
1907
|
+
Returns **[Promise][10]<any>** [Additional options][30] for uncheck available as 3rd argument.Examples:```js
|
|
1908
|
+
// click on element at position
|
|
1909
|
+
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1910
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
1911
|
+
|
|
1741
1912
|
### usePlaywrightTo
|
|
1742
1913
|
|
|
1743
1914
|
Use Playwright API inside a test.
|
|
@@ -1745,7 +1916,7 @@ Use Playwright API inside a test.
|
|
|
1745
1916
|
First argument is a description of an action.
|
|
1746
1917
|
Second argument is async function that gets this helper as parameter.
|
|
1747
1918
|
|
|
1748
|
-
{ [`page`][
|
|
1919
|
+
{ [`page`][31], [`browserContext`][32] [`browser`][33] } objects from Playwright API are available.
|
|
1749
1920
|
|
|
1750
1921
|
```js
|
|
1751
1922
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1755,8 +1926,10 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1755
1926
|
|
|
1756
1927
|
#### Parameters
|
|
1757
1928
|
|
|
1758
|
-
- `description` **[string][
|
|
1759
|
-
- `fn` **[function][
|
|
1929
|
+
- `description` **[string][13]** used to show in logs.
|
|
1930
|
+
- `fn` **[function][18]** async function that executed with Playwright helper as argument
|
|
1931
|
+
|
|
1932
|
+
Returns **[Promise][10]<any>**
|
|
1760
1933
|
|
|
1761
1934
|
### wait
|
|
1762
1935
|
|
|
@@ -1768,7 +1941,9 @@ I.wait(2); // wait 2 secs
|
|
|
1768
1941
|
|
|
1769
1942
|
#### Parameters
|
|
1770
1943
|
|
|
1771
|
-
- `sec` **[number][
|
|
1944
|
+
- `sec` **[number][17]** number of second to wait.
|
|
1945
|
+
|
|
1946
|
+
Returns **[Promise][10]<any>**
|
|
1772
1947
|
|
|
1773
1948
|
### waitForClickable
|
|
1774
1949
|
|
|
@@ -1782,9 +1957,11 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1782
1957
|
|
|
1783
1958
|
#### Parameters
|
|
1784
1959
|
|
|
1785
|
-
- `locator` **([string][
|
|
1960
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1786
1961
|
- `waitTimeout`
|
|
1787
|
-
- `sec` **[number][
|
|
1962
|
+
- `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
1963
|
+
|
|
1964
|
+
Returns **[Promise][10]<any>**
|
|
1788
1965
|
|
|
1789
1966
|
### waitForDetached
|
|
1790
1967
|
|
|
@@ -1797,8 +1974,10 @@ I.waitForDetached('#popup');
|
|
|
1797
1974
|
|
|
1798
1975
|
#### Parameters
|
|
1799
1976
|
|
|
1800
|
-
- `locator` **([string][
|
|
1801
|
-
- `sec` **[number][
|
|
1977
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1978
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
1979
|
+
|
|
1980
|
+
Returns **[Promise][10]<any>**
|
|
1802
1981
|
|
|
1803
1982
|
### waitForElement
|
|
1804
1983
|
|
|
@@ -1812,8 +1991,10 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1812
1991
|
|
|
1813
1992
|
#### Parameters
|
|
1814
1993
|
|
|
1815
|
-
- `locator` **([string][
|
|
1816
|
-
- `sec` **[number][
|
|
1994
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
1995
|
+
- `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
1996
|
+
|
|
1997
|
+
Returns **[Promise][10]<any>**
|
|
1817
1998
|
|
|
1818
1999
|
### waitForEnabled
|
|
1819
2000
|
|
|
@@ -1822,8 +2003,10 @@ Element can be located by CSS or XPath.
|
|
|
1822
2003
|
|
|
1823
2004
|
#### Parameters
|
|
1824
2005
|
|
|
1825
|
-
- `locator` **([string][
|
|
1826
|
-
- `sec` **[number][
|
|
2006
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
2007
|
+
- `sec` **[number][17]** (optional) time in seconds to wait, 1 by default.
|
|
2008
|
+
|
|
2009
|
+
Returns **[Promise][10]<any>**
|
|
1827
2010
|
|
|
1828
2011
|
### waitForFunction
|
|
1829
2012
|
|
|
@@ -1842,9 +2025,11 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1842
2025
|
|
|
1843
2026
|
#### Parameters
|
|
1844
2027
|
|
|
1845
|
-
- `fn` **([string][
|
|
1846
|
-
- `argsOrSec` **([Array][19]<any> | [number][
|
|
1847
|
-
- `sec` **[number][
|
|
2028
|
+
- `fn` **([string][13] | [function][18])** to be executed in browser context.
|
|
2029
|
+
- `argsOrSec` **([Array][19]<any> | [number][17])?** (optional, `1` by default) arguments for function or seconds.
|
|
2030
|
+
- `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
2031
|
+
|
|
2032
|
+
Returns **[Promise][10]<any>**
|
|
1848
2033
|
|
|
1849
2034
|
### waitForInvisible
|
|
1850
2035
|
|
|
@@ -1857,19 +2042,23 @@ I.waitForInvisible('#popup');
|
|
|
1857
2042
|
|
|
1858
2043
|
#### Parameters
|
|
1859
2044
|
|
|
1860
|
-
- `locator` **([string][
|
|
1861
|
-
- `sec` **[number][
|
|
2045
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
2046
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2047
|
+
|
|
2048
|
+
Returns **[Promise][10]<any>**
|
|
1862
2049
|
|
|
1863
2050
|
### waitForNavigation
|
|
1864
2051
|
|
|
1865
2052
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1866
2053
|
|
|
1867
|
-
See [Playwright's reference][
|
|
2054
|
+
See [Playwright's reference][34]
|
|
1868
2055
|
|
|
1869
2056
|
#### Parameters
|
|
1870
2057
|
|
|
1871
2058
|
- `opts` **any**
|
|
1872
2059
|
|
|
2060
|
+
Returns **[Promise][10]<any>**
|
|
2061
|
+
|
|
1873
2062
|
### waitForRequest
|
|
1874
2063
|
|
|
1875
2064
|
Waits for a network request.
|
|
@@ -1881,8 +2070,10 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1881
2070
|
|
|
1882
2071
|
#### Parameters
|
|
1883
2072
|
|
|
1884
|
-
- `urlOrPredicate` **([string][
|
|
1885
|
-
- `sec` **[number][
|
|
2073
|
+
- `urlOrPredicate` **([string][13] | [function][18])**
|
|
2074
|
+
- `sec` **[number][17]?** seconds to wait
|
|
2075
|
+
|
|
2076
|
+
Returns **[Promise][10]<any>**
|
|
1886
2077
|
|
|
1887
2078
|
### waitForResponse
|
|
1888
2079
|
|
|
@@ -1895,8 +2086,10 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
1895
2086
|
|
|
1896
2087
|
#### Parameters
|
|
1897
2088
|
|
|
1898
|
-
- `urlOrPredicate` **([string][
|
|
1899
|
-
- `sec` **[number][
|
|
2089
|
+
- `urlOrPredicate` **([string][13] | [function][18])**
|
|
2090
|
+
- `sec` **[number][17]?** number of seconds to wait
|
|
2091
|
+
|
|
2092
|
+
Returns **[Promise][10]<any>**
|
|
1900
2093
|
|
|
1901
2094
|
### waitForText
|
|
1902
2095
|
|
|
@@ -1911,9 +2104,11 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1911
2104
|
|
|
1912
2105
|
#### Parameters
|
|
1913
2106
|
|
|
1914
|
-
- `text` **[string][
|
|
1915
|
-
- `sec` **[number][
|
|
1916
|
-
- `context` **([string][
|
|
2107
|
+
- `text` **[string][13]** to wait for.
|
|
2108
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2109
|
+
- `context` **([string][13] | [object][11])?** (optional) element located by CSS|XPath|strict locator.
|
|
2110
|
+
|
|
2111
|
+
Returns **[Promise][10]<any>**
|
|
1917
2112
|
|
|
1918
2113
|
### waitForValue
|
|
1919
2114
|
|
|
@@ -1925,9 +2120,11 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1925
2120
|
|
|
1926
2121
|
#### Parameters
|
|
1927
2122
|
|
|
1928
|
-
- `field` **([string][
|
|
1929
|
-
- `value` **[string][
|
|
1930
|
-
- `sec` **[number][
|
|
2123
|
+
- `field` **([string][13] | [object][11])** input field.
|
|
2124
|
+
- `value` **[string][13]** expected value.
|
|
2125
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2126
|
+
|
|
2127
|
+
Returns **[Promise][10]<any>**
|
|
1931
2128
|
|
|
1932
2129
|
### waitForVisible
|
|
1933
2130
|
|
|
@@ -1940,8 +2137,10 @@ I.waitForVisible('#popup');
|
|
|
1940
2137
|
|
|
1941
2138
|
#### Parameters
|
|
1942
2139
|
|
|
1943
|
-
- `locator` **([string][
|
|
1944
|
-
- `sec` **[number][
|
|
2140
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
2141
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2142
|
+
|
|
2143
|
+
Returns **[Promise][10]<any>** This method accepts [React selectors][35].
|
|
1945
2144
|
|
|
1946
2145
|
### waitInUrl
|
|
1947
2146
|
|
|
@@ -1953,8 +2152,10 @@ I.waitInUrl('/info', 2);
|
|
|
1953
2152
|
|
|
1954
2153
|
#### Parameters
|
|
1955
2154
|
|
|
1956
|
-
- `urlPart` **[string][
|
|
1957
|
-
- `sec` **[number][
|
|
2155
|
+
- `urlPart` **[string][13]** value to check.
|
|
2156
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2157
|
+
|
|
2158
|
+
Returns **[Promise][10]<any>**
|
|
1958
2159
|
|
|
1959
2160
|
### waitNumberOfVisibleElements
|
|
1960
2161
|
|
|
@@ -1966,9 +2167,11 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1966
2167
|
|
|
1967
2168
|
#### Parameters
|
|
1968
2169
|
|
|
1969
|
-
- `locator` **([string][
|
|
1970
|
-
- `num` **[number][
|
|
1971
|
-
- `sec` **[number][
|
|
2170
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
2171
|
+
- `num` **[number][17]** number of elements.
|
|
2172
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2173
|
+
|
|
2174
|
+
Returns **[Promise][10]<any>**
|
|
1972
2175
|
|
|
1973
2176
|
### waitToHide
|
|
1974
2177
|
|
|
@@ -1981,8 +2184,10 @@ I.waitToHide('#popup');
|
|
|
1981
2184
|
|
|
1982
2185
|
#### Parameters
|
|
1983
2186
|
|
|
1984
|
-
- `locator` **([string][
|
|
1985
|
-
- `sec` **[number][
|
|
2187
|
+
- `locator` **([string][13] | [object][11])** element located by CSS|XPath|strict locator.
|
|
2188
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2189
|
+
|
|
2190
|
+
Returns **[Promise][10]<any>**
|
|
1986
2191
|
|
|
1987
2192
|
### waitUrlEquals
|
|
1988
2193
|
|
|
@@ -1995,8 +2200,10 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1995
2200
|
|
|
1996
2201
|
#### Parameters
|
|
1997
2202
|
|
|
1998
|
-
- `urlPart` **[string][
|
|
1999
|
-
- `sec` **[number][
|
|
2203
|
+
- `urlPart` **[string][13]** value to check.
|
|
2204
|
+
- `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2205
|
+
|
|
2206
|
+
Returns **[Promise][10]<any>**
|
|
2000
2207
|
|
|
2001
2208
|
[1]: https://github.com/microsoft/playwright
|
|
2002
2209
|
|
|
@@ -2016,23 +2223,23 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2016
2223
|
|
|
2017
2224
|
[9]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
2018
2225
|
|
|
2019
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2226
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2020
2227
|
|
|
2021
|
-
[11]:
|
|
2228
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2022
2229
|
|
|
2023
|
-
[12]:
|
|
2230
|
+
[12]: http://jster.net/category/windows-modals-popups
|
|
2024
2231
|
|
|
2025
|
-
[13]: https://
|
|
2232
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2026
2233
|
|
|
2027
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2234
|
+
[14]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2028
2235
|
|
|
2029
|
-
[15]: https://playwright.dev/docs/api/class-page#page-
|
|
2236
|
+
[15]: https://playwright.dev/docs/api/class-page#page-click
|
|
2030
2237
|
|
|
2031
|
-
[16]: https://
|
|
2238
|
+
[16]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2032
2239
|
|
|
2033
|
-
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2240
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2034
2241
|
|
|
2035
|
-
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2242
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2036
2243
|
|
|
2037
2244
|
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2038
2245
|
|
|
@@ -2044,24 +2251,26 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2044
2251
|
|
|
2045
2252
|
[23]: https://playwright.dev/docs/network#handle-requests
|
|
2046
2253
|
|
|
2047
|
-
[24]: https://
|
|
2254
|
+
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2255
|
+
|
|
2256
|
+
[25]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2048
2257
|
|
|
2049
|
-
[
|
|
2258
|
+
[26]: #fillfield
|
|
2050
2259
|
|
|
2051
|
-
[
|
|
2260
|
+
[27]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2052
2261
|
|
|
2053
|
-
[
|
|
2262
|
+
[28]: #click
|
|
2054
2263
|
|
|
2055
|
-
[
|
|
2264
|
+
[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2056
2265
|
|
|
2057
|
-
[
|
|
2266
|
+
[30]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2058
2267
|
|
|
2059
|
-
[
|
|
2268
|
+
[31]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2060
2269
|
|
|
2061
|
-
[
|
|
2270
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2062
2271
|
|
|
2063
|
-
[
|
|
2272
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2064
2273
|
|
|
2065
|
-
[
|
|
2274
|
+
[34]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2066
2275
|
|
|
2067
|
-
[
|
|
2276
|
+
[35]: https://codecept.io/react
|