codeceptjs 3.5.3 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/docs/build/Appium.js +8 -6
- package/docs/build/GraphQL.js +25 -0
- package/docs/build/Nightmare.js +11 -6
- package/docs/build/Playwright.js +425 -193
- package/docs/build/Protractor.js +13 -8
- package/docs/build/Puppeteer.js +20 -14
- package/docs/build/TestCafe.js +17 -10
- package/docs/build/WebDriver.js +41 -37
- package/docs/changelog.md +170 -1
- package/docs/community-helpers.md +8 -4
- package/docs/examples.md +8 -2
- package/docs/helpers/Appium.md +2 -2
- package/docs/helpers/GraphQL.md +21 -0
- package/docs/helpers/Nightmare.md +2 -2
- package/docs/helpers/Playwright.md +239 -122
- package/docs/helpers/Protractor.md +2 -2
- package/docs/helpers/Puppeteer.md +3 -3
- package/docs/helpers/TestCafe.md +2 -2
- package/docs/helpers/WebDriver.md +3 -3
- package/docs/playwright.md +24 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/wiki/Books-&-Posts.md +0 -0
- package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
- package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
- package/docs/wiki/Examples.md +8 -2
- package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
- package/docs/wiki/Home.md +0 -0
- package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
- package/docs/wiki/Release-Process.md +0 -0
- package/docs/wiki/Roadmap.md +0 -0
- package/docs/wiki/Tests.md +0 -0
- package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
- package/docs/wiki/Videos.md +0 -0
- package/lib/command/definitions.js +2 -7
- package/lib/command/run-multiple/collection.js +17 -5
- package/lib/helper/Appium.js +6 -4
- package/lib/helper/GraphQL.js +25 -0
- package/lib/helper/Nightmare.js +9 -4
- package/lib/helper/Playwright.js +422 -190
- package/lib/helper/Protractor.js +11 -6
- package/lib/helper/Puppeteer.js +18 -12
- package/lib/helper/TestCafe.js +15 -8
- package/lib/helper/WebDriver.js +39 -35
- package/lib/helper/errors/ElementNotFound.js +2 -1
- package/lib/helper/extras/PlaywrightReact.js +9 -0
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/interfaces/bdd.js +1 -1
- package/lib/mochaFactory.js +2 -1
- package/lib/pause.js +5 -4
- package/lib/plugin/heal.js +2 -3
- package/lib/plugin/selenoid.js +6 -1
- package/lib/step.js +27 -10
- package/lib/utils.js +4 -0
- package/lib/workers.js +3 -1
- package/package.json +14 -14
- package/typings/promiseBasedTypes.d.ts +145 -126
- package/typings/types.d.ts +152 -133
- package/CHANGELOG.md +0 -2563
- package/docs/build/Polly.js +0 -42
- package/docs/build/SeleniumWebdriver.js +0 -76
|
@@ -42,25 +42,25 @@ Type: [object][5]
|
|
|
42
42
|
- `url` **[string][8]?** base url of website to be tested
|
|
43
43
|
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
44
44
|
- `show` **[boolean][32]?** show browser window.
|
|
45
|
-
- `restart` **([string][8] | [boolean][32])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][
|
|
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][19]?** - [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
|
|
52
52
|
- `keepVideoForPassedTests` **[boolean][32]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
53
|
-
- `trace` **[boolean][32]?** record [tracing information][
|
|
53
|
+
- `trace` **[boolean][32]?** record [tracing information][42] with screenshots and snapshots.
|
|
54
54
|
- `keepTraceForPassedTests` **[boolean][32]?** save trace for passed tests.
|
|
55
55
|
- `fullPageScreenshots` **[boolean][32]?** make full page screenshots on failure.
|
|
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][
|
|
60
|
-
- `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"
|
|
61
|
-
- `pressKeyDelay` **[number][
|
|
62
|
-
- `getPageTimeout` **[number][
|
|
63
|
-
- `waitForTimeout` **[number][
|
|
59
|
+
- `waitForAction` **[number][19]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
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][19]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
62
|
+
- `getPageTimeout` **[number][19]?** config option to set maximum navigation time in milliseconds.
|
|
63
|
+
- `waitForTimeout` **[number][19]?** 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][9]<[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
|
|
77
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements. Default: false
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
@@ -165,6 +165,7 @@ Traces will be saved to `output/trace`
|
|
|
165
165
|
url: "http://localhost",
|
|
166
166
|
show: true // headless mode not supported for extensions
|
|
167
167
|
chromium: {
|
|
168
|
+
// Note: due to this would launch persistent context, so to avoid the error when running tests with run-workers a timestamp would be appended to the defined folder name. For instance: playwright-tmp_1692715649511
|
|
168
169
|
userDataDir: '/tmp/playwright-tmp', // necessary to launch the browser in normal mode instead of incognito,
|
|
169
170
|
args: [
|
|
170
171
|
`--disable-extensions-except=${pathToExtension}`,
|
|
@@ -299,7 +300,7 @@ const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
|
299
300
|
|
|
300
301
|
### _locateCheckable
|
|
301
302
|
|
|
302
|
-
Find a checkbox by providing human
|
|
303
|
+
Find a checkbox by providing human-readable text:
|
|
303
304
|
NOTE: Assumes the checkable element exists
|
|
304
305
|
|
|
305
306
|
```js
|
|
@@ -313,7 +314,7 @@ this.helpers['Playwright']._locateCheckable('I agree with terms and conditions')
|
|
|
313
314
|
|
|
314
315
|
### _locateClickable
|
|
315
316
|
|
|
316
|
-
Find a clickable element by providing human
|
|
317
|
+
Find a clickable element by providing human-readable text:
|
|
317
318
|
|
|
318
319
|
```js
|
|
319
320
|
this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
@@ -323,9 +324,22 @@ this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
|
323
324
|
|
|
324
325
|
- `locator`
|
|
325
326
|
|
|
327
|
+
### _locateElement
|
|
328
|
+
|
|
329
|
+
Get the first element by different locator types, including strict locator
|
|
330
|
+
Should be used in custom helpers:
|
|
331
|
+
|
|
332
|
+
```js
|
|
333
|
+
const element = await this.helpers['Playwright']._locateElement({name: 'password'});
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
#### Parameters
|
|
337
|
+
|
|
338
|
+
- `locator`
|
|
339
|
+
|
|
326
340
|
### _locateFields
|
|
327
341
|
|
|
328
|
-
Find field elements by providing human
|
|
342
|
+
Find field elements by providing human-readable text:
|
|
329
343
|
|
|
330
344
|
```js
|
|
331
345
|
this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
@@ -424,7 +438,7 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
424
438
|
|
|
425
439
|
### blockTraffic
|
|
426
440
|
|
|
427
|
-
Blocks traffic
|
|
441
|
+
Blocks traffic of a given URL or a list of URLs.
|
|
428
442
|
|
|
429
443
|
Examples:
|
|
430
444
|
|
|
@@ -435,14 +449,18 @@ I.blockTraffic('http://example.com/**');
|
|
|
435
449
|
I.blockTraffic(/.css$/);
|
|
436
450
|
```
|
|
437
451
|
|
|
452
|
+
```js
|
|
453
|
+
I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.css']);
|
|
454
|
+
```
|
|
455
|
+
|
|
438
456
|
#### Parameters
|
|
439
457
|
|
|
440
|
-
- `
|
|
458
|
+
- `urls` **([string][8] | [Array][9] | [RegExp][10])** URL or a list of URLs to block . URL can contain * for wildcards. Example: [https://www.example.com**][11] to block all traffic for that domain. Regexp are also supported.
|
|
441
459
|
|
|
442
460
|
### blur
|
|
443
461
|
|
|
444
462
|
Remove focus from a text input, button, etc.
|
|
445
|
-
Calls [blur][
|
|
463
|
+
Calls [blur][12] on the element.
|
|
446
464
|
|
|
447
465
|
Examples:
|
|
448
466
|
|
|
@@ -460,7 +478,7 @@ I.dontSee('#add-to-cart-btn');
|
|
|
460
478
|
#### Parameters
|
|
461
479
|
|
|
462
480
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
463
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
481
|
+
- `options` **any?** Playwright only: [Additional options][13] for available options object as 2nd argument.
|
|
464
482
|
|
|
465
483
|
### cancelPopup
|
|
466
484
|
|
|
@@ -483,7 +501,7 @@ I.checkOption('agree', '//form');
|
|
|
483
501
|
|
|
484
502
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
485
503
|
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
486
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][
|
|
504
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][14] for check available as 3rd argument.Examples:```js
|
|
487
505
|
// click on element at position
|
|
488
506
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
489
507
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -517,12 +535,12 @@ I.clearField('.text-area')
|
|
|
517
535
|
I.clearField('#submit', { force: true })
|
|
518
536
|
```
|
|
519
537
|
|
|
520
|
-
Use `force` to bypass the [actionability][
|
|
538
|
+
Use `force` to bypass the [actionability][15] checks.
|
|
521
539
|
|
|
522
540
|
#### Parameters
|
|
523
541
|
|
|
524
542
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
525
|
-
- `options` **any?** [Additional options][
|
|
543
|
+
- `options` **any?** [Additional options][16] for available options object as 2nd argument.
|
|
526
544
|
|
|
527
545
|
### click
|
|
528
546
|
|
|
@@ -553,7 +571,7 @@ I.click({css: 'nav a.login'});
|
|
|
553
571
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
554
572
|
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
555
573
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
556
|
-
- `options` **any?** [Additional options][
|
|
574
|
+
- `options` **any?** [Additional options][17] for click available as 3rd argument.Examples:```js
|
|
557
575
|
// click on element at position
|
|
558
576
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
559
577
|
|
|
@@ -693,7 +711,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
693
711
|
#### Parameters
|
|
694
712
|
|
|
695
713
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
696
|
-
- `value` **[string][8]** value to check.
|
|
714
|
+
- `value` **([string][8] | [object][5])** value to check.
|
|
697
715
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
698
716
|
|
|
699
717
|
### dontSeeInSource
|
|
@@ -738,7 +756,7 @@ I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.exa
|
|
|
738
756
|
|
|
739
757
|
- `opts` **[Object][5]** options when checking the traffic network.
|
|
740
758
|
- `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.
|
|
741
|
-
- `opts.url` **([string][8] | [RegExp][
|
|
759
|
+
- `opts.url` **([string][8] | [RegExp][10])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
742
760
|
|
|
743
761
|
### doubleClick
|
|
744
762
|
|
|
@@ -771,7 +789,7 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
771
789
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
772
790
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
773
791
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
774
|
-
- `options` **any?** [Additional options][
|
|
792
|
+
- `options` **any?** [Additional options][18] can be passed as 3rd argument.```js
|
|
775
793
|
// specify coordinates for source position
|
|
776
794
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
777
795
|
```> 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`
|
|
@@ -789,7 +807,7 @@ I.dragSlider('#slider', -70);
|
|
|
789
807
|
#### Parameters
|
|
790
808
|
|
|
791
809
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
792
|
-
- `offsetX` **[number][
|
|
810
|
+
- `offsetX` **[number][19]** position to drag.
|
|
793
811
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
794
812
|
|
|
795
813
|
### executeScript
|
|
@@ -817,10 +835,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
817
835
|
|
|
818
836
|
#### Parameters
|
|
819
837
|
|
|
820
|
-
- `fn` **([string][8] | [function][
|
|
838
|
+
- `fn` **([string][8] | [function][20])** function to be executed in browser context.
|
|
821
839
|
- `arg` **any?** optional argument to pass to the function
|
|
822
840
|
|
|
823
|
-
Returns **[Promise][
|
|
841
|
+
Returns **[Promise][21]<any>**
|
|
824
842
|
|
|
825
843
|
### fillField
|
|
826
844
|
|
|
@@ -848,9 +866,13 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
848
866
|
|
|
849
867
|
Resets all recorded network requests.
|
|
850
868
|
|
|
869
|
+
### flushWebSocketMessages
|
|
870
|
+
|
|
871
|
+
Resets all recorded WS messages.
|
|
872
|
+
|
|
851
873
|
### focus
|
|
852
874
|
|
|
853
|
-
Calls [focus][
|
|
875
|
+
Calls [focus][12] on the matching element.
|
|
854
876
|
|
|
855
877
|
Examples:
|
|
856
878
|
|
|
@@ -863,7 +885,7 @@ I.see('#add-to-cart-bnt');
|
|
|
863
885
|
#### Parameters
|
|
864
886
|
|
|
865
887
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
866
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
888
|
+
- `options` **any?** Playwright only: [Additional options][22] for available options object as 2nd argument.
|
|
867
889
|
|
|
868
890
|
### forceClick
|
|
869
891
|
|
|
@@ -913,7 +935,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
913
935
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
914
936
|
- `attr` **[string][8]** attribute name.
|
|
915
937
|
|
|
916
|
-
Returns **[Promise][
|
|
938
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
917
939
|
|
|
918
940
|
### grabAttributeFromAll
|
|
919
941
|
|
|
@@ -929,7 +951,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
929
951
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
930
952
|
- `attr` **[string][8]** attribute name.
|
|
931
953
|
|
|
932
|
-
Returns **[Promise][
|
|
954
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** attribute value
|
|
933
955
|
|
|
934
956
|
### grabBrowserLogs
|
|
935
957
|
|
|
@@ -943,7 +965,7 @@ console.log(JSON.stringify(errors));
|
|
|
943
965
|
|
|
944
966
|
[Learn more about console messages][23]
|
|
945
967
|
|
|
946
|
-
Returns **[Promise][
|
|
968
|
+
Returns **[Promise][21]<[Array][9]<any>>**
|
|
947
969
|
|
|
948
970
|
### grabCookie
|
|
949
971
|
|
|
@@ -960,7 +982,7 @@ assert(cookie.value, '123456');
|
|
|
960
982
|
|
|
961
983
|
- `name` **[string][8]?** cookie name.
|
|
962
984
|
|
|
963
|
-
Returns **([Promise][
|
|
985
|
+
Returns **([Promise][21]<[string][8]> | [Promise][21]<[Array][9]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
964
986
|
|
|
965
987
|
### grabCssPropertyFrom
|
|
966
988
|
|
|
@@ -977,7 +999,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
977
999
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
978
1000
|
- `cssProperty` **[string][8]** CSS property name.
|
|
979
1001
|
|
|
980
|
-
Returns **[Promise][
|
|
1002
|
+
Returns **[Promise][21]<[string][8]>** CSS value
|
|
981
1003
|
|
|
982
1004
|
### grabCssPropertyFromAll
|
|
983
1005
|
|
|
@@ -993,7 +1015,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
993
1015
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
994
1016
|
- `cssProperty` **[string][8]** CSS property name.
|
|
995
1017
|
|
|
996
|
-
Returns **[Promise][
|
|
1018
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** CSS value
|
|
997
1019
|
|
|
998
1020
|
### grabCurrentUrl
|
|
999
1021
|
|
|
@@ -1005,7 +1027,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1005
1027
|
console.log(`Current URL is [${url}]`);
|
|
1006
1028
|
```
|
|
1007
1029
|
|
|
1008
|
-
Returns **[Promise][
|
|
1030
|
+
Returns **[Promise][21]<[string][8]>** current URL
|
|
1009
1031
|
|
|
1010
1032
|
### grabDataFromPerformanceTiming
|
|
1011
1033
|
|
|
@@ -1030,7 +1052,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
1030
1052
|
}
|
|
1031
1053
|
```
|
|
1032
1054
|
|
|
1033
|
-
Returns **[Promise][
|
|
1055
|
+
Returns **[Promise][21]<any>** automatically synchronized promise through #recorder
|
|
1034
1056
|
|
|
1035
1057
|
### grabElementBoundingRect
|
|
1036
1058
|
|
|
@@ -1058,7 +1080,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1058
1080
|
- `prop`
|
|
1059
1081
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
1060
1082
|
|
|
1061
|
-
Returns **([Promise][
|
|
1083
|
+
Returns **([Promise][21]<DOMRect> | [Promise][21]<[number][19]>)** Element bounding rectangle
|
|
1062
1084
|
|
|
1063
1085
|
### grabHTMLFrom
|
|
1064
1086
|
|
|
@@ -1075,7 +1097,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1075
1097
|
- `locator`
|
|
1076
1098
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1077
1099
|
|
|
1078
|
-
Returns **[Promise][
|
|
1100
|
+
Returns **[Promise][21]<[string][8]>** HTML code for an element
|
|
1079
1101
|
|
|
1080
1102
|
### grabHTMLFromAll
|
|
1081
1103
|
|
|
@@ -1091,7 +1113,61 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1091
1113
|
- `locator`
|
|
1092
1114
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1093
1115
|
|
|
1094
|
-
Returns **[Promise][
|
|
1116
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** HTML code for an element
|
|
1117
|
+
|
|
1118
|
+
### grabMetrics
|
|
1119
|
+
|
|
1120
|
+
Return a performance metric from the chrome cdp session.
|
|
1121
|
+
Note: Chrome-only
|
|
1122
|
+
|
|
1123
|
+
Examples:
|
|
1124
|
+
|
|
1125
|
+
```js
|
|
1126
|
+
const metrics = await I.grabMetrics();
|
|
1127
|
+
|
|
1128
|
+
// returned metrics
|
|
1129
|
+
|
|
1130
|
+
[
|
|
1131
|
+
{ name: 'Timestamp', value: 1584904.203473 },
|
|
1132
|
+
{ name: 'AudioHandlers', value: 0 },
|
|
1133
|
+
{ name: 'AudioWorkletProcessors', value: 0 },
|
|
1134
|
+
{ name: 'Documents', value: 22 },
|
|
1135
|
+
{ name: 'Frames', value: 10 },
|
|
1136
|
+
{ name: 'JSEventListeners', value: 366 },
|
|
1137
|
+
{ name: 'LayoutObjects', value: 1240 },
|
|
1138
|
+
{ name: 'MediaKeySessions', value: 0 },
|
|
1139
|
+
{ name: 'MediaKeys', value: 0 },
|
|
1140
|
+
{ name: 'Nodes', value: 4505 },
|
|
1141
|
+
{ name: 'Resources', value: 141 },
|
|
1142
|
+
{ name: 'ContextLifecycleStateObservers', value: 34 },
|
|
1143
|
+
{ name: 'V8PerContextDatas', value: 4 },
|
|
1144
|
+
{ name: 'WorkerGlobalScopes', value: 0 },
|
|
1145
|
+
{ name: 'UACSSResources', value: 0 },
|
|
1146
|
+
{ name: 'RTCPeerConnections', value: 0 },
|
|
1147
|
+
{ name: 'ResourceFetchers', value: 22 },
|
|
1148
|
+
{ name: 'AdSubframes', value: 0 },
|
|
1149
|
+
{ name: 'DetachedScriptStates', value: 2 },
|
|
1150
|
+
{ name: 'ArrayBufferContents', value: 1 },
|
|
1151
|
+
{ name: 'LayoutCount', value: 0 },
|
|
1152
|
+
{ name: 'RecalcStyleCount', value: 0 },
|
|
1153
|
+
{ name: 'LayoutDuration', value: 0 },
|
|
1154
|
+
{ name: 'RecalcStyleDuration', value: 0 },
|
|
1155
|
+
{ name: 'DevToolsCommandDuration', value: 0.000013 },
|
|
1156
|
+
{ name: 'ScriptDuration', value: 0 },
|
|
1157
|
+
{ name: 'V8CompileDuration', value: 0 },
|
|
1158
|
+
{ name: 'TaskDuration', value: 0.000014 },
|
|
1159
|
+
{ name: 'TaskOtherDuration', value: 0.000001 },
|
|
1160
|
+
{ name: 'ThreadTime', value: 0.000046 },
|
|
1161
|
+
{ name: 'ProcessTime', value: 0.616852 },
|
|
1162
|
+
{ name: 'JSHeapUsedSize', value: 19004908 },
|
|
1163
|
+
{ name: 'JSHeapTotalSize', value: 26820608 },
|
|
1164
|
+
{ name: 'FirstMeaningfulPaint', value: 0 },
|
|
1165
|
+
{ name: 'DomContentLoaded', value: 1584903.690491 },
|
|
1166
|
+
{ name: 'NavigationStart', value: 1584902.841845 }
|
|
1167
|
+
]
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
Returns **[Promise][21]<[Array][9]<[Object][5]>>**
|
|
1095
1171
|
|
|
1096
1172
|
### grabNumberOfOpenTabs
|
|
1097
1173
|
|
|
@@ -1102,7 +1178,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1102
1178
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1103
1179
|
```
|
|
1104
1180
|
|
|
1105
|
-
Returns **[Promise][
|
|
1181
|
+
Returns **[Promise][21]<[number][19]>** number of open tabs
|
|
1106
1182
|
|
|
1107
1183
|
### grabNumberOfVisibleElements
|
|
1108
1184
|
|
|
@@ -1117,7 +1193,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1117
1193
|
|
|
1118
1194
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1119
1195
|
|
|
1120
|
-
Returns **[Promise][
|
|
1196
|
+
Returns **[Promise][21]<[number][19]>** number of visible elements
|
|
1121
1197
|
|
|
1122
1198
|
### grabPageScrollPosition
|
|
1123
1199
|
|
|
@@ -1128,7 +1204,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1128
1204
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1129
1205
|
```
|
|
1130
1206
|
|
|
1131
|
-
Returns **[Promise][
|
|
1207
|
+
Returns **[Promise][21]<PageScrollPosition>** scroll position
|
|
1132
1208
|
|
|
1133
1209
|
### grabPopupText
|
|
1134
1210
|
|
|
@@ -1138,13 +1214,20 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1138
1214
|
await I.grabPopupText();
|
|
1139
1215
|
```
|
|
1140
1216
|
|
|
1141
|
-
Returns **[Promise][
|
|
1217
|
+
Returns **[Promise][21]<([string][8] | null)>**
|
|
1142
1218
|
|
|
1143
1219
|
### grabRecordedNetworkTraffics
|
|
1144
1220
|
|
|
1145
1221
|
Grab the recording network traffics
|
|
1146
1222
|
|
|
1147
|
-
|
|
1223
|
+
```js
|
|
1224
|
+
const traffics = await I.grabRecordedNetworkTraffics();
|
|
1225
|
+
expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1');
|
|
1226
|
+
expect(traffics[0].response.status).to.equal(200);
|
|
1227
|
+
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
Returns **[Promise][21]<[Array][9]<any>>**
|
|
1148
1231
|
|
|
1149
1232
|
### grabSource
|
|
1150
1233
|
|
|
@@ -1155,7 +1238,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1155
1238
|
let pageSource = await I.grabSource();
|
|
1156
1239
|
```
|
|
1157
1240
|
|
|
1158
|
-
Returns **[Promise][
|
|
1241
|
+
Returns **[Promise][21]<[string][8]>** source code
|
|
1159
1242
|
|
|
1160
1243
|
### grabTextFrom
|
|
1161
1244
|
|
|
@@ -1172,7 +1255,7 @@ If multiple elements found returns first element.
|
|
|
1172
1255
|
|
|
1173
1256
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1174
1257
|
|
|
1175
|
-
Returns **[Promise][
|
|
1258
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
1176
1259
|
|
|
1177
1260
|
### grabTextFromAll
|
|
1178
1261
|
|
|
@@ -1187,7 +1270,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1187
1270
|
|
|
1188
1271
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1189
1272
|
|
|
1190
|
-
Returns **[Promise][
|
|
1273
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** attribute value
|
|
1191
1274
|
|
|
1192
1275
|
### grabTitle
|
|
1193
1276
|
|
|
@@ -1198,7 +1281,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1198
1281
|
let title = await I.grabTitle();
|
|
1199
1282
|
```
|
|
1200
1283
|
|
|
1201
|
-
Returns **[Promise][
|
|
1284
|
+
Returns **[Promise][21]<[string][8]>** title
|
|
1202
1285
|
|
|
1203
1286
|
### grabTrafficUrl
|
|
1204
1287
|
|
|
@@ -1206,12 +1289,12 @@ Returns full URL of request matching parameter "urlMatch".
|
|
|
1206
1289
|
|
|
1207
1290
|
#### Parameters
|
|
1208
1291
|
|
|
1209
|
-
- `urlMatch` **([string][8] | [RegExp][
|
|
1292
|
+
- `urlMatch` **([string][8] | [RegExp][10])** Expected URL of request in network traffic. Can be a string or a regular expression.Examples:```js
|
|
1210
1293
|
I.grabTrafficUrl('https://api.example.com/session');
|
|
1211
1294
|
I.grabTrafficUrl(/session.*start/);
|
|
1212
1295
|
```
|
|
1213
1296
|
|
|
1214
|
-
Returns **[Promise][
|
|
1297
|
+
Returns **[Promise][21]<any>**
|
|
1215
1298
|
|
|
1216
1299
|
### grabValueFrom
|
|
1217
1300
|
|
|
@@ -1227,7 +1310,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1227
1310
|
|
|
1228
1311
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1229
1312
|
|
|
1230
|
-
Returns **[Promise][
|
|
1313
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
1231
1314
|
|
|
1232
1315
|
### grabValueFromAll
|
|
1233
1316
|
|
|
@@ -1242,7 +1325,13 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1242
1325
|
|
|
1243
1326
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1244
1327
|
|
|
1245
|
-
Returns **[Promise][
|
|
1328
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** attribute value
|
|
1329
|
+
|
|
1330
|
+
### grabWebSocketMessages
|
|
1331
|
+
|
|
1332
|
+
Grab the recording WS messages
|
|
1333
|
+
|
|
1334
|
+
Returns **[Array][9]<any>**
|
|
1246
1335
|
|
|
1247
1336
|
### handleDownloads
|
|
1248
1337
|
|
|
@@ -1262,7 +1351,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1262
1351
|
|
|
1263
1352
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1264
1353
|
|
|
1265
|
-
Returns **[Promise][
|
|
1354
|
+
Returns **[Promise][21]<void>**
|
|
1266
1355
|
|
|
1267
1356
|
### haveRequestHeaders
|
|
1268
1357
|
|
|
@@ -1297,7 +1386,7 @@ I.makeApiRequest('PATCH', )
|
|
|
1297
1386
|
- `url` **[string][8]** endpoint
|
|
1298
1387
|
- `options` **[object][5]** request options depending on method used
|
|
1299
1388
|
|
|
1300
|
-
Returns **[Promise][
|
|
1389
|
+
Returns **[Promise][21]<[object][5]>** response
|
|
1301
1390
|
|
|
1302
1391
|
### mockRoute
|
|
1303
1392
|
|
|
@@ -1311,8 +1400,8 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
|
|
|
1311
1400
|
|
|
1312
1401
|
#### Parameters
|
|
1313
1402
|
|
|
1314
|
-
- `url` **([string][8] | [RegExp][
|
|
1315
|
-
- `handler` **[function][
|
|
1403
|
+
- `url` **([string][8] | [RegExp][10])?** URL, regex or pattern for to match URL
|
|
1404
|
+
- `handler` **[function][20]?** a function to process reques
|
|
1316
1405
|
|
|
1317
1406
|
### mockTraffic
|
|
1318
1407
|
|
|
@@ -1346,8 +1435,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1346
1435
|
#### Parameters
|
|
1347
1436
|
|
|
1348
1437
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1349
|
-
- `offsetX` **[number][
|
|
1350
|
-
- `offsetY` **[number][
|
|
1438
|
+
- `offsetX` **[number][19]** (optional, `0` by default) X-axis offset.
|
|
1439
|
+
- `offsetY` **[number][19]** (optional, `0` by default) Y-axis offset.
|
|
1351
1440
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1352
1441
|
|
|
1353
1442
|
### openNewTab
|
|
@@ -1432,7 +1521,7 @@ Some of the supported key names are:
|
|
|
1432
1521
|
|
|
1433
1522
|
#### Parameters
|
|
1434
1523
|
|
|
1435
|
-
- `key` **([string][8] | [Array][
|
|
1524
|
+
- `key` **([string][8] | [Array][9]<[string][8]>)** key or array of keys to press.
|
|
1436
1525
|
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][30]).
|
|
1437
1526
|
|
|
1438
1527
|
### pressKeyDown
|
|
@@ -1486,8 +1575,8 @@ First parameter can be set to `maximize`.
|
|
|
1486
1575
|
|
|
1487
1576
|
#### Parameters
|
|
1488
1577
|
|
|
1489
|
-
- `width` **[number][
|
|
1490
|
-
- `height` **[number][
|
|
1578
|
+
- `width` **[number][19]** width in pixels or `maximize`.
|
|
1579
|
+
- `height` **[number][19]** height in pixels.
|
|
1491
1580
|
⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1492
1581
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1493
1582
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1597,8 +1686,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1597
1686
|
#### Parameters
|
|
1598
1687
|
|
|
1599
1688
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1600
|
-
- `offsetX` **[number][
|
|
1601
|
-
- `offsetY` **[number][
|
|
1689
|
+
- `offsetX` **[number][19]** (optional, `0` by default) X-axis offset.
|
|
1690
|
+
- `offsetY` **[number][19]** (optional, `0` by default) Y-axis offset.
|
|
1602
1691
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1603
1692
|
|
|
1604
1693
|
### see
|
|
@@ -1746,7 +1835,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1746
1835
|
#### Parameters
|
|
1747
1836
|
|
|
1748
1837
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1749
|
-
- `value` **[string][8]** value to check.
|
|
1838
|
+
- `value` **([string][8] | [object][5])** value to check.
|
|
1750
1839
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1751
1840
|
|
|
1752
1841
|
### seeInPopup
|
|
@@ -1801,7 +1890,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1801
1890
|
#### Parameters
|
|
1802
1891
|
|
|
1803
1892
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1804
|
-
- `num` **[number][
|
|
1893
|
+
- `num` **[number][19]** number of elements.
|
|
1805
1894
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1806
1895
|
|
|
1807
1896
|
### seeNumberOfVisibleElements
|
|
@@ -1816,7 +1905,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1816
1905
|
#### Parameters
|
|
1817
1906
|
|
|
1818
1907
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1819
|
-
- `num` **[number][
|
|
1908
|
+
- `num` **[number][19]** number of elements.
|
|
1820
1909
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1821
1910
|
|
|
1822
1911
|
### seeTextEquals
|
|
@@ -1884,9 +1973,9 @@ await I.seeTraffic({
|
|
|
1884
1973
|
- `opts.url` **[string][8]** Expected URL of request in network traffic
|
|
1885
1974
|
- `opts.parameters` **[Object][5]?** Expected parameters of that request in network traffic
|
|
1886
1975
|
- `opts.requestPostData` **[Object][5]?** Expected that request contains post data in network traffic
|
|
1887
|
-
- `opts.timeout` **[number][
|
|
1976
|
+
- `opts.timeout` **[number][19]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
1888
1977
|
|
|
1889
|
-
Returns **[Promise][
|
|
1978
|
+
Returns **[Promise][21]<any>**
|
|
1890
1979
|
|
|
1891
1980
|
### selectOption
|
|
1892
1981
|
|
|
@@ -1912,7 +2001,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1912
2001
|
#### Parameters
|
|
1913
2002
|
|
|
1914
2003
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1915
|
-
- `option` **([string][8] | [Array][
|
|
2004
|
+
- `option` **([string][8] | [Array][9]<any>)** visible text or value of option.
|
|
1916
2005
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1917
2006
|
|
|
1918
2007
|
### setCookie
|
|
@@ -1933,19 +2022,28 @@ I.setCookie([
|
|
|
1933
2022
|
|
|
1934
2023
|
#### Parameters
|
|
1935
2024
|
|
|
1936
|
-
- `cookie` **(Cookie | [Array][
|
|
2025
|
+
- `cookie` **(Cookie | [Array][9]<Cookie>)** a cookie object or array of cookie objects.
|
|
1937
2026
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1938
2027
|
|
|
1939
2028
|
### startRecordingTraffic
|
|
1940
2029
|
|
|
1941
|
-
Starts recording
|
|
2030
|
+
Starts recording the network traffics.
|
|
1942
2031
|
This also resets recorded network requests.
|
|
1943
2032
|
|
|
1944
2033
|
```js
|
|
1945
2034
|
I.startRecordingTraffic();
|
|
1946
2035
|
```
|
|
1947
2036
|
|
|
1948
|
-
Returns **
|
|
2037
|
+
Returns **void**
|
|
2038
|
+
|
|
2039
|
+
### startRecordingWebSocketMessages
|
|
2040
|
+
|
|
2041
|
+
Starts recording of websocket messages.
|
|
2042
|
+
This also resets recorded websocket messages.
|
|
2043
|
+
|
|
2044
|
+
```js
|
|
2045
|
+
await I.startRecordingWebSocketMessages();
|
|
2046
|
+
```
|
|
1949
2047
|
|
|
1950
2048
|
### stopMockingRoute
|
|
1951
2049
|
|
|
@@ -1960,8 +2058,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1960
2058
|
|
|
1961
2059
|
#### Parameters
|
|
1962
2060
|
|
|
1963
|
-
- `url` **([string][8] | [RegExp][
|
|
1964
|
-
- `handler` **[function][
|
|
2061
|
+
- `url` **([string][8] | [RegExp][10])?** URL, regex or pattern for to match URL
|
|
2062
|
+
- `handler` **[function][20]?** a function to process reques
|
|
1965
2063
|
|
|
1966
2064
|
### stopRecordingTraffic
|
|
1967
2065
|
|
|
@@ -1971,6 +2069,14 @@ Stops recording of network traffic. Recorded traffic is not flashed.
|
|
|
1971
2069
|
I.stopRecordingTraffic();
|
|
1972
2070
|
```
|
|
1973
2071
|
|
|
2072
|
+
### stopRecordingWebSocketMessages
|
|
2073
|
+
|
|
2074
|
+
Stops recording WS messages. Recorded WS messages is not flashed.
|
|
2075
|
+
|
|
2076
|
+
```js
|
|
2077
|
+
await I.stopRecordingWebSocketMessages();
|
|
2078
|
+
```
|
|
2079
|
+
|
|
1974
2080
|
### switchTo
|
|
1975
2081
|
|
|
1976
2082
|
Switches frame or in case of null locator reverts to parent.
|
|
@@ -1996,7 +2102,7 @@ I.switchToNextTab(2);
|
|
|
1996
2102
|
|
|
1997
2103
|
#### Parameters
|
|
1998
2104
|
|
|
1999
|
-
- `num` **[number][
|
|
2105
|
+
- `num` **[number][19]**
|
|
2000
2106
|
|
|
2001
2107
|
### switchToPreviousTab
|
|
2002
2108
|
|
|
@@ -2009,7 +2115,7 @@ I.switchToPreviousTab(2);
|
|
|
2009
2115
|
|
|
2010
2116
|
#### Parameters
|
|
2011
2117
|
|
|
2012
|
-
- `num` **[number][
|
|
2118
|
+
- `num` **[number][19]**
|
|
2013
2119
|
|
|
2014
2120
|
### type
|
|
2015
2121
|
|
|
@@ -2034,9 +2140,9 @@ I.type(secret('123456'));
|
|
|
2034
2140
|
#### Parameters
|
|
2035
2141
|
|
|
2036
2142
|
- `keys`
|
|
2037
|
-
- `delay` **[number][
|
|
2143
|
+
- `delay` **[number][19]?** (optional) delay in ms between key presses
|
|
2038
2144
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2039
|
-
- `key` **([string][8] | [Array][
|
|
2145
|
+
- `key` **([string][8] | [Array][9]<[string][8]>)** or array of keys to type.
|
|
2040
2146
|
|
|
2041
2147
|
### uncheckOption
|
|
2042
2148
|
|
|
@@ -2079,7 +2185,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
2079
2185
|
#### Parameters
|
|
2080
2186
|
|
|
2081
2187
|
- `description` **[string][8]** used to show in logs.
|
|
2082
|
-
- `fn` **[function][
|
|
2188
|
+
- `fn` **[function][20]** async function that executed with Playwright helper as argumen
|
|
2083
2189
|
|
|
2084
2190
|
### wait
|
|
2085
2191
|
|
|
@@ -2091,7 +2197,7 @@ I.wait(2); // wait 2 secs
|
|
|
2091
2197
|
|
|
2092
2198
|
#### Parameters
|
|
2093
2199
|
|
|
2094
|
-
- `sec` **[number][
|
|
2200
|
+
- `sec` **[number][19]** number of second to wait.
|
|
2095
2201
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2096
2202
|
|
|
2097
2203
|
### waitForClickable
|
|
@@ -2108,7 +2214,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2108
2214
|
|
|
2109
2215
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2110
2216
|
- `waitTimeout`
|
|
2111
|
-
- `sec` **[number][
|
|
2217
|
+
- `sec` **[number][19]?** (optional, `1` by default) time in seconds to wait
|
|
2112
2218
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2113
2219
|
|
|
2114
2220
|
### waitForDetached
|
|
@@ -2123,7 +2229,7 @@ I.waitForDetached('#popup');
|
|
|
2123
2229
|
#### Parameters
|
|
2124
2230
|
|
|
2125
2231
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2126
|
-
- `sec` **[number][
|
|
2232
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2127
2233
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2128
2234
|
|
|
2129
2235
|
### waitForElement
|
|
@@ -2139,7 +2245,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2139
2245
|
#### Parameters
|
|
2140
2246
|
|
|
2141
2247
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2142
|
-
- `sec` **[number][
|
|
2248
|
+
- `sec` **[number][19]?** (optional, `1` by default) time in seconds to wait
|
|
2143
2249
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2144
2250
|
|
|
2145
2251
|
### waitForEnabled
|
|
@@ -2150,7 +2256,7 @@ Element can be located by CSS or XPath.
|
|
|
2150
2256
|
#### Parameters
|
|
2151
2257
|
|
|
2152
2258
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2153
|
-
- `sec` **[number][
|
|
2259
|
+
- `sec` **[number][19]** (optional) time in seconds to wait, 1 by default.
|
|
2154
2260
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2155
2261
|
|
|
2156
2262
|
### waitForFunction
|
|
@@ -2170,9 +2276,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2170
2276
|
|
|
2171
2277
|
#### Parameters
|
|
2172
2278
|
|
|
2173
|
-
- `fn` **([string][8] | [function][
|
|
2174
|
-
- `argsOrSec` **([Array][
|
|
2175
|
-
- `sec` **[number][
|
|
2279
|
+
- `fn` **([string][8] | [function][20])** to be executed in browser context.
|
|
2280
|
+
- `argsOrSec` **([Array][9]<any> | [number][19])?** (optional, `1` by default) arguments for function or seconds.
|
|
2281
|
+
- `sec` **[number][19]?** (optional, `1` by default) time in seconds to wait
|
|
2176
2282
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2177
2283
|
|
|
2178
2284
|
### waitForInvisible
|
|
@@ -2187,12 +2293,12 @@ I.waitForInvisible('#popup');
|
|
|
2187
2293
|
#### Parameters
|
|
2188
2294
|
|
|
2189
2295
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2190
|
-
- `sec` **[number][
|
|
2296
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2191
2297
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2192
2298
|
|
|
2193
2299
|
### waitForNavigation
|
|
2194
2300
|
|
|
2195
|
-
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
2301
|
+
Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
2196
2302
|
|
|
2197
2303
|
See [Playwright's reference][37]
|
|
2198
2304
|
|
|
@@ -2211,8 +2317,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2211
2317
|
|
|
2212
2318
|
#### Parameters
|
|
2213
2319
|
|
|
2214
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2215
|
-
- `sec` **[number][
|
|
2320
|
+
- `urlOrPredicate` **([string][8] | [function][20])**
|
|
2321
|
+
- `sec` **[number][19]?** seconds to wait
|
|
2216
2322
|
|
|
2217
2323
|
### waitForResponse
|
|
2218
2324
|
|
|
@@ -2225,8 +2331,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2225
2331
|
|
|
2226
2332
|
#### Parameters
|
|
2227
2333
|
|
|
2228
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2229
|
-
- `sec` **[number][
|
|
2334
|
+
- `urlOrPredicate` **([string][8] | [function][20])**
|
|
2335
|
+
- `sec` **[number][19]?** number of seconds to wait
|
|
2230
2336
|
|
|
2231
2337
|
### waitForText
|
|
2232
2338
|
|
|
@@ -2242,10 +2348,21 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2242
2348
|
#### Parameters
|
|
2243
2349
|
|
|
2244
2350
|
- `text` **[string][8]** to wait for.
|
|
2245
|
-
- `sec` **[number][
|
|
2351
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2246
2352
|
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2247
2353
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2248
2354
|
|
|
2355
|
+
### waitForURL
|
|
2356
|
+
|
|
2357
|
+
Waits for page navigates to a new URL or reloads. By default, it takes configured `waitForNavigation` option.
|
|
2358
|
+
|
|
2359
|
+
See [Playwright's reference][38]
|
|
2360
|
+
|
|
2361
|
+
#### Parameters
|
|
2362
|
+
|
|
2363
|
+
- `url` **([string][8] | [RegExp][10])** 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
|
+
- `options` **any**
|
|
2365
|
+
|
|
2249
2366
|
### waitForValue
|
|
2250
2367
|
|
|
2251
2368
|
Waits for the specified value to be in value attribute.
|
|
@@ -2258,7 +2375,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2258
2375
|
|
|
2259
2376
|
- `field` **([string][8] | [object][5])** input field.
|
|
2260
2377
|
- `value` **[string][8]** expected value.
|
|
2261
|
-
- `sec` **[number][
|
|
2378
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2262
2379
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2263
2380
|
|
|
2264
2381
|
### waitForVisible
|
|
@@ -2273,8 +2390,8 @@ I.waitForVisible('#popup');
|
|
|
2273
2390
|
#### Parameters
|
|
2274
2391
|
|
|
2275
2392
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2276
|
-
- `sec` **[number][
|
|
2277
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][
|
|
2393
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2394
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][39].
|
|
2278
2395
|
|
|
2279
2396
|
### waitInUrl
|
|
2280
2397
|
|
|
@@ -2287,7 +2404,7 @@ I.waitInUrl('/info', 2);
|
|
|
2287
2404
|
#### Parameters
|
|
2288
2405
|
|
|
2289
2406
|
- `urlPart` **[string][8]** value to check.
|
|
2290
|
-
- `sec` **[number][
|
|
2407
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2291
2408
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2292
2409
|
|
|
2293
2410
|
### waitNumberOfVisibleElements
|
|
@@ -2301,8 +2418,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2301
2418
|
#### Parameters
|
|
2302
2419
|
|
|
2303
2420
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2304
|
-
- `num` **[number][
|
|
2305
|
-
- `sec` **[number][
|
|
2421
|
+
- `num` **[number][19]** number of elements.
|
|
2422
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2306
2423
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2307
2424
|
|
|
2308
2425
|
### waitToHide
|
|
@@ -2317,7 +2434,7 @@ I.waitToHide('#popup');
|
|
|
2317
2434
|
#### Parameters
|
|
2318
2435
|
|
|
2319
2436
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2320
|
-
- `sec` **[number][
|
|
2437
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2321
2438
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2322
2439
|
|
|
2323
2440
|
### waitUrlEquals
|
|
@@ -2332,7 +2449,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2332
2449
|
#### Parameters
|
|
2333
2450
|
|
|
2334
2451
|
- `urlPart` **[string][8]** value to check.
|
|
2335
|
-
- `sec` **[number][
|
|
2452
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2336
2453
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2337
2454
|
|
|
2338
2455
|
[1]: https://github.com/microsoft/playwright
|
|
@@ -2351,33 +2468,33 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2351
2468
|
|
|
2352
2469
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2353
2470
|
|
|
2354
|
-
[9]: https://
|
|
2471
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2355
2472
|
|
|
2356
|
-
[10]: https://developer.mozilla.org/
|
|
2473
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2357
2474
|
|
|
2358
|
-
[11]: https://
|
|
2475
|
+
[11]: https://www.example.com**
|
|
2359
2476
|
|
|
2360
|
-
[12]: https://
|
|
2477
|
+
[12]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2361
2478
|
|
|
2362
|
-
[13]: https://playwright.dev/docs/
|
|
2479
|
+
[13]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2363
2480
|
|
|
2364
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2481
|
+
[14]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2365
2482
|
|
|
2366
|
-
[15]: https://playwright.dev/docs/
|
|
2483
|
+
[15]: https://playwright.dev/docs/actionability
|
|
2367
2484
|
|
|
2368
|
-
[16]: https://
|
|
2485
|
+
[16]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2369
2486
|
|
|
2370
|
-
[17]: https://playwright.dev/docs/api/class-page#page-
|
|
2487
|
+
[17]: https://playwright.dev/docs/api/class-page#page-click
|
|
2371
2488
|
|
|
2372
|
-
[18]: https://
|
|
2489
|
+
[18]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2373
2490
|
|
|
2374
|
-
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2491
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2375
2492
|
|
|
2376
|
-
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2493
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2377
2494
|
|
|
2378
|
-
[21]: https://
|
|
2495
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2379
2496
|
|
|
2380
|
-
[22]: https://
|
|
2497
|
+
[22]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2381
2498
|
|
|
2382
2499
|
[23]: https://playwright.dev/docs/api/class-consolemessage
|
|
2383
2500
|
|
|
@@ -2409,15 +2526,15 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2409
2526
|
|
|
2410
2527
|
[37]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2411
2528
|
|
|
2412
|
-
[38]: https://
|
|
2529
|
+
[38]: https://playwright.dev/docs/api/class-page#page-wait-for-url
|
|
2413
2530
|
|
|
2414
|
-
[39]: https://
|
|
2531
|
+
[39]: https://codecept.io/react
|
|
2415
2532
|
|
|
2416
|
-
[40]: https://playwright.dev/docs/api/class-
|
|
2533
|
+
[40]: https://playwright.dev/docs/api/class-browsercontext
|
|
2417
2534
|
|
|
2418
|
-
[41]: https://playwright.dev/docs/
|
|
2535
|
+
[41]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2419
2536
|
|
|
2420
|
-
[42]: https://playwright.dev/docs/
|
|
2537
|
+
[42]: https://playwright.dev/docs/trace-viewer
|
|
2421
2538
|
|
|
2422
2539
|
[43]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2423
2540
|
|