codeceptjs 3.4.1 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/README.md +9 -7
- package/bin/codecept.js +1 -1
- package/docs/ai.md +246 -0
- package/docs/build/Appium.js +47 -7
- package/docs/build/JSONResponse.js +4 -4
- package/docs/build/Nightmare.js +3 -1
- package/docs/build/OpenAI.js +122 -0
- package/docs/build/Playwright.js +193 -45
- package/docs/build/Protractor.js +3 -1
- package/docs/build/Puppeteer.js +45 -12
- package/docs/build/REST.js +15 -5
- package/docs/build/TestCafe.js +3 -1
- package/docs/build/WebDriver.js +30 -5
- package/docs/changelog.md +65 -0
- package/docs/helpers/Appium.md +152 -147
- package/docs/helpers/JSONResponse.md +4 -4
- package/docs/helpers/Nightmare.md +2 -0
- package/docs/helpers/OpenAI.md +70 -0
- package/docs/helpers/Playwright.md +194 -152
- package/docs/helpers/Puppeteer.md +6 -0
- package/docs/helpers/REST.md +6 -5
- package/docs/helpers/TestCafe.md +2 -0
- package/docs/helpers/WebDriver.md +10 -4
- package/docs/mobile.md +49 -2
- package/docs/parallel.md +56 -0
- package/docs/plugins.md +87 -33
- package/docs/secrets.md +6 -0
- package/docs/tutorial.md +2 -2
- package/docs/webapi/appendField.mustache +2 -0
- package/docs/webapi/type.mustache +3 -0
- package/lib/ai.js +171 -0
- package/lib/cli.js +1 -1
- package/lib/codecept.js +4 -0
- package/lib/command/dryRun.js +9 -1
- package/lib/command/generate.js +46 -3
- package/lib/command/init.js +13 -1
- package/lib/command/interactive.js +15 -1
- package/lib/command/run-workers.js +2 -1
- package/lib/container.js +13 -3
- package/lib/helper/Appium.js +45 -7
- package/lib/helper/JSONResponse.js +4 -4
- package/lib/helper/Nightmare.js +1 -1
- package/lib/helper/OpenAI.js +122 -0
- package/lib/helper/Playwright.js +190 -38
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/Puppeteer.js +40 -12
- package/lib/helper/REST.js +15 -5
- package/lib/helper/TestCafe.js +1 -1
- package/lib/helper/WebDriver.js +25 -5
- package/lib/helper/scripts/highlightElement.js +20 -0
- package/lib/html.js +258 -0
- package/lib/listener/retry.js +2 -1
- package/lib/pause.js +73 -17
- package/lib/plugin/debugErrors.js +67 -0
- package/lib/plugin/fakerTransform.js +4 -6
- package/lib/plugin/heal.js +179 -0
- package/lib/plugin/screenshotOnFail.js +11 -2
- package/lib/recorder.js +4 -4
- package/lib/secret.js +5 -4
- package/lib/step.js +6 -1
- package/lib/ui.js +4 -3
- package/lib/utils.js +4 -0
- package/lib/workers.js +57 -9
- package/package.json +25 -13
- package/translations/ja-JP.js +9 -9
- package/typings/index.d.ts +43 -9
- package/typings/promiseBasedTypes.d.ts +124 -24
- package/typings/types.d.ts +138 -30
|
@@ -40,39 +40,41 @@ Type: [object][5]
|
|
|
40
40
|
### Properties
|
|
41
41
|
|
|
42
42
|
- `url` **[string][8]** base url of website to be tested
|
|
43
|
-
- `browser` **
|
|
44
|
-
- `show` **[boolean][
|
|
45
|
-
- `restart` **([string][8] | [boolean][
|
|
43
|
+
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
44
|
+
- `show` **[boolean][30]?** show browser window.
|
|
45
|
+
- `restart` **([string][8] | [boolean][30])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][37] 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][
|
|
49
|
-
- `disableScreenshots` **[boolean][
|
|
48
|
+
- `timeout` **[number][14]?** - [timeout][38] in ms of all Playwright actions .
|
|
49
|
+
- `disableScreenshots` **[boolean][30]?** don't save screenshot on failure.
|
|
50
50
|
- `emulate` **any?** browser in device emulation mode.
|
|
51
|
-
- `video` **[boolean][
|
|
52
|
-
- `keepVideoForPassedTests` **[boolean][
|
|
53
|
-
- `trace` **[boolean][
|
|
54
|
-
- `keepTraceForPassedTests` **[boolean][
|
|
55
|
-
- `fullPageScreenshots` **[boolean][
|
|
56
|
-
- `uniqueScreenshotNames` **[boolean][
|
|
57
|
-
- `keepBrowserState` **[boolean][
|
|
58
|
-
- `keepCookies` **[boolean][
|
|
59
|
-
- `waitForAction` **[number][
|
|
60
|
-
- `waitForNavigation` **
|
|
61
|
-
- `pressKeyDelay` **[number][
|
|
62
|
-
- `getPageTimeout` **[number][
|
|
63
|
-
- `waitForTimeout` **[number][
|
|
51
|
+
- `video` **[boolean][30]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
52
|
+
- `keepVideoForPassedTests` **[boolean][30]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
53
|
+
- `trace` **[boolean][30]?** record [tracing information][39] with screenshots and snapshots.
|
|
54
|
+
- `keepTraceForPassedTests` **[boolean][30]?** save trace for passed tests.
|
|
55
|
+
- `fullPageScreenshots` **[boolean][30]?** make full page screenshots on failure.
|
|
56
|
+
- `uniqueScreenshotNames` **[boolean][30]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
57
|
+
- `keepBrowserState` **[boolean][30]?** keep browser state between tests when `restart` is set to 'session'.
|
|
58
|
+
- `keepCookies` **[boolean][30]?** keep cookies between tests when `restart` is set to 'session'.
|
|
59
|
+
- `waitForAction` **[number][14]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
60
|
+
- `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"networkidle"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][40].
|
|
61
|
+
- `pressKeyDelay` **[number][14]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
62
|
+
- `getPageTimeout` **[number][14]?** config option to set maximum navigation time in milliseconds.
|
|
63
|
+
- `waitForTimeout` **[number][14]?** 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
|
-
- `colorScheme` **
|
|
66
|
+
- `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
67
67
|
- `userAgent` **[string][8]?** user-agent string.
|
|
68
68
|
- `locale` **[string][8]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
69
|
-
- `manualStart` **[boolean][
|
|
69
|
+
- `manualStart` **[boolean][30]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
70
70
|
- `chromium` **[object][5]?** pass additional chromium options
|
|
71
71
|
- `firefox` **[object][5]?** pass additional firefox options
|
|
72
72
|
- `electron` **[object][5]?** (pass additional electron options
|
|
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][
|
|
74
|
-
- `ignoreLog` **[Array][
|
|
75
|
-
- `ignoreHTTPSErrors` **[boolean][
|
|
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][41].
|
|
74
|
+
- `ignoreLog` **[Array][19]<[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][42].
|
|
75
|
+
- `ignoreHTTPSErrors` **[boolean][30]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
|
+
- `bypassCSP` **[boolean][30]?** bypass Content Security Policy or CSP
|
|
77
|
+
- `highlightElement` **[boolean][30]?** highlight the interacting elements
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
|
|
@@ -87,7 +89,7 @@ By default, video is saved to `output/video` dir. You can customize this path by
|
|
|
87
89
|
|
|
88
90
|
#### Trace Recording Customization
|
|
89
91
|
|
|
90
|
-
Trace recording provides
|
|
92
|
+
Trace recording provides complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
|
|
91
93
|
Traces will be saved to `output/trace`
|
|
92
94
|
|
|
93
95
|
- `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
@@ -377,6 +379,8 @@ Field is located by name, label, CSS or XPath
|
|
|
377
379
|
|
|
378
380
|
```js
|
|
379
381
|
I.appendField('#myTextField', 'appended');
|
|
382
|
+
// typing secret
|
|
383
|
+
I.appendField('password', secret('123456'));
|
|
380
384
|
```
|
|
381
385
|
|
|
382
386
|
#### Parameters
|
|
@@ -402,6 +406,23 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
402
406
|
- `pathToFile` **[string][8]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
403
407
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
404
408
|
|
|
409
|
+
### blur
|
|
410
|
+
|
|
411
|
+
Remove focus from a text input, button, etc
|
|
412
|
+
Calls [blur][9] on the element.
|
|
413
|
+
|
|
414
|
+
#### Parameters
|
|
415
|
+
|
|
416
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
417
|
+
- `options` **any?** [Additional options][9] for available options object as 2nd argument.Examples:```js
|
|
418
|
+
I.blur('.text-area')
|
|
419
|
+
``````js
|
|
420
|
+
//element `#product-tile` is focused
|
|
421
|
+
I.see('#add-to-cart-btn');
|
|
422
|
+
I.blur('#product-tile')
|
|
423
|
+
I.dontSee('#add-to-cart-btn');
|
|
424
|
+
```
|
|
425
|
+
|
|
405
426
|
### cancelPopup
|
|
406
427
|
|
|
407
428
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
@@ -423,7 +444,7 @@ I.checkOption('agree', '//form');
|
|
|
423
444
|
|
|
424
445
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
425
446
|
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
426
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][
|
|
447
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][10] for check available as 3rd argument.Examples:```js
|
|
427
448
|
// click on element at position
|
|
428
449
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
429
450
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -446,19 +467,16 @@ I.clearCookie('test');
|
|
|
446
467
|
|
|
447
468
|
### clearField
|
|
448
469
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
```js
|
|
452
|
-
I.clearField('Email');
|
|
453
|
-
I.clearField('user[email]');
|
|
454
|
-
I.clearField('#email');
|
|
455
|
-
```
|
|
470
|
+
Clear the <input>, <textarea> or [contenteditable] .
|
|
456
471
|
|
|
457
472
|
#### Parameters
|
|
458
473
|
|
|
459
|
-
- `field
|
|
460
|
-
- `
|
|
461
|
-
|
|
474
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
475
|
+
- `options` **any?** [Additional options][11] for available options object as 2nd argument.Examples:```js
|
|
476
|
+
I.clearField('.text-area')
|
|
477
|
+
``````js
|
|
478
|
+
I.clearField('#submit', { force: true }) // force to bypass the [actionability](https://playwright.dev/docs/actionability) checks.
|
|
479
|
+
```
|
|
462
480
|
|
|
463
481
|
### click
|
|
464
482
|
|
|
@@ -489,7 +507,7 @@ I.click({css: 'nav a.login'});
|
|
|
489
507
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
490
508
|
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
491
509
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
492
|
-
- `
|
|
510
|
+
- `options` **any?** [Additional options][12] for click available as 3rd argument.Examples:```js
|
|
493
511
|
// click on element at position
|
|
494
512
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
495
513
|
|
|
@@ -690,10 +708,10 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
690
708
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
691
709
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
692
710
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
693
|
-
- `options` **any?** [Additional options][
|
|
711
|
+
- `options` **any?** [Additional options][13] can be passed as 3rd argument.```js
|
|
694
712
|
// specify coordinates for source position
|
|
695
713
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
696
|
-
```>
|
|
714
|
+
```> 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`
|
|
697
715
|
|
|
698
716
|
### dragSlider
|
|
699
717
|
|
|
@@ -708,7 +726,7 @@ I.dragSlider('#slider', -70);
|
|
|
708
726
|
#### Parameters
|
|
709
727
|
|
|
710
728
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
711
|
-
- `offsetX` **[number][
|
|
729
|
+
- `offsetX` **[number][14]** position to drag.
|
|
712
730
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
713
731
|
|
|
714
732
|
### executeScript
|
|
@@ -736,10 +754,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
736
754
|
|
|
737
755
|
#### Parameters
|
|
738
756
|
|
|
739
|
-
- `fn` **([string][8] | [function][
|
|
757
|
+
- `fn` **([string][8] | [function][15])** function to be executed in browser context.
|
|
740
758
|
- `arg` **any?** optional argument to pass to the function
|
|
741
759
|
|
|
742
|
-
Returns **[Promise][
|
|
760
|
+
Returns **[Promise][16]<any>**
|
|
743
761
|
|
|
744
762
|
### fillField
|
|
745
763
|
|
|
@@ -763,6 +781,19 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
763
781
|
- `value` **([string][8] | [object][5])** text value to fill.
|
|
764
782
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
765
783
|
|
|
784
|
+
### focus
|
|
785
|
+
|
|
786
|
+
Calls [focus][17] on the matching element.
|
|
787
|
+
|
|
788
|
+
#### Parameters
|
|
789
|
+
|
|
790
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
791
|
+
- `options` **any?** [Additional options][18] for available options object as 2nd argument.Examples:```js
|
|
792
|
+
I.dontSee('#add-to-cart-btn');
|
|
793
|
+
I.focus('#product-tile')
|
|
794
|
+
I.see('#add-to-cart-bnt');
|
|
795
|
+
```
|
|
796
|
+
|
|
766
797
|
### forceClick
|
|
767
798
|
|
|
768
799
|
Perform an emulated click on a link or a button, given by a locator.
|
|
@@ -811,7 +842,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
811
842
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
812
843
|
- `attr` **[string][8]** attribute name.
|
|
813
844
|
|
|
814
|
-
Returns **[Promise][
|
|
845
|
+
Returns **[Promise][16]<[string][8]>** attribute value
|
|
815
846
|
|
|
816
847
|
### grabAttributeFromAll
|
|
817
848
|
|
|
@@ -827,7 +858,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
827
858
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
828
859
|
- `attr` **[string][8]** attribute name.
|
|
829
860
|
|
|
830
|
-
Returns **[Promise][
|
|
861
|
+
Returns **[Promise][16]<[Array][19]<[string][8]>>** attribute value
|
|
831
862
|
|
|
832
863
|
### grabBrowserLogs
|
|
833
864
|
|
|
@@ -839,9 +870,9 @@ const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l
|
|
|
839
870
|
console.log(JSON.stringify(errors));
|
|
840
871
|
```
|
|
841
872
|
|
|
842
|
-
[Learn more about console messages][
|
|
873
|
+
[Learn more about console messages][20]
|
|
843
874
|
|
|
844
|
-
Returns **[Promise][
|
|
875
|
+
Returns **[Promise][16]<[Array][19]<any>>**
|
|
845
876
|
|
|
846
877
|
### grabCookie
|
|
847
878
|
|
|
@@ -858,7 +889,7 @@ assert(cookie.value, '123456');
|
|
|
858
889
|
|
|
859
890
|
- `name` **[string][8]?** cookie name.
|
|
860
891
|
|
|
861
|
-
Returns **([Promise][
|
|
892
|
+
Returns **([Promise][16]<[string][8]> | [Promise][16]<[Array][19]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
862
893
|
|
|
863
894
|
### grabCssPropertyFrom
|
|
864
895
|
|
|
@@ -875,7 +906,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
875
906
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
876
907
|
- `cssProperty` **[string][8]** CSS property name.
|
|
877
908
|
|
|
878
|
-
Returns **[Promise][
|
|
909
|
+
Returns **[Promise][16]<[string][8]>** CSS value
|
|
879
910
|
|
|
880
911
|
### grabCssPropertyFromAll
|
|
881
912
|
|
|
@@ -891,7 +922,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
891
922
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
892
923
|
- `cssProperty` **[string][8]** CSS property name.
|
|
893
924
|
|
|
894
|
-
Returns **[Promise][
|
|
925
|
+
Returns **[Promise][16]<[Array][19]<[string][8]>>** CSS value
|
|
895
926
|
|
|
896
927
|
### grabCurrentUrl
|
|
897
928
|
|
|
@@ -903,7 +934,7 @@ let url = await I.grabCurrentUrl();
|
|
|
903
934
|
console.log(`Current URL is [${url}]`);
|
|
904
935
|
```
|
|
905
936
|
|
|
906
|
-
Returns **[Promise][
|
|
937
|
+
Returns **[Promise][16]<[string][8]>** current URL
|
|
907
938
|
|
|
908
939
|
### grabDataFromPerformanceTiming
|
|
909
940
|
|
|
@@ -928,7 +959,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
928
959
|
}
|
|
929
960
|
```
|
|
930
961
|
|
|
931
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][16]<any>** automatically synchronized promise through #recorder
|
|
932
963
|
|
|
933
964
|
### grabElementBoundingRect
|
|
934
965
|
|
|
@@ -956,7 +987,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
956
987
|
- `prop`
|
|
957
988
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
958
989
|
|
|
959
|
-
Returns **([Promise][
|
|
990
|
+
Returns **([Promise][16]<DOMRect> | [Promise][16]<[number][14]>)** Element bounding rectangle
|
|
960
991
|
|
|
961
992
|
### grabHTMLFrom
|
|
962
993
|
|
|
@@ -973,7 +1004,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
973
1004
|
- `locator`
|
|
974
1005
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
975
1006
|
|
|
976
|
-
Returns **[Promise][
|
|
1007
|
+
Returns **[Promise][16]<[string][8]>** HTML code for an element
|
|
977
1008
|
|
|
978
1009
|
### grabHTMLFromAll
|
|
979
1010
|
|
|
@@ -989,7 +1020,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
989
1020
|
- `locator`
|
|
990
1021
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
991
1022
|
|
|
992
|
-
Returns **[Promise][
|
|
1023
|
+
Returns **[Promise][16]<[Array][19]<[string][8]>>** HTML code for an element
|
|
993
1024
|
|
|
994
1025
|
### grabNumberOfOpenTabs
|
|
995
1026
|
|
|
@@ -1000,7 +1031,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1000
1031
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1001
1032
|
```
|
|
1002
1033
|
|
|
1003
|
-
Returns **[Promise][
|
|
1034
|
+
Returns **[Promise][16]<[number][14]>** number of open tabs
|
|
1004
1035
|
|
|
1005
1036
|
### grabNumberOfVisibleElements
|
|
1006
1037
|
|
|
@@ -1015,7 +1046,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1015
1046
|
|
|
1016
1047
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1017
1048
|
|
|
1018
|
-
Returns **[Promise][
|
|
1049
|
+
Returns **[Promise][16]<[number][14]>** number of visible elements
|
|
1019
1050
|
|
|
1020
1051
|
### grabPageScrollPosition
|
|
1021
1052
|
|
|
@@ -1026,7 +1057,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1026
1057
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1027
1058
|
```
|
|
1028
1059
|
|
|
1029
|
-
Returns **[Promise][
|
|
1060
|
+
Returns **[Promise][16]<PageScrollPosition>** scroll position
|
|
1030
1061
|
|
|
1031
1062
|
### grabPopupText
|
|
1032
1063
|
|
|
@@ -1036,7 +1067,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1036
1067
|
await I.grabPopupText();
|
|
1037
1068
|
```
|
|
1038
1069
|
|
|
1039
|
-
Returns **[Promise][
|
|
1070
|
+
Returns **[Promise][16]<([string][8] | null)>**
|
|
1040
1071
|
|
|
1041
1072
|
### grabSource
|
|
1042
1073
|
|
|
@@ -1047,7 +1078,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1047
1078
|
let pageSource = await I.grabSource();
|
|
1048
1079
|
```
|
|
1049
1080
|
|
|
1050
|
-
Returns **[Promise][
|
|
1081
|
+
Returns **[Promise][16]<[string][8]>** source code
|
|
1051
1082
|
|
|
1052
1083
|
### grabTextFrom
|
|
1053
1084
|
|
|
@@ -1064,7 +1095,7 @@ If multiple elements found returns first element.
|
|
|
1064
1095
|
|
|
1065
1096
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1066
1097
|
|
|
1067
|
-
Returns **[Promise][
|
|
1098
|
+
Returns **[Promise][16]<[string][8]>** attribute value
|
|
1068
1099
|
|
|
1069
1100
|
### grabTextFromAll
|
|
1070
1101
|
|
|
@@ -1079,7 +1110,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1079
1110
|
|
|
1080
1111
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1081
1112
|
|
|
1082
|
-
Returns **[Promise][
|
|
1113
|
+
Returns **[Promise][16]<[Array][19]<[string][8]>>** attribute value
|
|
1083
1114
|
|
|
1084
1115
|
### grabTitle
|
|
1085
1116
|
|
|
@@ -1090,7 +1121,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1090
1121
|
let title = await I.grabTitle();
|
|
1091
1122
|
```
|
|
1092
1123
|
|
|
1093
|
-
Returns **[Promise][
|
|
1124
|
+
Returns **[Promise][16]<[string][8]>** title
|
|
1094
1125
|
|
|
1095
1126
|
### grabValueFrom
|
|
1096
1127
|
|
|
@@ -1106,7 +1137,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1106
1137
|
|
|
1107
1138
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1108
1139
|
|
|
1109
|
-
Returns **[Promise][
|
|
1140
|
+
Returns **[Promise][16]<[string][8]>** attribute value
|
|
1110
1141
|
|
|
1111
1142
|
### grabValueFromAll
|
|
1112
1143
|
|
|
@@ -1121,14 +1152,14 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1121
1152
|
|
|
1122
1153
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1123
1154
|
|
|
1124
|
-
Returns **[Promise][
|
|
1155
|
+
Returns **[Promise][16]<[Array][19]<[string][8]>>** attribute value
|
|
1125
1156
|
|
|
1126
1157
|
### handleDownloads
|
|
1127
1158
|
|
|
1128
1159
|
Handles a file download. A file name is required to save the file on disk.
|
|
1129
1160
|
Files are saved to "output" directory.
|
|
1130
1161
|
|
|
1131
|
-
Should be used with [FileSystem helper][
|
|
1162
|
+
Should be used with [FileSystem helper][21] to check that file were downloaded correctly.
|
|
1132
1163
|
|
|
1133
1164
|
```js
|
|
1134
1165
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1141,7 +1172,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1141
1172
|
|
|
1142
1173
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1143
1174
|
|
|
1144
|
-
Returns **[Promise][
|
|
1175
|
+
Returns **[Promise][16]<void>**
|
|
1145
1176
|
|
|
1146
1177
|
### haveRequestHeaders
|
|
1147
1178
|
|
|
@@ -1159,7 +1190,7 @@ I.haveRequestHeaders({
|
|
|
1159
1190
|
|
|
1160
1191
|
### makeApiRequest
|
|
1161
1192
|
|
|
1162
|
-
Performs [api request][
|
|
1193
|
+
Performs [api request][22] using
|
|
1163
1194
|
the cookies from the current browser session.
|
|
1164
1195
|
|
|
1165
1196
|
```js
|
|
@@ -1176,22 +1207,22 @@ I.makeApiRequest('PATCH', )
|
|
|
1176
1207
|
- `url` **[string][8]** endpoint
|
|
1177
1208
|
- `options` **[object][5]** request options depending on method used
|
|
1178
1209
|
|
|
1179
|
-
Returns **[Promise][
|
|
1210
|
+
Returns **[Promise][16]<[object][5]>** response
|
|
1180
1211
|
|
|
1181
1212
|
### mockRoute
|
|
1182
1213
|
|
|
1183
|
-
Mocks network request using [`browserContext.route`][
|
|
1214
|
+
Mocks network request using [`browserContext.route`][23] of Playwright
|
|
1184
1215
|
|
|
1185
1216
|
```js
|
|
1186
1217
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1187
1218
|
```
|
|
1188
1219
|
|
|
1189
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1220
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][24]
|
|
1190
1221
|
|
|
1191
1222
|
#### Parameters
|
|
1192
1223
|
|
|
1193
|
-
- `url` **([string][8] | [RegExp][
|
|
1194
|
-
- `handler` **[function][
|
|
1224
|
+
- `url` **([string][8] | [RegExp][25])?** URL, regex or pattern for to match URL
|
|
1225
|
+
- `handler` **[function][15]?** a function to process reques
|
|
1195
1226
|
|
|
1196
1227
|
### moveCursorTo
|
|
1197
1228
|
|
|
@@ -1206,8 +1237,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1206
1237
|
#### Parameters
|
|
1207
1238
|
|
|
1208
1239
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1209
|
-
- `offsetX` **[number][
|
|
1210
|
-
- `offsetY` **[number][
|
|
1240
|
+
- `offsetX` **[number][14]** (optional, `0` by default) X-axis offset.
|
|
1241
|
+
- `offsetY` **[number][14]** (optional, `0` by default) Y-axis offset.
|
|
1211
1242
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1212
1243
|
|
|
1213
1244
|
### openNewTab
|
|
@@ -1218,7 +1249,7 @@ Open new tab and automatically switched to new tab
|
|
|
1218
1249
|
I.openNewTab();
|
|
1219
1250
|
```
|
|
1220
1251
|
|
|
1221
|
-
You can pass in [page options][
|
|
1252
|
+
You can pass in [page options][26] to emulate device on this page
|
|
1222
1253
|
|
|
1223
1254
|
```js
|
|
1224
1255
|
// enable mobile
|
|
@@ -1233,7 +1264,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1233
1264
|
|
|
1234
1265
|
Presses a key in the browser (on a focused element).
|
|
1235
1266
|
|
|
1236
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1267
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][27].
|
|
1237
1268
|
|
|
1238
1269
|
```js
|
|
1239
1270
|
I.pressKey('Backspace');
|
|
@@ -1292,14 +1323,14 @@ Some of the supported key names are:
|
|
|
1292
1323
|
|
|
1293
1324
|
#### Parameters
|
|
1294
1325
|
|
|
1295
|
-
- `key` **([string][8] | [Array][
|
|
1296
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][
|
|
1326
|
+
- `key` **([string][8] | [Array][19]<[string][8]>)** key or array of keys to press.
|
|
1327
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][28]).
|
|
1297
1328
|
|
|
1298
1329
|
### pressKeyDown
|
|
1299
1330
|
|
|
1300
1331
|
Presses a key in the browser and leaves it in a down state.
|
|
1301
1332
|
|
|
1302
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1333
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][29]).
|
|
1303
1334
|
|
|
1304
1335
|
```js
|
|
1305
1336
|
I.pressKeyDown('Control');
|
|
@@ -1316,7 +1347,7 @@ I.pressKeyUp('Control');
|
|
|
1316
1347
|
|
|
1317
1348
|
Releases a key in the browser which was previously set to a down state.
|
|
1318
1349
|
|
|
1319
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1350
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][29]).
|
|
1320
1351
|
|
|
1321
1352
|
```js
|
|
1322
1353
|
I.pressKeyDown('Control');
|
|
@@ -1346,8 +1377,8 @@ First parameter can be set to `maximize`.
|
|
|
1346
1377
|
|
|
1347
1378
|
#### Parameters
|
|
1348
1379
|
|
|
1349
|
-
- `width` **[number][
|
|
1350
|
-
- `height` **[number][
|
|
1380
|
+
- `width` **[number][14]** width in pixels or `maximize`.
|
|
1381
|
+
- `height` **[number][14]** height in pixels.
|
|
1351
1382
|
⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1352
1383
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1353
1384
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1421,7 +1452,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1421
1452
|
#### Parameters
|
|
1422
1453
|
|
|
1423
1454
|
- `fileName` **[string][8]** file name to save.
|
|
1424
|
-
- `fullPage` **[boolean][
|
|
1455
|
+
- `fullPage` **[boolean][30]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1425
1456
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1426
1457
|
|
|
1427
1458
|
### scrollPageToBottom
|
|
@@ -1457,8 +1488,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1457
1488
|
#### Parameters
|
|
1458
1489
|
|
|
1459
1490
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1460
|
-
- `offsetX` **[number][
|
|
1461
|
-
- `offsetY` **[number][
|
|
1491
|
+
- `offsetX` **[number][14]** (optional, `0` by default) X-axis offset.
|
|
1492
|
+
- `offsetY` **[number][14]** (optional, `0` by default) Y-axis offset.
|
|
1462
1493
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1463
1494
|
|
|
1464
1495
|
### see
|
|
@@ -1661,7 +1692,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1661
1692
|
#### Parameters
|
|
1662
1693
|
|
|
1663
1694
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1664
|
-
- `num` **[number][
|
|
1695
|
+
- `num` **[number][14]** number of elements.
|
|
1665
1696
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1666
1697
|
|
|
1667
1698
|
### seeNumberOfVisibleElements
|
|
@@ -1676,7 +1707,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1676
1707
|
#### Parameters
|
|
1677
1708
|
|
|
1678
1709
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1679
|
-
- `num` **[number][
|
|
1710
|
+
- `num` **[number][14]** number of elements.
|
|
1680
1711
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1681
1712
|
|
|
1682
1713
|
### seeTextEquals
|
|
@@ -1730,7 +1761,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1730
1761
|
#### Parameters
|
|
1731
1762
|
|
|
1732
1763
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1733
|
-
- `option` **([string][8] | [Array][
|
|
1764
|
+
- `option` **([string][8] | [Array][19]<any>)** visible text or value of option.
|
|
1734
1765
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1735
1766
|
|
|
1736
1767
|
### setCookie
|
|
@@ -1751,7 +1782,7 @@ I.setCookie([
|
|
|
1751
1782
|
|
|
1752
1783
|
#### Parameters
|
|
1753
1784
|
|
|
1754
|
-
- `cookie` **(Cookie | [Array][
|
|
1785
|
+
- `cookie` **(Cookie | [Array][19]<Cookie>)** a cookie object or array of cookie objects.
|
|
1755
1786
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1756
1787
|
|
|
1757
1788
|
### stopMockingRoute
|
|
@@ -1767,8 +1798,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1767
1798
|
|
|
1768
1799
|
#### Parameters
|
|
1769
1800
|
|
|
1770
|
-
- `url` **([string][8] | [RegExp][
|
|
1771
|
-
- `handler` **[function][
|
|
1801
|
+
- `url` **([string][8] | [RegExp][25])?** URL, regex or pattern for to match URL
|
|
1802
|
+
- `handler` **[function][15]?** a function to process reques
|
|
1772
1803
|
|
|
1773
1804
|
### switchTo
|
|
1774
1805
|
|
|
@@ -1795,7 +1826,7 @@ I.switchToNextTab(2);
|
|
|
1795
1826
|
|
|
1796
1827
|
#### Parameters
|
|
1797
1828
|
|
|
1798
|
-
- `num` **[number][
|
|
1829
|
+
- `num` **[number][14]**
|
|
1799
1830
|
|
|
1800
1831
|
### switchToPreviousTab
|
|
1801
1832
|
|
|
@@ -1808,13 +1839,13 @@ I.switchToPreviousTab(2);
|
|
|
1808
1839
|
|
|
1809
1840
|
#### Parameters
|
|
1810
1841
|
|
|
1811
|
-
- `num` **[number][
|
|
1842
|
+
- `num` **[number][14]**
|
|
1812
1843
|
|
|
1813
1844
|
### type
|
|
1814
1845
|
|
|
1815
1846
|
Types out the given text into an active field.
|
|
1816
1847
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1817
|
-
_Note:_ Should be used when [`fillField`][
|
|
1848
|
+
_Note:_ Should be used when [`fillField`][27] is not an option.
|
|
1818
1849
|
|
|
1819
1850
|
```js
|
|
1820
1851
|
// passing in a string
|
|
@@ -1825,14 +1856,17 @@ I.type('4141555311111111', 100);
|
|
|
1825
1856
|
|
|
1826
1857
|
// passing in an array
|
|
1827
1858
|
I.type(['T', 'E', 'X', 'T']);
|
|
1859
|
+
|
|
1860
|
+
// passing a secret
|
|
1861
|
+
I.type(secret('123456'));
|
|
1828
1862
|
```
|
|
1829
1863
|
|
|
1830
1864
|
#### Parameters
|
|
1831
1865
|
|
|
1832
1866
|
- `keys`
|
|
1833
|
-
- `delay` **[number][
|
|
1867
|
+
- `delay` **[number][14]?** (optional) delay in ms between key presses
|
|
1834
1868
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1835
|
-
- `key` **([string][8] | [Array][
|
|
1869
|
+
- `key` **([string][8] | [Array][19]<[string][8]>)** or array of keys to type.
|
|
1836
1870
|
|
|
1837
1871
|
### uncheckOption
|
|
1838
1872
|
|
|
@@ -1851,7 +1885,7 @@ I.uncheckOption('agree', '//form');
|
|
|
1851
1885
|
|
|
1852
1886
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1853
1887
|
- `context` **([string][8]? | [object][5])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1854
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][
|
|
1888
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][31] for uncheck available as 3rd argument.Examples:```js
|
|
1855
1889
|
// click on element at position
|
|
1856
1890
|
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1857
1891
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -1864,7 +1898,7 @@ Use Playwright API inside a test.
|
|
|
1864
1898
|
First argument is a description of an action.
|
|
1865
1899
|
Second argument is async function that gets this helper as parameter.
|
|
1866
1900
|
|
|
1867
|
-
{ [`page`][
|
|
1901
|
+
{ [`page`][32], [`browserContext`][33] [`browser`][34] } objects from Playwright API are available.
|
|
1868
1902
|
|
|
1869
1903
|
```js
|
|
1870
1904
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1875,7 +1909,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1875
1909
|
#### Parameters
|
|
1876
1910
|
|
|
1877
1911
|
- `description` **[string][8]** used to show in logs.
|
|
1878
|
-
- `fn` **[function][
|
|
1912
|
+
- `fn` **[function][15]** async function that executed with Playwright helper as argumen
|
|
1879
1913
|
|
|
1880
1914
|
### wait
|
|
1881
1915
|
|
|
@@ -1887,7 +1921,7 @@ I.wait(2); // wait 2 secs
|
|
|
1887
1921
|
|
|
1888
1922
|
#### Parameters
|
|
1889
1923
|
|
|
1890
|
-
- `sec` **[number][
|
|
1924
|
+
- `sec` **[number][14]** number of second to wait.
|
|
1891
1925
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1892
1926
|
|
|
1893
1927
|
### waitForClickable
|
|
@@ -1904,7 +1938,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1904
1938
|
|
|
1905
1939
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1906
1940
|
- `waitTimeout`
|
|
1907
|
-
- `sec` **[number][
|
|
1941
|
+
- `sec` **[number][14]?** (optional, `1` by default) time in seconds to wait
|
|
1908
1942
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1909
1943
|
|
|
1910
1944
|
### waitForDetached
|
|
@@ -1919,7 +1953,7 @@ I.waitForDetached('#popup');
|
|
|
1919
1953
|
#### Parameters
|
|
1920
1954
|
|
|
1921
1955
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1922
|
-
- `sec` **[number][
|
|
1956
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
1923
1957
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1924
1958
|
|
|
1925
1959
|
### waitForElement
|
|
@@ -1935,7 +1969,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1935
1969
|
#### Parameters
|
|
1936
1970
|
|
|
1937
1971
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1938
|
-
- `sec` **[number][
|
|
1972
|
+
- `sec` **[number][14]?** (optional, `1` by default) time in seconds to wait
|
|
1939
1973
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1940
1974
|
|
|
1941
1975
|
### waitForEnabled
|
|
@@ -1946,7 +1980,7 @@ Element can be located by CSS or XPath.
|
|
|
1946
1980
|
#### Parameters
|
|
1947
1981
|
|
|
1948
1982
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1949
|
-
- `sec` **[number][
|
|
1983
|
+
- `sec` **[number][14]** (optional) time in seconds to wait, 1 by default.
|
|
1950
1984
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1951
1985
|
|
|
1952
1986
|
### waitForFunction
|
|
@@ -1966,9 +2000,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1966
2000
|
|
|
1967
2001
|
#### Parameters
|
|
1968
2002
|
|
|
1969
|
-
- `fn` **([string][8] | [function][
|
|
1970
|
-
- `argsOrSec` **([Array][
|
|
1971
|
-
- `sec` **[number][
|
|
2003
|
+
- `fn` **([string][8] | [function][15])** to be executed in browser context.
|
|
2004
|
+
- `argsOrSec` **([Array][19]<any> | [number][14])?** (optional, `1` by default) arguments for function or seconds.
|
|
2005
|
+
- `sec` **[number][14]?** (optional, `1` by default) time in seconds to wait
|
|
1972
2006
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1973
2007
|
|
|
1974
2008
|
### waitForInvisible
|
|
@@ -1983,18 +2017,18 @@ I.waitForInvisible('#popup');
|
|
|
1983
2017
|
#### Parameters
|
|
1984
2018
|
|
|
1985
2019
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1986
|
-
- `sec` **[number][
|
|
2020
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
1987
2021
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1988
2022
|
|
|
1989
2023
|
### waitForNavigation
|
|
1990
2024
|
|
|
1991
2025
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1992
2026
|
|
|
1993
|
-
See [Playwright's reference][
|
|
2027
|
+
See [Playwright's reference][35]
|
|
1994
2028
|
|
|
1995
2029
|
#### Parameters
|
|
1996
2030
|
|
|
1997
|
-
- `
|
|
2031
|
+
- `options` **any**
|
|
1998
2032
|
|
|
1999
2033
|
### waitForRequest
|
|
2000
2034
|
|
|
@@ -2007,8 +2041,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2007
2041
|
|
|
2008
2042
|
#### Parameters
|
|
2009
2043
|
|
|
2010
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2011
|
-
- `sec` **[number][
|
|
2044
|
+
- `urlOrPredicate` **([string][8] | [function][15])**
|
|
2045
|
+
- `sec` **[number][14]?** seconds to wait
|
|
2012
2046
|
|
|
2013
2047
|
### waitForResponse
|
|
2014
2048
|
|
|
@@ -2021,8 +2055,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2021
2055
|
|
|
2022
2056
|
#### Parameters
|
|
2023
2057
|
|
|
2024
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2025
|
-
- `sec` **[number][
|
|
2058
|
+
- `urlOrPredicate` **([string][8] | [function][15])**
|
|
2059
|
+
- `sec` **[number][14]?** number of seconds to wait
|
|
2026
2060
|
|
|
2027
2061
|
### waitForText
|
|
2028
2062
|
|
|
@@ -2038,7 +2072,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2038
2072
|
#### Parameters
|
|
2039
2073
|
|
|
2040
2074
|
- `text` **[string][8]** to wait for.
|
|
2041
|
-
- `sec` **[number][
|
|
2075
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2042
2076
|
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2043
2077
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2044
2078
|
|
|
@@ -2054,7 +2088,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2054
2088
|
|
|
2055
2089
|
- `field` **([string][8] | [object][5])** input field.
|
|
2056
2090
|
- `value` **[string][8]** expected value.
|
|
2057
|
-
- `sec` **[number][
|
|
2091
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2058
2092
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2059
2093
|
|
|
2060
2094
|
### waitForVisible
|
|
@@ -2069,8 +2103,8 @@ I.waitForVisible('#popup');
|
|
|
2069
2103
|
#### Parameters
|
|
2070
2104
|
|
|
2071
2105
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2072
|
-
- `sec` **[number][
|
|
2073
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][
|
|
2106
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2107
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][36].
|
|
2074
2108
|
|
|
2075
2109
|
### waitInUrl
|
|
2076
2110
|
|
|
@@ -2083,7 +2117,7 @@ I.waitInUrl('/info', 2);
|
|
|
2083
2117
|
#### Parameters
|
|
2084
2118
|
|
|
2085
2119
|
- `urlPart` **[string][8]** value to check.
|
|
2086
|
-
- `sec` **[number][
|
|
2120
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2087
2121
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2088
2122
|
|
|
2089
2123
|
### waitNumberOfVisibleElements
|
|
@@ -2097,8 +2131,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2097
2131
|
#### Parameters
|
|
2098
2132
|
|
|
2099
2133
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2100
|
-
- `num` **[number][
|
|
2101
|
-
- `sec` **[number][
|
|
2134
|
+
- `num` **[number][14]** number of elements.
|
|
2135
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2102
2136
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2103
2137
|
|
|
2104
2138
|
### waitToHide
|
|
@@ -2113,7 +2147,7 @@ I.waitToHide('#popup');
|
|
|
2113
2147
|
#### Parameters
|
|
2114
2148
|
|
|
2115
2149
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2116
|
-
- `sec` **[number][
|
|
2150
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2117
2151
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2118
2152
|
|
|
2119
2153
|
### waitUrlEquals
|
|
@@ -2128,7 +2162,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2128
2162
|
#### Parameters
|
|
2129
2163
|
|
|
2130
2164
|
- `urlPart` **[string][8]** value to check.
|
|
2131
|
-
- `sec` **[number][
|
|
2165
|
+
- `sec` **[number][14]** (optional, `1` by default) time in seconds to wait
|
|
2132
2166
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2133
2167
|
|
|
2134
2168
|
[1]: https://github.com/microsoft/playwright
|
|
@@ -2147,62 +2181,70 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2147
2181
|
|
|
2148
2182
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2149
2183
|
|
|
2150
|
-
[9]: https://playwright.dev/docs/api/class-
|
|
2184
|
+
[9]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2185
|
+
|
|
2186
|
+
[10]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2187
|
+
|
|
2188
|
+
[11]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2189
|
+
|
|
2190
|
+
[12]: https://playwright.dev/docs/api/class-page#page-click
|
|
2191
|
+
|
|
2192
|
+
[13]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2151
2193
|
|
|
2152
|
-
[
|
|
2194
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2153
2195
|
|
|
2154
|
-
[
|
|
2196
|
+
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2155
2197
|
|
|
2156
|
-
[
|
|
2198
|
+
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2157
2199
|
|
|
2158
|
-
[
|
|
2200
|
+
[17]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2159
2201
|
|
|
2160
|
-
[
|
|
2202
|
+
[18]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2161
2203
|
|
|
2162
|
-
[
|
|
2204
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2163
2205
|
|
|
2164
|
-
[
|
|
2206
|
+
[20]: https://playwright.dev/docs/api/class-consolemessage
|
|
2165
2207
|
|
|
2166
|
-
[
|
|
2208
|
+
[21]: https://codecept.io/helpers/FileSystem
|
|
2167
2209
|
|
|
2168
|
-
[
|
|
2210
|
+
[22]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2169
2211
|
|
|
2170
|
-
[
|
|
2212
|
+
[23]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2171
2213
|
|
|
2172
|
-
[
|
|
2214
|
+
[24]: https://playwright.dev/docs/network#handle-requests
|
|
2173
2215
|
|
|
2174
|
-
[
|
|
2216
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2175
2217
|
|
|
2176
|
-
[
|
|
2218
|
+
[26]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2177
2219
|
|
|
2178
|
-
[
|
|
2220
|
+
[27]: #fillfield
|
|
2179
2221
|
|
|
2180
|
-
[
|
|
2222
|
+
[28]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2181
2223
|
|
|
2182
|
-
[
|
|
2224
|
+
[29]: #click
|
|
2183
2225
|
|
|
2184
|
-
[
|
|
2226
|
+
[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2185
2227
|
|
|
2186
|
-
[
|
|
2228
|
+
[31]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2187
2229
|
|
|
2188
|
-
[
|
|
2230
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2189
2231
|
|
|
2190
|
-
[
|
|
2232
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2191
2233
|
|
|
2192
|
-
[
|
|
2234
|
+
[34]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2193
2235
|
|
|
2194
|
-
[
|
|
2236
|
+
[35]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2195
2237
|
|
|
2196
|
-
[
|
|
2238
|
+
[36]: https://codecept.io/react
|
|
2197
2239
|
|
|
2198
|
-
[
|
|
2240
|
+
[37]: https://playwright.dev/docs/api/class-browsercontext
|
|
2199
2241
|
|
|
2200
|
-
[
|
|
2242
|
+
[38]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2201
2243
|
|
|
2202
|
-
[
|
|
2244
|
+
[39]: https://playwright.dev/docs/trace-viewer
|
|
2203
2245
|
|
|
2204
|
-
[
|
|
2246
|
+
[40]: https://playwright.dev/docs/api/class-page#page-wait-for-navigation
|
|
2205
2247
|
|
|
2206
|
-
[
|
|
2248
|
+
[41]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2207
2249
|
|
|
2208
|
-
[
|
|
2250
|
+
[42]: https://playwright.dev/docs/api/class-consolemessage#console-message-type
|