codeceptjs 3.5.5 → 3.5.7-beta.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 +63 -0
- package/docs/bdd.md +11 -7
- package/docs/build/ApiDataFactory.js +2 -1
- package/docs/build/Appium.js +25 -23
- package/docs/build/Expect.js +422 -0
- package/docs/build/FileSystem.js +1 -1
- package/docs/build/Nightmare.js +53 -56
- package/docs/build/Playwright.js +209 -135
- package/docs/build/Protractor.js +66 -69
- package/docs/build/Puppeteer.js +83 -83
- package/docs/build/TestCafe.js +56 -55
- package/docs/build/WebDriver.js +85 -86
- package/docs/changelog.md +63 -0
- package/docs/commands.md +12 -0
- package/docs/helpers/Appium.md +50 -32
- package/docs/helpers/Expect.md +275 -0
- package/docs/helpers/FileSystem.md +1 -1
- package/docs/helpers/Nightmare.md +141 -94
- package/docs/helpers/Playwright.md +281 -212
- package/docs/helpers/Protractor.md +229 -169
- package/docs/helpers/Puppeteer.md +257 -186
- package/docs/helpers/TestCafe.md +201 -149
- package/docs/helpers/WebDriver.md +253 -179
- package/docs/mobile.md +17 -21
- package/docs/plugins.md +35 -1
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/blur.mustache +1 -0
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +0 -2
- package/docs/webapi/executeScript.mustache +0 -2
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/focus.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/grabCookie.mustache +1 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +1 -1
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- 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 +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/ai.js +12 -3
- package/lib/cli.js +3 -1
- package/lib/codecept.js +3 -0
- package/lib/command/dryRun.js +2 -1
- package/lib/command/info.js +24 -0
- package/lib/command/run-workers.js +3 -2
- package/lib/command/run.js +3 -2
- package/lib/data/context.js +14 -6
- package/lib/helper/ApiDataFactory.js +2 -1
- package/lib/helper/Appium.js +7 -5
- package/lib/helper/Expect.js +422 -0
- package/lib/helper/FileSystem.js +1 -1
- package/lib/helper/Playwright.js +134 -64
- package/lib/helper/Puppeteer.js +6 -6
- package/lib/helper/WebDriver.js +4 -4
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/html.js +3 -3
- package/lib/interfaces/gherkin.js +21 -2
- package/lib/output.js +1 -1
- package/lib/pause.js +6 -5
- package/lib/plugin/autoLogin.js +35 -8
- package/lib/plugin/heal.js +40 -7
- package/lib/plugin/retryTo.js +0 -2
- package/lib/plugin/tryTo.js +0 -3
- package/lib/recorder.js +12 -5
- package/lib/session.js +1 -1
- package/package.json +24 -17
- package/translations/de-DE.js +5 -0
- package/translations/fr-FR.js +14 -1
- package/translations/it-IT.js +1 -0
- package/translations/ja-JP.js +5 -0
- package/translations/pl-PL.js +5 -0
- package/translations/pt-BR.js +1 -0
- package/translations/ru-RU.js +1 -0
- package/translations/zh-CN.js +5 -0
- package/translations/zh-TW.js +5 -0
- package/typings/promiseBasedTypes.d.ts +905 -863
- package/typings/types.d.ts +909 -850
|
@@ -45,7 +45,7 @@ Type: [object][5]
|
|
|
45
45
|
- `restart` **([string][8] | [boolean][32])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][40] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
46
46
|
- 'browser' or **true** - closes browser and opens it again between tests.
|
|
47
47
|
- 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default before CodeceptJS 3.1
|
|
48
|
-
- `timeout` **[number][
|
|
48
|
+
- `timeout` **[number][20]?** - [timeout][41] in ms of all Playwright actions .
|
|
49
49
|
- `disableScreenshots` **[boolean][32]?** don't save screenshot on failure.
|
|
50
50
|
- `emulate` **any?** browser in device emulation mode.
|
|
51
51
|
- `video` **[boolean][32]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
@@ -56,11 +56,11 @@ Type: [object][5]
|
|
|
56
56
|
- `uniqueScreenshotNames` **[boolean][32]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
57
57
|
- `keepBrowserState` **[boolean][32]?** keep browser state between tests when `restart` is set to 'session'.
|
|
58
58
|
- `keepCookies` **[boolean][32]?** keep cookies between tests when `restart` is set to 'session'.
|
|
59
|
-
- `waitForAction` **[number][
|
|
59
|
+
- `waitForAction` **[number][20]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
60
60
|
- `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][38].
|
|
61
|
-
- `pressKeyDelay` **[number][
|
|
62
|
-
- `getPageTimeout` **[number][
|
|
63
|
-
- `waitForTimeout` **[number][
|
|
61
|
+
- `pressKeyDelay` **[number][20]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
62
|
+
- `getPageTimeout` **[number][20]?** config option to set maximum navigation time in milliseconds.
|
|
63
|
+
- `waitForTimeout` **[number][20]?** default wait* timeout in ms. Default: 1000.
|
|
64
64
|
- `basicAuth` **[object][5]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
65
65
|
- `windowSize` **[string][8]?** default window size. Set a dimension like `640x480`.
|
|
66
66
|
- `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
@@ -71,10 +71,10 @@ Type: [object][5]
|
|
|
71
71
|
- `firefox` **[object][5]?** pass additional firefox options
|
|
72
72
|
- `electron` **[object][5]?** (pass additional electron options
|
|
73
73
|
- `channel` **any?** (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge][43].
|
|
74
|
-
- `ignoreLog` **[Array][
|
|
74
|
+
- `ignoreLog` **[Array][10]<[string][8]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][44].
|
|
75
75
|
- `ignoreHTTPSErrors` **[boolean][32]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
76
|
- `bypassCSP` **[boolean][32]?** bypass Content Security Policy or CSP
|
|
77
|
-
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
77
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -400,7 +400,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
400
400
|
|
|
401
401
|
- `url` **[string][8]** url path or global url.
|
|
402
402
|
|
|
403
|
-
Returns **void
|
|
403
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
404
404
|
|
|
405
405
|
### appendField
|
|
406
406
|
|
|
@@ -417,7 +417,8 @@ I.appendField('password', secret('123456'));
|
|
|
417
417
|
|
|
418
418
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator
|
|
419
419
|
- `value` **[string][8]** text value to append.
|
|
420
|
-
|
|
420
|
+
|
|
421
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
421
422
|
|
|
422
423
|
### attachFile
|
|
423
424
|
|
|
@@ -434,7 +435,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
434
435
|
|
|
435
436
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
436
437
|
- `pathToFile` **[string][8]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
437
|
-
|
|
438
|
+
|
|
439
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
438
440
|
|
|
439
441
|
### blockTraffic
|
|
440
442
|
|
|
@@ -455,12 +457,12 @@ I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.cs
|
|
|
455
457
|
|
|
456
458
|
#### Parameters
|
|
457
459
|
|
|
458
|
-
- `urls` **([string][8] | [Array][
|
|
460
|
+
- `urls` **([string][8] | [Array][10] | [RegExp][11])** URL or a list of URLs to block . URL can contain * for wildcards. Example: [https://www.example.com**][12] to block all traffic for that domain. Regexp are also supported.
|
|
459
461
|
|
|
460
462
|
### blur
|
|
461
463
|
|
|
462
464
|
Remove focus from a text input, button, etc.
|
|
463
|
-
Calls [blur][
|
|
465
|
+
Calls [blur][13] on the element.
|
|
464
466
|
|
|
465
467
|
Examples:
|
|
466
468
|
|
|
@@ -478,7 +480,9 @@ I.dontSee('#add-to-cart-btn');
|
|
|
478
480
|
#### Parameters
|
|
479
481
|
|
|
480
482
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
481
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
483
|
+
- `options` **any?** Playwright only: [Additional options][14] for available options object as 2nd argument.
|
|
484
|
+
|
|
485
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
482
486
|
|
|
483
487
|
### cancelPopup
|
|
484
488
|
|
|
@@ -500,13 +504,14 @@ I.checkOption('agree', '//form');
|
|
|
500
504
|
#### Parameters
|
|
501
505
|
|
|
502
506
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
503
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
504
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][14] for check available as 3rd argument.Examples:```js
|
|
505
|
-
// click on element at position
|
|
506
|
-
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
507
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
507
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
508
508
|
- `options`
|
|
509
509
|
|
|
510
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder[Additional options][15] for check available as 3rd argument.Examples:```js
|
|
511
|
+
// click on element at position
|
|
512
|
+
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
513
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
514
|
+
|
|
510
515
|
### clearCookie
|
|
511
516
|
|
|
512
517
|
Clears a cookie by name,
|
|
@@ -519,8 +524,9 @@ I.clearCookie('test');
|
|
|
519
524
|
|
|
520
525
|
#### Parameters
|
|
521
526
|
|
|
522
|
-
- `cookie` **[string][8]?** (optional, `null` by default) cookie name
|
|
523
|
-
|
|
527
|
+
- `cookie` **[string][8]?** (optional, `null` by default) cookie name
|
|
528
|
+
|
|
529
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
524
530
|
|
|
525
531
|
### clearField
|
|
526
532
|
|
|
@@ -535,12 +541,12 @@ I.clearField('.text-area')
|
|
|
535
541
|
I.clearField('#submit', { force: true })
|
|
536
542
|
```
|
|
537
543
|
|
|
538
|
-
Use `force` to bypass the [actionability][
|
|
544
|
+
Use `force` to bypass the [actionability][16] checks.
|
|
539
545
|
|
|
540
546
|
#### Parameters
|
|
541
547
|
|
|
542
548
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
543
|
-
- `options` **any?** [Additional options][
|
|
549
|
+
- `options` **any?** [Additional options][17] for available options object as 2nd argument.
|
|
544
550
|
|
|
545
551
|
### click
|
|
546
552
|
|
|
@@ -569,9 +575,8 @@ I.click({css: 'nav a.login'});
|
|
|
569
575
|
#### Parameters
|
|
570
576
|
|
|
571
577
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
572
|
-
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
573
|
-
|
|
574
|
-
- `options` **any?** [Additional options][17] for click available as 3rd argument.Examples:```js
|
|
578
|
+
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
579
|
+
- `options` **any?** [Additional options][18] for click available as 3rd argument.Examples:```js
|
|
575
580
|
// click on element at position
|
|
576
581
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
577
582
|
|
|
@@ -579,6 +584,8 @@ I.click({css: 'nav a.login'});
|
|
|
579
584
|
I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
580
585
|
```
|
|
581
586
|
|
|
587
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
588
|
+
|
|
582
589
|
### clickLink
|
|
583
590
|
|
|
584
591
|
Clicks link and waits for navigation (deprecated)
|
|
@@ -617,8 +624,9 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
617
624
|
#### Parameters
|
|
618
625
|
|
|
619
626
|
- `text` **[string][8]** which is not present.
|
|
620
|
-
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
621
|
-
|
|
627
|
+
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
628
|
+
|
|
629
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
622
630
|
|
|
623
631
|
### dontSeeCheckboxIsChecked
|
|
624
632
|
|
|
@@ -633,7 +641,8 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
633
641
|
#### Parameters
|
|
634
642
|
|
|
635
643
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
636
|
-
|
|
644
|
+
|
|
645
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
637
646
|
|
|
638
647
|
### dontSeeCookie
|
|
639
648
|
|
|
@@ -646,7 +655,8 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
646
655
|
#### Parameters
|
|
647
656
|
|
|
648
657
|
- `name` **[string][8]** cookie name.
|
|
649
|
-
|
|
658
|
+
|
|
659
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
650
660
|
|
|
651
661
|
### dontSeeCurrentUrlEquals
|
|
652
662
|
|
|
@@ -661,7 +671,8 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
661
671
|
#### Parameters
|
|
662
672
|
|
|
663
673
|
- `url` **[string][8]** value to check.
|
|
664
|
-
|
|
674
|
+
|
|
675
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
665
676
|
|
|
666
677
|
### dontSeeElement
|
|
667
678
|
|
|
@@ -674,7 +685,8 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
674
685
|
#### Parameters
|
|
675
686
|
|
|
676
687
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|Strict locator.
|
|
677
|
-
|
|
688
|
+
|
|
689
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
678
690
|
|
|
679
691
|
### dontSeeElementInDOM
|
|
680
692
|
|
|
@@ -687,7 +699,8 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
687
699
|
#### Parameters
|
|
688
700
|
|
|
689
701
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|Strict locator.
|
|
690
|
-
|
|
702
|
+
|
|
703
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
691
704
|
|
|
692
705
|
### dontSeeInCurrentUrl
|
|
693
706
|
|
|
@@ -696,7 +709,8 @@ Checks that current url does not contain a provided fragment.
|
|
|
696
709
|
#### Parameters
|
|
697
710
|
|
|
698
711
|
- `url` **[string][8]** value to check.
|
|
699
|
-
|
|
712
|
+
|
|
713
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
700
714
|
|
|
701
715
|
### dontSeeInField
|
|
702
716
|
|
|
@@ -712,7 +726,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
712
726
|
|
|
713
727
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
714
728
|
- `value` **([string][8] | [object][5])** value to check.
|
|
715
|
-
|
|
729
|
+
|
|
730
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
716
731
|
|
|
717
732
|
### dontSeeInSource
|
|
718
733
|
|
|
@@ -726,7 +741,8 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
726
741
|
|
|
727
742
|
- `text`
|
|
728
743
|
- `value` **[string][8]** to check.
|
|
729
|
-
|
|
744
|
+
|
|
745
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
730
746
|
|
|
731
747
|
### dontSeeInTitle
|
|
732
748
|
|
|
@@ -739,7 +755,8 @@ I.dontSeeInTitle('Error');
|
|
|
739
755
|
#### Parameters
|
|
740
756
|
|
|
741
757
|
- `text` **[string][8]** value to check.
|
|
742
|
-
|
|
758
|
+
|
|
759
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
743
760
|
|
|
744
761
|
### dontSeeTraffic
|
|
745
762
|
|
|
@@ -756,7 +773,7 @@ I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.exa
|
|
|
756
773
|
|
|
757
774
|
- `opts` **[Object][5]** options when checking the traffic network.
|
|
758
775
|
- `opts.name` **[string][8]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
759
|
-
- `opts.url` **([string][8] | [RegExp][
|
|
776
|
+
- `opts.url` **([string][8] | [RegExp][11])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
760
777
|
|
|
761
778
|
### doubleClick
|
|
762
779
|
|
|
@@ -773,8 +790,9 @@ I.doubleClick('.btn.edit');
|
|
|
773
790
|
#### Parameters
|
|
774
791
|
|
|
775
792
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
776
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
777
|
-
|
|
793
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
794
|
+
|
|
795
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
778
796
|
|
|
779
797
|
### dragAndDrop
|
|
780
798
|
|
|
@@ -788,12 +806,13 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
788
806
|
|
|
789
807
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
790
808
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
791
|
-
|
|
792
|
-
- `options` **any?** [Additional options][18] can be passed as 3rd argument.```js
|
|
809
|
+
- `options` **any?** [Additional options][19] can be passed as 3rd argument.```js
|
|
793
810
|
// specify coordinates for source position
|
|
794
811
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
795
812
|
```> When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
|
|
796
813
|
|
|
814
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
815
|
+
|
|
797
816
|
### dragSlider
|
|
798
817
|
|
|
799
818
|
Drag the scrubber of a slider to a given position
|
|
@@ -807,8 +826,9 @@ I.dragSlider('#slider', -70);
|
|
|
807
826
|
#### Parameters
|
|
808
827
|
|
|
809
828
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
810
|
-
- `offsetX` **[number][
|
|
811
|
-
|
|
829
|
+
- `offsetX` **[number][20]** position to drag.
|
|
830
|
+
|
|
831
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
812
832
|
|
|
813
833
|
### executeScript
|
|
814
834
|
|
|
@@ -835,10 +855,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
835
855
|
|
|
836
856
|
#### Parameters
|
|
837
857
|
|
|
838
|
-
- `fn` **([string][8] | [function][
|
|
858
|
+
- `fn` **([string][8] | [function][21])** function to be executed in browser context.
|
|
839
859
|
- `arg` **any?** optional argument to pass to the function
|
|
840
860
|
|
|
841
|
-
Returns **[Promise][
|
|
861
|
+
Returns **[Promise][9]<any>**
|
|
842
862
|
|
|
843
863
|
### fillField
|
|
844
864
|
|
|
@@ -860,7 +880,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
860
880
|
|
|
861
881
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
862
882
|
- `value` **([string][8] | [object][5])** text value to fill.
|
|
863
|
-
|
|
883
|
+
|
|
884
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
864
885
|
|
|
865
886
|
### flushNetworkTraffics
|
|
866
887
|
|
|
@@ -872,7 +893,7 @@ Resets all recorded WS messages.
|
|
|
872
893
|
|
|
873
894
|
### focus
|
|
874
895
|
|
|
875
|
-
Calls [focus][
|
|
896
|
+
Calls [focus][13] on the matching element.
|
|
876
897
|
|
|
877
898
|
Examples:
|
|
878
899
|
|
|
@@ -887,6 +908,8 @@ I.see('#add-to-cart-bnt');
|
|
|
887
908
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
888
909
|
- `options` **any?** Playwright only: [Additional options][22] for available options object as 2nd argument.
|
|
889
910
|
|
|
911
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
912
|
+
|
|
890
913
|
### forceClick
|
|
891
914
|
|
|
892
915
|
Perform an emulated click on a link or a button, given by a locator.
|
|
@@ -917,8 +940,9 @@ I.forceClick({css: 'nav a.login'});
|
|
|
917
940
|
#### Parameters
|
|
918
941
|
|
|
919
942
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
920
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
921
|
-
|
|
943
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
944
|
+
|
|
945
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
922
946
|
|
|
923
947
|
### grabAttributeFrom
|
|
924
948
|
|
|
@@ -935,7 +959,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
935
959
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
936
960
|
- `attr` **[string][8]** attribute name.
|
|
937
961
|
|
|
938
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
939
963
|
|
|
940
964
|
### grabAttributeFromAll
|
|
941
965
|
|
|
@@ -951,7 +975,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
951
975
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
952
976
|
- `attr` **[string][8]** attribute name.
|
|
953
977
|
|
|
954
|
-
Returns **[Promise][
|
|
978
|
+
Returns **[Promise][9]<[Array][10]<[string][8]>>** attribute value
|
|
955
979
|
|
|
956
980
|
### grabBrowserLogs
|
|
957
981
|
|
|
@@ -965,7 +989,7 @@ console.log(JSON.stringify(errors));
|
|
|
965
989
|
|
|
966
990
|
[Learn more about console messages][23]
|
|
967
991
|
|
|
968
|
-
Returns **[Promise][
|
|
992
|
+
Returns **[Promise][9]<[Array][10]<any>>**
|
|
969
993
|
|
|
970
994
|
### grabCookie
|
|
971
995
|
|
|
@@ -982,7 +1006,7 @@ assert(cookie.value, '123456');
|
|
|
982
1006
|
|
|
983
1007
|
- `name` **[string][8]?** cookie name.
|
|
984
1008
|
|
|
985
|
-
Returns **
|
|
1009
|
+
Returns **any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
986
1010
|
|
|
987
1011
|
### grabCssPropertyFrom
|
|
988
1012
|
|
|
@@ -999,7 +1023,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
999
1023
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1000
1024
|
- `cssProperty` **[string][8]** CSS property name.
|
|
1001
1025
|
|
|
1002
|
-
Returns **[Promise][
|
|
1026
|
+
Returns **[Promise][9]<[string][8]>** CSS value
|
|
1003
1027
|
|
|
1004
1028
|
### grabCssPropertyFromAll
|
|
1005
1029
|
|
|
@@ -1015,7 +1039,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1015
1039
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1016
1040
|
- `cssProperty` **[string][8]** CSS property name.
|
|
1017
1041
|
|
|
1018
|
-
Returns **[Promise][
|
|
1042
|
+
Returns **[Promise][9]<[Array][10]<[string][8]>>** CSS value
|
|
1019
1043
|
|
|
1020
1044
|
### grabCurrentUrl
|
|
1021
1045
|
|
|
@@ -1027,7 +1051,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1027
1051
|
console.log(`Current URL is [${url}]`);
|
|
1028
1052
|
```
|
|
1029
1053
|
|
|
1030
|
-
Returns **[Promise][
|
|
1054
|
+
Returns **[Promise][9]<[string][8]>** current URL
|
|
1031
1055
|
|
|
1032
1056
|
### grabDataFromPerformanceTiming
|
|
1033
1057
|
|
|
@@ -1052,7 +1076,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
1052
1076
|
}
|
|
1053
1077
|
```
|
|
1054
1078
|
|
|
1055
|
-
Returns **[Promise][
|
|
1079
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1056
1080
|
|
|
1057
1081
|
### grabElementBoundingRect
|
|
1058
1082
|
|
|
@@ -1080,7 +1104,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1080
1104
|
- `prop`
|
|
1081
1105
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
1082
1106
|
|
|
1083
|
-
Returns **([Promise][
|
|
1107
|
+
Returns **([Promise][9]<DOMRect> | [Promise][9]<[number][20]>)** Element bounding rectangle
|
|
1084
1108
|
|
|
1085
1109
|
### grabHTMLFrom
|
|
1086
1110
|
|
|
@@ -1097,7 +1121,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1097
1121
|
- `locator`
|
|
1098
1122
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1099
1123
|
|
|
1100
|
-
Returns **[Promise][
|
|
1124
|
+
Returns **[Promise][9]<[string][8]>** HTML code for an element
|
|
1101
1125
|
|
|
1102
1126
|
### grabHTMLFromAll
|
|
1103
1127
|
|
|
@@ -1113,7 +1137,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1113
1137
|
- `locator`
|
|
1114
1138
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1115
1139
|
|
|
1116
|
-
Returns **[Promise][
|
|
1140
|
+
Returns **[Promise][9]<[Array][10]<[string][8]>>** HTML code for an element
|
|
1117
1141
|
|
|
1118
1142
|
### grabMetrics
|
|
1119
1143
|
|
|
@@ -1167,7 +1191,7 @@ const metrics = await I.grabMetrics();
|
|
|
1167
1191
|
]
|
|
1168
1192
|
```
|
|
1169
1193
|
|
|
1170
|
-
Returns **[Promise][
|
|
1194
|
+
Returns **[Promise][9]<[Array][10]<[Object][5]>>**
|
|
1171
1195
|
|
|
1172
1196
|
### grabNumberOfOpenTabs
|
|
1173
1197
|
|
|
@@ -1178,7 +1202,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1178
1202
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1179
1203
|
```
|
|
1180
1204
|
|
|
1181
|
-
Returns **[Promise][
|
|
1205
|
+
Returns **[Promise][9]<[number][20]>** number of open tabs
|
|
1182
1206
|
|
|
1183
1207
|
### grabNumberOfVisibleElements
|
|
1184
1208
|
|
|
@@ -1193,7 +1217,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1193
1217
|
|
|
1194
1218
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1195
1219
|
|
|
1196
|
-
Returns **[Promise][
|
|
1220
|
+
Returns **[Promise][9]<[number][20]>** number of visible elements
|
|
1197
1221
|
|
|
1198
1222
|
### grabPageScrollPosition
|
|
1199
1223
|
|
|
@@ -1204,7 +1228,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1204
1228
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1205
1229
|
```
|
|
1206
1230
|
|
|
1207
|
-
Returns **[Promise][
|
|
1231
|
+
Returns **[Promise][9]<PageScrollPosition>** scroll position
|
|
1208
1232
|
|
|
1209
1233
|
### grabPopupText
|
|
1210
1234
|
|
|
@@ -1214,7 +1238,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1214
1238
|
await I.grabPopupText();
|
|
1215
1239
|
```
|
|
1216
1240
|
|
|
1217
|
-
Returns **[Promise][
|
|
1241
|
+
Returns **[Promise][9]<([string][8] | null)>**
|
|
1218
1242
|
|
|
1219
1243
|
### grabRecordedNetworkTraffics
|
|
1220
1244
|
|
|
@@ -1227,7 +1251,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
1227
1251
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1228
1252
|
```
|
|
1229
1253
|
|
|
1230
|
-
Returns **[Promise][
|
|
1254
|
+
Returns **[Promise][9]<[Array][10]<any>>**
|
|
1231
1255
|
|
|
1232
1256
|
### grabSource
|
|
1233
1257
|
|
|
@@ -1238,7 +1262,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1238
1262
|
let pageSource = await I.grabSource();
|
|
1239
1263
|
```
|
|
1240
1264
|
|
|
1241
|
-
Returns **[Promise][
|
|
1265
|
+
Returns **[Promise][9]<[string][8]>** source code
|
|
1242
1266
|
|
|
1243
1267
|
### grabTextFrom
|
|
1244
1268
|
|
|
@@ -1255,7 +1279,7 @@ If multiple elements found returns first element.
|
|
|
1255
1279
|
|
|
1256
1280
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1257
1281
|
|
|
1258
|
-
Returns **[Promise][
|
|
1282
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
1259
1283
|
|
|
1260
1284
|
### grabTextFromAll
|
|
1261
1285
|
|
|
@@ -1270,7 +1294,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1270
1294
|
|
|
1271
1295
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1272
1296
|
|
|
1273
|
-
Returns **[Promise][
|
|
1297
|
+
Returns **[Promise][9]<[Array][10]<[string][8]>>** attribute value
|
|
1274
1298
|
|
|
1275
1299
|
### grabTitle
|
|
1276
1300
|
|
|
@@ -1281,7 +1305,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1281
1305
|
let title = await I.grabTitle();
|
|
1282
1306
|
```
|
|
1283
1307
|
|
|
1284
|
-
Returns **[Promise][
|
|
1308
|
+
Returns **[Promise][9]<[string][8]>** title
|
|
1285
1309
|
|
|
1286
1310
|
### grabTrafficUrl
|
|
1287
1311
|
|
|
@@ -1289,12 +1313,12 @@ Returns full URL of request matching parameter "urlMatch".
|
|
|
1289
1313
|
|
|
1290
1314
|
#### Parameters
|
|
1291
1315
|
|
|
1292
|
-
- `urlMatch` **([string][8] | [RegExp][
|
|
1316
|
+
- `urlMatch` **([string][8] | [RegExp][11])** Expected URL of request in network traffic. Can be a string or a regular expression.Examples:```js
|
|
1293
1317
|
I.grabTrafficUrl('https://api.example.com/session');
|
|
1294
1318
|
I.grabTrafficUrl(/session.*start/);
|
|
1295
1319
|
```
|
|
1296
1320
|
|
|
1297
|
-
Returns **[Promise][
|
|
1321
|
+
Returns **[Promise][9]<any>**
|
|
1298
1322
|
|
|
1299
1323
|
### grabValueFrom
|
|
1300
1324
|
|
|
@@ -1310,7 +1334,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1310
1334
|
|
|
1311
1335
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1312
1336
|
|
|
1313
|
-
Returns **[Promise][
|
|
1337
|
+
Returns **[Promise][9]<[string][8]>** attribute value
|
|
1314
1338
|
|
|
1315
1339
|
### grabValueFromAll
|
|
1316
1340
|
|
|
@@ -1325,13 +1349,13 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1325
1349
|
|
|
1326
1350
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1327
1351
|
|
|
1328
|
-
Returns **[Promise][
|
|
1352
|
+
Returns **[Promise][9]<[Array][10]<[string][8]>>** attribute value
|
|
1329
1353
|
|
|
1330
1354
|
### grabWebSocketMessages
|
|
1331
1355
|
|
|
1332
1356
|
Grab the recording WS messages
|
|
1333
1357
|
|
|
1334
|
-
Returns **[Array][
|
|
1358
|
+
Returns **[Array][10]<any>**
|
|
1335
1359
|
|
|
1336
1360
|
### handleDownloads
|
|
1337
1361
|
|
|
@@ -1351,21 +1375,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1351
1375
|
|
|
1352
1376
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1353
1377
|
|
|
1354
|
-
Returns **[Promise][
|
|
1355
|
-
|
|
1356
|
-
### haveRequestHeaders
|
|
1357
|
-
|
|
1358
|
-
Set headers for all next requests
|
|
1359
|
-
|
|
1360
|
-
```js
|
|
1361
|
-
I.haveRequestHeaders({
|
|
1362
|
-
'X-Sent-By': 'CodeceptJS',
|
|
1363
|
-
});
|
|
1364
|
-
```
|
|
1365
|
-
|
|
1366
|
-
#### Parameters
|
|
1367
|
-
|
|
1368
|
-
- `customHeaders` **[object][5]** headers to set
|
|
1378
|
+
Returns **[Promise][9]<void>**
|
|
1369
1379
|
|
|
1370
1380
|
### makeApiRequest
|
|
1371
1381
|
|
|
@@ -1386,7 +1396,7 @@ I.makeApiRequest('PATCH', )
|
|
|
1386
1396
|
- `url` **[string][8]** endpoint
|
|
1387
1397
|
- `options` **[object][5]** request options depending on method used
|
|
1388
1398
|
|
|
1389
|
-
Returns **[Promise][
|
|
1399
|
+
Returns **[Promise][9]<[object][5]>** response
|
|
1390
1400
|
|
|
1391
1401
|
### mockRoute
|
|
1392
1402
|
|
|
@@ -1400,8 +1410,8 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
|
|
|
1400
1410
|
|
|
1401
1411
|
#### Parameters
|
|
1402
1412
|
|
|
1403
|
-
- `url` **([string][8] | [RegExp][
|
|
1404
|
-
- `handler` **[function][
|
|
1413
|
+
- `url` **([string][8] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
1414
|
+
- `handler` **[function][21]?** a function to process reques
|
|
1405
1415
|
|
|
1406
1416
|
### mockTraffic
|
|
1407
1417
|
|
|
@@ -1435,9 +1445,10 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1435
1445
|
#### Parameters
|
|
1436
1446
|
|
|
1437
1447
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1438
|
-
- `offsetX` **[number][
|
|
1439
|
-
- `offsetY` **[number][
|
|
1440
|
-
|
|
1448
|
+
- `offsetX` **[number][20]** (optional, `0` by default) X-axis offset.
|
|
1449
|
+
- `offsetY` **[number][20]** (optional, `0` by default) Y-axis offset.
|
|
1450
|
+
|
|
1451
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1441
1452
|
|
|
1442
1453
|
### openNewTab
|
|
1443
1454
|
|
|
@@ -1521,8 +1532,9 @@ Some of the supported key names are:
|
|
|
1521
1532
|
|
|
1522
1533
|
#### Parameters
|
|
1523
1534
|
|
|
1524
|
-
- `key` **([string][8] | [Array][
|
|
1525
|
-
|
|
1535
|
+
- `key` **([string][8] | [Array][10]<[string][8]>)** key or array of keys to press.
|
|
1536
|
+
|
|
1537
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][30]).
|
|
1526
1538
|
|
|
1527
1539
|
### pressKeyDown
|
|
1528
1540
|
|
|
@@ -1539,7 +1551,8 @@ I.pressKeyUp('Control');
|
|
|
1539
1551
|
#### Parameters
|
|
1540
1552
|
|
|
1541
1553
|
- `key` **[string][8]** name of key to press down.
|
|
1542
|
-
|
|
1554
|
+
|
|
1555
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1543
1556
|
|
|
1544
1557
|
### pressKeyUp
|
|
1545
1558
|
|
|
@@ -1556,7 +1569,8 @@ I.pressKeyUp('Control');
|
|
|
1556
1569
|
#### Parameters
|
|
1557
1570
|
|
|
1558
1571
|
- `key` **[string][8]** name of key to release.
|
|
1559
|
-
|
|
1572
|
+
|
|
1573
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1560
1574
|
|
|
1561
1575
|
### refreshPage
|
|
1562
1576
|
|
|
@@ -1566,7 +1580,7 @@ Reload the current page.
|
|
|
1566
1580
|
I.refreshPage();
|
|
1567
1581
|
```
|
|
1568
1582
|
|
|
1569
|
-
|
|
1583
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1570
1584
|
|
|
1571
1585
|
### resizeWindow
|
|
1572
1586
|
|
|
@@ -1575,15 +1589,16 @@ First parameter can be set to `maximize`.
|
|
|
1575
1589
|
|
|
1576
1590
|
#### Parameters
|
|
1577
1591
|
|
|
1578
|
-
- `width` **[number][
|
|
1579
|
-
- `height` **[number][
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1592
|
+
- `width` **[number][20]** width in pixels or `maximize`.
|
|
1593
|
+
- `height` **[number][20]** height in pixels.
|
|
1594
|
+
|
|
1595
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1596
|
+
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1597
|
+
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1598
|
+
// inside codecept.conf.js
|
|
1599
|
+
// @codeceptjs/configure package must be installed
|
|
1600
|
+
{ setWindowSize } = require('@codeceptjs/configure');
|
|
1601
|
+
```
|
|
1587
1602
|
|
|
1588
1603
|
### restartBrowser
|
|
1589
1604
|
|
|
@@ -1618,8 +1633,9 @@ I.rightClick('Click me', '.context');
|
|
|
1618
1633
|
#### Parameters
|
|
1619
1634
|
|
|
1620
1635
|
- `locator` **([string][8] | [object][5])** clickable element located by CSS|XPath|strict locator.
|
|
1621
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1622
|
-
|
|
1636
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1637
|
+
|
|
1638
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1623
1639
|
|
|
1624
1640
|
### saveElementScreenshot
|
|
1625
1641
|
|
|
@@ -1634,7 +1650,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1634
1650
|
|
|
1635
1651
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1636
1652
|
- `fileName` **[string][8]** file name to save.
|
|
1637
|
-
|
|
1653
|
+
|
|
1654
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1638
1655
|
|
|
1639
1656
|
### saveScreenshot
|
|
1640
1657
|
|
|
@@ -1650,8 +1667,9 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1650
1667
|
#### Parameters
|
|
1651
1668
|
|
|
1652
1669
|
- `fileName` **[string][8]** file name to save.
|
|
1653
|
-
- `fullPage` **[boolean][32]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1654
|
-
|
|
1670
|
+
- `fullPage` **[boolean][32]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1671
|
+
|
|
1672
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1655
1673
|
|
|
1656
1674
|
### scrollPageToBottom
|
|
1657
1675
|
|
|
@@ -1661,7 +1679,7 @@ Scroll page to the bottom.
|
|
|
1661
1679
|
I.scrollPageToBottom();
|
|
1662
1680
|
```
|
|
1663
1681
|
|
|
1664
|
-
|
|
1682
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1665
1683
|
|
|
1666
1684
|
### scrollPageToTop
|
|
1667
1685
|
|
|
@@ -1671,7 +1689,7 @@ Scroll page to the top.
|
|
|
1671
1689
|
I.scrollPageToTop();
|
|
1672
1690
|
```
|
|
1673
1691
|
|
|
1674
|
-
|
|
1692
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1675
1693
|
|
|
1676
1694
|
### scrollTo
|
|
1677
1695
|
|
|
@@ -1686,9 +1704,10 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1686
1704
|
#### Parameters
|
|
1687
1705
|
|
|
1688
1706
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1689
|
-
- `offsetX` **[number][
|
|
1690
|
-
- `offsetY` **[number][
|
|
1691
|
-
|
|
1707
|
+
- `offsetX` **[number][20]** (optional, `0` by default) X-axis offset.
|
|
1708
|
+
- `offsetY` **[number][20]** (optional, `0` by default) Y-axis offset.
|
|
1709
|
+
|
|
1710
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1692
1711
|
|
|
1693
1712
|
### see
|
|
1694
1713
|
|
|
@@ -1704,8 +1723,9 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1704
1723
|
#### Parameters
|
|
1705
1724
|
|
|
1706
1725
|
- `text` **[string][8]** expected on page.
|
|
1707
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1708
|
-
|
|
1726
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1727
|
+
|
|
1728
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1709
1729
|
|
|
1710
1730
|
### seeAttributesOnElements
|
|
1711
1731
|
|
|
@@ -1719,7 +1739,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1719
1739
|
|
|
1720
1740
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1721
1741
|
- `attributes` **[object][5]** attributes and their values to check.
|
|
1722
|
-
|
|
1742
|
+
|
|
1743
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1723
1744
|
|
|
1724
1745
|
### seeCheckboxIsChecked
|
|
1725
1746
|
|
|
@@ -1734,7 +1755,8 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1734
1755
|
#### Parameters
|
|
1735
1756
|
|
|
1736
1757
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1737
|
-
|
|
1758
|
+
|
|
1759
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1738
1760
|
|
|
1739
1761
|
### seeCookie
|
|
1740
1762
|
|
|
@@ -1747,7 +1769,8 @@ I.seeCookie('Auth');
|
|
|
1747
1769
|
#### Parameters
|
|
1748
1770
|
|
|
1749
1771
|
- `name` **[string][8]** cookie name.
|
|
1750
|
-
|
|
1772
|
+
|
|
1773
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1751
1774
|
|
|
1752
1775
|
### seeCssPropertiesOnElements
|
|
1753
1776
|
|
|
@@ -1761,7 +1784,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1761
1784
|
|
|
1762
1785
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1763
1786
|
- `cssProperties` **[object][5]** object with CSS properties and their values to check.
|
|
1764
|
-
|
|
1787
|
+
|
|
1788
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1765
1789
|
|
|
1766
1790
|
### seeCurrentUrlEquals
|
|
1767
1791
|
|
|
@@ -1777,7 +1801,8 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1777
1801
|
#### Parameters
|
|
1778
1802
|
|
|
1779
1803
|
- `url` **[string][8]** value to check.
|
|
1780
|
-
|
|
1804
|
+
|
|
1805
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1781
1806
|
|
|
1782
1807
|
### seeElement
|
|
1783
1808
|
|
|
@@ -1791,7 +1816,8 @@ I.seeElement('#modal');
|
|
|
1791
1816
|
#### Parameters
|
|
1792
1817
|
|
|
1793
1818
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1794
|
-
|
|
1819
|
+
|
|
1820
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1795
1821
|
|
|
1796
1822
|
### seeElementInDOM
|
|
1797
1823
|
|
|
@@ -1805,7 +1831,8 @@ I.seeElementInDOM('#modal');
|
|
|
1805
1831
|
#### Parameters
|
|
1806
1832
|
|
|
1807
1833
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1808
|
-
|
|
1834
|
+
|
|
1835
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1809
1836
|
|
|
1810
1837
|
### seeInCurrentUrl
|
|
1811
1838
|
|
|
@@ -1818,7 +1845,8 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1818
1845
|
#### Parameters
|
|
1819
1846
|
|
|
1820
1847
|
- `url` **[string][8]** a fragment to check
|
|
1821
|
-
|
|
1848
|
+
|
|
1849
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1822
1850
|
|
|
1823
1851
|
### seeInField
|
|
1824
1852
|
|
|
@@ -1836,7 +1864,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1836
1864
|
|
|
1837
1865
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1838
1866
|
- `value` **([string][8] | [object][5])** value to check.
|
|
1839
|
-
|
|
1867
|
+
|
|
1868
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1840
1869
|
|
|
1841
1870
|
### seeInPopup
|
|
1842
1871
|
|
|
@@ -1850,7 +1879,8 @@ I.seeInPopup('Popup text');
|
|
|
1850
1879
|
#### Parameters
|
|
1851
1880
|
|
|
1852
1881
|
- `text` **[string][8]** value to check.
|
|
1853
|
-
|
|
1882
|
+
|
|
1883
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1854
1884
|
|
|
1855
1885
|
### seeInSource
|
|
1856
1886
|
|
|
@@ -1863,7 +1893,8 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1863
1893
|
#### Parameters
|
|
1864
1894
|
|
|
1865
1895
|
- `text` **[string][8]** value to check.
|
|
1866
|
-
|
|
1896
|
+
|
|
1897
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1867
1898
|
|
|
1868
1899
|
### seeInTitle
|
|
1869
1900
|
|
|
@@ -1876,7 +1907,8 @@ I.seeInTitle('Home Page');
|
|
|
1876
1907
|
#### Parameters
|
|
1877
1908
|
|
|
1878
1909
|
- `text` **[string][8]** text value to check.
|
|
1879
|
-
|
|
1910
|
+
|
|
1911
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1880
1912
|
|
|
1881
1913
|
### seeNumberOfElements
|
|
1882
1914
|
|
|
@@ -1890,8 +1922,9 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1890
1922
|
#### Parameters
|
|
1891
1923
|
|
|
1892
1924
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1893
|
-
- `num` **[number][
|
|
1894
|
-
|
|
1925
|
+
- `num` **[number][20]** number of elements.
|
|
1926
|
+
|
|
1927
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1895
1928
|
|
|
1896
1929
|
### seeNumberOfVisibleElements
|
|
1897
1930
|
|
|
@@ -1905,8 +1938,9 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1905
1938
|
#### Parameters
|
|
1906
1939
|
|
|
1907
1940
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1908
|
-
- `num` **[number][
|
|
1909
|
-
|
|
1941
|
+
- `num` **[number][20]** number of elements.
|
|
1942
|
+
|
|
1943
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1910
1944
|
|
|
1911
1945
|
### seeTextEquals
|
|
1912
1946
|
|
|
@@ -1919,8 +1953,9 @@ I.seeTextEquals('text', 'h1');
|
|
|
1919
1953
|
#### Parameters
|
|
1920
1954
|
|
|
1921
1955
|
- `text` **[string][8]** element value to check.
|
|
1922
|
-
- `context` **([string][8] | [object][5])?** element located by CSS|XPath|strict locator.
|
|
1923
|
-
|
|
1956
|
+
- `context` **([string][8] | [object][5])?** element located by CSS|XPath|strict locator.
|
|
1957
|
+
|
|
1958
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1924
1959
|
|
|
1925
1960
|
### seeTitleEquals
|
|
1926
1961
|
|
|
@@ -1933,7 +1968,8 @@ I.seeTitleEquals('Test title.');
|
|
|
1933
1968
|
#### Parameters
|
|
1934
1969
|
|
|
1935
1970
|
- `text` **[string][8]** value to check.
|
|
1936
|
-
|
|
1971
|
+
|
|
1972
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
1937
1973
|
|
|
1938
1974
|
### seeTraffic
|
|
1939
1975
|
|
|
@@ -1973,9 +2009,9 @@ await I.seeTraffic({
|
|
|
1973
2009
|
- `opts.url` **[string][8]** Expected URL of request in network traffic
|
|
1974
2010
|
- `opts.parameters` **[Object][5]?** Expected parameters of that request in network traffic
|
|
1975
2011
|
- `opts.requestPostData` **[Object][5]?** Expected that request contains post data in network traffic
|
|
1976
|
-
- `opts.timeout` **[number][
|
|
2012
|
+
- `opts.timeout` **[number][20]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
1977
2013
|
|
|
1978
|
-
Returns **[Promise][
|
|
2014
|
+
Returns **[Promise][9]<any>**
|
|
1979
2015
|
|
|
1980
2016
|
### selectOption
|
|
1981
2017
|
|
|
@@ -2001,8 +2037,9 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
2001
2037
|
#### Parameters
|
|
2002
2038
|
|
|
2003
2039
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
2004
|
-
- `option` **([string][8] | [Array][
|
|
2005
|
-
|
|
2040
|
+
- `option` **([string][8] | [Array][10]<any>)** visible text or value of option.
|
|
2041
|
+
|
|
2042
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2006
2043
|
|
|
2007
2044
|
### setCookie
|
|
2008
2045
|
|
|
@@ -2022,8 +2059,23 @@ I.setCookie([
|
|
|
2022
2059
|
|
|
2023
2060
|
#### Parameters
|
|
2024
2061
|
|
|
2025
|
-
- `cookie` **(Cookie | [Array][
|
|
2026
|
-
|
|
2062
|
+
- `cookie` **(Cookie | [Array][10]<Cookie>)** a cookie object or array of cookie objects.
|
|
2063
|
+
|
|
2064
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2065
|
+
|
|
2066
|
+
### setPlaywrightRequestHeaders
|
|
2067
|
+
|
|
2068
|
+
Set headers for all next requests
|
|
2069
|
+
|
|
2070
|
+
```js
|
|
2071
|
+
I.setPlaywrightRequestHeaders({
|
|
2072
|
+
'X-Sent-By': 'CodeceptJS',
|
|
2073
|
+
});
|
|
2074
|
+
```
|
|
2075
|
+
|
|
2076
|
+
#### Parameters
|
|
2077
|
+
|
|
2078
|
+
- `customHeaders` **[object][5]** headers to set
|
|
2027
2079
|
|
|
2028
2080
|
### startRecordingTraffic
|
|
2029
2081
|
|
|
@@ -2058,8 +2110,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
2058
2110
|
|
|
2059
2111
|
#### Parameters
|
|
2060
2112
|
|
|
2061
|
-
- `url` **([string][8] | [RegExp][
|
|
2062
|
-
- `handler` **[function][
|
|
2113
|
+
- `url` **([string][8] | [RegExp][11])?** URL, regex or pattern for to match URL
|
|
2114
|
+
- `handler` **[function][21]?** a function to process reques
|
|
2063
2115
|
|
|
2064
2116
|
### stopRecordingTraffic
|
|
2065
2117
|
|
|
@@ -2088,8 +2140,9 @@ I.switchTo(); // switch back to main page
|
|
|
2088
2140
|
|
|
2089
2141
|
#### Parameters
|
|
2090
2142
|
|
|
2091
|
-
- `locator` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2092
|
-
|
|
2143
|
+
- `locator` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2144
|
+
|
|
2145
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2093
2146
|
|
|
2094
2147
|
### switchToNextTab
|
|
2095
2148
|
|
|
@@ -2102,7 +2155,7 @@ I.switchToNextTab(2);
|
|
|
2102
2155
|
|
|
2103
2156
|
#### Parameters
|
|
2104
2157
|
|
|
2105
|
-
- `num` **[number][
|
|
2158
|
+
- `num` **[number][20]**
|
|
2106
2159
|
|
|
2107
2160
|
### switchToPreviousTab
|
|
2108
2161
|
|
|
@@ -2115,7 +2168,7 @@ I.switchToPreviousTab(2);
|
|
|
2115
2168
|
|
|
2116
2169
|
#### Parameters
|
|
2117
2170
|
|
|
2118
|
-
- `num` **[number][
|
|
2171
|
+
- `num` **[number][20]**
|
|
2119
2172
|
|
|
2120
2173
|
### type
|
|
2121
2174
|
|
|
@@ -2140,9 +2193,10 @@ I.type(secret('123456'));
|
|
|
2140
2193
|
#### Parameters
|
|
2141
2194
|
|
|
2142
2195
|
- `keys`
|
|
2143
|
-
- `delay` **[number][
|
|
2144
|
-
|
|
2145
|
-
|
|
2196
|
+
- `delay` **[number][20]?** (optional) delay in ms between key presses
|
|
2197
|
+
- `key` **([string][8] | [Array][10]<[string][8]>)** or array of keys to type.
|
|
2198
|
+
|
|
2199
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2146
2200
|
|
|
2147
2201
|
### uncheckOption
|
|
2148
2202
|
|
|
@@ -2160,13 +2214,14 @@ I.uncheckOption('agree', '//form');
|
|
|
2160
2214
|
#### Parameters
|
|
2161
2215
|
|
|
2162
2216
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
2163
|
-
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2164
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][33] for uncheck available as 3rd argument.Examples:```js
|
|
2165
|
-
// click on element at position
|
|
2166
|
-
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
2167
|
-
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
2217
|
+
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2168
2218
|
- `options`
|
|
2169
2219
|
|
|
2220
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder[Additional options][33] for uncheck available as 3rd argument.Examples:```js
|
|
2221
|
+
// click on element at position
|
|
2222
|
+
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
2223
|
+
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
2224
|
+
|
|
2170
2225
|
### usePlaywrightTo
|
|
2171
2226
|
|
|
2172
2227
|
Use Playwright API inside a test.
|
|
@@ -2185,7 +2240,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
2185
2240
|
#### Parameters
|
|
2186
2241
|
|
|
2187
2242
|
- `description` **[string][8]** used to show in logs.
|
|
2188
|
-
- `fn` **[function][
|
|
2243
|
+
- `fn` **[function][21]** async function that executed with Playwright helper as argumen
|
|
2189
2244
|
|
|
2190
2245
|
### wait
|
|
2191
2246
|
|
|
@@ -2197,8 +2252,9 @@ I.wait(2); // wait 2 secs
|
|
|
2197
2252
|
|
|
2198
2253
|
#### Parameters
|
|
2199
2254
|
|
|
2200
|
-
- `sec` **[number][
|
|
2201
|
-
|
|
2255
|
+
- `sec` **[number][20]** number of second to wait.
|
|
2256
|
+
|
|
2257
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2202
2258
|
|
|
2203
2259
|
### waitForClickable
|
|
2204
2260
|
|
|
@@ -2214,8 +2270,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2214
2270
|
|
|
2215
2271
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2216
2272
|
- `waitTimeout`
|
|
2217
|
-
- `sec` **[number][
|
|
2218
|
-
|
|
2273
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2274
|
+
|
|
2275
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2219
2276
|
|
|
2220
2277
|
### waitForDetached
|
|
2221
2278
|
|
|
@@ -2229,8 +2286,9 @@ I.waitForDetached('#popup');
|
|
|
2229
2286
|
#### Parameters
|
|
2230
2287
|
|
|
2231
2288
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2232
|
-
- `sec` **[number][
|
|
2233
|
-
|
|
2289
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2290
|
+
|
|
2291
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2234
2292
|
|
|
2235
2293
|
### waitForElement
|
|
2236
2294
|
|
|
@@ -2245,8 +2303,9 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2245
2303
|
#### Parameters
|
|
2246
2304
|
|
|
2247
2305
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2248
|
-
- `sec` **[number][
|
|
2249
|
-
|
|
2306
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2307
|
+
|
|
2308
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2250
2309
|
|
|
2251
2310
|
### waitForEnabled
|
|
2252
2311
|
|
|
@@ -2256,8 +2315,9 @@ Element can be located by CSS or XPath.
|
|
|
2256
2315
|
#### Parameters
|
|
2257
2316
|
|
|
2258
2317
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2259
|
-
- `sec` **[number][
|
|
2260
|
-
|
|
2318
|
+
- `sec` **[number][20]** (optional) time in seconds to wait, 1 by default.
|
|
2319
|
+
|
|
2320
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2261
2321
|
|
|
2262
2322
|
### waitForFunction
|
|
2263
2323
|
|
|
@@ -2276,10 +2336,11 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2276
2336
|
|
|
2277
2337
|
#### Parameters
|
|
2278
2338
|
|
|
2279
|
-
- `fn` **([string][8] | [function][
|
|
2280
|
-
- `argsOrSec` **([Array][
|
|
2281
|
-
- `sec` **[number][
|
|
2282
|
-
|
|
2339
|
+
- `fn` **([string][8] | [function][21])** to be executed in browser context.
|
|
2340
|
+
- `argsOrSec` **([Array][10]<any> | [number][20])?** (optional, `1` by default) arguments for function or seconds.
|
|
2341
|
+
- `sec` **[number][20]?** (optional, `1` by default) time in seconds to wait
|
|
2342
|
+
|
|
2343
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2283
2344
|
|
|
2284
2345
|
### waitForInvisible
|
|
2285
2346
|
|
|
@@ -2293,8 +2354,9 @@ I.waitForInvisible('#popup');
|
|
|
2293
2354
|
#### Parameters
|
|
2294
2355
|
|
|
2295
2356
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2296
|
-
- `sec` **[number][
|
|
2297
|
-
|
|
2357
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2358
|
+
|
|
2359
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2298
2360
|
|
|
2299
2361
|
### waitForNavigation
|
|
2300
2362
|
|
|
@@ -2317,8 +2379,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2317
2379
|
|
|
2318
2380
|
#### Parameters
|
|
2319
2381
|
|
|
2320
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2321
|
-
- `sec` **[number][
|
|
2382
|
+
- `urlOrPredicate` **([string][8] | [function][21])**
|
|
2383
|
+
- `sec` **[number][20]?** seconds to wait
|
|
2322
2384
|
|
|
2323
2385
|
### waitForResponse
|
|
2324
2386
|
|
|
@@ -2331,8 +2393,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2331
2393
|
|
|
2332
2394
|
#### Parameters
|
|
2333
2395
|
|
|
2334
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2335
|
-
- `sec` **[number][
|
|
2396
|
+
- `urlOrPredicate` **([string][8] | [function][21])**
|
|
2397
|
+
- `sec` **[number][20]?** number of seconds to wait
|
|
2336
2398
|
|
|
2337
2399
|
### waitForText
|
|
2338
2400
|
|
|
@@ -2348,9 +2410,10 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2348
2410
|
#### Parameters
|
|
2349
2411
|
|
|
2350
2412
|
- `text` **[string][8]** to wait for.
|
|
2351
|
-
- `sec` **[number][
|
|
2352
|
-
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2353
|
-
|
|
2413
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2414
|
+
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2415
|
+
|
|
2416
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2354
2417
|
|
|
2355
2418
|
### waitForURL
|
|
2356
2419
|
|
|
@@ -2360,7 +2423,7 @@ See [Playwright's reference][38]
|
|
|
2360
2423
|
|
|
2361
2424
|
#### Parameters
|
|
2362
2425
|
|
|
2363
|
-
- `url` **([string][8] | [RegExp][
|
|
2426
|
+
- `url` **([string][8] | [RegExp][11])** A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
|
|
2364
2427
|
- `options` **any**
|
|
2365
2428
|
|
|
2366
2429
|
### waitForValue
|
|
@@ -2375,8 +2438,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2375
2438
|
|
|
2376
2439
|
- `field` **([string][8] | [object][5])** input field.
|
|
2377
2440
|
- `value` **[string][8]** expected value.
|
|
2378
|
-
- `sec` **[number][
|
|
2379
|
-
|
|
2441
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2442
|
+
|
|
2443
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2380
2444
|
|
|
2381
2445
|
### waitForVisible
|
|
2382
2446
|
|
|
@@ -2390,8 +2454,9 @@ I.waitForVisible('#popup');
|
|
|
2390
2454
|
#### Parameters
|
|
2391
2455
|
|
|
2392
2456
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2393
|
-
- `sec` **[number][
|
|
2394
|
-
|
|
2457
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2458
|
+
|
|
2459
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorderThis method accepts [React selectors][39].
|
|
2395
2460
|
|
|
2396
2461
|
### waitInUrl
|
|
2397
2462
|
|
|
@@ -2404,8 +2469,9 @@ I.waitInUrl('/info', 2);
|
|
|
2404
2469
|
#### Parameters
|
|
2405
2470
|
|
|
2406
2471
|
- `urlPart` **[string][8]** value to check.
|
|
2407
|
-
- `sec` **[number][
|
|
2408
|
-
|
|
2472
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2473
|
+
|
|
2474
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2409
2475
|
|
|
2410
2476
|
### waitNumberOfVisibleElements
|
|
2411
2477
|
|
|
@@ -2418,9 +2484,10 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2418
2484
|
#### Parameters
|
|
2419
2485
|
|
|
2420
2486
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2421
|
-
- `num` **[number][
|
|
2422
|
-
- `sec` **[number][
|
|
2423
|
-
|
|
2487
|
+
- `num` **[number][20]** number of elements.
|
|
2488
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2489
|
+
|
|
2490
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2424
2491
|
|
|
2425
2492
|
### waitToHide
|
|
2426
2493
|
|
|
@@ -2434,8 +2501,9 @@ I.waitToHide('#popup');
|
|
|
2434
2501
|
#### Parameters
|
|
2435
2502
|
|
|
2436
2503
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2437
|
-
- `sec` **[number][
|
|
2438
|
-
|
|
2504
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2505
|
+
|
|
2506
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2439
2507
|
|
|
2440
2508
|
### waitUrlEquals
|
|
2441
2509
|
|
|
@@ -2449,8 +2517,9 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2449
2517
|
#### Parameters
|
|
2450
2518
|
|
|
2451
2519
|
- `urlPart` **[string][8]** value to check.
|
|
2452
|
-
- `sec` **[number][
|
|
2453
|
-
|
|
2520
|
+
- `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
|
|
2521
|
+
|
|
2522
|
+
Returns **[Promise][9]<void>** automatically synchronized promise through #recorder
|
|
2454
2523
|
|
|
2455
2524
|
[1]: https://github.com/microsoft/playwright
|
|
2456
2525
|
|
|
@@ -2468,31 +2537,31 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2468
2537
|
|
|
2469
2538
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2470
2539
|
|
|
2471
|
-
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2540
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2472
2541
|
|
|
2473
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2542
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2474
2543
|
|
|
2475
|
-
[11]: https://
|
|
2544
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2476
2545
|
|
|
2477
|
-
[12]: https://
|
|
2546
|
+
[12]: https://www.example.com**
|
|
2478
2547
|
|
|
2479
|
-
[13]: https://
|
|
2548
|
+
[13]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2480
2549
|
|
|
2481
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2550
|
+
[14]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2482
2551
|
|
|
2483
|
-
[15]: https://playwright.dev/docs/
|
|
2552
|
+
[15]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2484
2553
|
|
|
2485
|
-
[16]: https://playwright.dev/docs/
|
|
2554
|
+
[16]: https://playwright.dev/docs/actionability
|
|
2486
2555
|
|
|
2487
|
-
[17]: https://playwright.dev/docs/api/class-
|
|
2556
|
+
[17]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2488
2557
|
|
|
2489
|
-
[18]: https://playwright.dev/docs/api/class-page#page-
|
|
2558
|
+
[18]: https://playwright.dev/docs/api/class-page#page-click
|
|
2490
2559
|
|
|
2491
|
-
[19]: https://
|
|
2560
|
+
[19]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2492
2561
|
|
|
2493
|
-
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2562
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2494
2563
|
|
|
2495
|
-
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2564
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2496
2565
|
|
|
2497
2566
|
[22]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2498
2567
|
|