codeceptjs 3.5.4-beta.1 → 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 +220 -0
- 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 +1258 -0
- package/docs/helpers/Playwright.md +223 -119
- package/docs/helpers/Protractor.md +1709 -0
- 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 +1415 -0
- package/lib/helper/Playwright.js +321 -54
- package/lib/helper/Protractor.js +1837 -0
- package/lib/helper/Puppeteer.js +18 -12
- package/lib/helper/TestCafe.js +15 -8
- package/lib/helper/WebDriver.js +39 -35
- package/lib/helper/clientscripts/nightmare.js +213 -0
- package/lib/helper/errors/ElementNotFound.js +2 -1
- 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 +13 -13
- package/typings/promiseBasedTypes.d.ts +145 -126
- package/typings/types.d.ts +152 -133
- package/CHANGELOG.md +0 -2519
- 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}`,
|
|
@@ -437,7 +438,7 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
437
438
|
|
|
438
439
|
### blockTraffic
|
|
439
440
|
|
|
440
|
-
Blocks traffic
|
|
441
|
+
Blocks traffic of a given URL or a list of URLs.
|
|
441
442
|
|
|
442
443
|
Examples:
|
|
443
444
|
|
|
@@ -448,14 +449,18 @@ I.blockTraffic('http://example.com/**');
|
|
|
448
449
|
I.blockTraffic(/.css$/);
|
|
449
450
|
```
|
|
450
451
|
|
|
452
|
+
```js
|
|
453
|
+
I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.css']);
|
|
454
|
+
```
|
|
455
|
+
|
|
451
456
|
#### Parameters
|
|
452
457
|
|
|
453
|
-
- `
|
|
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.
|
|
454
459
|
|
|
455
460
|
### blur
|
|
456
461
|
|
|
457
462
|
Remove focus from a text input, button, etc.
|
|
458
|
-
Calls [blur][
|
|
463
|
+
Calls [blur][12] on the element.
|
|
459
464
|
|
|
460
465
|
Examples:
|
|
461
466
|
|
|
@@ -473,7 +478,7 @@ I.dontSee('#add-to-cart-btn');
|
|
|
473
478
|
#### Parameters
|
|
474
479
|
|
|
475
480
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
476
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
481
|
+
- `options` **any?** Playwright only: [Additional options][13] for available options object as 2nd argument.
|
|
477
482
|
|
|
478
483
|
### cancelPopup
|
|
479
484
|
|
|
@@ -496,7 +501,7 @@ I.checkOption('agree', '//form');
|
|
|
496
501
|
|
|
497
502
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
498
503
|
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
499
|
-
⚠️ 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
|
|
500
505
|
// click on element at position
|
|
501
506
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
502
507
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -530,12 +535,12 @@ I.clearField('.text-area')
|
|
|
530
535
|
I.clearField('#submit', { force: true })
|
|
531
536
|
```
|
|
532
537
|
|
|
533
|
-
Use `force` to bypass the [actionability][
|
|
538
|
+
Use `force` to bypass the [actionability][15] checks.
|
|
534
539
|
|
|
535
540
|
#### Parameters
|
|
536
541
|
|
|
537
542
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
538
|
-
- `options` **any?** [Additional options][
|
|
543
|
+
- `options` **any?** [Additional options][16] for available options object as 2nd argument.
|
|
539
544
|
|
|
540
545
|
### click
|
|
541
546
|
|
|
@@ -566,7 +571,7 @@ I.click({css: 'nav a.login'});
|
|
|
566
571
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
567
572
|
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
568
573
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
569
|
-
- `options` **any?** [Additional options][
|
|
574
|
+
- `options` **any?** [Additional options][17] for click available as 3rd argument.Examples:```js
|
|
570
575
|
// click on element at position
|
|
571
576
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
572
577
|
|
|
@@ -706,7 +711,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
706
711
|
#### Parameters
|
|
707
712
|
|
|
708
713
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
709
|
-
- `value` **[string][8]** value to check.
|
|
714
|
+
- `value` **([string][8] | [object][5])** value to check.
|
|
710
715
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
711
716
|
|
|
712
717
|
### dontSeeInSource
|
|
@@ -751,7 +756,7 @@ I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.exa
|
|
|
751
756
|
|
|
752
757
|
- `opts` **[Object][5]** options when checking the traffic network.
|
|
753
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.
|
|
754
|
-
- `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.
|
|
755
760
|
|
|
756
761
|
### doubleClick
|
|
757
762
|
|
|
@@ -784,7 +789,7 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
784
789
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
785
790
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
786
791
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
787
|
-
- `options` **any?** [Additional options][
|
|
792
|
+
- `options` **any?** [Additional options][18] can be passed as 3rd argument.```js
|
|
788
793
|
// specify coordinates for source position
|
|
789
794
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
790
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`
|
|
@@ -802,7 +807,7 @@ I.dragSlider('#slider', -70);
|
|
|
802
807
|
#### Parameters
|
|
803
808
|
|
|
804
809
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
805
|
-
- `offsetX` **[number][
|
|
810
|
+
- `offsetX` **[number][19]** position to drag.
|
|
806
811
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
807
812
|
|
|
808
813
|
### executeScript
|
|
@@ -830,10 +835,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
830
835
|
|
|
831
836
|
#### Parameters
|
|
832
837
|
|
|
833
|
-
- `fn` **([string][8] | [function][
|
|
838
|
+
- `fn` **([string][8] | [function][20])** function to be executed in browser context.
|
|
834
839
|
- `arg` **any?** optional argument to pass to the function
|
|
835
840
|
|
|
836
|
-
Returns **[Promise][
|
|
841
|
+
Returns **[Promise][21]<any>**
|
|
837
842
|
|
|
838
843
|
### fillField
|
|
839
844
|
|
|
@@ -861,9 +866,13 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
861
866
|
|
|
862
867
|
Resets all recorded network requests.
|
|
863
868
|
|
|
869
|
+
### flushWebSocketMessages
|
|
870
|
+
|
|
871
|
+
Resets all recorded WS messages.
|
|
872
|
+
|
|
864
873
|
### focus
|
|
865
874
|
|
|
866
|
-
Calls [focus][
|
|
875
|
+
Calls [focus][12] on the matching element.
|
|
867
876
|
|
|
868
877
|
Examples:
|
|
869
878
|
|
|
@@ -876,7 +885,7 @@ I.see('#add-to-cart-bnt');
|
|
|
876
885
|
#### Parameters
|
|
877
886
|
|
|
878
887
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
879
|
-
- `options` **any?** Playwright only: [Additional options][
|
|
888
|
+
- `options` **any?** Playwright only: [Additional options][22] for available options object as 2nd argument.
|
|
880
889
|
|
|
881
890
|
### forceClick
|
|
882
891
|
|
|
@@ -926,7 +935,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
926
935
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
927
936
|
- `attr` **[string][8]** attribute name.
|
|
928
937
|
|
|
929
|
-
Returns **[Promise][
|
|
938
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
930
939
|
|
|
931
940
|
### grabAttributeFromAll
|
|
932
941
|
|
|
@@ -942,7 +951,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
942
951
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
943
952
|
- `attr` **[string][8]** attribute name.
|
|
944
953
|
|
|
945
|
-
Returns **[Promise][
|
|
954
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** attribute value
|
|
946
955
|
|
|
947
956
|
### grabBrowserLogs
|
|
948
957
|
|
|
@@ -956,7 +965,7 @@ console.log(JSON.stringify(errors));
|
|
|
956
965
|
|
|
957
966
|
[Learn more about console messages][23]
|
|
958
967
|
|
|
959
|
-
Returns **[Promise][
|
|
968
|
+
Returns **[Promise][21]<[Array][9]<any>>**
|
|
960
969
|
|
|
961
970
|
### grabCookie
|
|
962
971
|
|
|
@@ -973,7 +982,7 @@ assert(cookie.value, '123456');
|
|
|
973
982
|
|
|
974
983
|
- `name` **[string][8]?** cookie name.
|
|
975
984
|
|
|
976
|
-
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.
|
|
977
986
|
|
|
978
987
|
### grabCssPropertyFrom
|
|
979
988
|
|
|
@@ -990,7 +999,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
990
999
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
991
1000
|
- `cssProperty` **[string][8]** CSS property name.
|
|
992
1001
|
|
|
993
|
-
Returns **[Promise][
|
|
1002
|
+
Returns **[Promise][21]<[string][8]>** CSS value
|
|
994
1003
|
|
|
995
1004
|
### grabCssPropertyFromAll
|
|
996
1005
|
|
|
@@ -1006,7 +1015,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1006
1015
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1007
1016
|
- `cssProperty` **[string][8]** CSS property name.
|
|
1008
1017
|
|
|
1009
|
-
Returns **[Promise][
|
|
1018
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** CSS value
|
|
1010
1019
|
|
|
1011
1020
|
### grabCurrentUrl
|
|
1012
1021
|
|
|
@@ -1018,7 +1027,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1018
1027
|
console.log(`Current URL is [${url}]`);
|
|
1019
1028
|
```
|
|
1020
1029
|
|
|
1021
|
-
Returns **[Promise][
|
|
1030
|
+
Returns **[Promise][21]<[string][8]>** current URL
|
|
1022
1031
|
|
|
1023
1032
|
### grabDataFromPerformanceTiming
|
|
1024
1033
|
|
|
@@ -1043,7 +1052,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
1043
1052
|
}
|
|
1044
1053
|
```
|
|
1045
1054
|
|
|
1046
|
-
Returns **[Promise][
|
|
1055
|
+
Returns **[Promise][21]<any>** automatically synchronized promise through #recorder
|
|
1047
1056
|
|
|
1048
1057
|
### grabElementBoundingRect
|
|
1049
1058
|
|
|
@@ -1071,7 +1080,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1071
1080
|
- `prop`
|
|
1072
1081
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
1073
1082
|
|
|
1074
|
-
Returns **([Promise][
|
|
1083
|
+
Returns **([Promise][21]<DOMRect> | [Promise][21]<[number][19]>)** Element bounding rectangle
|
|
1075
1084
|
|
|
1076
1085
|
### grabHTMLFrom
|
|
1077
1086
|
|
|
@@ -1088,7 +1097,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1088
1097
|
- `locator`
|
|
1089
1098
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1090
1099
|
|
|
1091
|
-
Returns **[Promise][
|
|
1100
|
+
Returns **[Promise][21]<[string][8]>** HTML code for an element
|
|
1092
1101
|
|
|
1093
1102
|
### grabHTMLFromAll
|
|
1094
1103
|
|
|
@@ -1104,7 +1113,61 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1104
1113
|
- `locator`
|
|
1105
1114
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1106
1115
|
|
|
1107
|
-
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]>>**
|
|
1108
1171
|
|
|
1109
1172
|
### grabNumberOfOpenTabs
|
|
1110
1173
|
|
|
@@ -1115,7 +1178,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1115
1178
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1116
1179
|
```
|
|
1117
1180
|
|
|
1118
|
-
Returns **[Promise][
|
|
1181
|
+
Returns **[Promise][21]<[number][19]>** number of open tabs
|
|
1119
1182
|
|
|
1120
1183
|
### grabNumberOfVisibleElements
|
|
1121
1184
|
|
|
@@ -1130,7 +1193,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1130
1193
|
|
|
1131
1194
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1132
1195
|
|
|
1133
|
-
Returns **[Promise][
|
|
1196
|
+
Returns **[Promise][21]<[number][19]>** number of visible elements
|
|
1134
1197
|
|
|
1135
1198
|
### grabPageScrollPosition
|
|
1136
1199
|
|
|
@@ -1141,7 +1204,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1141
1204
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1142
1205
|
```
|
|
1143
1206
|
|
|
1144
|
-
Returns **[Promise][
|
|
1207
|
+
Returns **[Promise][21]<PageScrollPosition>** scroll position
|
|
1145
1208
|
|
|
1146
1209
|
### grabPopupText
|
|
1147
1210
|
|
|
@@ -1151,13 +1214,20 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1151
1214
|
await I.grabPopupText();
|
|
1152
1215
|
```
|
|
1153
1216
|
|
|
1154
|
-
Returns **[Promise][
|
|
1217
|
+
Returns **[Promise][21]<([string][8] | null)>**
|
|
1155
1218
|
|
|
1156
1219
|
### grabRecordedNetworkTraffics
|
|
1157
1220
|
|
|
1158
1221
|
Grab the recording network traffics
|
|
1159
1222
|
|
|
1160
|
-
|
|
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>>**
|
|
1161
1231
|
|
|
1162
1232
|
### grabSource
|
|
1163
1233
|
|
|
@@ -1168,7 +1238,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1168
1238
|
let pageSource = await I.grabSource();
|
|
1169
1239
|
```
|
|
1170
1240
|
|
|
1171
|
-
Returns **[Promise][
|
|
1241
|
+
Returns **[Promise][21]<[string][8]>** source code
|
|
1172
1242
|
|
|
1173
1243
|
### grabTextFrom
|
|
1174
1244
|
|
|
@@ -1185,7 +1255,7 @@ If multiple elements found returns first element.
|
|
|
1185
1255
|
|
|
1186
1256
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1187
1257
|
|
|
1188
|
-
Returns **[Promise][
|
|
1258
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
1189
1259
|
|
|
1190
1260
|
### grabTextFromAll
|
|
1191
1261
|
|
|
@@ -1200,7 +1270,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1200
1270
|
|
|
1201
1271
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1202
1272
|
|
|
1203
|
-
Returns **[Promise][
|
|
1273
|
+
Returns **[Promise][21]<[Array][9]<[string][8]>>** attribute value
|
|
1204
1274
|
|
|
1205
1275
|
### grabTitle
|
|
1206
1276
|
|
|
@@ -1211,7 +1281,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1211
1281
|
let title = await I.grabTitle();
|
|
1212
1282
|
```
|
|
1213
1283
|
|
|
1214
|
-
Returns **[Promise][
|
|
1284
|
+
Returns **[Promise][21]<[string][8]>** title
|
|
1215
1285
|
|
|
1216
1286
|
### grabTrafficUrl
|
|
1217
1287
|
|
|
@@ -1219,12 +1289,12 @@ Returns full URL of request matching parameter "urlMatch".
|
|
|
1219
1289
|
|
|
1220
1290
|
#### Parameters
|
|
1221
1291
|
|
|
1222
|
-
- `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
|
|
1223
1293
|
I.grabTrafficUrl('https://api.example.com/session');
|
|
1224
1294
|
I.grabTrafficUrl(/session.*start/);
|
|
1225
1295
|
```
|
|
1226
1296
|
|
|
1227
|
-
Returns **[Promise][
|
|
1297
|
+
Returns **[Promise][21]<any>**
|
|
1228
1298
|
|
|
1229
1299
|
### grabValueFrom
|
|
1230
1300
|
|
|
@@ -1240,7 +1310,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1240
1310
|
|
|
1241
1311
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1242
1312
|
|
|
1243
|
-
Returns **[Promise][
|
|
1313
|
+
Returns **[Promise][21]<[string][8]>** attribute value
|
|
1244
1314
|
|
|
1245
1315
|
### grabValueFromAll
|
|
1246
1316
|
|
|
@@ -1255,7 +1325,13 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1255
1325
|
|
|
1256
1326
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1257
1327
|
|
|
1258
|
-
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>**
|
|
1259
1335
|
|
|
1260
1336
|
### handleDownloads
|
|
1261
1337
|
|
|
@@ -1275,7 +1351,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1275
1351
|
|
|
1276
1352
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1277
1353
|
|
|
1278
|
-
Returns **[Promise][
|
|
1354
|
+
Returns **[Promise][21]<void>**
|
|
1279
1355
|
|
|
1280
1356
|
### haveRequestHeaders
|
|
1281
1357
|
|
|
@@ -1310,7 +1386,7 @@ I.makeApiRequest('PATCH', )
|
|
|
1310
1386
|
- `url` **[string][8]** endpoint
|
|
1311
1387
|
- `options` **[object][5]** request options depending on method used
|
|
1312
1388
|
|
|
1313
|
-
Returns **[Promise][
|
|
1389
|
+
Returns **[Promise][21]<[object][5]>** response
|
|
1314
1390
|
|
|
1315
1391
|
### mockRoute
|
|
1316
1392
|
|
|
@@ -1324,8 +1400,8 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
|
|
|
1324
1400
|
|
|
1325
1401
|
#### Parameters
|
|
1326
1402
|
|
|
1327
|
-
- `url` **([string][8] | [RegExp][
|
|
1328
|
-
- `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
|
|
1329
1405
|
|
|
1330
1406
|
### mockTraffic
|
|
1331
1407
|
|
|
@@ -1359,8 +1435,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1359
1435
|
#### Parameters
|
|
1360
1436
|
|
|
1361
1437
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1362
|
-
- `offsetX` **[number][
|
|
1363
|
-
- `offsetY` **[number][
|
|
1438
|
+
- `offsetX` **[number][19]** (optional, `0` by default) X-axis offset.
|
|
1439
|
+
- `offsetY` **[number][19]** (optional, `0` by default) Y-axis offset.
|
|
1364
1440
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1365
1441
|
|
|
1366
1442
|
### openNewTab
|
|
@@ -1445,7 +1521,7 @@ Some of the supported key names are:
|
|
|
1445
1521
|
|
|
1446
1522
|
#### Parameters
|
|
1447
1523
|
|
|
1448
|
-
- `key` **([string][8] | [Array][
|
|
1524
|
+
- `key` **([string][8] | [Array][9]<[string][8]>)** key or array of keys to press.
|
|
1449
1525
|
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][30]).
|
|
1450
1526
|
|
|
1451
1527
|
### pressKeyDown
|
|
@@ -1499,8 +1575,8 @@ First parameter can be set to `maximize`.
|
|
|
1499
1575
|
|
|
1500
1576
|
#### Parameters
|
|
1501
1577
|
|
|
1502
|
-
- `width` **[number][
|
|
1503
|
-
- `height` **[number][
|
|
1578
|
+
- `width` **[number][19]** width in pixels or `maximize`.
|
|
1579
|
+
- `height` **[number][19]** height in pixels.
|
|
1504
1580
|
⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1505
1581
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1506
1582
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1610,8 +1686,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1610
1686
|
#### Parameters
|
|
1611
1687
|
|
|
1612
1688
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1613
|
-
- `offsetX` **[number][
|
|
1614
|
-
- `offsetY` **[number][
|
|
1689
|
+
- `offsetX` **[number][19]** (optional, `0` by default) X-axis offset.
|
|
1690
|
+
- `offsetY` **[number][19]** (optional, `0` by default) Y-axis offset.
|
|
1615
1691
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1616
1692
|
|
|
1617
1693
|
### see
|
|
@@ -1759,7 +1835,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1759
1835
|
#### Parameters
|
|
1760
1836
|
|
|
1761
1837
|
- `field` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
1762
|
-
- `value` **[string][8]** value to check.
|
|
1838
|
+
- `value` **([string][8] | [object][5])** value to check.
|
|
1763
1839
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1764
1840
|
|
|
1765
1841
|
### seeInPopup
|
|
@@ -1814,7 +1890,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1814
1890
|
#### Parameters
|
|
1815
1891
|
|
|
1816
1892
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1817
|
-
- `num` **[number][
|
|
1893
|
+
- `num` **[number][19]** number of elements.
|
|
1818
1894
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1819
1895
|
|
|
1820
1896
|
### seeNumberOfVisibleElements
|
|
@@ -1829,7 +1905,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1829
1905
|
#### Parameters
|
|
1830
1906
|
|
|
1831
1907
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1832
|
-
- `num` **[number][
|
|
1908
|
+
- `num` **[number][19]** number of elements.
|
|
1833
1909
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1834
1910
|
|
|
1835
1911
|
### seeTextEquals
|
|
@@ -1897,9 +1973,9 @@ await I.seeTraffic({
|
|
|
1897
1973
|
- `opts.url` **[string][8]** Expected URL of request in network traffic
|
|
1898
1974
|
- `opts.parameters` **[Object][5]?** Expected parameters of that request in network traffic
|
|
1899
1975
|
- `opts.requestPostData` **[Object][5]?** Expected that request contains post data in network traffic
|
|
1900
|
-
- `opts.timeout` **[number][
|
|
1976
|
+
- `opts.timeout` **[number][19]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
1901
1977
|
|
|
1902
|
-
Returns **[Promise][
|
|
1978
|
+
Returns **[Promise][21]<any>**
|
|
1903
1979
|
|
|
1904
1980
|
### selectOption
|
|
1905
1981
|
|
|
@@ -1925,7 +2001,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1925
2001
|
#### Parameters
|
|
1926
2002
|
|
|
1927
2003
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1928
|
-
- `option` **([string][8] | [Array][
|
|
2004
|
+
- `option` **([string][8] | [Array][9]<any>)** visible text or value of option.
|
|
1929
2005
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1930
2006
|
|
|
1931
2007
|
### setCookie
|
|
@@ -1946,19 +2022,28 @@ I.setCookie([
|
|
|
1946
2022
|
|
|
1947
2023
|
#### Parameters
|
|
1948
2024
|
|
|
1949
|
-
- `cookie` **(Cookie | [Array][
|
|
2025
|
+
- `cookie` **(Cookie | [Array][9]<Cookie>)** a cookie object or array of cookie objects.
|
|
1950
2026
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1951
2027
|
|
|
1952
2028
|
### startRecordingTraffic
|
|
1953
2029
|
|
|
1954
|
-
Starts recording
|
|
2030
|
+
Starts recording the network traffics.
|
|
1955
2031
|
This also resets recorded network requests.
|
|
1956
2032
|
|
|
1957
2033
|
```js
|
|
1958
2034
|
I.startRecordingTraffic();
|
|
1959
2035
|
```
|
|
1960
2036
|
|
|
1961
|
-
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
|
+
```
|
|
1962
2047
|
|
|
1963
2048
|
### stopMockingRoute
|
|
1964
2049
|
|
|
@@ -1973,8 +2058,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1973
2058
|
|
|
1974
2059
|
#### Parameters
|
|
1975
2060
|
|
|
1976
|
-
- `url` **([string][8] | [RegExp][
|
|
1977
|
-
- `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
|
|
1978
2063
|
|
|
1979
2064
|
### stopRecordingTraffic
|
|
1980
2065
|
|
|
@@ -1984,6 +2069,14 @@ Stops recording of network traffic. Recorded traffic is not flashed.
|
|
|
1984
2069
|
I.stopRecordingTraffic();
|
|
1985
2070
|
```
|
|
1986
2071
|
|
|
2072
|
+
### stopRecordingWebSocketMessages
|
|
2073
|
+
|
|
2074
|
+
Stops recording WS messages. Recorded WS messages is not flashed.
|
|
2075
|
+
|
|
2076
|
+
```js
|
|
2077
|
+
await I.stopRecordingWebSocketMessages();
|
|
2078
|
+
```
|
|
2079
|
+
|
|
1987
2080
|
### switchTo
|
|
1988
2081
|
|
|
1989
2082
|
Switches frame or in case of null locator reverts to parent.
|
|
@@ -2009,7 +2102,7 @@ I.switchToNextTab(2);
|
|
|
2009
2102
|
|
|
2010
2103
|
#### Parameters
|
|
2011
2104
|
|
|
2012
|
-
- `num` **[number][
|
|
2105
|
+
- `num` **[number][19]**
|
|
2013
2106
|
|
|
2014
2107
|
### switchToPreviousTab
|
|
2015
2108
|
|
|
@@ -2022,7 +2115,7 @@ I.switchToPreviousTab(2);
|
|
|
2022
2115
|
|
|
2023
2116
|
#### Parameters
|
|
2024
2117
|
|
|
2025
|
-
- `num` **[number][
|
|
2118
|
+
- `num` **[number][19]**
|
|
2026
2119
|
|
|
2027
2120
|
### type
|
|
2028
2121
|
|
|
@@ -2047,9 +2140,9 @@ I.type(secret('123456'));
|
|
|
2047
2140
|
#### Parameters
|
|
2048
2141
|
|
|
2049
2142
|
- `keys`
|
|
2050
|
-
- `delay` **[number][
|
|
2143
|
+
- `delay` **[number][19]?** (optional) delay in ms between key presses
|
|
2051
2144
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2052
|
-
- `key` **([string][8] | [Array][
|
|
2145
|
+
- `key` **([string][8] | [Array][9]<[string][8]>)** or array of keys to type.
|
|
2053
2146
|
|
|
2054
2147
|
### uncheckOption
|
|
2055
2148
|
|
|
@@ -2092,7 +2185,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
2092
2185
|
#### Parameters
|
|
2093
2186
|
|
|
2094
2187
|
- `description` **[string][8]** used to show in logs.
|
|
2095
|
-
- `fn` **[function][
|
|
2188
|
+
- `fn` **[function][20]** async function that executed with Playwright helper as argumen
|
|
2096
2189
|
|
|
2097
2190
|
### wait
|
|
2098
2191
|
|
|
@@ -2104,7 +2197,7 @@ I.wait(2); // wait 2 secs
|
|
|
2104
2197
|
|
|
2105
2198
|
#### Parameters
|
|
2106
2199
|
|
|
2107
|
-
- `sec` **[number][
|
|
2200
|
+
- `sec` **[number][19]** number of second to wait.
|
|
2108
2201
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2109
2202
|
|
|
2110
2203
|
### waitForClickable
|
|
@@ -2121,7 +2214,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2121
2214
|
|
|
2122
2215
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2123
2216
|
- `waitTimeout`
|
|
2124
|
-
- `sec` **[number][
|
|
2217
|
+
- `sec` **[number][19]?** (optional, `1` by default) time in seconds to wait
|
|
2125
2218
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2126
2219
|
|
|
2127
2220
|
### waitForDetached
|
|
@@ -2136,7 +2229,7 @@ I.waitForDetached('#popup');
|
|
|
2136
2229
|
#### Parameters
|
|
2137
2230
|
|
|
2138
2231
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2139
|
-
- `sec` **[number][
|
|
2232
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2140
2233
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2141
2234
|
|
|
2142
2235
|
### waitForElement
|
|
@@ -2152,7 +2245,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2152
2245
|
#### Parameters
|
|
2153
2246
|
|
|
2154
2247
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2155
|
-
- `sec` **[number][
|
|
2248
|
+
- `sec` **[number][19]?** (optional, `1` by default) time in seconds to wait
|
|
2156
2249
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2157
2250
|
|
|
2158
2251
|
### waitForEnabled
|
|
@@ -2163,7 +2256,7 @@ Element can be located by CSS or XPath.
|
|
|
2163
2256
|
#### Parameters
|
|
2164
2257
|
|
|
2165
2258
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2166
|
-
- `sec` **[number][
|
|
2259
|
+
- `sec` **[number][19]** (optional) time in seconds to wait, 1 by default.
|
|
2167
2260
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2168
2261
|
|
|
2169
2262
|
### waitForFunction
|
|
@@ -2183,9 +2276,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2183
2276
|
|
|
2184
2277
|
#### Parameters
|
|
2185
2278
|
|
|
2186
|
-
- `fn` **([string][8] | [function][
|
|
2187
|
-
- `argsOrSec` **([Array][
|
|
2188
|
-
- `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
|
|
2189
2282
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2190
2283
|
|
|
2191
2284
|
### waitForInvisible
|
|
@@ -2200,12 +2293,12 @@ I.waitForInvisible('#popup');
|
|
|
2200
2293
|
#### Parameters
|
|
2201
2294
|
|
|
2202
2295
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2203
|
-
- `sec` **[number][
|
|
2296
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2204
2297
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2205
2298
|
|
|
2206
2299
|
### waitForNavigation
|
|
2207
2300
|
|
|
2208
|
-
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
2301
|
+
Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
2209
2302
|
|
|
2210
2303
|
See [Playwright's reference][37]
|
|
2211
2304
|
|
|
@@ -2224,8 +2317,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2224
2317
|
|
|
2225
2318
|
#### Parameters
|
|
2226
2319
|
|
|
2227
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2228
|
-
- `sec` **[number][
|
|
2320
|
+
- `urlOrPredicate` **([string][8] | [function][20])**
|
|
2321
|
+
- `sec` **[number][19]?** seconds to wait
|
|
2229
2322
|
|
|
2230
2323
|
### waitForResponse
|
|
2231
2324
|
|
|
@@ -2238,8 +2331,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2238
2331
|
|
|
2239
2332
|
#### Parameters
|
|
2240
2333
|
|
|
2241
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2242
|
-
- `sec` **[number][
|
|
2334
|
+
- `urlOrPredicate` **([string][8] | [function][20])**
|
|
2335
|
+
- `sec` **[number][19]?** number of seconds to wait
|
|
2243
2336
|
|
|
2244
2337
|
### waitForText
|
|
2245
2338
|
|
|
@@ -2255,10 +2348,21 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2255
2348
|
#### Parameters
|
|
2256
2349
|
|
|
2257
2350
|
- `text` **[string][8]** to wait for.
|
|
2258
|
-
- `sec` **[number][
|
|
2351
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2259
2352
|
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2260
2353
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2261
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
|
+
|
|
2262
2366
|
### waitForValue
|
|
2263
2367
|
|
|
2264
2368
|
Waits for the specified value to be in value attribute.
|
|
@@ -2271,7 +2375,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2271
2375
|
|
|
2272
2376
|
- `field` **([string][8] | [object][5])** input field.
|
|
2273
2377
|
- `value` **[string][8]** expected value.
|
|
2274
|
-
- `sec` **[number][
|
|
2378
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2275
2379
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2276
2380
|
|
|
2277
2381
|
### waitForVisible
|
|
@@ -2286,8 +2390,8 @@ I.waitForVisible('#popup');
|
|
|
2286
2390
|
#### Parameters
|
|
2287
2391
|
|
|
2288
2392
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2289
|
-
- `sec` **[number][
|
|
2290
|
-
⚠️ 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].
|
|
2291
2395
|
|
|
2292
2396
|
### waitInUrl
|
|
2293
2397
|
|
|
@@ -2300,7 +2404,7 @@ I.waitInUrl('/info', 2);
|
|
|
2300
2404
|
#### Parameters
|
|
2301
2405
|
|
|
2302
2406
|
- `urlPart` **[string][8]** value to check.
|
|
2303
|
-
- `sec` **[number][
|
|
2407
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2304
2408
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2305
2409
|
|
|
2306
2410
|
### waitNumberOfVisibleElements
|
|
@@ -2314,8 +2418,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2314
2418
|
#### Parameters
|
|
2315
2419
|
|
|
2316
2420
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2317
|
-
- `num` **[number][
|
|
2318
|
-
- `sec` **[number][
|
|
2421
|
+
- `num` **[number][19]** number of elements.
|
|
2422
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2319
2423
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2320
2424
|
|
|
2321
2425
|
### waitToHide
|
|
@@ -2330,7 +2434,7 @@ I.waitToHide('#popup');
|
|
|
2330
2434
|
#### Parameters
|
|
2331
2435
|
|
|
2332
2436
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2333
|
-
- `sec` **[number][
|
|
2437
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2334
2438
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2335
2439
|
|
|
2336
2440
|
### waitUrlEquals
|
|
@@ -2345,7 +2449,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2345
2449
|
#### Parameters
|
|
2346
2450
|
|
|
2347
2451
|
- `urlPart` **[string][8]** value to check.
|
|
2348
|
-
- `sec` **[number][
|
|
2452
|
+
- `sec` **[number][19]** (optional, `1` by default) time in seconds to wait
|
|
2349
2453
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2350
2454
|
|
|
2351
2455
|
[1]: https://github.com/microsoft/playwright
|
|
@@ -2364,33 +2468,33 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2364
2468
|
|
|
2365
2469
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2366
2470
|
|
|
2367
|
-
[9]: https://
|
|
2471
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2368
2472
|
|
|
2369
|
-
[10]: https://developer.mozilla.org/
|
|
2473
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2370
2474
|
|
|
2371
|
-
[11]: https://
|
|
2475
|
+
[11]: https://www.example.com**
|
|
2372
2476
|
|
|
2373
|
-
[12]: https://
|
|
2477
|
+
[12]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2374
2478
|
|
|
2375
|
-
[13]: https://playwright.dev/docs/
|
|
2479
|
+
[13]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2376
2480
|
|
|
2377
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2481
|
+
[14]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2378
2482
|
|
|
2379
|
-
[15]: https://playwright.dev/docs/
|
|
2483
|
+
[15]: https://playwright.dev/docs/actionability
|
|
2380
2484
|
|
|
2381
|
-
[16]: https://
|
|
2485
|
+
[16]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2382
2486
|
|
|
2383
|
-
[17]: https://playwright.dev/docs/api/class-page#page-
|
|
2487
|
+
[17]: https://playwright.dev/docs/api/class-page#page-click
|
|
2384
2488
|
|
|
2385
|
-
[18]: https://
|
|
2489
|
+
[18]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2386
2490
|
|
|
2387
|
-
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2491
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2388
2492
|
|
|
2389
|
-
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
2493
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2390
2494
|
|
|
2391
|
-
[21]: https://
|
|
2495
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2392
2496
|
|
|
2393
|
-
[22]: https://
|
|
2497
|
+
[22]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2394
2498
|
|
|
2395
2499
|
[23]: https://playwright.dev/docs/api/class-consolemessage
|
|
2396
2500
|
|
|
@@ -2422,15 +2526,15 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2422
2526
|
|
|
2423
2527
|
[37]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2424
2528
|
|
|
2425
|
-
[38]: https://
|
|
2529
|
+
[38]: https://playwright.dev/docs/api/class-page#page-wait-for-url
|
|
2426
2530
|
|
|
2427
|
-
[39]: https://
|
|
2531
|
+
[39]: https://codecept.io/react
|
|
2428
2532
|
|
|
2429
|
-
[40]: https://playwright.dev/docs/api/class-
|
|
2533
|
+
[40]: https://playwright.dev/docs/api/class-browsercontext
|
|
2430
2534
|
|
|
2431
|
-
[41]: https://playwright.dev/docs/
|
|
2535
|
+
[41]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2432
2536
|
|
|
2433
|
-
[42]: https://playwright.dev/docs/
|
|
2537
|
+
[42]: https://playwright.dev/docs/trace-viewer
|
|
2434
2538
|
|
|
2435
2539
|
[43]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2436
2540
|
|