codeceptjs 3.4.1 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +11 -9
- package/bin/codecept.js +1 -1
- package/docs/ai.md +248 -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 +234 -54
- package/docs/build/Protractor.js +3 -1
- package/docs/build/Puppeteer.js +101 -12
- package/docs/build/REST.js +15 -5
- package/docs/build/TestCafe.js +61 -2
- package/docs/build/WebDriver.js +85 -5
- package/docs/changelog.md +85 -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 +228 -151
- package/docs/helpers/Puppeteer.md +153 -101
- package/docs/helpers/REST.md +6 -5
- package/docs/helpers/TestCafe.md +97 -49
- package/docs/helpers/WebDriver.md +159 -107
- 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/blur.mustache +17 -0
- package/docs/webapi/focus.mustache +12 -0
- package/docs/webapi/type.mustache +3 -0
- package/lib/ai.js +171 -0
- package/lib/cli.js +10 -2
- 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 +23 -1
- package/lib/command/interactive.js +15 -1
- package/lib/command/run-workers.js +2 -1
- package/lib/container.js +13 -3
- package/lib/event.js +2 -0
- 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 +200 -45
- package/lib/helper/Protractor.js +1 -1
- package/lib/helper/Puppeteer.js +67 -12
- package/lib/helper/REST.js +15 -5
- package/lib/helper/TestCafe.js +30 -2
- package/lib/helper/WebDriver.js +51 -5
- package/lib/helper/scripts/blurElement.js +17 -0
- package/lib/helper/scripts/focusElement.js +17 -0
- package/lib/helper/scripts/highlightElement.js +20 -0
- package/lib/html.js +258 -0
- package/lib/interfaces/gherkin.js +8 -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 +177 -0
- package/lib/plugin/screenshotOnFail.js +11 -2
- package/lib/recorder.js +11 -8
- package/lib/secret.js +5 -4
- package/lib/step.js +6 -1
- package/lib/ui.js +4 -3
- package/lib/utils.js +17 -0
- package/lib/workers.js +57 -9
- package/package.json +25 -16
- package/translations/ja-JP.js +9 -9
- package/typings/index.d.ts +43 -9
- package/typings/promiseBasedTypes.d.ts +242 -25
- package/typings/types.d.ts +260 -35
|
@@ -33,46 +33,48 @@ Using playwright-core package, will prevent the download of browser binaries and
|
|
|
33
33
|
|
|
34
34
|
## Configuration
|
|
35
35
|
|
|
36
|
-
This helper should be configured in codecept.conf.js
|
|
36
|
+
This helper should be configured in codecept.conf.(js|ts)
|
|
37
37
|
|
|
38
38
|
Type: [object][5]
|
|
39
39
|
|
|
40
40
|
### Properties
|
|
41
41
|
|
|
42
|
-
- `url` **[string][8]
|
|
43
|
-
- `browser` **
|
|
44
|
-
- `show` **[boolean][
|
|
45
|
-
- `restart` **([string][8] | [boolean][
|
|
42
|
+
- `url` **[string][8]?** base url of website to be tested
|
|
43
|
+
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
44
|
+
- `show` **[boolean][31]?** show browser window.
|
|
45
|
+
- `restart` **([string][8] | [boolean][31])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][38] 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][16]?** - [timeout][39] in ms of all Playwright actions .
|
|
49
|
+
- `disableScreenshots` **[boolean][31]?** 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][31]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
52
|
+
- `keepVideoForPassedTests` **[boolean][31]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
53
|
+
- `trace` **[boolean][31]?** record [tracing information][40] with screenshots and snapshots.
|
|
54
|
+
- `keepTraceForPassedTests` **[boolean][31]?** save trace for passed tests.
|
|
55
|
+
- `fullPageScreenshots` **[boolean][31]?** make full page screenshots on failure.
|
|
56
|
+
- `uniqueScreenshotNames` **[boolean][31]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
57
|
+
- `keepBrowserState` **[boolean][31]?** keep browser state between tests when `restart` is set to 'session'.
|
|
58
|
+
- `keepCookies` **[boolean][31]?** keep cookies between tests when `restart` is set to 'session'.
|
|
59
|
+
- `waitForAction` **[number][16]?** 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][41].
|
|
61
|
+
- `pressKeyDelay` **[number][16]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
62
|
+
- `getPageTimeout` **[number][16]?** config option to set maximum navigation time in milliseconds.
|
|
63
|
+
- `waitForTimeout` **[number][16]?** 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][31]?** 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][42].
|
|
74
|
+
- `ignoreLog` **[Array][20]<[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][43].
|
|
75
|
+
- `ignoreHTTPSErrors` **[boolean][31]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
76
|
+
- `bypassCSP` **[boolean][31]?** bypass Content Security Policy or CSP
|
|
77
|
+
- `highlightElement` **[boolean][31]?** 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
|
|
@@ -215,6 +217,22 @@ const { devices } = require('playwright');
|
|
|
215
217
|
}
|
|
216
218
|
```
|
|
217
219
|
|
|
220
|
+
- #### Example #9: Launch electron test
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
{
|
|
224
|
+
helpers: {
|
|
225
|
+
Playwright: {
|
|
226
|
+
browser: 'electron',
|
|
227
|
+
electron: {
|
|
228
|
+
executablePath: require("electron"),
|
|
229
|
+
args: [path.join('../', "main.js")],
|
|
230
|
+
},
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
218
236
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
219
237
|
|
|
220
238
|
## Access From Helpers
|
|
@@ -377,6 +395,8 @@ Field is located by name, label, CSS or XPath
|
|
|
377
395
|
|
|
378
396
|
```js
|
|
379
397
|
I.appendField('#myTextField', 'appended');
|
|
398
|
+
// typing secret
|
|
399
|
+
I.appendField('password', secret('123456'));
|
|
380
400
|
```
|
|
381
401
|
|
|
382
402
|
#### Parameters
|
|
@@ -402,6 +422,29 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
402
422
|
- `pathToFile` **[string][8]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
403
423
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
404
424
|
|
|
425
|
+
### blur
|
|
426
|
+
|
|
427
|
+
Remove focus from a text input, button, etc.
|
|
428
|
+
Calls [blur][9] on the element.
|
|
429
|
+
|
|
430
|
+
Examples:
|
|
431
|
+
|
|
432
|
+
```js
|
|
433
|
+
I.blur('.text-area')
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```js
|
|
437
|
+
//element `#product-tile` is focused
|
|
438
|
+
I.see('#add-to-cart-btn');
|
|
439
|
+
I.blur('#product-tile')
|
|
440
|
+
I.dontSee('#add-to-cart-btn');
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### Parameters
|
|
444
|
+
|
|
445
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
446
|
+
- `options` **any?** Playwright only: [Additional options][10] for available options object as 2nd argument.
|
|
447
|
+
|
|
405
448
|
### cancelPopup
|
|
406
449
|
|
|
407
450
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
@@ -423,7 +466,7 @@ I.checkOption('agree', '//form');
|
|
|
423
466
|
|
|
424
467
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
425
468
|
- `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][
|
|
469
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][11] for check available as 3rd argument.Examples:```js
|
|
427
470
|
// click on element at position
|
|
428
471
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
429
472
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -446,19 +489,23 @@ I.clearCookie('test');
|
|
|
446
489
|
|
|
447
490
|
### clearField
|
|
448
491
|
|
|
449
|
-
Clears
|
|
492
|
+
Clears the text input element: `<input>`, `<textarea>` or `[contenteditable]` .
|
|
493
|
+
|
|
494
|
+
Examples:
|
|
450
495
|
|
|
451
496
|
```js
|
|
452
|
-
I.clearField('
|
|
453
|
-
|
|
454
|
-
|
|
497
|
+
I.clearField('.text-area')
|
|
498
|
+
|
|
499
|
+
// if this doesn't work use force option
|
|
500
|
+
I.clearField('#submit', { force: true })
|
|
455
501
|
```
|
|
456
502
|
|
|
503
|
+
Use `force` to bypass the [actionability][12] checks.
|
|
504
|
+
|
|
457
505
|
#### Parameters
|
|
458
506
|
|
|
459
|
-
- `field
|
|
460
|
-
- `
|
|
461
|
-
⚠️ returns a _promise_ which is synchronized internally by recorder.
|
|
507
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
508
|
+
- `options` **any?** [Additional options][13] for available options object as 2nd argument.
|
|
462
509
|
|
|
463
510
|
### click
|
|
464
511
|
|
|
@@ -489,7 +536,7 @@ I.click({css: 'nav a.login'});
|
|
|
489
536
|
- `locator` **([string][8] | [object][5])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
490
537
|
- `context` **([string][8]? | [object][5] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
491
538
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
492
|
-
- `
|
|
539
|
+
- `options` **any?** [Additional options][14] for click available as 3rd argument.Examples:```js
|
|
493
540
|
// click on element at position
|
|
494
541
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
495
542
|
|
|
@@ -690,10 +737,10 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
690
737
|
- `srcElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
691
738
|
- `destElement` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
692
739
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
693
|
-
- `options` **any?** [Additional options][
|
|
740
|
+
- `options` **any?** [Additional options][15] can be passed as 3rd argument.```js
|
|
694
741
|
// specify coordinates for source position
|
|
695
742
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
696
|
-
```>
|
|
743
|
+
```> 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
744
|
|
|
698
745
|
### dragSlider
|
|
699
746
|
|
|
@@ -708,7 +755,7 @@ I.dragSlider('#slider', -70);
|
|
|
708
755
|
#### Parameters
|
|
709
756
|
|
|
710
757
|
- `locator` **([string][8] | [object][5])** located by label|name|CSS|XPath|strict locator.
|
|
711
|
-
- `offsetX` **[number][
|
|
758
|
+
- `offsetX` **[number][16]** position to drag.
|
|
712
759
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
713
760
|
|
|
714
761
|
### executeScript
|
|
@@ -736,10 +783,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
736
783
|
|
|
737
784
|
#### Parameters
|
|
738
785
|
|
|
739
|
-
- `fn` **([string][8] | [function][
|
|
786
|
+
- `fn` **([string][8] | [function][17])** function to be executed in browser context.
|
|
740
787
|
- `arg` **any?** optional argument to pass to the function
|
|
741
788
|
|
|
742
|
-
Returns **[Promise][
|
|
789
|
+
Returns **[Promise][18]<any>**
|
|
743
790
|
|
|
744
791
|
### fillField
|
|
745
792
|
|
|
@@ -763,6 +810,23 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
763
810
|
- `value` **([string][8] | [object][5])** text value to fill.
|
|
764
811
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
765
812
|
|
|
813
|
+
### focus
|
|
814
|
+
|
|
815
|
+
Calls [focus][9] on the matching element.
|
|
816
|
+
|
|
817
|
+
Examples:
|
|
818
|
+
|
|
819
|
+
```js
|
|
820
|
+
I.dontSee('#add-to-cart-btn');
|
|
821
|
+
I.focus('#product-tile')
|
|
822
|
+
I.see('#add-to-cart-bnt');
|
|
823
|
+
```
|
|
824
|
+
|
|
825
|
+
#### Parameters
|
|
826
|
+
|
|
827
|
+
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
828
|
+
- `options` **any?** Playwright only: [Additional options][19] for available options object as 2nd argument.
|
|
829
|
+
|
|
766
830
|
### forceClick
|
|
767
831
|
|
|
768
832
|
Perform an emulated click on a link or a button, given by a locator.
|
|
@@ -811,7 +875,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
811
875
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
812
876
|
- `attr` **[string][8]** attribute name.
|
|
813
877
|
|
|
814
|
-
Returns **[Promise][
|
|
878
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
815
879
|
|
|
816
880
|
### grabAttributeFromAll
|
|
817
881
|
|
|
@@ -827,7 +891,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
827
891
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
828
892
|
- `attr` **[string][8]** attribute name.
|
|
829
893
|
|
|
830
|
-
Returns **[Promise][
|
|
894
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
831
895
|
|
|
832
896
|
### grabBrowserLogs
|
|
833
897
|
|
|
@@ -839,9 +903,9 @@ const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l
|
|
|
839
903
|
console.log(JSON.stringify(errors));
|
|
840
904
|
```
|
|
841
905
|
|
|
842
|
-
[Learn more about console messages][
|
|
906
|
+
[Learn more about console messages][21]
|
|
843
907
|
|
|
844
|
-
Returns **[Promise][
|
|
908
|
+
Returns **[Promise][18]<[Array][20]<any>>**
|
|
845
909
|
|
|
846
910
|
### grabCookie
|
|
847
911
|
|
|
@@ -858,7 +922,7 @@ assert(cookie.value, '123456');
|
|
|
858
922
|
|
|
859
923
|
- `name` **[string][8]?** cookie name.
|
|
860
924
|
|
|
861
|
-
Returns **([Promise][
|
|
925
|
+
Returns **([Promise][18]<[string][8]> | [Promise][18]<[Array][20]<[string][8]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
862
926
|
|
|
863
927
|
### grabCssPropertyFrom
|
|
864
928
|
|
|
@@ -875,7 +939,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
875
939
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
876
940
|
- `cssProperty` **[string][8]** CSS property name.
|
|
877
941
|
|
|
878
|
-
Returns **[Promise][
|
|
942
|
+
Returns **[Promise][18]<[string][8]>** CSS value
|
|
879
943
|
|
|
880
944
|
### grabCssPropertyFromAll
|
|
881
945
|
|
|
@@ -891,7 +955,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
891
955
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
892
956
|
- `cssProperty` **[string][8]** CSS property name.
|
|
893
957
|
|
|
894
|
-
Returns **[Promise][
|
|
958
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** CSS value
|
|
895
959
|
|
|
896
960
|
### grabCurrentUrl
|
|
897
961
|
|
|
@@ -903,7 +967,7 @@ let url = await I.grabCurrentUrl();
|
|
|
903
967
|
console.log(`Current URL is [${url}]`);
|
|
904
968
|
```
|
|
905
969
|
|
|
906
|
-
Returns **[Promise][
|
|
970
|
+
Returns **[Promise][18]<[string][8]>** current URL
|
|
907
971
|
|
|
908
972
|
### grabDataFromPerformanceTiming
|
|
909
973
|
|
|
@@ -928,7 +992,7 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
928
992
|
}
|
|
929
993
|
```
|
|
930
994
|
|
|
931
|
-
Returns **[Promise][
|
|
995
|
+
Returns **[Promise][18]<any>** automatically synchronized promise through #recorder
|
|
932
996
|
|
|
933
997
|
### grabElementBoundingRect
|
|
934
998
|
|
|
@@ -956,7 +1020,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
956
1020
|
- `prop`
|
|
957
1021
|
- `elementSize` **[string][8]?** x, y, width or height of the given element.
|
|
958
1022
|
|
|
959
|
-
Returns **([Promise][
|
|
1023
|
+
Returns **([Promise][18]<DOMRect> | [Promise][18]<[number][16]>)** Element bounding rectangle
|
|
960
1024
|
|
|
961
1025
|
### grabHTMLFrom
|
|
962
1026
|
|
|
@@ -973,7 +1037,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
973
1037
|
- `locator`
|
|
974
1038
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
975
1039
|
|
|
976
|
-
Returns **[Promise][
|
|
1040
|
+
Returns **[Promise][18]<[string][8]>** HTML code for an element
|
|
977
1041
|
|
|
978
1042
|
### grabHTMLFromAll
|
|
979
1043
|
|
|
@@ -989,7 +1053,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
989
1053
|
- `locator`
|
|
990
1054
|
- `element` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
991
1055
|
|
|
992
|
-
Returns **[Promise][
|
|
1056
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** HTML code for an element
|
|
993
1057
|
|
|
994
1058
|
### grabNumberOfOpenTabs
|
|
995
1059
|
|
|
@@ -1000,7 +1064,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1000
1064
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1001
1065
|
```
|
|
1002
1066
|
|
|
1003
|
-
Returns **[Promise][
|
|
1067
|
+
Returns **[Promise][18]<[number][16]>** number of open tabs
|
|
1004
1068
|
|
|
1005
1069
|
### grabNumberOfVisibleElements
|
|
1006
1070
|
|
|
@@ -1015,7 +1079,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1015
1079
|
|
|
1016
1080
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1017
1081
|
|
|
1018
|
-
Returns **[Promise][
|
|
1082
|
+
Returns **[Promise][18]<[number][16]>** number of visible elements
|
|
1019
1083
|
|
|
1020
1084
|
### grabPageScrollPosition
|
|
1021
1085
|
|
|
@@ -1026,7 +1090,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1026
1090
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1027
1091
|
```
|
|
1028
1092
|
|
|
1029
|
-
Returns **[Promise][
|
|
1093
|
+
Returns **[Promise][18]<PageScrollPosition>** scroll position
|
|
1030
1094
|
|
|
1031
1095
|
### grabPopupText
|
|
1032
1096
|
|
|
@@ -1036,7 +1100,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1036
1100
|
await I.grabPopupText();
|
|
1037
1101
|
```
|
|
1038
1102
|
|
|
1039
|
-
Returns **[Promise][
|
|
1103
|
+
Returns **[Promise][18]<([string][8] | null)>**
|
|
1040
1104
|
|
|
1041
1105
|
### grabSource
|
|
1042
1106
|
|
|
@@ -1047,7 +1111,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1047
1111
|
let pageSource = await I.grabSource();
|
|
1048
1112
|
```
|
|
1049
1113
|
|
|
1050
|
-
Returns **[Promise][
|
|
1114
|
+
Returns **[Promise][18]<[string][8]>** source code
|
|
1051
1115
|
|
|
1052
1116
|
### grabTextFrom
|
|
1053
1117
|
|
|
@@ -1064,7 +1128,7 @@ If multiple elements found returns first element.
|
|
|
1064
1128
|
|
|
1065
1129
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1066
1130
|
|
|
1067
|
-
Returns **[Promise][
|
|
1131
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
1068
1132
|
|
|
1069
1133
|
### grabTextFromAll
|
|
1070
1134
|
|
|
@@ -1079,7 +1143,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1079
1143
|
|
|
1080
1144
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1081
1145
|
|
|
1082
|
-
Returns **[Promise][
|
|
1146
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
1083
1147
|
|
|
1084
1148
|
### grabTitle
|
|
1085
1149
|
|
|
@@ -1090,7 +1154,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1090
1154
|
let title = await I.grabTitle();
|
|
1091
1155
|
```
|
|
1092
1156
|
|
|
1093
|
-
Returns **[Promise][
|
|
1157
|
+
Returns **[Promise][18]<[string][8]>** title
|
|
1094
1158
|
|
|
1095
1159
|
### grabValueFrom
|
|
1096
1160
|
|
|
@@ -1106,7 +1170,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1106
1170
|
|
|
1107
1171
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1108
1172
|
|
|
1109
|
-
Returns **[Promise][
|
|
1173
|
+
Returns **[Promise][18]<[string][8]>** attribute value
|
|
1110
1174
|
|
|
1111
1175
|
### grabValueFromAll
|
|
1112
1176
|
|
|
@@ -1121,14 +1185,14 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1121
1185
|
|
|
1122
1186
|
- `locator` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1123
1187
|
|
|
1124
|
-
Returns **[Promise][
|
|
1188
|
+
Returns **[Promise][18]<[Array][20]<[string][8]>>** attribute value
|
|
1125
1189
|
|
|
1126
1190
|
### handleDownloads
|
|
1127
1191
|
|
|
1128
1192
|
Handles a file download. A file name is required to save the file on disk.
|
|
1129
1193
|
Files are saved to "output" directory.
|
|
1130
1194
|
|
|
1131
|
-
Should be used with [FileSystem helper][
|
|
1195
|
+
Should be used with [FileSystem helper][22] to check that file were downloaded correctly.
|
|
1132
1196
|
|
|
1133
1197
|
```js
|
|
1134
1198
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1141,7 +1205,7 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1141
1205
|
|
|
1142
1206
|
- `fileName` **[string][8]** set filename for downloaded file
|
|
1143
1207
|
|
|
1144
|
-
Returns **[Promise][
|
|
1208
|
+
Returns **[Promise][18]<void>**
|
|
1145
1209
|
|
|
1146
1210
|
### haveRequestHeaders
|
|
1147
1211
|
|
|
@@ -1159,7 +1223,7 @@ I.haveRequestHeaders({
|
|
|
1159
1223
|
|
|
1160
1224
|
### makeApiRequest
|
|
1161
1225
|
|
|
1162
|
-
Performs [api request][
|
|
1226
|
+
Performs [api request][23] using
|
|
1163
1227
|
the cookies from the current browser session.
|
|
1164
1228
|
|
|
1165
1229
|
```js
|
|
@@ -1176,22 +1240,22 @@ I.makeApiRequest('PATCH', )
|
|
|
1176
1240
|
- `url` **[string][8]** endpoint
|
|
1177
1241
|
- `options` **[object][5]** request options depending on method used
|
|
1178
1242
|
|
|
1179
|
-
Returns **[Promise][
|
|
1243
|
+
Returns **[Promise][18]<[object][5]>** response
|
|
1180
1244
|
|
|
1181
1245
|
### mockRoute
|
|
1182
1246
|
|
|
1183
|
-
Mocks network request using [`browserContext.route`][
|
|
1247
|
+
Mocks network request using [`browserContext.route`][24] of Playwright
|
|
1184
1248
|
|
|
1185
1249
|
```js
|
|
1186
1250
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1187
1251
|
```
|
|
1188
1252
|
|
|
1189
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1253
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][25]
|
|
1190
1254
|
|
|
1191
1255
|
#### Parameters
|
|
1192
1256
|
|
|
1193
|
-
- `url` **([string][8] | [RegExp][
|
|
1194
|
-
- `handler` **[function][
|
|
1257
|
+
- `url` **([string][8] | [RegExp][26])?** URL, regex or pattern for to match URL
|
|
1258
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1195
1259
|
|
|
1196
1260
|
### moveCursorTo
|
|
1197
1261
|
|
|
@@ -1206,8 +1270,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1206
1270
|
#### Parameters
|
|
1207
1271
|
|
|
1208
1272
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1209
|
-
- `offsetX` **[number][
|
|
1210
|
-
- `offsetY` **[number][
|
|
1273
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1274
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1211
1275
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1212
1276
|
|
|
1213
1277
|
### openNewTab
|
|
@@ -1218,7 +1282,7 @@ Open new tab and automatically switched to new tab
|
|
|
1218
1282
|
I.openNewTab();
|
|
1219
1283
|
```
|
|
1220
1284
|
|
|
1221
|
-
You can pass in [page options][
|
|
1285
|
+
You can pass in [page options][27] to emulate device on this page
|
|
1222
1286
|
|
|
1223
1287
|
```js
|
|
1224
1288
|
// enable mobile
|
|
@@ -1233,7 +1297,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1233
1297
|
|
|
1234
1298
|
Presses a key in the browser (on a focused element).
|
|
1235
1299
|
|
|
1236
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1300
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][28].
|
|
1237
1301
|
|
|
1238
1302
|
```js
|
|
1239
1303
|
I.pressKey('Backspace');
|
|
@@ -1292,14 +1356,14 @@ Some of the supported key names are:
|
|
|
1292
1356
|
|
|
1293
1357
|
#### Parameters
|
|
1294
1358
|
|
|
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][
|
|
1359
|
+
- `key` **([string][8] | [Array][20]<[string][8]>)** key or array of keys to press.
|
|
1360
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][29]).
|
|
1297
1361
|
|
|
1298
1362
|
### pressKeyDown
|
|
1299
1363
|
|
|
1300
1364
|
Presses a key in the browser and leaves it in a down state.
|
|
1301
1365
|
|
|
1302
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1366
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][30]).
|
|
1303
1367
|
|
|
1304
1368
|
```js
|
|
1305
1369
|
I.pressKeyDown('Control');
|
|
@@ -1316,7 +1380,7 @@ I.pressKeyUp('Control');
|
|
|
1316
1380
|
|
|
1317
1381
|
Releases a key in the browser which was previously set to a down state.
|
|
1318
1382
|
|
|
1319
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1383
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][30]).
|
|
1320
1384
|
|
|
1321
1385
|
```js
|
|
1322
1386
|
I.pressKeyDown('Control');
|
|
@@ -1346,8 +1410,8 @@ First parameter can be set to `maximize`.
|
|
|
1346
1410
|
|
|
1347
1411
|
#### Parameters
|
|
1348
1412
|
|
|
1349
|
-
- `width` **[number][
|
|
1350
|
-
- `height` **[number][
|
|
1413
|
+
- `width` **[number][16]** width in pixels or `maximize`.
|
|
1414
|
+
- `height` **[number][16]** height in pixels.
|
|
1351
1415
|
⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1352
1416
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1353
1417
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
@@ -1421,7 +1485,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1421
1485
|
#### Parameters
|
|
1422
1486
|
|
|
1423
1487
|
- `fileName` **[string][8]** file name to save.
|
|
1424
|
-
- `fullPage` **[boolean][
|
|
1488
|
+
- `fullPage` **[boolean][31]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1425
1489
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1426
1490
|
|
|
1427
1491
|
### scrollPageToBottom
|
|
@@ -1457,8 +1521,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1457
1521
|
#### Parameters
|
|
1458
1522
|
|
|
1459
1523
|
- `locator` **([string][8] | [object][5])** located by CSS|XPath|strict locator.
|
|
1460
|
-
- `offsetX` **[number][
|
|
1461
|
-
- `offsetY` **[number][
|
|
1524
|
+
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1525
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1462
1526
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1463
1527
|
|
|
1464
1528
|
### see
|
|
@@ -1661,7 +1725,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1661
1725
|
#### Parameters
|
|
1662
1726
|
|
|
1663
1727
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1664
|
-
- `num` **[number][
|
|
1728
|
+
- `num` **[number][16]** number of elements.
|
|
1665
1729
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1666
1730
|
|
|
1667
1731
|
### seeNumberOfVisibleElements
|
|
@@ -1676,7 +1740,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1676
1740
|
#### Parameters
|
|
1677
1741
|
|
|
1678
1742
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1679
|
-
- `num` **[number][
|
|
1743
|
+
- `num` **[number][16]** number of elements.
|
|
1680
1744
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1681
1745
|
|
|
1682
1746
|
### seeTextEquals
|
|
@@ -1730,7 +1794,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1730
1794
|
#### Parameters
|
|
1731
1795
|
|
|
1732
1796
|
- `select` **([string][8] | [object][5])** field located by label|name|CSS|XPath|strict locator.
|
|
1733
|
-
- `option` **([string][8] | [Array][
|
|
1797
|
+
- `option` **([string][8] | [Array][20]<any>)** visible text or value of option.
|
|
1734
1798
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1735
1799
|
|
|
1736
1800
|
### setCookie
|
|
@@ -1751,7 +1815,7 @@ I.setCookie([
|
|
|
1751
1815
|
|
|
1752
1816
|
#### Parameters
|
|
1753
1817
|
|
|
1754
|
-
- `cookie` **(Cookie | [Array][
|
|
1818
|
+
- `cookie` **(Cookie | [Array][20]<Cookie>)** a cookie object or array of cookie objects.
|
|
1755
1819
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1756
1820
|
|
|
1757
1821
|
### stopMockingRoute
|
|
@@ -1767,8 +1831,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1767
1831
|
|
|
1768
1832
|
#### Parameters
|
|
1769
1833
|
|
|
1770
|
-
- `url` **([string][8] | [RegExp][
|
|
1771
|
-
- `handler` **[function][
|
|
1834
|
+
- `url` **([string][8] | [RegExp][26])?** URL, regex or pattern for to match URL
|
|
1835
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1772
1836
|
|
|
1773
1837
|
### switchTo
|
|
1774
1838
|
|
|
@@ -1795,7 +1859,7 @@ I.switchToNextTab(2);
|
|
|
1795
1859
|
|
|
1796
1860
|
#### Parameters
|
|
1797
1861
|
|
|
1798
|
-
- `num` **[number][
|
|
1862
|
+
- `num` **[number][16]**
|
|
1799
1863
|
|
|
1800
1864
|
### switchToPreviousTab
|
|
1801
1865
|
|
|
@@ -1808,13 +1872,13 @@ I.switchToPreviousTab(2);
|
|
|
1808
1872
|
|
|
1809
1873
|
#### Parameters
|
|
1810
1874
|
|
|
1811
|
-
- `num` **[number][
|
|
1875
|
+
- `num` **[number][16]**
|
|
1812
1876
|
|
|
1813
1877
|
### type
|
|
1814
1878
|
|
|
1815
1879
|
Types out the given text into an active field.
|
|
1816
1880
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1817
|
-
_Note:_ Should be used when [`fillField`][
|
|
1881
|
+
_Note:_ Should be used when [`fillField`][28] is not an option.
|
|
1818
1882
|
|
|
1819
1883
|
```js
|
|
1820
1884
|
// passing in a string
|
|
@@ -1825,14 +1889,17 @@ I.type('4141555311111111', 100);
|
|
|
1825
1889
|
|
|
1826
1890
|
// passing in an array
|
|
1827
1891
|
I.type(['T', 'E', 'X', 'T']);
|
|
1892
|
+
|
|
1893
|
+
// passing a secret
|
|
1894
|
+
I.type(secret('123456'));
|
|
1828
1895
|
```
|
|
1829
1896
|
|
|
1830
1897
|
#### Parameters
|
|
1831
1898
|
|
|
1832
1899
|
- `keys`
|
|
1833
|
-
- `delay` **[number][
|
|
1900
|
+
- `delay` **[number][16]?** (optional) delay in ms between key presses
|
|
1834
1901
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1835
|
-
- `key` **([string][8] | [Array][
|
|
1902
|
+
- `key` **([string][8] | [Array][20]<[string][8]>)** or array of keys to type.
|
|
1836
1903
|
|
|
1837
1904
|
### uncheckOption
|
|
1838
1905
|
|
|
@@ -1851,7 +1918,7 @@ I.uncheckOption('agree', '//form');
|
|
|
1851
1918
|
|
|
1852
1919
|
- `field` **([string][8] | [object][5])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1853
1920
|
- `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][
|
|
1921
|
+
⚠️ returns a _promise_ which is synchronized internally by recorder[Additional options][32] for uncheck available as 3rd argument.Examples:```js
|
|
1855
1922
|
// click on element at position
|
|
1856
1923
|
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1857
1924
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -1864,7 +1931,7 @@ Use Playwright API inside a test.
|
|
|
1864
1931
|
First argument is a description of an action.
|
|
1865
1932
|
Second argument is async function that gets this helper as parameter.
|
|
1866
1933
|
|
|
1867
|
-
{ [`page`][
|
|
1934
|
+
{ [`page`][33], [`browserContext`][34] [`browser`][35] } objects from Playwright API are available.
|
|
1868
1935
|
|
|
1869
1936
|
```js
|
|
1870
1937
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1875,7 +1942,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1875
1942
|
#### Parameters
|
|
1876
1943
|
|
|
1877
1944
|
- `description` **[string][8]** used to show in logs.
|
|
1878
|
-
- `fn` **[function][
|
|
1945
|
+
- `fn` **[function][17]** async function that executed with Playwright helper as argumen
|
|
1879
1946
|
|
|
1880
1947
|
### wait
|
|
1881
1948
|
|
|
@@ -1887,7 +1954,7 @@ I.wait(2); // wait 2 secs
|
|
|
1887
1954
|
|
|
1888
1955
|
#### Parameters
|
|
1889
1956
|
|
|
1890
|
-
- `sec` **[number][
|
|
1957
|
+
- `sec` **[number][16]** number of second to wait.
|
|
1891
1958
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1892
1959
|
|
|
1893
1960
|
### waitForClickable
|
|
@@ -1904,7 +1971,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1904
1971
|
|
|
1905
1972
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1906
1973
|
- `waitTimeout`
|
|
1907
|
-
- `sec` **[number][
|
|
1974
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1908
1975
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1909
1976
|
|
|
1910
1977
|
### waitForDetached
|
|
@@ -1919,7 +1986,7 @@ I.waitForDetached('#popup');
|
|
|
1919
1986
|
#### Parameters
|
|
1920
1987
|
|
|
1921
1988
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1922
|
-
- `sec` **[number][
|
|
1989
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1923
1990
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1924
1991
|
|
|
1925
1992
|
### waitForElement
|
|
@@ -1935,7 +2002,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1935
2002
|
#### Parameters
|
|
1936
2003
|
|
|
1937
2004
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1938
|
-
- `sec` **[number][
|
|
2005
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1939
2006
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1940
2007
|
|
|
1941
2008
|
### waitForEnabled
|
|
@@ -1946,7 +2013,7 @@ Element can be located by CSS or XPath.
|
|
|
1946
2013
|
#### Parameters
|
|
1947
2014
|
|
|
1948
2015
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1949
|
-
- `sec` **[number][
|
|
2016
|
+
- `sec` **[number][16]** (optional) time in seconds to wait, 1 by default.
|
|
1950
2017
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1951
2018
|
|
|
1952
2019
|
### waitForFunction
|
|
@@ -1966,9 +2033,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1966
2033
|
|
|
1967
2034
|
#### Parameters
|
|
1968
2035
|
|
|
1969
|
-
- `fn` **([string][8] | [function][
|
|
1970
|
-
- `argsOrSec` **([Array][
|
|
1971
|
-
- `sec` **[number][
|
|
2036
|
+
- `fn` **([string][8] | [function][17])** to be executed in browser context.
|
|
2037
|
+
- `argsOrSec` **([Array][20]<any> | [number][16])?** (optional, `1` by default) arguments for function or seconds.
|
|
2038
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1972
2039
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1973
2040
|
|
|
1974
2041
|
### waitForInvisible
|
|
@@ -1983,18 +2050,18 @@ I.waitForInvisible('#popup');
|
|
|
1983
2050
|
#### Parameters
|
|
1984
2051
|
|
|
1985
2052
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
1986
|
-
- `sec` **[number][
|
|
2053
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1987
2054
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1988
2055
|
|
|
1989
2056
|
### waitForNavigation
|
|
1990
2057
|
|
|
1991
2058
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1992
2059
|
|
|
1993
|
-
See [Playwright's reference][
|
|
2060
|
+
See [Playwright's reference][36]
|
|
1994
2061
|
|
|
1995
2062
|
#### Parameters
|
|
1996
2063
|
|
|
1997
|
-
- `
|
|
2064
|
+
- `options` **any**
|
|
1998
2065
|
|
|
1999
2066
|
### waitForRequest
|
|
2000
2067
|
|
|
@@ -2007,8 +2074,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2007
2074
|
|
|
2008
2075
|
#### Parameters
|
|
2009
2076
|
|
|
2010
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2011
|
-
- `sec` **[number][
|
|
2077
|
+
- `urlOrPredicate` **([string][8] | [function][17])**
|
|
2078
|
+
- `sec` **[number][16]?** seconds to wait
|
|
2012
2079
|
|
|
2013
2080
|
### waitForResponse
|
|
2014
2081
|
|
|
@@ -2021,8 +2088,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2021
2088
|
|
|
2022
2089
|
#### Parameters
|
|
2023
2090
|
|
|
2024
|
-
- `urlOrPredicate` **([string][8] | [function][
|
|
2025
|
-
- `sec` **[number][
|
|
2091
|
+
- `urlOrPredicate` **([string][8] | [function][17])**
|
|
2092
|
+
- `sec` **[number][16]?** number of seconds to wait
|
|
2026
2093
|
|
|
2027
2094
|
### waitForText
|
|
2028
2095
|
|
|
@@ -2038,7 +2105,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2038
2105
|
#### Parameters
|
|
2039
2106
|
|
|
2040
2107
|
- `text` **[string][8]** to wait for.
|
|
2041
|
-
- `sec` **[number][
|
|
2108
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2042
2109
|
- `context` **([string][8] | [object][5])?** (optional) element located by CSS|XPath|strict locator.
|
|
2043
2110
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2044
2111
|
|
|
@@ -2054,7 +2121,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2054
2121
|
|
|
2055
2122
|
- `field` **([string][8] | [object][5])** input field.
|
|
2056
2123
|
- `value` **[string][8]** expected value.
|
|
2057
|
-
- `sec` **[number][
|
|
2124
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2058
2125
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2059
2126
|
|
|
2060
2127
|
### waitForVisible
|
|
@@ -2069,8 +2136,8 @@ I.waitForVisible('#popup');
|
|
|
2069
2136
|
#### Parameters
|
|
2070
2137
|
|
|
2071
2138
|
- `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][
|
|
2139
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2140
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][37].
|
|
2074
2141
|
|
|
2075
2142
|
### waitInUrl
|
|
2076
2143
|
|
|
@@ -2083,7 +2150,7 @@ I.waitInUrl('/info', 2);
|
|
|
2083
2150
|
#### Parameters
|
|
2084
2151
|
|
|
2085
2152
|
- `urlPart` **[string][8]** value to check.
|
|
2086
|
-
- `sec` **[number][
|
|
2153
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2087
2154
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2088
2155
|
|
|
2089
2156
|
### waitNumberOfVisibleElements
|
|
@@ -2097,8 +2164,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2097
2164
|
#### Parameters
|
|
2098
2165
|
|
|
2099
2166
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2100
|
-
- `num` **[number][
|
|
2101
|
-
- `sec` **[number][
|
|
2167
|
+
- `num` **[number][16]** number of elements.
|
|
2168
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2102
2169
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2103
2170
|
|
|
2104
2171
|
### waitToHide
|
|
@@ -2113,7 +2180,7 @@ I.waitToHide('#popup');
|
|
|
2113
2180
|
#### Parameters
|
|
2114
2181
|
|
|
2115
2182
|
- `locator` **([string][8] | [object][5])** element located by CSS|XPath|strict locator.
|
|
2116
|
-
- `sec` **[number][
|
|
2183
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2117
2184
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2118
2185
|
|
|
2119
2186
|
### waitUrlEquals
|
|
@@ -2128,7 +2195,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2128
2195
|
#### Parameters
|
|
2129
2196
|
|
|
2130
2197
|
- `urlPart` **[string][8]** value to check.
|
|
2131
|
-
- `sec` **[number][
|
|
2198
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2132
2199
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2133
2200
|
|
|
2134
2201
|
[1]: https://github.com/microsoft/playwright
|
|
@@ -2147,62 +2214,72 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2147
2214
|
|
|
2148
2215
|
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2149
2216
|
|
|
2150
|
-
[9]: https://
|
|
2217
|
+
[9]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2218
|
+
|
|
2219
|
+
[10]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2220
|
+
|
|
2221
|
+
[11]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2222
|
+
|
|
2223
|
+
[12]: https://playwright.dev/docs/actionability
|
|
2224
|
+
|
|
2225
|
+
[13]: https://playwright.dev/docs/api/class-locator#locator-clear
|
|
2226
|
+
|
|
2227
|
+
[14]: https://playwright.dev/docs/api/class-page#page-click
|
|
2151
2228
|
|
|
2152
|
-
[
|
|
2229
|
+
[15]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2153
2230
|
|
|
2154
|
-
[
|
|
2231
|
+
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2155
2232
|
|
|
2156
|
-
[
|
|
2233
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2157
2234
|
|
|
2158
|
-
[
|
|
2235
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2159
2236
|
|
|
2160
|
-
[
|
|
2237
|
+
[19]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2161
2238
|
|
|
2162
|
-
[
|
|
2239
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2163
2240
|
|
|
2164
|
-
[
|
|
2241
|
+
[21]: https://playwright.dev/docs/api/class-consolemessage
|
|
2165
2242
|
|
|
2166
|
-
[
|
|
2243
|
+
[22]: https://codecept.io/helpers/FileSystem
|
|
2167
2244
|
|
|
2168
|
-
[
|
|
2245
|
+
[23]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2169
2246
|
|
|
2170
|
-
[
|
|
2247
|
+
[24]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2171
2248
|
|
|
2172
|
-
[
|
|
2249
|
+
[25]: https://playwright.dev/docs/network#handle-requests
|
|
2173
2250
|
|
|
2174
|
-
[
|
|
2251
|
+
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2175
2252
|
|
|
2176
|
-
[
|
|
2253
|
+
[27]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2177
2254
|
|
|
2178
|
-
[
|
|
2255
|
+
[28]: #fillfield
|
|
2179
2256
|
|
|
2180
|
-
[
|
|
2257
|
+
[29]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2181
2258
|
|
|
2182
|
-
[
|
|
2259
|
+
[30]: #click
|
|
2183
2260
|
|
|
2184
|
-
[
|
|
2261
|
+
[31]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2185
2262
|
|
|
2186
|
-
[
|
|
2263
|
+
[32]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2187
2264
|
|
|
2188
|
-
[
|
|
2265
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2189
2266
|
|
|
2190
|
-
[
|
|
2267
|
+
[34]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2191
2268
|
|
|
2192
|
-
[
|
|
2269
|
+
[35]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2193
2270
|
|
|
2194
|
-
[
|
|
2271
|
+
[36]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2195
2272
|
|
|
2196
|
-
[
|
|
2273
|
+
[37]: https://codecept.io/react
|
|
2197
2274
|
|
|
2198
|
-
[
|
|
2275
|
+
[38]: https://playwright.dev/docs/api/class-browsercontext
|
|
2199
2276
|
|
|
2200
|
-
[
|
|
2277
|
+
[39]: https://playwright.dev/docs/api/class-page#page-set-default-timeout
|
|
2201
2278
|
|
|
2202
|
-
[
|
|
2279
|
+
[40]: https://playwright.dev/docs/trace-viewer
|
|
2203
2280
|
|
|
2204
|
-
[
|
|
2281
|
+
[41]: https://playwright.dev/docs/api/class-page#page-wait-for-navigation
|
|
2205
2282
|
|
|
2206
|
-
[
|
|
2283
|
+
[42]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
2207
2284
|
|
|
2208
|
-
[
|
|
2285
|
+
[43]: https://playwright.dev/docs/api/class-consolemessage#console-message-type
|