codeceptjs 4.2.0 → 4.2.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/codecept.js +11 -0
- package/docs/agents.md +26 -1
- package/docs/ai.md +57 -0
- package/docs/alternative-browsers.md +175 -148
- package/docs/assertions.md +74 -0
- package/docs/bootstrap.md +2 -0
- package/docs/commands.md +45 -0
- package/docs/configuration.md +37 -0
- package/docs/debugging.md +1 -1
- package/docs/helpers/ApiDataFactory.md +20 -20
- package/docs/helpers/Appium.md +1615 -670
- package/docs/helpers/Decision.md +146 -0
- package/docs/helpers/GraphQL.md +31 -31
- package/docs/helpers/GraphQLDataFactory.md +20 -20
- package/docs/helpers/Kitesurf.md +1808 -25
- package/docs/helpers/Lightpanda.md +139 -0
- package/docs/helpers/Obscura.md +1799 -74
- package/docs/helpers/Playwright.md +490 -428
- package/docs/helpers/Puppeteer.md +317 -255
- package/docs/helpers/REST.md +43 -43
- package/docs/helpers/WebDriver.md +237 -175
- package/docs/installation.md +16 -0
- package/docs/mcp.md +7 -1
- package/docs/parallel.md +35 -1
- package/docs/plugins/pause.md +2 -1
- package/docs/plugins/sitemap.md +48 -0
- package/docs/plugins.md +4 -0
- package/lib/ai.js +81 -2
- package/lib/codecept.js +32 -2
- package/lib/command/init.js +22 -0
- package/lib/command/initAgent.js +78 -0
- package/lib/command/run-multiple.js +3 -0
- package/lib/command/run-workers.js +10 -3
- package/lib/command/run.js +3 -2
- package/lib/command/utils.js +15 -0
- package/lib/command/workers/runTests.js +10 -10
- package/lib/container.js +4 -2
- package/lib/effects.js +19 -1
- package/lib/helper/CDPBrowser.js +349 -1384
- package/lib/helper/Decision.js +256 -0
- package/lib/helper/Kitesurf.js +3 -21
- package/lib/helper/Lightpanda.js +137 -0
- package/lib/helper/Obscura.js +21 -238
- package/lib/helper/Playwright.js +6 -4
- package/lib/helper/Puppeteer.js +12 -7
- package/lib/helper/WebDriver.js +2 -1
- package/lib/listener/result.js +4 -0
- package/lib/mocha/bdd.js +19 -1
- package/lib/plugin/junitReporter.js +4 -1
- package/lib/plugin/pause.js +4 -1
- package/lib/plugin/sitemap.js +228 -0
- package/lib/recorder.js +19 -18
- package/lib/result.js +16 -0
- package/lib/step/base.js +12 -0
- package/lib/utils.js +2 -10
- package/lib/webServer.js +193 -0
- package/lib/workers.js +118 -31
- package/package.json +4 -2
- package/typings/index.d.ts +60 -7
- package/typings/promiseBasedTypes.d.ts +772 -824
- package/typings/types.d.ts +866 -833
- package/docs/helpers/CDPBrowser.md +0 -2138
|
@@ -39,49 +39,49 @@ Using playwright-core package, will prevent the download of browser binaries and
|
|
|
39
39
|
|
|
40
40
|
This helper should be configured in codecept.conf.(js|ts)
|
|
41
41
|
|
|
42
|
-
Type: [object][
|
|
42
|
+
Type: [object][8]
|
|
43
43
|
|
|
44
44
|
### Properties
|
|
45
45
|
|
|
46
|
-
* `url` **[string][
|
|
46
|
+
* `url` **[string][7]?** base url of website to be tested
|
|
47
47
|
* `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
|
|
48
|
-
* `show` **[boolean][
|
|
49
|
-
* `restart` **([string][
|
|
48
|
+
* `show` **[boolean][26]?** show browser window.
|
|
49
|
+
* `restart` **([string][7] | [boolean][26])?** restart strategy between tests. Possible values:* 'context' or **false** - restarts [browser context][44] but keeps running browser. Recommended by Playwright team to keep tests isolated.
|
|
50
50
|
* '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
|
|
51
|
-
* `timeout` **[number][
|
|
52
|
-
* `disableScreenshots` **[boolean][
|
|
51
|
+
* `timeout` **[number][17]?** * [timeout][45] in ms of all Playwright actions .
|
|
52
|
+
* `disableScreenshots` **[boolean][26]?** don't save screenshot on failure.
|
|
53
53
|
* `emulate` **any?** browser in device emulation mode.
|
|
54
|
-
* `video` **[boolean][
|
|
55
|
-
* `keepVideoForPassedTests` **[boolean][
|
|
56
|
-
* `trace` **[boolean][
|
|
57
|
-
* `keepTraceForPassedTests` **[boolean][
|
|
58
|
-
* `fullPageScreenshots` **[boolean][
|
|
59
|
-
* `uniqueScreenshotNames` **[boolean][
|
|
60
|
-
* `keepBrowserState` **[boolean][
|
|
61
|
-
* `keepCookies` **[boolean][
|
|
62
|
-
* `waitForAction` **[number][
|
|
63
|
-
* `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][
|
|
64
|
-
* `pressKeyDelay` **[number][
|
|
65
|
-
* `getPageTimeout` **[number][
|
|
66
|
-
* `waitForTimeout` **[number][
|
|
67
|
-
* `basicAuth` **[object][
|
|
68
|
-
* `windowSize` **[string][
|
|
54
|
+
* `video` **[boolean][26]?** enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
55
|
+
* `keepVideoForPassedTests` **[boolean][26]?** save videos for passed tests; videos are saved into `output/videos` folder
|
|
56
|
+
* `trace` **[boolean][26]?** record [tracing information][46] with screenshots and snapshots.
|
|
57
|
+
* `keepTraceForPassedTests` **[boolean][26]?** save trace for passed tests.
|
|
58
|
+
* `fullPageScreenshots` **[boolean][26]?** make full page screenshots on failure.
|
|
59
|
+
* `uniqueScreenshotNames` **[boolean][26]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
60
|
+
* `keepBrowserState` **[boolean][26]?** keep browser state between tests when `restart` is set to 'session'.
|
|
61
|
+
* `keepCookies` **[boolean][26]?** keep cookies between tests when `restart` is set to 'session'.
|
|
62
|
+
* `waitForAction` **[number][17]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
63
|
+
* `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"commit"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `commit`. Choose one of those options is possible. See [Playwright API][42].
|
|
64
|
+
* `pressKeyDelay` **[number][17]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
65
|
+
* `getPageTimeout` **[number][17]?** config option to set maximum navigation time in milliseconds.
|
|
66
|
+
* `waitForTimeout` **[number][17]?** default wait* timeout in ms. Default: 1000.
|
|
67
|
+
* `basicAuth` **[object][8]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
68
|
+
* `windowSize` **[string][7]?** default window size. Set a dimension like `640x480`.
|
|
69
69
|
* `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
70
|
-
* `userAgent` **[string][
|
|
71
|
-
* `locale` **[string][
|
|
72
|
-
* `manualStart` **[boolean][
|
|
73
|
-
* `chromium` **[object][
|
|
74
|
-
* `firefox` **[object][
|
|
75
|
-
* `electron` **[object][
|
|
70
|
+
* `userAgent` **[string][7]?** user-agent string.
|
|
71
|
+
* `locale` **[string][7]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
72
|
+
* `manualStart` **[boolean][26]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
73
|
+
* `chromium` **[object][8]?** pass additional chromium options
|
|
74
|
+
* `firefox` **[object][8]?** pass additional firefox options
|
|
75
|
+
* `electron` **[object][8]?** (pass additional electron options
|
|
76
76
|
* `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][47].
|
|
77
|
-
* `ignoreLog` **[Array][
|
|
78
|
-
* `ignoreHTTPSErrors` **[boolean][
|
|
79
|
-
* `bypassCSP` **[boolean][
|
|
80
|
-
* `highlightElement` **[boolean][
|
|
81
|
-
* `visibleLocator` **[boolean][
|
|
82
|
-
* `recordHar` **[object][
|
|
83
|
-
* `testIdAttribute` **[string][
|
|
84
|
-
* `storageState` **([string][
|
|
77
|
+
* `ignoreLog` **[Array][9]<[string][7]>?** 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][48].
|
|
78
|
+
* `ignoreHTTPSErrors` **[boolean][26]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
|
|
79
|
+
* `bypassCSP` **[boolean][26]?** bypass Content Security Policy or CSP
|
|
80
|
+
* `highlightElement` **[boolean][26]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
81
|
+
* `visibleLocator` **[boolean][26]?** append [`visible()`][49] to locators, so only visible elements are matched. Requires Playwright 1.63 or newer. Switch it off for a single step with `stepOpts({ visibleLocator: false })`. Not applied to `dragAndDrop`, which passes selectors to Playwright directly, nor to steps that must reach hidden elements: `grab*` methods, `scrollTo`, `seeElementInDOM`, `dontSeeElementInDOM` and `seeNumberOfElements`. When enabled, a locator matching only hidden elements fails as "element not found" instead of timing out on actionability, `strict` mode ignores hidden duplicates, and elements hidden by CSS (like a custom checkbox built on a visually hidden `input`) are no longer found.
|
|
82
|
+
* `recordHar` **[object][8]?** record HAR and will be saved to `output/har`. See more of [HAR options][3].
|
|
83
|
+
* `testIdAttribute` **[string][7]?** locate elements based on the testIdAttribute. See more of [locate by test id][50].
|
|
84
|
+
* `storageState` **([string][7] | [object][8])?** Playwright storage state (path to JSON file or object)
|
|
85
85
|
passed directly to `browser.newContext`.
|
|
86
86
|
If a Scenario is declared with a `cookies` option (e.g. `Scenario('name', { cookies: [...] }, fn)`),
|
|
87
87
|
those cookies are used instead and the configured `storageState` is ignored (no merge).
|
|
@@ -292,112 +292,11 @@ await browserContext.cookies(); // get current browser context
|
|
|
292
292
|
|
|
293
293
|
* `config`  
|
|
294
294
|
|
|
295
|
-
### _addPopupListener
|
|
296
|
-
|
|
297
|
-
Add the 'dialog' event listener to a page
|
|
298
|
-
|
|
299
|
-
#### Parameters
|
|
300
|
-
|
|
301
|
-
* `page`  
|
|
302
|
-
|
|
303
|
-
### _contextLocator
|
|
304
|
-
|
|
305
|
-
Grab Locator if called within Context
|
|
306
|
-
|
|
307
|
-
#### Parameters
|
|
308
|
-
|
|
309
|
-
* `locator` **any** 
|
|
310
|
-
|
|
311
|
-
### _createContextPage
|
|
312
|
-
|
|
313
|
-
Create a new browser context with a page.
|
|
314
|
-
Usually it should be run from a custom helper after call of `_startBrowser()`
|
|
315
|
-
|
|
316
|
-
#### Parameters
|
|
317
|
-
|
|
318
|
-
* `contextOptions` **[object][6]?** See [https://playwright.dev/docs/api/class-browser#browser-new-context][7]
|
|
319
|
-
|
|
320
|
-
### _getPageUrl
|
|
321
|
-
|
|
322
|
-
Gets page URL including hash.
|
|
323
|
-
|
|
324
|
-
### _locate
|
|
325
|
-
|
|
326
|
-
Get elements by different locator types, including strict locator
|
|
327
|
-
Should be used in custom helpers:
|
|
328
|
-
|
|
329
|
-
```js
|
|
330
|
-
const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
#### Parameters
|
|
334
|
-
|
|
335
|
-
* `locator`  
|
|
336
|
-
|
|
337
|
-
### _locateCheckable
|
|
338
|
-
|
|
339
|
-
Find a checkbox by providing human-readable text:
|
|
340
|
-
NOTE: Assumes the checkable element exists
|
|
341
|
-
|
|
342
|
-
```js
|
|
343
|
-
this.helpers['Playwright']._locateCheckable('I agree with terms and conditions').then // ...
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
#### Parameters
|
|
347
|
-
|
|
348
|
-
* `locator`  
|
|
349
|
-
* `providedContext`
|
|
350
|
-
|
|
351
|
-
### _locateClickable
|
|
352
|
-
|
|
353
|
-
Find a clickable element by providing human-readable text:
|
|
354
|
-
|
|
355
|
-
```js
|
|
356
|
-
this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
#### Parameters
|
|
360
|
-
|
|
361
|
-
* `locator`  
|
|
362
|
-
|
|
363
|
-
### _locateElement
|
|
364
|
-
|
|
365
|
-
Get the first element by different locator types, including strict locator
|
|
366
|
-
Should be used in custom helpers:
|
|
367
|
-
|
|
368
|
-
```js
|
|
369
|
-
const element = await this.helpers['Playwright']._locateElement({name: 'password'});
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
#### Parameters
|
|
373
|
-
|
|
374
|
-
* `locator`  
|
|
375
|
-
|
|
376
|
-
### _locateFields
|
|
377
|
-
|
|
378
|
-
Find field elements by providing human-readable text:
|
|
379
|
-
|
|
380
|
-
```js
|
|
381
|
-
this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
#### Parameters
|
|
385
|
-
|
|
386
|
-
* `locator`  
|
|
387
|
-
|
|
388
|
-
### _setPage
|
|
389
|
-
|
|
390
|
-
Set current page
|
|
391
|
-
|
|
392
|
-
#### Parameters
|
|
393
|
-
|
|
394
|
-
* `page` **[object][6]** page to set
|
|
395
|
-
|
|
396
295
|
### acceptPopup
|
|
397
296
|
|
|
398
297
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
399
298
|
Don't confuse popups with modal windows, as created by [various
|
|
400
|
-
libraries][
|
|
299
|
+
libraries][6].
|
|
401
300
|
|
|
402
301
|
### amAcceptingPopups
|
|
403
302
|
|
|
@@ -434,7 +333,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
434
333
|
|
|
435
334
|
#### Parameters
|
|
436
335
|
|
|
437
|
-
* `url` **[string][
|
|
336
|
+
* `url` **[string][7]** url path or global url.
|
|
438
337
|
|
|
439
338
|
Returns **void** automatically synchronized promise through #recorder
|
|
440
339
|
|
|
@@ -455,9 +354,9 @@ I.appendField('name', 'John', '.form-container');
|
|
|
455
354
|
|
|
456
355
|
#### Parameters
|
|
457
356
|
|
|
458
|
-
* `field` **([string][
|
|
459
|
-
* `value` **[string][
|
|
460
|
-
* `context` **([string][
|
|
357
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator
|
|
358
|
+
* `value` **[string][7]** text value to append.
|
|
359
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
461
360
|
|
|
462
361
|
Returns **void** automatically synchronized promise through #recorder
|
|
463
362
|
|
|
@@ -485,9 +384,9 @@ I.attachFile('#dropzone', 'data/avatar.jpg');
|
|
|
485
384
|
|
|
486
385
|
#### Parameters
|
|
487
386
|
|
|
488
|
-
* `locator` **([string][
|
|
489
|
-
* `pathToFile` **[string][
|
|
490
|
-
* `context` **([string][
|
|
387
|
+
* `locator` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
388
|
+
* `pathToFile` **[string][7]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
389
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
491
390
|
|
|
492
391
|
Returns **void** automatically synchronized promise through #recorder
|
|
493
392
|
|
|
@@ -510,12 +409,12 @@ I.blockTraffic(['http://example.com/css/style.css', 'http://example.com/css/*.cs
|
|
|
510
409
|
|
|
511
410
|
#### Parameters
|
|
512
411
|
|
|
513
|
-
* `urls` **([string][
|
|
412
|
+
* `urls` **([string][7] | [Array][9] | [RegExp][10])** URL or a list of URLs to block . URL can contain * for wildcards. Example: [https://www.example.com][11]** to block all traffic for that domain. Regexp are also supported.
|
|
514
413
|
|
|
515
414
|
### blur
|
|
516
415
|
|
|
517
416
|
Remove focus from a text input, button, etc.
|
|
518
|
-
Calls [blur][
|
|
417
|
+
Calls [blur][12] on the element.
|
|
519
418
|
|
|
520
419
|
Examples:
|
|
521
420
|
|
|
@@ -532,8 +431,8 @@ I.dontSee('#add-to-cart-btn');
|
|
|
532
431
|
|
|
533
432
|
#### Parameters
|
|
534
433
|
|
|
535
|
-
* `locator` **([string][
|
|
536
|
-
* `options` **any?** Playwright only: [Additional options][
|
|
434
|
+
* `locator` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
435
|
+
* `options` **any?** Playwright only: [Additional options][13] for available options object as 2nd argument.
|
|
537
436
|
|
|
538
437
|
Returns **void** automatically synchronized promise through #recorder
|
|
539
438
|
|
|
@@ -543,7 +442,7 @@ Dismisses the active JavaScript popup, as created by window.alert|window.confirm
|
|
|
543
442
|
|
|
544
443
|
### checkOption
|
|
545
444
|
|
|
546
|
-
[Additional options][
|
|
445
|
+
[Additional options][14] for check available as 3rd argument.
|
|
547
446
|
|
|
548
447
|
Examples:
|
|
549
448
|
|
|
@@ -567,12 +466,23 @@ I.checkOption('agree', '//form');
|
|
|
567
466
|
|
|
568
467
|
#### Parameters
|
|
569
468
|
|
|
570
|
-
* `field` **([string][
|
|
571
|
-
* `context` **([string][
|
|
469
|
+
* `field` **([string][7] | [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
470
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
572
471
|
* `options`
|
|
573
472
|
|
|
574
473
|
Returns **void** automatically synchronized promise through #recorder
|
|
575
474
|
|
|
475
|
+
### clearClipboard
|
|
476
|
+
|
|
477
|
+
Clears the system clipboard.
|
|
478
|
+
|
|
479
|
+
```js
|
|
480
|
+
I.clearClipboard();
|
|
481
|
+
I.seeClipboardEquals('');
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
485
|
+
|
|
576
486
|
### clearCookie
|
|
577
487
|
|
|
578
488
|
Clears a cookie by name,
|
|
@@ -586,7 +496,7 @@ I.clearCookie('test');
|
|
|
586
496
|
#### Parameters
|
|
587
497
|
|
|
588
498
|
* `cookieName`  
|
|
589
|
-
* `cookie` **[string][
|
|
499
|
+
* `cookie` **[string][7]?** (optional, `null` by default) cookie name
|
|
590
500
|
|
|
591
501
|
### clearField
|
|
592
502
|
|
|
@@ -605,8 +515,8 @@ I.clearField('Email', '.form-container');
|
|
|
605
515
|
#### Parameters
|
|
606
516
|
|
|
607
517
|
* `locator`  
|
|
608
|
-
* `context` **([string][
|
|
609
|
-
* `editable` **([string][
|
|
518
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
519
|
+
* `editable` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
610
520
|
|
|
611
521
|
Returns **void** automatically synchronized promise through #recorder.
|
|
612
522
|
|
|
@@ -640,13 +550,13 @@ I.click({css: 'nav a.login'});
|
|
|
640
550
|
I.click({role: 'button', name: 'Submit'});
|
|
641
551
|
```
|
|
642
552
|
|
|
643
|
-
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][
|
|
553
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][15].
|
|
644
554
|
|
|
645
555
|
#### Parameters
|
|
646
556
|
|
|
647
|
-
* `locator` **([string][
|
|
648
|
-
* `context` **([string][
|
|
649
|
-
* `options` **any?** [Additional options][
|
|
557
|
+
* `locator` **([string][7] | [object][8])** (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
558
|
+
* `context` **([string][7]? | [object][8] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
559
|
+
* `options` **any?** [Additional options][16] for click available as 3rd argument.
|
|
650
560
|
|
|
651
561
|
#### Examples
|
|
652
562
|
|
|
@@ -678,11 +588,11 @@ I.clickXY('#someElement', 50, 30);
|
|
|
678
588
|
|
|
679
589
|
#### Parameters
|
|
680
590
|
|
|
681
|
-
* `locator` **([string][
|
|
682
|
-
* `x` **[number][
|
|
683
|
-
* `y` **[number][
|
|
591
|
+
* `locator` **([string][7] | [object][8] | [number][17])** Element to click on or X coordinate if no element.
|
|
592
|
+
* `x` **[number][17]?** X coordinate relative to element, or Y coordinate if locator is a number.
|
|
593
|
+
* `y` **[number][17]?** Y coordinate relative to element.
|
|
684
594
|
|
|
685
|
-
Returns **[Promise][
|
|
595
|
+
Returns **[Promise][18]<void>** 
|
|
686
596
|
|
|
687
597
|
### closeCurrentTab
|
|
688
598
|
|
|
@@ -712,8 +622,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
712
622
|
|
|
713
623
|
#### Parameters
|
|
714
624
|
|
|
715
|
-
* `text` **[string][
|
|
716
|
-
* `context` **([string][
|
|
625
|
+
* `text` **[string][7]** which is not present.
|
|
626
|
+
* `context` **([string][7] | [object][8])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
717
627
|
|
|
718
628
|
Returns **void** automatically synchronized promise through #recorder
|
|
719
629
|
|
|
@@ -729,7 +639,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
729
639
|
|
|
730
640
|
#### Parameters
|
|
731
641
|
|
|
732
|
-
* `field` **([string][
|
|
642
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
733
643
|
|
|
734
644
|
Returns **void** automatically synchronized promise through #recorder
|
|
735
645
|
|
|
@@ -743,7 +653,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
743
653
|
|
|
744
654
|
#### Parameters
|
|
745
655
|
|
|
746
|
-
* `name` **[string][
|
|
656
|
+
* `name` **[string][7]** cookie name.
|
|
747
657
|
|
|
748
658
|
Returns **void** automatically synchronized promise through #recorder
|
|
749
659
|
|
|
@@ -759,7 +669,7 @@ I.dontSeeCurrentPathEquals('/'); // fails for '/', '/?user=ok', '/#top'
|
|
|
759
669
|
|
|
760
670
|
#### Parameters
|
|
761
671
|
|
|
762
|
-
* `path` **[string][
|
|
672
|
+
* `path` **[string][7]** value to check.
|
|
763
673
|
|
|
764
674
|
Returns **void** automatically synchronized promise through #recorder
|
|
765
675
|
|
|
@@ -775,7 +685,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
775
685
|
|
|
776
686
|
#### Parameters
|
|
777
687
|
|
|
778
|
-
* `url` **[string][
|
|
688
|
+
* `url` **[string][7]** value to check.
|
|
779
689
|
|
|
780
690
|
Returns **void** automatically synchronized promise through #recorder
|
|
781
691
|
|
|
@@ -792,8 +702,8 @@ I.dontSeeElement('.modal', '#container');
|
|
|
792
702
|
|
|
793
703
|
#### Parameters
|
|
794
704
|
|
|
795
|
-
* `locator` **([string][
|
|
796
|
-
* `context` **([string][
|
|
705
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|Strict locator.
|
|
706
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
797
707
|
|
|
798
708
|
Returns **void** automatically synchronized promise through #recorder
|
|
799
709
|
|
|
@@ -807,7 +717,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
807
717
|
|
|
808
718
|
#### Parameters
|
|
809
719
|
|
|
810
|
-
* `locator` **([string][
|
|
720
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|Strict locator.
|
|
811
721
|
|
|
812
722
|
Returns **void** automatically synchronized promise through #recorder
|
|
813
723
|
|
|
@@ -817,7 +727,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
817
727
|
|
|
818
728
|
#### Parameters
|
|
819
729
|
|
|
820
|
-
* `url` **[string][
|
|
730
|
+
* `url` **[string][7]** value to check.
|
|
821
731
|
|
|
822
732
|
Returns **void** automatically synchronized promise through #recorder
|
|
823
733
|
|
|
@@ -837,9 +747,9 @@ I.dontSeeInField('Name', 'old_value', '.form-container');
|
|
|
837
747
|
|
|
838
748
|
#### Parameters
|
|
839
749
|
|
|
840
|
-
* `field` **([string][
|
|
841
|
-
* `value` **([string][
|
|
842
|
-
* `context` **([string][
|
|
750
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
751
|
+
* `value` **([string][7] | [object][8])** value to check.
|
|
752
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
843
753
|
|
|
844
754
|
Returns **void** automatically synchronized promise through #recorder
|
|
845
755
|
|
|
@@ -854,7 +764,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
854
764
|
#### Parameters
|
|
855
765
|
|
|
856
766
|
* `text`  
|
|
857
|
-
* `value` **[string][
|
|
767
|
+
* `value` **[string][7]** to check.
|
|
858
768
|
|
|
859
769
|
Returns **void** automatically synchronized promise through #recorder
|
|
860
770
|
|
|
@@ -868,7 +778,7 @@ I.dontSeeInTitle('Error');
|
|
|
868
778
|
|
|
869
779
|
#### Parameters
|
|
870
780
|
|
|
871
|
-
* `text` **[string][
|
|
781
|
+
* `text` **[string][7]** value to check.
|
|
872
782
|
|
|
873
783
|
Returns **void** automatically synchronized promise through #recorder
|
|
874
784
|
|
|
@@ -885,10 +795,10 @@ I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.exa
|
|
|
885
795
|
|
|
886
796
|
#### Parameters
|
|
887
797
|
|
|
888
|
-
* `opts` **[Object][
|
|
798
|
+
* `opts` **[Object][8]** options when checking the traffic network.
|
|
889
799
|
|
|
890
|
-
* `opts.name` **[string][
|
|
891
|
-
* `opts.url` **([string][
|
|
800
|
+
* `opts.name` **[string][7]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
801
|
+
* `opts.url` **([string][7] | [RegExp][10])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
892
802
|
|
|
893
803
|
Returns **void** automatically synchronized promise through #recorder
|
|
894
804
|
|
|
@@ -906,8 +816,8 @@ I.doubleClick('.btn.edit');
|
|
|
906
816
|
|
|
907
817
|
#### Parameters
|
|
908
818
|
|
|
909
|
-
* `locator` **([string][
|
|
910
|
-
* `context` **([string][
|
|
819
|
+
* `locator` **([string][7] | [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
820
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
911
821
|
|
|
912
822
|
Returns **void** automatically synchronized promise through #recorder
|
|
913
823
|
|
|
@@ -928,9 +838,9 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
928
838
|
|
|
929
839
|
#### Parameters
|
|
930
840
|
|
|
931
|
-
* `srcElement` **([string][
|
|
932
|
-
* `destElement` **([string][
|
|
933
|
-
* `options` **any?** [Additional options][
|
|
841
|
+
* `srcElement` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
842
|
+
* `destElement` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
843
|
+
* `options` **any?** [Additional options][19] can be passed as 3rd argument.
|
|
934
844
|
|
|
935
845
|
Returns **void** automatically synchronized promise through #recorder
|
|
936
846
|
|
|
@@ -946,8 +856,8 @@ I.dragSlider('#slider', -70);
|
|
|
946
856
|
|
|
947
857
|
#### Parameters
|
|
948
858
|
|
|
949
|
-
* `locator` **([string][
|
|
950
|
-
* `offsetX` **[number][
|
|
859
|
+
* `locator` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
860
|
+
* `offsetX` **[number][17]** position to drag.
|
|
951
861
|
|
|
952
862
|
Returns **void** automatically synchronized promise through #recorder
|
|
953
863
|
|
|
@@ -976,10 +886,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
976
886
|
|
|
977
887
|
#### Parameters
|
|
978
888
|
|
|
979
|
-
* `fn` **([string][
|
|
889
|
+
* `fn` **([string][7] | [function][20])** function to be executed in browser context.
|
|
980
890
|
* `arg` **any?** optional argument to pass to the function
|
|
981
891
|
|
|
982
|
-
Returns **[Promise][
|
|
892
|
+
Returns **[Promise][18]<any>** 
|
|
983
893
|
|
|
984
894
|
### fillField
|
|
985
895
|
|
|
@@ -1003,13 +913,13 @@ I.fillField({role: 'textbox', name: 'Email'}, 'hello@world.com');
|
|
|
1003
913
|
I.fillField('Name', 'John', '#section2');
|
|
1004
914
|
```
|
|
1005
915
|
|
|
1006
|
-
> ℹ️ ARIA role locators (`{role, name}`) match fields by their accessible name and survive markup refactors. See [Locators][
|
|
916
|
+
> ℹ️ ARIA role locators (`{role, name}`) match fields by their accessible name and survive markup refactors. See [Locators][15].
|
|
1007
917
|
|
|
1008
918
|
#### Parameters
|
|
1009
919
|
|
|
1010
|
-
* `field` **([string][
|
|
1011
|
-
* `value` **([string][
|
|
1012
|
-
* `context` **([string][
|
|
920
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
921
|
+
* `value` **([string][7] | [object][8])** text value to fill.
|
|
922
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1013
923
|
|
|
1014
924
|
Returns **void** automatically synchronized promise through #recorder
|
|
1015
925
|
|
|
@@ -1027,7 +937,7 @@ Resets all recorded WS messages.
|
|
|
1027
937
|
|
|
1028
938
|
### focus
|
|
1029
939
|
|
|
1030
|
-
Calls [focus][
|
|
940
|
+
Calls [focus][12] on the matching element.
|
|
1031
941
|
|
|
1032
942
|
Examples:
|
|
1033
943
|
|
|
@@ -1039,8 +949,8 @@ I.see('#add-to-cart-bnt');
|
|
|
1039
949
|
|
|
1040
950
|
#### Parameters
|
|
1041
951
|
|
|
1042
|
-
* `locator` **([string][
|
|
1043
|
-
* `options` **any?** Playwright only: [Additional options][
|
|
952
|
+
* `locator` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
953
|
+
* `options` **any?** Playwright only: [Additional options][21] for available options object as 2nd argument.
|
|
1044
954
|
|
|
1045
955
|
Returns **void** automatically synchronized promise through #recorder
|
|
1046
956
|
|
|
@@ -1073,14 +983,14 @@ I.forceClick({css: 'nav a.login'});
|
|
|
1073
983
|
|
|
1074
984
|
#### Parameters
|
|
1075
985
|
|
|
1076
|
-
* `locator` **([string][
|
|
1077
|
-
* `context` **([string][
|
|
986
|
+
* `locator` **([string][7] | [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
987
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1078
988
|
|
|
1079
989
|
Returns **void** automatically synchronized promise through #recorder
|
|
1080
990
|
|
|
1081
991
|
### grabAriaSnapshot
|
|
1082
992
|
|
|
1083
|
-
Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`][
|
|
993
|
+
Retrieves the ARIA snapshot for an element using Playwright's [`locator.ariaSnapshot`][22].
|
|
1084
994
|
This method returns a YAML representation of the accessibility tree that can be used for assertions.
|
|
1085
995
|
If no locator is provided, it captures the snapshot of the entire page body.
|
|
1086
996
|
|
|
@@ -1092,13 +1002,13 @@ const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
|
1092
1002
|
expect(formSnapshot).toContain('textbox "Email"');
|
|
1093
1003
|
```
|
|
1094
1004
|
|
|
1095
|
-
[Learn more about ARIA snapshots][
|
|
1005
|
+
[Learn more about ARIA snapshots][23]
|
|
1096
1006
|
|
|
1097
1007
|
#### Parameters
|
|
1098
1008
|
|
|
1099
|
-
* `locator` **([string][
|
|
1009
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator. Defaults to body element.
|
|
1100
1010
|
|
|
1101
|
-
Returns **[Promise][
|
|
1011
|
+
Returns **[Promise][18]<[string][7]>** YAML representation of the accessibility tree
|
|
1102
1012
|
|
|
1103
1013
|
### grabAttributeFrom
|
|
1104
1014
|
|
|
@@ -1112,10 +1022,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
1112
1022
|
|
|
1113
1023
|
#### Parameters
|
|
1114
1024
|
|
|
1115
|
-
* `locator` **([string][
|
|
1116
|
-
* `attr` **[string][
|
|
1025
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1026
|
+
* `attr` **[string][7]** attribute name.
|
|
1117
1027
|
|
|
1118
|
-
Returns **[Promise][
|
|
1028
|
+
Returns **[Promise][18]<[string][7]>** attribute value
|
|
1119
1029
|
|
|
1120
1030
|
### grabAttributeFromAll
|
|
1121
1031
|
|
|
@@ -1128,10 +1038,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1128
1038
|
|
|
1129
1039
|
#### Parameters
|
|
1130
1040
|
|
|
1131
|
-
* `locator` **([string][
|
|
1132
|
-
* `attr` **[string][
|
|
1041
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1042
|
+
* `attr` **[string][7]** attribute name.
|
|
1133
1043
|
|
|
1134
|
-
Returns **[Promise][
|
|
1044
|
+
Returns **[Promise][18]<[Array][9]<[string][7]>>** attribute value
|
|
1135
1045
|
|
|
1136
1046
|
### grabBrowserLogs
|
|
1137
1047
|
|
|
@@ -1143,9 +1053,9 @@ const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l
|
|
|
1143
1053
|
console.log(JSON.stringify(errors));
|
|
1144
1054
|
```
|
|
1145
1055
|
|
|
1146
|
-
[Learn more about console messages][
|
|
1056
|
+
[Learn more about console messages][24]
|
|
1147
1057
|
|
|
1148
|
-
Returns **[Promise][
|
|
1058
|
+
Returns **[Promise][18]<[Array][9]<any>>** 
|
|
1149
1059
|
|
|
1150
1060
|
### grabCheckedElementStatus
|
|
1151
1061
|
|
|
@@ -1153,10 +1063,10 @@ Return the checked status of given element.
|
|
|
1153
1063
|
|
|
1154
1064
|
#### Parameters
|
|
1155
1065
|
|
|
1156
|
-
* `locator` **([string][
|
|
1157
|
-
* `options` **[object][
|
|
1066
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1067
|
+
* `options` **[object][8]?** See [https://playwright.dev/docs/api/class-locator#locator-is-checked][25]
|
|
1158
1068
|
|
|
1159
|
-
Returns **[Promise][
|
|
1069
|
+
Returns **[Promise][18]<[boolean][26]>** 
|
|
1160
1070
|
|
|
1161
1071
|
### grabCookie
|
|
1162
1072
|
|
|
@@ -1173,7 +1083,7 @@ assert(cookie.value, '123456');
|
|
|
1173
1083
|
|
|
1174
1084
|
#### Parameters
|
|
1175
1085
|
|
|
1176
|
-
* `name` **[string][
|
|
1086
|
+
* `name` **[string][7]?** cookie name.
|
|
1177
1087
|
|
|
1178
1088
|
Returns **any** attribute value
|
|
1179
1089
|
|
|
@@ -1189,10 +1099,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1189
1099
|
|
|
1190
1100
|
#### Parameters
|
|
1191
1101
|
|
|
1192
|
-
* `locator` **([string][
|
|
1193
|
-
* `cssProperty` **[string][
|
|
1102
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1103
|
+
* `cssProperty` **[string][7]** CSS property name.
|
|
1194
1104
|
|
|
1195
|
-
Returns **[Promise][
|
|
1105
|
+
Returns **[Promise][18]<[string][7]>** CSS value
|
|
1196
1106
|
|
|
1197
1107
|
### grabCssPropertyFromAll
|
|
1198
1108
|
|
|
@@ -1205,10 +1115,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1205
1115
|
|
|
1206
1116
|
#### Parameters
|
|
1207
1117
|
|
|
1208
|
-
* `locator` **([string][
|
|
1209
|
-
* `cssProperty` **[string][
|
|
1118
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1119
|
+
* `cssProperty` **[string][7]** CSS property name.
|
|
1210
1120
|
|
|
1211
|
-
Returns **[Promise][
|
|
1121
|
+
Returns **[Promise][18]<[Array][9]<[string][7]>>** CSS value
|
|
1212
1122
|
|
|
1213
1123
|
### grabCurrentUrl
|
|
1214
1124
|
|
|
@@ -1220,7 +1130,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1220
1130
|
console.log(`Current URL is [${url}]`);
|
|
1221
1131
|
```
|
|
1222
1132
|
|
|
1223
|
-
Returns **[Promise][
|
|
1133
|
+
Returns **[Promise][18]<[string][7]>** current URL
|
|
1224
1134
|
|
|
1225
1135
|
### grabDataFromPerformanceTiming
|
|
1226
1136
|
|
|
@@ -1253,10 +1163,10 @@ Return the disabled status of given element.
|
|
|
1253
1163
|
|
|
1254
1164
|
#### Parameters
|
|
1255
1165
|
|
|
1256
|
-
* `locator` **([string][
|
|
1257
|
-
* `options` **[object][
|
|
1166
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1167
|
+
* `options` **[object][8]?** See [https://playwright.dev/docs/api/class-locator#locator-is-disabled][27]
|
|
1258
1168
|
|
|
1259
|
-
Returns **[Promise][
|
|
1169
|
+
Returns **[Promise][18]<[boolean][26]>** 
|
|
1260
1170
|
|
|
1261
1171
|
### grabElementBoundingRect
|
|
1262
1172
|
|
|
@@ -1280,11 +1190,26 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1280
1190
|
|
|
1281
1191
|
#### Parameters
|
|
1282
1192
|
|
|
1283
|
-
* `locator` **([string][
|
|
1193
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1284
1194
|
* `prop`  
|
|
1285
|
-
* `elementSize` **[string][
|
|
1195
|
+
* `elementSize` **[string][7]?** x, y, width or height of the given element.
|
|
1196
|
+
|
|
1197
|
+
Returns **([Promise][18]<DOMRect> | [Promise][18]<[number][17]>)** Element bounding rectangle
|
|
1198
|
+
|
|
1199
|
+
### grabFromClipboard
|
|
1200
|
+
|
|
1201
|
+
Grabs the text content of the system clipboard and returns it to test.
|
|
1202
|
+
Resumes test execution, so **should be used inside async function with `await`** operator.
|
|
1203
|
+
|
|
1204
|
+
```js
|
|
1205
|
+
I.click('Copy to clipboard');
|
|
1206
|
+
let url = await I.grabFromClipboard();
|
|
1207
|
+
```
|
|
1208
|
+
|
|
1209
|
+
Reading the clipboard requires a secure context (`https` or `localhost`) and is supported
|
|
1210
|
+
in Chromium-based browsers, where read access is granted automatically.
|
|
1286
1211
|
|
|
1287
|
-
Returns **
|
|
1212
|
+
Returns **[Promise][18]<[string][7]>** the system clipboard contents.
|
|
1288
1213
|
|
|
1289
1214
|
### grabHTMLFrom
|
|
1290
1215
|
|
|
@@ -1299,9 +1224,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1299
1224
|
#### Parameters
|
|
1300
1225
|
|
|
1301
1226
|
* `locator`  
|
|
1302
|
-
* `element` **([string][
|
|
1227
|
+
* `element` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1303
1228
|
|
|
1304
|
-
Returns **[Promise][
|
|
1229
|
+
Returns **[Promise][18]<[string][7]>** HTML code for an element
|
|
1305
1230
|
|
|
1306
1231
|
### grabHTMLFromAll
|
|
1307
1232
|
|
|
@@ -1315,9 +1240,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1315
1240
|
#### Parameters
|
|
1316
1241
|
|
|
1317
1242
|
* `locator`  
|
|
1318
|
-
* `element` **([string][
|
|
1243
|
+
* `element` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1319
1244
|
|
|
1320
|
-
Returns **[Promise][
|
|
1245
|
+
Returns **[Promise][18]<[Array][9]<[string][7]>>** HTML code for an element
|
|
1321
1246
|
|
|
1322
1247
|
### grabMetrics
|
|
1323
1248
|
|
|
@@ -1372,7 +1297,7 @@ const metrics = await I.grabMetrics();
|
|
|
1372
1297
|
|
|
1373
1298
|
```
|
|
1374
1299
|
|
|
1375
|
-
Returns **[Promise][
|
|
1300
|
+
Returns **[Promise][18]<[Array][9]<[Object][8]>>** 
|
|
1376
1301
|
|
|
1377
1302
|
### grabNumberOfOpenTabs
|
|
1378
1303
|
|
|
@@ -1383,7 +1308,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1383
1308
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1384
1309
|
```
|
|
1385
1310
|
|
|
1386
|
-
Returns **[Promise][
|
|
1311
|
+
Returns **[Promise][18]<[number][17]>** number of open tabs
|
|
1387
1312
|
|
|
1388
1313
|
### grabNumberOfVisibleElements
|
|
1389
1314
|
|
|
@@ -1396,9 +1321,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1396
1321
|
|
|
1397
1322
|
#### Parameters
|
|
1398
1323
|
|
|
1399
|
-
* `locator` **([string][
|
|
1324
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1400
1325
|
|
|
1401
|
-
Returns **[Promise][
|
|
1326
|
+
Returns **[Promise][18]<[number][17]>** number of visible elements
|
|
1402
1327
|
|
|
1403
1328
|
### grabPageScrollPosition
|
|
1404
1329
|
|
|
@@ -1409,7 +1334,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1409
1334
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1410
1335
|
```
|
|
1411
1336
|
|
|
1412
|
-
Returns **[Promise][
|
|
1337
|
+
Returns **[Promise][18]<PageScrollPosition>** scroll position
|
|
1413
1338
|
|
|
1414
1339
|
### grabPopupText
|
|
1415
1340
|
|
|
@@ -1419,7 +1344,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1419
1344
|
await I.grabPopupText();
|
|
1420
1345
|
```
|
|
1421
1346
|
|
|
1422
|
-
Returns **[Promise][
|
|
1347
|
+
Returns **[Promise][18]<([string][7] | null)>** 
|
|
1423
1348
|
|
|
1424
1349
|
### grabRecordedNetworkTraffics
|
|
1425
1350
|
|
|
@@ -1432,7 +1357,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
1432
1357
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1433
1358
|
```
|
|
1434
1359
|
|
|
1435
|
-
Returns **[Array][
|
|
1360
|
+
Returns **[Array][9]** recorded network traffics
|
|
1436
1361
|
|
|
1437
1362
|
### grabSource
|
|
1438
1363
|
|
|
@@ -1443,7 +1368,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1443
1368
|
let pageSource = await I.grabSource();
|
|
1444
1369
|
```
|
|
1445
1370
|
|
|
1446
|
-
Returns **[Promise][
|
|
1371
|
+
Returns **[Promise][18]<[string][7]>** source code
|
|
1447
1372
|
|
|
1448
1373
|
### grabStorageState
|
|
1449
1374
|
|
|
@@ -1456,9 +1381,9 @@ Avoid committing it to source control and prefer storing it in a protected secre
|
|
|
1456
1381
|
|
|
1457
1382
|
#### Parameters
|
|
1458
1383
|
|
|
1459
|
-
* `options` **[object][
|
|
1384
|
+
* `options` **[object][8]?**
|
|
1460
1385
|
|
|
1461
|
-
* `options.indexedDB` **[boolean][
|
|
1386
|
+
* `options.indexedDB` **[boolean][26]?** set to true to include IndexedDB in snapshot (Playwright >=1.51)```js
|
|
1462
1387
|
// basic usage
|
|
1463
1388
|
const state = await I.grabStorageState();
|
|
1464
1389
|
require('fs').writeFileSync('authState.json', JSON.stringify(state));
|
|
@@ -1480,9 +1405,9 @@ If multiple elements found returns first element.
|
|
|
1480
1405
|
|
|
1481
1406
|
#### Parameters
|
|
1482
1407
|
|
|
1483
|
-
* `locator` **([string][
|
|
1408
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1484
1409
|
|
|
1485
|
-
Returns **[Promise][
|
|
1410
|
+
Returns **[Promise][18]<[string][7]>** attribute value
|
|
1486
1411
|
|
|
1487
1412
|
### grabTextFromAll
|
|
1488
1413
|
|
|
@@ -1495,9 +1420,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1495
1420
|
|
|
1496
1421
|
#### Parameters
|
|
1497
1422
|
|
|
1498
|
-
* `locator` **([string][
|
|
1423
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1499
1424
|
|
|
1500
|
-
Returns **[Promise][
|
|
1425
|
+
Returns **[Promise][18]<[Array][9]<[string][7]>>** attribute value
|
|
1501
1426
|
|
|
1502
1427
|
### grabTitle
|
|
1503
1428
|
|
|
@@ -1508,7 +1433,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1508
1433
|
let title = await I.grabTitle();
|
|
1509
1434
|
```
|
|
1510
1435
|
|
|
1511
|
-
Returns **[Promise][
|
|
1436
|
+
Returns **[Promise][18]<[string][7]>** title
|
|
1512
1437
|
|
|
1513
1438
|
### grabTrafficUrl
|
|
1514
1439
|
|
|
@@ -1523,9 +1448,9 @@ I.grabTrafficUrl(/session.*start/);
|
|
|
1523
1448
|
|
|
1524
1449
|
#### Parameters
|
|
1525
1450
|
|
|
1526
|
-
* `urlMatch` **([string][
|
|
1451
|
+
* `urlMatch` **([string][7] | [RegExp][10])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
1527
1452
|
|
|
1528
|
-
Returns **[Promise][
|
|
1453
|
+
Returns **[Promise][18]<any>** 
|
|
1529
1454
|
|
|
1530
1455
|
### grabValueFrom
|
|
1531
1456
|
|
|
@@ -1539,9 +1464,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1539
1464
|
|
|
1540
1465
|
#### Parameters
|
|
1541
1466
|
|
|
1542
|
-
* `locator` **([string][
|
|
1467
|
+
* `locator` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1543
1468
|
|
|
1544
|
-
Returns **[Promise][
|
|
1469
|
+
Returns **[Promise][18]<[string][7]>** attribute value
|
|
1545
1470
|
|
|
1546
1471
|
### grabValueFromAll
|
|
1547
1472
|
|
|
@@ -1554,9 +1479,9 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1554
1479
|
|
|
1555
1480
|
#### Parameters
|
|
1556
1481
|
|
|
1557
|
-
* `locator` **([string][
|
|
1482
|
+
* `locator` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1558
1483
|
|
|
1559
|
-
Returns **[Promise][
|
|
1484
|
+
Returns **[Promise][18]<[Array][9]<[string][7]>>** attribute value
|
|
1560
1485
|
|
|
1561
1486
|
### grabWebElement
|
|
1562
1487
|
|
|
@@ -1569,9 +1494,9 @@ const webElement = await I.grabWebElement('#button');
|
|
|
1569
1494
|
|
|
1570
1495
|
#### Parameters
|
|
1571
1496
|
|
|
1572
|
-
* `locator` **([string][
|
|
1497
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1573
1498
|
|
|
1574
|
-
Returns **[Promise][
|
|
1499
|
+
Returns **[Promise][18]<any>** WebElement of being used Web helper
|
|
1575
1500
|
|
|
1576
1501
|
### grabWebElements
|
|
1577
1502
|
|
|
@@ -1584,22 +1509,22 @@ const webElements = await I.grabWebElements('#button');
|
|
|
1584
1509
|
|
|
1585
1510
|
#### Parameters
|
|
1586
1511
|
|
|
1587
|
-
* `locator` **([string][
|
|
1512
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1588
1513
|
|
|
1589
|
-
Returns **[Promise][
|
|
1514
|
+
Returns **[Promise][18]<any>** WebElement of being used Web helper
|
|
1590
1515
|
|
|
1591
1516
|
### grabWebSocketMessages
|
|
1592
1517
|
|
|
1593
1518
|
Grab the recording WS messages
|
|
1594
1519
|
|
|
1595
|
-
Returns **[Array][
|
|
1520
|
+
Returns **[Array][9]<any>** 
|
|
1596
1521
|
|
|
1597
1522
|
### handleDownloads
|
|
1598
1523
|
|
|
1599
1524
|
Handles a file download. A file name is required to save the file on disk.
|
|
1600
1525
|
Files are saved to "output" directory.
|
|
1601
1526
|
|
|
1602
|
-
Should be used with [FileSystem helper][
|
|
1527
|
+
Should be used with [FileSystem helper][28] to check that file were downloaded correctly.
|
|
1603
1528
|
|
|
1604
1529
|
```js
|
|
1605
1530
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1611,13 +1536,13 @@ I.waitForFile('avatar.jpg', 5);
|
|
|
1611
1536
|
|
|
1612
1537
|
#### Parameters
|
|
1613
1538
|
|
|
1614
|
-
* `fileName` **[string][
|
|
1539
|
+
* `fileName` **[string][7]** set filename for downloaded file
|
|
1615
1540
|
|
|
1616
|
-
Returns **[Promise][
|
|
1541
|
+
Returns **[Promise][18]<void>** 
|
|
1617
1542
|
|
|
1618
1543
|
### makeApiRequest
|
|
1619
1544
|
|
|
1620
|
-
Performs [api request][
|
|
1545
|
+
Performs [api request][29] using
|
|
1621
1546
|
the cookies from the current browser session.
|
|
1622
1547
|
|
|
1623
1548
|
```js
|
|
@@ -1630,26 +1555,26 @@ I.makeApiRequest('PATCH', )
|
|
|
1630
1555
|
|
|
1631
1556
|
#### Parameters
|
|
1632
1557
|
|
|
1633
|
-
* `method` **[string][
|
|
1634
|
-
* `url` **[string][
|
|
1635
|
-
* `options` **[object][
|
|
1558
|
+
* `method` **[string][7]** HTTP method
|
|
1559
|
+
* `url` **[string][7]** endpoint
|
|
1560
|
+
* `options` **[object][8]** request options depending on method used
|
|
1636
1561
|
|
|
1637
|
-
Returns **[Promise][
|
|
1562
|
+
Returns **[Promise][18]<[object][8]>** response
|
|
1638
1563
|
|
|
1639
1564
|
### mockRoute
|
|
1640
1565
|
|
|
1641
|
-
Mocks network request using [`browserContext.route`][
|
|
1566
|
+
Mocks network request using [`browserContext.route`][30] of Playwright
|
|
1642
1567
|
|
|
1643
1568
|
```js
|
|
1644
1569
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1645
1570
|
```
|
|
1646
1571
|
|
|
1647
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1572
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][31]
|
|
1648
1573
|
|
|
1649
1574
|
#### Parameters
|
|
1650
1575
|
|
|
1651
|
-
* `url` **([string][
|
|
1652
|
-
* `handler` **[function][
|
|
1576
|
+
* `url` **([string][7] | [RegExp][10])?** URL, regex or pattern for to match URL
|
|
1577
|
+
* `handler` **[function][20]?** a function to process request
|
|
1653
1578
|
|
|
1654
1579
|
### mockTraffic
|
|
1655
1580
|
|
|
@@ -1686,9 +1611,9 @@ I.moveCursorTo('#submit', '.container');
|
|
|
1686
1611
|
|
|
1687
1612
|
#### Parameters
|
|
1688
1613
|
|
|
1689
|
-
* `locator` **([string][
|
|
1690
|
-
* `offsetX` **([number][
|
|
1691
|
-
* `offsetY` **[number][
|
|
1614
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1615
|
+
* `offsetX` **([number][17] | [string][7] | [object][8])** (optional, `0` by default) X-axis offset or context locator.
|
|
1616
|
+
* `offsetY` **[number][17]** (optional, `0` by default) Y-axis offset.
|
|
1692
1617
|
|
|
1693
1618
|
Returns **void** automatically synchronized promise through #recorder
|
|
1694
1619
|
|
|
@@ -1700,7 +1625,7 @@ Open new tab and automatically switched to new tab
|
|
|
1700
1625
|
I.openNewTab();
|
|
1701
1626
|
```
|
|
1702
1627
|
|
|
1703
|
-
You can pass in [page options][
|
|
1628
|
+
You can pass in [page options][32] to emulate device on this page
|
|
1704
1629
|
|
|
1705
1630
|
```js
|
|
1706
1631
|
// enable mobile
|
|
@@ -1713,11 +1638,11 @@ I.openNewTab({ isMobile: true });
|
|
|
1713
1638
|
|
|
1714
1639
|
### pressKey
|
|
1715
1640
|
|
|
1716
|
-
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][
|
|
1641
|
+
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][33]).
|
|
1717
1642
|
|
|
1718
1643
|
Presses a key in the browser (on a focused element).
|
|
1719
1644
|
|
|
1720
|
-
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1645
|
+
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][34].
|
|
1721
1646
|
|
|
1722
1647
|
```js
|
|
1723
1648
|
I.pressKey('Backspace');
|
|
@@ -1776,7 +1701,7 @@ Some of the supported key names are:
|
|
|
1776
1701
|
|
|
1777
1702
|
#### Parameters
|
|
1778
1703
|
|
|
1779
|
-
* `key` **([string][
|
|
1704
|
+
* `key` **([string][7] | [Array][9]<[string][7]>)** key or array of keys to press.
|
|
1780
1705
|
|
|
1781
1706
|
Returns **void** automatically synchronized promise through #recorder
|
|
1782
1707
|
|
|
@@ -1784,7 +1709,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1784
1709
|
|
|
1785
1710
|
Presses a key in the browser and leaves it in a down state.
|
|
1786
1711
|
|
|
1787
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1712
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][35]).
|
|
1788
1713
|
|
|
1789
1714
|
```js
|
|
1790
1715
|
I.pressKeyDown('Control');
|
|
@@ -1794,7 +1719,7 @@ I.pressKeyUp('Control');
|
|
|
1794
1719
|
|
|
1795
1720
|
#### Parameters
|
|
1796
1721
|
|
|
1797
|
-
* `key` **[string][
|
|
1722
|
+
* `key` **[string][7]** name of key to press down.
|
|
1798
1723
|
|
|
1799
1724
|
Returns **void** automatically synchronized promise through #recorder
|
|
1800
1725
|
|
|
@@ -1802,7 +1727,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1802
1727
|
|
|
1803
1728
|
Releases a key in the browser which was previously set to a down state.
|
|
1804
1729
|
|
|
1805
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1730
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][35]).
|
|
1806
1731
|
|
|
1807
1732
|
```js
|
|
1808
1733
|
I.pressKeyDown('Control');
|
|
@@ -1812,7 +1737,7 @@ I.pressKeyUp('Control');
|
|
|
1812
1737
|
|
|
1813
1738
|
#### Parameters
|
|
1814
1739
|
|
|
1815
|
-
* `key` **[string][
|
|
1740
|
+
* `key` **[string][7]** name of key to release.
|
|
1816
1741
|
|
|
1817
1742
|
Returns **void** automatically synchronized promise through #recorder
|
|
1818
1743
|
|
|
@@ -1841,8 +1766,8 @@ Replaying from HAR
|
|
|
1841
1766
|
|
|
1842
1767
|
#### Parameters
|
|
1843
1768
|
|
|
1844
|
-
* `harFilePath` **[string][
|
|
1845
|
-
* `opts` **[object][
|
|
1769
|
+
* `harFilePath` **[string][7]** Path to recorded HAR file
|
|
1770
|
+
* `opts` **[object][8]?** [Options for replaying from HAR][36]
|
|
1846
1771
|
|
|
1847
1772
|
Returns **any** Promise<void>
|
|
1848
1773
|
|
|
@@ -1865,8 +1790,8 @@ First parameter can be set to `maximize`.
|
|
|
1865
1790
|
|
|
1866
1791
|
#### Parameters
|
|
1867
1792
|
|
|
1868
|
-
* `width` **[number][
|
|
1869
|
-
* `height` **[number][
|
|
1793
|
+
* `width` **[number][17]** width in pixels or `maximize`.
|
|
1794
|
+
* `height` **[number][17]** height in pixels.
|
|
1870
1795
|
|
|
1871
1796
|
Returns **void** automatically synchronized promise through #recorder
|
|
1872
1797
|
|
|
@@ -1885,8 +1810,8 @@ I.rightClick('Click me', '.context');
|
|
|
1885
1810
|
|
|
1886
1811
|
#### Parameters
|
|
1887
1812
|
|
|
1888
|
-
* `locator` **([string][
|
|
1889
|
-
* `context` **([string][
|
|
1813
|
+
* `locator` **([string][7] | [object][8])** clickable element located by CSS|XPath|strict locator.
|
|
1814
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1890
1815
|
|
|
1891
1816
|
Returns **void** automatically synchronized promise through #recorder
|
|
1892
1817
|
|
|
@@ -1901,8 +1826,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1901
1826
|
|
|
1902
1827
|
#### Parameters
|
|
1903
1828
|
|
|
1904
|
-
* `locator` **([string][
|
|
1905
|
-
* `fileName` **[string][
|
|
1829
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1830
|
+
* `fileName` **[string][7]** file name to save.
|
|
1906
1831
|
|
|
1907
1832
|
Returns **void** automatically synchronized promise through #recorder
|
|
1908
1833
|
|
|
@@ -1919,8 +1844,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1919
1844
|
|
|
1920
1845
|
#### Parameters
|
|
1921
1846
|
|
|
1922
|
-
* `fileName` **[string][
|
|
1923
|
-
* `fullPage` **[boolean][
|
|
1847
|
+
* `fileName` **[string][7]** file name to save.
|
|
1848
|
+
* `fullPage` **[boolean][26]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1924
1849
|
|
|
1925
1850
|
Returns **void** automatically synchronized promise through #recorder
|
|
1926
1851
|
|
|
@@ -1956,9 +1881,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1956
1881
|
|
|
1957
1882
|
#### Parameters
|
|
1958
1883
|
|
|
1959
|
-
* `locator` **([string][
|
|
1960
|
-
* `offsetX` **[number][
|
|
1961
|
-
* `offsetY` **[number][
|
|
1884
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1885
|
+
* `offsetX` **[number][17]** (optional, `0` by default) X-axis offset.
|
|
1886
|
+
* `offsetY` **[number][17]** (optional, `0` by default) Y-axis offset.
|
|
1962
1887
|
|
|
1963
1888
|
Returns **void** automatically synchronized promise through #recorder
|
|
1964
1889
|
|
|
@@ -1975,8 +1900,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1975
1900
|
|
|
1976
1901
|
#### Parameters
|
|
1977
1902
|
|
|
1978
|
-
* `text` **[string][
|
|
1979
|
-
* `context` **([string][
|
|
1903
|
+
* `text` **[string][7]** expected on page.
|
|
1904
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1980
1905
|
|
|
1981
1906
|
Returns **void** automatically synchronized promise through #recorder
|
|
1982
1907
|
|
|
@@ -1990,8 +1915,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1990
1915
|
|
|
1991
1916
|
#### Parameters
|
|
1992
1917
|
|
|
1993
|
-
* `locator` **([string][
|
|
1994
|
-
* `attributes` **[object][
|
|
1918
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1919
|
+
* `attributes` **[object][8]** attributes and their values to check.
|
|
1995
1920
|
|
|
1996
1921
|
Returns **void** automatically synchronized promise through #recorder
|
|
1997
1922
|
|
|
@@ -2007,7 +1932,25 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
2007
1932
|
|
|
2008
1933
|
#### Parameters
|
|
2009
1934
|
|
|
2010
|
-
* `field` **([string][
|
|
1935
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1936
|
+
|
|
1937
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
1938
|
+
|
|
1939
|
+
### seeClipboardEquals
|
|
1940
|
+
|
|
1941
|
+
Checks that the system clipboard is equal to the given text.
|
|
1942
|
+
|
|
1943
|
+
```js
|
|
1944
|
+
I.click('Copy to clipboard');
|
|
1945
|
+
I.seeClipboardEquals('https://codecept.io');
|
|
1946
|
+
```
|
|
1947
|
+
|
|
1948
|
+
Reading the clipboard requires a secure context (`https` or `localhost`) and is supported
|
|
1949
|
+
in Chromium-based browsers, where read access is granted automatically.
|
|
1950
|
+
|
|
1951
|
+
#### Parameters
|
|
1952
|
+
|
|
1953
|
+
* `text` **[string][7]** value to check.
|
|
2011
1954
|
|
|
2012
1955
|
Returns **void** automatically synchronized promise through #recorder
|
|
2013
1956
|
|
|
@@ -2021,7 +1964,7 @@ I.seeCookie('Auth');
|
|
|
2021
1964
|
|
|
2022
1965
|
#### Parameters
|
|
2023
1966
|
|
|
2024
|
-
* `name` **[string][
|
|
1967
|
+
* `name` **[string][7]** cookie name.
|
|
2025
1968
|
|
|
2026
1969
|
Returns **void** automatically synchronized promise through #recorder
|
|
2027
1970
|
|
|
@@ -2035,8 +1978,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
2035
1978
|
|
|
2036
1979
|
#### Parameters
|
|
2037
1980
|
|
|
2038
|
-
* `locator` **([string][
|
|
2039
|
-
* `cssProperties` **[object][
|
|
1981
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
1982
|
+
* `cssProperties` **[object][8]** object with CSS properties and their values to check.
|
|
2040
1983
|
|
|
2041
1984
|
Returns **void** automatically synchronized promise through #recorder
|
|
2042
1985
|
|
|
@@ -2052,7 +1995,7 @@ I.seeCurrentPathEquals('/'); // passes for '/', '/?user=ok', '/#top'
|
|
|
2052
1995
|
|
|
2053
1996
|
#### Parameters
|
|
2054
1997
|
|
|
2055
|
-
* `path` **[string][
|
|
1998
|
+
* `path` **[string][7]** value to check.
|
|
2056
1999
|
|
|
2057
2000
|
Returns **void** automatically synchronized promise through #recorder
|
|
2058
2001
|
|
|
@@ -2069,7 +2012,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
2069
2012
|
|
|
2070
2013
|
#### Parameters
|
|
2071
2014
|
|
|
2072
|
-
* `url` **[string][
|
|
2015
|
+
* `url` **[string][7]** value to check.
|
|
2073
2016
|
|
|
2074
2017
|
Returns **void** automatically synchronized promise through #recorder
|
|
2075
2018
|
|
|
@@ -2087,12 +2030,12 @@ I.seeElement('#modal', '#container');
|
|
|
2087
2030
|
I.seeElement({role: 'dialog'});
|
|
2088
2031
|
```
|
|
2089
2032
|
|
|
2090
|
-
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][
|
|
2033
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][15].
|
|
2091
2034
|
|
|
2092
2035
|
#### Parameters
|
|
2093
2036
|
|
|
2094
|
-
* `locator` **([string][
|
|
2095
|
-
* `context` **([string][
|
|
2037
|
+
* `locator` **([string][7] | [object][8])** located by CSS|XPath|strict locator.
|
|
2038
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2096
2039
|
|
|
2097
2040
|
Returns **void** automatically synchronized promise through #recorder
|
|
2098
2041
|
|
|
@@ -2107,7 +2050,25 @@ I.seeElementInDOM('#modal');
|
|
|
2107
2050
|
|
|
2108
2051
|
#### Parameters
|
|
2109
2052
|
|
|
2110
|
-
* `locator` **([string][
|
|
2053
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2054
|
+
|
|
2055
|
+
Returns **void** automatically synchronized promise through #recorder
|
|
2056
|
+
|
|
2057
|
+
### seeInClipboard
|
|
2058
|
+
|
|
2059
|
+
Checks that the system clipboard contains the given text.
|
|
2060
|
+
|
|
2061
|
+
```js
|
|
2062
|
+
I.click('Copy to clipboard');
|
|
2063
|
+
I.seeInClipboard('https://codecept.io');
|
|
2064
|
+
```
|
|
2065
|
+
|
|
2066
|
+
Reading the clipboard requires a secure context (`https` or `localhost`) and is supported
|
|
2067
|
+
in Chromium-based browsers, where read access is granted automatically.
|
|
2068
|
+
|
|
2069
|
+
#### Parameters
|
|
2070
|
+
|
|
2071
|
+
* `text` **[string][7]** value to check.
|
|
2111
2072
|
|
|
2112
2073
|
Returns **void** automatically synchronized promise through #recorder
|
|
2113
2074
|
|
|
@@ -2121,7 +2082,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
2121
2082
|
|
|
2122
2083
|
#### Parameters
|
|
2123
2084
|
|
|
2124
|
-
* `url` **[string][
|
|
2085
|
+
* `url` **[string][7]** a fragment to check
|
|
2125
2086
|
|
|
2126
2087
|
Returns **void** automatically synchronized promise through #recorder
|
|
2127
2088
|
|
|
@@ -2143,9 +2104,9 @@ I.seeInField('Name', 'John', '.form-container');
|
|
|
2143
2104
|
|
|
2144
2105
|
#### Parameters
|
|
2145
2106
|
|
|
2146
|
-
* `field` **([string][
|
|
2147
|
-
* `value` **([string][
|
|
2148
|
-
* `context` **([string][
|
|
2107
|
+
* `field` **([string][7] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
2108
|
+
* `value` **([string][7] | [object][8])** value to check.
|
|
2109
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2149
2110
|
|
|
2150
2111
|
Returns **void** automatically synchronized promise through #recorder
|
|
2151
2112
|
|
|
@@ -2160,7 +2121,7 @@ I.seeInPopup('Popup text');
|
|
|
2160
2121
|
|
|
2161
2122
|
#### Parameters
|
|
2162
2123
|
|
|
2163
|
-
* `text` **[string][
|
|
2124
|
+
* `text` **[string][7]** value to check.
|
|
2164
2125
|
|
|
2165
2126
|
Returns **void** automatically synchronized promise through #recorder
|
|
2166
2127
|
|
|
@@ -2174,7 +2135,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
2174
2135
|
|
|
2175
2136
|
#### Parameters
|
|
2176
2137
|
|
|
2177
|
-
* `text` **[string][
|
|
2138
|
+
* `text` **[string][7]** value to check.
|
|
2178
2139
|
|
|
2179
2140
|
Returns **void** automatically synchronized promise through #recorder
|
|
2180
2141
|
|
|
@@ -2188,7 +2149,7 @@ I.seeInTitle('Home Page');
|
|
|
2188
2149
|
|
|
2189
2150
|
#### Parameters
|
|
2190
2151
|
|
|
2191
|
-
* `text` **[string][
|
|
2152
|
+
* `text` **[string][7]** text value to check.
|
|
2192
2153
|
|
|
2193
2154
|
Returns **void** automatically synchronized promise through #recorder
|
|
2194
2155
|
|
|
@@ -2203,8 +2164,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
2203
2164
|
|
|
2204
2165
|
#### Parameters
|
|
2205
2166
|
|
|
2206
|
-
* `locator` **([string][
|
|
2207
|
-
* `num` **[number][
|
|
2167
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2168
|
+
* `num` **[number][17]** number of elements.
|
|
2208
2169
|
|
|
2209
2170
|
Returns **void** automatically synchronized promise through #recorder
|
|
2210
2171
|
|
|
@@ -2219,8 +2180,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
2219
2180
|
|
|
2220
2181
|
#### Parameters
|
|
2221
2182
|
|
|
2222
|
-
* `locator` **([string][
|
|
2223
|
-
* `num` **[number][
|
|
2183
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2184
|
+
* `num` **[number][17]** number of elements.
|
|
2224
2185
|
|
|
2225
2186
|
Returns **void** automatically synchronized promise through #recorder
|
|
2226
2187
|
|
|
@@ -2234,8 +2195,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
2234
2195
|
|
|
2235
2196
|
#### Parameters
|
|
2236
2197
|
|
|
2237
|
-
* `text` **[string][
|
|
2238
|
-
* `context` **([string][
|
|
2198
|
+
* `text` **[string][7]** element value to check.
|
|
2199
|
+
* `context` **([string][7] | [object][8])?** element located by CSS|XPath|strict locator.
|
|
2239
2200
|
|
|
2240
2201
|
Returns **void** automatically synchronized promise through #recorder
|
|
2241
2202
|
|
|
@@ -2249,7 +2210,7 @@ I.seeTitleEquals('Test title.');
|
|
|
2249
2210
|
|
|
2250
2211
|
#### Parameters
|
|
2251
2212
|
|
|
2252
|
-
* `text` **[string][
|
|
2213
|
+
* `text` **[string][7]** value to check.
|
|
2253
2214
|
|
|
2254
2215
|
Returns **void** automatically synchronized promise through #recorder
|
|
2255
2216
|
|
|
@@ -2286,13 +2247,13 @@ await I.seeTraffic({
|
|
|
2286
2247
|
|
|
2287
2248
|
#### Parameters
|
|
2288
2249
|
|
|
2289
|
-
* `opts` **[Object][
|
|
2250
|
+
* `opts` **[Object][8]** options when checking the traffic network.
|
|
2290
2251
|
|
|
2291
|
-
* `opts.name` **[string][
|
|
2292
|
-
* `opts.url` **[string][
|
|
2293
|
-
* `opts.parameters` **[Object][
|
|
2294
|
-
* `opts.requestPostData` **[Object][
|
|
2295
|
-
* `opts.timeout` **[number][
|
|
2252
|
+
* `opts.name` **[string][7]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
2253
|
+
* `opts.url` **[string][7]** Expected URL of request in network traffic
|
|
2254
|
+
* `opts.parameters` **[Object][8]?** Expected parameters of that request in network traffic
|
|
2255
|
+
* `opts.requestPostData` **[Object][8]?** Expected that request contains post data in network traffic
|
|
2256
|
+
* `opts.timeout` **[number][17]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
2296
2257
|
|
|
2297
2258
|
Returns **void** automatically synchronized promise through #recorder
|
|
2298
2259
|
|
|
@@ -2323,9 +2284,9 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
2323
2284
|
|
|
2324
2285
|
#### Parameters
|
|
2325
2286
|
|
|
2326
|
-
* `select` **([string][
|
|
2327
|
-
* `option` **([string][
|
|
2328
|
-
* `context` **([string][
|
|
2287
|
+
* `select` **([string][7] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
2288
|
+
* `option` **([string][7] | [Array][9]<any>)** visible text or value of option.
|
|
2289
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2329
2290
|
|
|
2330
2291
|
Returns **void** automatically synchronized promise through #recorder
|
|
2331
2292
|
|
|
@@ -2347,7 +2308,7 @@ I.setCookie([
|
|
|
2347
2308
|
|
|
2348
2309
|
#### Parameters
|
|
2349
2310
|
|
|
2350
|
-
* `cookie` **(Cookie | [Array][
|
|
2311
|
+
* `cookie` **(Cookie | [Array][9]<Cookie>)** a cookie object or array of cookie objects.
|
|
2351
2312
|
|
|
2352
2313
|
Returns **void** automatically synchronized promise through #recorder
|
|
2353
2314
|
|
|
@@ -2363,7 +2324,7 @@ I.setPlaywrightRequestHeaders({
|
|
|
2363
2324
|
|
|
2364
2325
|
#### Parameters
|
|
2365
2326
|
|
|
2366
|
-
* `customHeaders` **[object][
|
|
2327
|
+
* `customHeaders` **[object][8]** headers to set
|
|
2367
2328
|
|
|
2368
2329
|
### startRecordingTraffic
|
|
2369
2330
|
|
|
@@ -2400,8 +2361,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
2400
2361
|
|
|
2401
2362
|
#### Parameters
|
|
2402
2363
|
|
|
2403
|
-
* `url` **([string][
|
|
2404
|
-
* `handler` **[function][
|
|
2364
|
+
* `url` **([string][7] | [RegExp][10])?** URL, regex or pattern for to match URL
|
|
2365
|
+
* `handler` **[function][20]?** a function to process request
|
|
2405
2366
|
|
|
2406
2367
|
### stopRecordingTraffic
|
|
2407
2368
|
|
|
@@ -2432,7 +2393,7 @@ I.switchTo(); // switch back to main page
|
|
|
2432
2393
|
|
|
2433
2394
|
#### Parameters
|
|
2434
2395
|
|
|
2435
|
-
* `locator` **([string][
|
|
2396
|
+
* `locator` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
2436
2397
|
|
|
2437
2398
|
Returns **void** automatically synchronized promise through #recorder
|
|
2438
2399
|
|
|
@@ -2447,7 +2408,7 @@ I.switchToNextTab(2);
|
|
|
2447
2408
|
|
|
2448
2409
|
#### Parameters
|
|
2449
2410
|
|
|
2450
|
-
* `num` **[number][
|
|
2411
|
+
* `num` **[number][17]**
|
|
2451
2412
|
|
|
2452
2413
|
### switchToPreviousTab
|
|
2453
2414
|
|
|
@@ -2460,13 +2421,13 @@ I.switchToPreviousTab(2);
|
|
|
2460
2421
|
|
|
2461
2422
|
#### Parameters
|
|
2462
2423
|
|
|
2463
|
-
* `num` **[number][
|
|
2424
|
+
* `num` **[number][17]**
|
|
2464
2425
|
|
|
2465
2426
|
### type
|
|
2466
2427
|
|
|
2467
2428
|
Types out the given text into an active field.
|
|
2468
2429
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
2469
|
-
*Note:* Should be used when [`fillField`][
|
|
2430
|
+
*Note:* Should be used when [`fillField`][34] is not an option.
|
|
2470
2431
|
|
|
2471
2432
|
```js
|
|
2472
2433
|
// passing in a string
|
|
@@ -2485,14 +2446,14 @@ I.type(secret('123456'));
|
|
|
2485
2446
|
#### Parameters
|
|
2486
2447
|
|
|
2487
2448
|
* `keys`  
|
|
2488
|
-
* `delay` **[number][
|
|
2489
|
-
* `key` **([string][
|
|
2449
|
+
* `delay` **[number][17]?** (optional) delay in ms between key presses
|
|
2450
|
+
* `key` **([string][7] | [Array][9]<[string][7]>)** or array of keys to type.
|
|
2490
2451
|
|
|
2491
2452
|
Returns **void** automatically synchronized promise through #recorder
|
|
2492
2453
|
|
|
2493
2454
|
### uncheckOption
|
|
2494
2455
|
|
|
2495
|
-
[Additional options][
|
|
2456
|
+
[Additional options][37] for uncheck available as 3rd argument.
|
|
2496
2457
|
|
|
2497
2458
|
Examples:
|
|
2498
2459
|
|
|
@@ -2516,8 +2477,8 @@ I.uncheckOption('agree', '//form');
|
|
|
2516
2477
|
|
|
2517
2478
|
#### Parameters
|
|
2518
2479
|
|
|
2519
|
-
* `field` **([string][
|
|
2520
|
-
* `context` **([string][
|
|
2480
|
+
* `field` **([string][7] | [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
2481
|
+
* `context` **([string][7]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2521
2482
|
* `options`
|
|
2522
2483
|
|
|
2523
2484
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2529,7 +2490,7 @@ Use Playwright API inside a test.
|
|
|
2529
2490
|
First argument is a description of an action.
|
|
2530
2491
|
Second argument is async function that gets this helper as parameter.
|
|
2531
2492
|
|
|
2532
|
-
{ [`page`][
|
|
2493
|
+
{ [`page`][38], [`browserContext`][39] [`browser`][40] } objects from Playwright API are available.
|
|
2533
2494
|
|
|
2534
2495
|
```js
|
|
2535
2496
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -2539,8 +2500,8 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
2539
2500
|
|
|
2540
2501
|
#### Parameters
|
|
2541
2502
|
|
|
2542
|
-
* `description` **[string][
|
|
2543
|
-
* `fn` **[function][
|
|
2503
|
+
* `description` **[string][7]** used to show in logs.
|
|
2504
|
+
* `fn` **[function][20]** async function that executed with Playwright helper as arguments
|
|
2544
2505
|
|
|
2545
2506
|
### wait
|
|
2546
2507
|
|
|
@@ -2552,7 +2513,7 @@ I.wait(2); // wait 2 secs
|
|
|
2552
2513
|
|
|
2553
2514
|
#### Parameters
|
|
2554
2515
|
|
|
2555
|
-
* `sec` **[number][
|
|
2516
|
+
* `sec` **[number][17]** number of second to wait.
|
|
2556
2517
|
|
|
2557
2518
|
Returns **void** automatically synchronized promise through #recorder
|
|
2558
2519
|
|
|
@@ -2577,9 +2538,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2577
2538
|
|
|
2578
2539
|
#### Parameters
|
|
2579
2540
|
|
|
2580
|
-
* `locator` **([string][
|
|
2541
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2581
2542
|
* `waitTimeout`  
|
|
2582
|
-
* `sec` **[number][
|
|
2543
|
+
* `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
2583
2544
|
|
|
2584
2545
|
Returns **void** automatically synchronized promise through #recorder
|
|
2585
2546
|
|
|
@@ -2593,8 +2554,8 @@ I.waitForCookie("token");
|
|
|
2593
2554
|
|
|
2594
2555
|
#### Parameters
|
|
2595
2556
|
|
|
2596
|
-
* `name` **[string][
|
|
2597
|
-
* `sec` **[number][
|
|
2557
|
+
* `name` **[string][7]** expected cookie name.
|
|
2558
|
+
* `sec` **[number][17]** (optional, `3` by default) time in seconds to wait
|
|
2598
2559
|
|
|
2599
2560
|
Returns **void** automatically synchronized promise through #recorder
|
|
2600
2561
|
|
|
@@ -2609,8 +2570,8 @@ I.waitForDetached('#popup');
|
|
|
2609
2570
|
|
|
2610
2571
|
#### Parameters
|
|
2611
2572
|
|
|
2612
|
-
* `locator` **([string][
|
|
2613
|
-
* `sec` **[number][
|
|
2573
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2574
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2614
2575
|
|
|
2615
2576
|
Returns **void** automatically synchronized promise through #recorder
|
|
2616
2577
|
|
|
@@ -2621,8 +2582,8 @@ Element can be located by CSS or XPath.
|
|
|
2621
2582
|
|
|
2622
2583
|
#### Parameters
|
|
2623
2584
|
|
|
2624
|
-
* `locator` **([string][
|
|
2625
|
-
* `sec` **[number][
|
|
2585
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2586
|
+
* `sec` **[number][17]** (optional) time in seconds to wait, 1 by default.
|
|
2626
2587
|
|
|
2627
2588
|
Returns **void** automatically synchronized promise through #recorder
|
|
2628
2589
|
|
|
@@ -2638,8 +2599,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2638
2599
|
|
|
2639
2600
|
#### Parameters
|
|
2640
2601
|
|
|
2641
|
-
* `locator` **([string][
|
|
2642
|
-
* `sec` **[number][
|
|
2602
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2603
|
+
* `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
2643
2604
|
|
|
2644
2605
|
Returns **void** automatically synchronized promise through #recorder
|
|
2645
2606
|
|
|
@@ -2650,8 +2611,8 @@ Element can be located by CSS or XPath.
|
|
|
2650
2611
|
|
|
2651
2612
|
#### Parameters
|
|
2652
2613
|
|
|
2653
|
-
* `locator` **([string][
|
|
2654
|
-
* `sec` **[number][
|
|
2614
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2615
|
+
* `sec` **[number][17]** (optional) time in seconds to wait, 1 by default.
|
|
2655
2616
|
|
|
2656
2617
|
Returns **void** automatically synchronized promise through #recorder
|
|
2657
2618
|
|
|
@@ -2672,9 +2633,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2672
2633
|
|
|
2673
2634
|
#### Parameters
|
|
2674
2635
|
|
|
2675
|
-
* `fn` **([string][
|
|
2676
|
-
* `argsOrSec` **([Array][
|
|
2677
|
-
* `sec` **[number][
|
|
2636
|
+
* `fn` **([string][7] | [function][20])** to be executed in browser context.
|
|
2637
|
+
* `argsOrSec` **([Array][9]<any> | [number][17])?** (optional, `1` by default) arguments for function or seconds.
|
|
2638
|
+
* `sec` **[number][17]?** (optional, `1` by default) time in seconds to wait
|
|
2678
2639
|
|
|
2679
2640
|
Returns **void** automatically synchronized promise through #recorder
|
|
2680
2641
|
|
|
@@ -2689,8 +2650,8 @@ I.waitForInvisible('#popup');
|
|
|
2689
2650
|
|
|
2690
2651
|
#### Parameters
|
|
2691
2652
|
|
|
2692
|
-
* `locator` **([string][
|
|
2693
|
-
* `sec` **[number][
|
|
2653
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2654
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2694
2655
|
|
|
2695
2656
|
Returns **void** automatically synchronized promise through #recorder
|
|
2696
2657
|
|
|
@@ -2698,7 +2659,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2698
2659
|
|
|
2699
2660
|
Waits for navigation to finish. By default, it takes configured `waitForNavigation` option.
|
|
2700
2661
|
|
|
2701
|
-
See [Playwright's reference][
|
|
2662
|
+
See [Playwright's reference][41]
|
|
2702
2663
|
|
|
2703
2664
|
#### Parameters
|
|
2704
2665
|
|
|
@@ -2714,8 +2675,8 @@ I.waitForNumberOfTabs(2);
|
|
|
2714
2675
|
|
|
2715
2676
|
#### Parameters
|
|
2716
2677
|
|
|
2717
|
-
* `expectedTabs` **[number][
|
|
2718
|
-
* `sec` **[number][
|
|
2678
|
+
* `expectedTabs` **[number][17]** expecting the number of tabs.
|
|
2679
|
+
* `sec` **[number][17]** number of secs to wait.
|
|
2719
2680
|
|
|
2720
2681
|
Returns **void** automatically synchronized promise through #recorder
|
|
2721
2682
|
|
|
@@ -2730,8 +2691,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2730
2691
|
|
|
2731
2692
|
#### Parameters
|
|
2732
2693
|
|
|
2733
|
-
* `urlOrPredicate` **([string][
|
|
2734
|
-
* `sec` **[number][
|
|
2694
|
+
* `urlOrPredicate` **([string][7] | [function][20])** 
|
|
2695
|
+
* `sec` **[number][17]?** seconds to wait
|
|
2735
2696
|
|
|
2736
2697
|
### waitForResponse
|
|
2737
2698
|
|
|
@@ -2744,8 +2705,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
2744
2705
|
|
|
2745
2706
|
#### Parameters
|
|
2746
2707
|
|
|
2747
|
-
* `urlOrPredicate` **([string][
|
|
2748
|
-
* `sec` **[number][
|
|
2708
|
+
* `urlOrPredicate` **([string][7] | [function][20])** 
|
|
2709
|
+
* `sec` **[number][17]?** number of seconds to wait
|
|
2749
2710
|
|
|
2750
2711
|
### waitForText
|
|
2751
2712
|
|
|
@@ -2760,9 +2721,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2760
2721
|
|
|
2761
2722
|
#### Parameters
|
|
2762
2723
|
|
|
2763
|
-
* `text` **[string][
|
|
2764
|
-
* `sec` **[number][
|
|
2765
|
-
* `context` **([string][
|
|
2724
|
+
* `text` **[string][7]** to wait for.
|
|
2725
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2726
|
+
* `context` **([string][7] | [object][8])?** (optional) element located by CSS|XPath|strict locator.
|
|
2766
2727
|
|
|
2767
2728
|
Returns **void** automatically synchronized promise through #recorder
|
|
2768
2729
|
|
|
@@ -2770,11 +2731,11 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2770
2731
|
|
|
2771
2732
|
Waits for page navigates to a new URL or reloads. By default, it takes configured `waitForNavigation` option.
|
|
2772
2733
|
|
|
2773
|
-
See [Playwright's reference][
|
|
2734
|
+
See [Playwright's reference][42]
|
|
2774
2735
|
|
|
2775
2736
|
#### Parameters
|
|
2776
2737
|
|
|
2777
|
-
* `url` **([string][
|
|
2738
|
+
* `url` **([string][7] | [RegExp][10])** A glob pattern, regex pattern or predicate receiving URL to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
|
|
2778
2739
|
* `options` **any**
|
|
2779
2740
|
|
|
2780
2741
|
### waitForValue
|
|
@@ -2787,9 +2748,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2787
2748
|
|
|
2788
2749
|
#### Parameters
|
|
2789
2750
|
|
|
2790
|
-
* `field` **([string][
|
|
2791
|
-
* `value` **[string][
|
|
2792
|
-
* `sec` **[number][
|
|
2751
|
+
* `field` **([string][7] | [object][8])** input field.
|
|
2752
|
+
* `value` **[string][7]** expected value.
|
|
2753
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2793
2754
|
|
|
2794
2755
|
Returns **void** automatically synchronized promise through #recorder
|
|
2795
2756
|
|
|
@@ -2804,8 +2765,8 @@ I.waitForVisible('#popup');
|
|
|
2804
2765
|
|
|
2805
2766
|
#### Parameters
|
|
2806
2767
|
|
|
2807
|
-
* `locator` **([string][
|
|
2808
|
-
* `sec` **[number][
|
|
2768
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2769
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2809
2770
|
|
|
2810
2771
|
Returns **void** automatically synchronized promise through #recorder
|
|
2811
2772
|
|
|
@@ -2819,8 +2780,8 @@ I.waitInUrl('/info', 2);
|
|
|
2819
2780
|
|
|
2820
2781
|
#### Parameters
|
|
2821
2782
|
|
|
2822
|
-
* `urlPart` **[string][
|
|
2823
|
-
* `sec` **[number][
|
|
2783
|
+
* `urlPart` **[string][7]** value to check.
|
|
2784
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2824
2785
|
|
|
2825
2786
|
Returns **void** automatically synchronized promise through #recorder
|
|
2826
2787
|
|
|
@@ -2834,9 +2795,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2834
2795
|
|
|
2835
2796
|
#### Parameters
|
|
2836
2797
|
|
|
2837
|
-
* `locator` **([string][
|
|
2838
|
-
* `num` **[number][
|
|
2839
|
-
* `sec` **[number][
|
|
2798
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2799
|
+
* `num` **[number][17]** number of elements.
|
|
2800
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2840
2801
|
|
|
2841
2802
|
Returns **void** automatically synchronized promise through #recorder
|
|
2842
2803
|
|
|
@@ -2851,8 +2812,8 @@ I.waitToHide('#popup');
|
|
|
2851
2812
|
|
|
2852
2813
|
#### Parameters
|
|
2853
2814
|
|
|
2854
|
-
* `locator` **([string][
|
|
2855
|
-
* `sec` **[number][
|
|
2815
|
+
* `locator` **([string][7] | [object][8])** element located by CSS|XPath|strict locator.
|
|
2816
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2856
2817
|
|
|
2857
2818
|
Returns **void** automatically synchronized promise through #recorder
|
|
2858
2819
|
|
|
@@ -2867,11 +2828,112 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2867
2828
|
|
|
2868
2829
|
#### Parameters
|
|
2869
2830
|
|
|
2870
|
-
* `urlPart` **[string][
|
|
2871
|
-
* `sec` **[number][
|
|
2831
|
+
* `urlPart` **[string][7]** value to check.
|
|
2832
|
+
* `sec` **[number][17]** (optional, `1` by default) time in seconds to wait
|
|
2872
2833
|
|
|
2873
2834
|
Returns **void** automatically synchronized promise through #recorder
|
|
2874
2835
|
|
|
2836
|
+
### _addPopupListener
|
|
2837
|
+
|
|
2838
|
+
Add the 'dialog' event listener to a page
|
|
2839
|
+
|
|
2840
|
+
#### Parameters
|
|
2841
|
+
|
|
2842
|
+
* `page`  
|
|
2843
|
+
|
|
2844
|
+
### _contextLocator
|
|
2845
|
+
|
|
2846
|
+
Grab Locator if called within Context
|
|
2847
|
+
|
|
2848
|
+
#### Parameters
|
|
2849
|
+
|
|
2850
|
+
* `locator` **any** 
|
|
2851
|
+
|
|
2852
|
+
### _createContextPage
|
|
2853
|
+
|
|
2854
|
+
Create a new browser context with a page.
|
|
2855
|
+
Usually it should be run from a custom helper after call of `_startBrowser()`
|
|
2856
|
+
|
|
2857
|
+
#### Parameters
|
|
2858
|
+
|
|
2859
|
+
* `contextOptions` **[object][8]?** See [https://playwright.dev/docs/api/class-browser#browser-new-context][43]
|
|
2860
|
+
|
|
2861
|
+
### _getPageUrl
|
|
2862
|
+
|
|
2863
|
+
Gets page URL including hash.
|
|
2864
|
+
|
|
2865
|
+
### _locate
|
|
2866
|
+
|
|
2867
|
+
Get elements by different locator types, including strict locator
|
|
2868
|
+
Should be used in custom helpers:
|
|
2869
|
+
|
|
2870
|
+
```js
|
|
2871
|
+
const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
2872
|
+
```
|
|
2873
|
+
|
|
2874
|
+
#### Parameters
|
|
2875
|
+
|
|
2876
|
+
* `locator`  
|
|
2877
|
+
|
|
2878
|
+
### _locateCheckable
|
|
2879
|
+
|
|
2880
|
+
Find a checkbox by providing human-readable text:
|
|
2881
|
+
NOTE: Assumes the checkable element exists
|
|
2882
|
+
|
|
2883
|
+
```js
|
|
2884
|
+
this.helpers['Playwright']._locateCheckable('I agree with terms and conditions').then // ...
|
|
2885
|
+
```
|
|
2886
|
+
|
|
2887
|
+
#### Parameters
|
|
2888
|
+
|
|
2889
|
+
* `locator`  
|
|
2890
|
+
* `providedContext`
|
|
2891
|
+
|
|
2892
|
+
### _locateClickable
|
|
2893
|
+
|
|
2894
|
+
Find a clickable element by providing human-readable text:
|
|
2895
|
+
|
|
2896
|
+
```js
|
|
2897
|
+
this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
2898
|
+
```
|
|
2899
|
+
|
|
2900
|
+
#### Parameters
|
|
2901
|
+
|
|
2902
|
+
* `locator`  
|
|
2903
|
+
|
|
2904
|
+
### _locateElement
|
|
2905
|
+
|
|
2906
|
+
Get the first element by different locator types, including strict locator
|
|
2907
|
+
Should be used in custom helpers:
|
|
2908
|
+
|
|
2909
|
+
```js
|
|
2910
|
+
const element = await this.helpers['Playwright']._locateElement({name: 'password'});
|
|
2911
|
+
```
|
|
2912
|
+
|
|
2913
|
+
#### Parameters
|
|
2914
|
+
|
|
2915
|
+
* `locator`  
|
|
2916
|
+
|
|
2917
|
+
### _locateFields
|
|
2918
|
+
|
|
2919
|
+
Find field elements by providing human-readable text:
|
|
2920
|
+
|
|
2921
|
+
```js
|
|
2922
|
+
this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
2923
|
+
```
|
|
2924
|
+
|
|
2925
|
+
#### Parameters
|
|
2926
|
+
|
|
2927
|
+
* `locator`  
|
|
2928
|
+
|
|
2929
|
+
### _setPage
|
|
2930
|
+
|
|
2931
|
+
Set current page
|
|
2932
|
+
|
|
2933
|
+
#### Parameters
|
|
2934
|
+
|
|
2935
|
+
* `page` **[object][8]** page to set
|
|
2936
|
+
|
|
2875
2937
|
[1]: https://github.com/microsoft/playwright
|
|
2876
2938
|
|
|
2877
2939
|
[2]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
@@ -2882,81 +2944,81 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2882
2944
|
|
|
2883
2945
|
[5]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
2884
2946
|
|
|
2885
|
-
[6]:
|
|
2947
|
+
[6]: http://jster.net/category/windows-modals-popups
|
|
2886
2948
|
|
|
2887
|
-
[7]: https://
|
|
2949
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
2888
2950
|
|
|
2889
|
-
[8]:
|
|
2951
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
2890
2952
|
|
|
2891
|
-
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2953
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2892
2954
|
|
|
2893
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2955
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2894
2956
|
|
|
2895
|
-
[11]: https://
|
|
2957
|
+
[11]: https://www.example.com
|
|
2896
2958
|
|
|
2897
|
-
[12]: https://
|
|
2959
|
+
[12]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2898
2960
|
|
|
2899
|
-
[13]: https://
|
|
2961
|
+
[13]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2900
2962
|
|
|
2901
|
-
[14]: https://playwright.dev/docs/api/class-
|
|
2963
|
+
[14]: https://playwright.dev/docs/api/class-elementhandle#element-handle-check
|
|
2902
2964
|
|
|
2903
|
-
[15]:
|
|
2965
|
+
[15]: /locators#aria-locators
|
|
2904
2966
|
|
|
2905
|
-
[16]: /
|
|
2967
|
+
[16]: https://playwright.dev/docs/api/class-page#page-click
|
|
2906
2968
|
|
|
2907
|
-
[17]: https://
|
|
2969
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2908
2970
|
|
|
2909
|
-
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
2971
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2910
2972
|
|
|
2911
|
-
[19]: https://
|
|
2973
|
+
[19]: https://playwright.dev/docs/api/class-page#page-drag-and-drop
|
|
2912
2974
|
|
|
2913
|
-
[20]: https://
|
|
2975
|
+
[20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2914
2976
|
|
|
2915
|
-
[21]: https://
|
|
2977
|
+
[21]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2916
2978
|
|
|
2917
|
-
[22]: https://playwright.dev/docs/api/class-locator#locator-
|
|
2979
|
+
[22]: https://playwright.dev/docs/api/class-locator#locator-aria-snapshot
|
|
2918
2980
|
|
|
2919
|
-
[23]: https://playwright.dev/docs/
|
|
2981
|
+
[23]: https://playwright.dev/docs/aria-snapshots
|
|
2920
2982
|
|
|
2921
|
-
[24]: https://playwright.dev/docs/
|
|
2983
|
+
[24]: https://playwright.dev/docs/api/class-consolemessage
|
|
2922
2984
|
|
|
2923
|
-
[25]: https://playwright.dev/docs/api/class-
|
|
2985
|
+
[25]: https://playwright.dev/docs/api/class-locator#locator-is-checked
|
|
2924
2986
|
|
|
2925
|
-
[26]: https://
|
|
2987
|
+
[26]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2926
2988
|
|
|
2927
|
-
[27]: https://
|
|
2989
|
+
[27]: https://playwright.dev/docs/api/class-locator#locator-is-disabled
|
|
2928
2990
|
|
|
2929
|
-
[28]: https://
|
|
2991
|
+
[28]: https://codecept.io/helpers/FileSystem
|
|
2930
2992
|
|
|
2931
|
-
[29]: https://
|
|
2993
|
+
[29]: https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-get
|
|
2932
2994
|
|
|
2933
|
-
[30]: https://playwright.dev/docs/api/class-
|
|
2995
|
+
[30]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
2934
2996
|
|
|
2935
|
-
[31]: https://playwright.dev/docs/
|
|
2997
|
+
[31]: https://playwright.dev/docs/network#handle-requests
|
|
2936
2998
|
|
|
2937
|
-
[32]: https://
|
|
2999
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2938
3000
|
|
|
2939
|
-
[33]: https://github.com/
|
|
3001
|
+
[33]: https://github.com/puppeteer/puppeteer/issues/1313
|
|
2940
3002
|
|
|
2941
|
-
[34]:
|
|
3003
|
+
[34]: #fillfield
|
|
2942
3004
|
|
|
2943
|
-
[35]: #
|
|
3005
|
+
[35]: #click
|
|
2944
3006
|
|
|
2945
|
-
[36]: #
|
|
3007
|
+
[36]: https://playwright.dev/docs/api/class-page#page-route-from-har
|
|
2946
3008
|
|
|
2947
|
-
[37]: https://playwright.dev/docs/api/class-
|
|
3009
|
+
[37]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2948
3010
|
|
|
2949
|
-
[38]: https://
|
|
3011
|
+
[38]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2950
3012
|
|
|
2951
|
-
[39]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-
|
|
3013
|
+
[39]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2952
3014
|
|
|
2953
|
-
[40]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-
|
|
3015
|
+
[40]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2954
3016
|
|
|
2955
|
-
[41]: https://
|
|
3017
|
+
[41]: https://playwright.dev/docs/api/class-page#page-wait-for-navigation
|
|
2956
3018
|
|
|
2957
|
-
[42]: https://playwright.dev/docs/api/class-page#page-wait-for-
|
|
3019
|
+
[42]: https://playwright.dev/docs/api/class-page#page-wait-for-url
|
|
2958
3020
|
|
|
2959
|
-
[43]: https://playwright.dev/docs/api/class-
|
|
3021
|
+
[43]: https://playwright.dev/docs/api/class-browser#browser-new-context
|
|
2960
3022
|
|
|
2961
3023
|
[44]: https://playwright.dev/docs/api/class-browsercontext
|
|
2962
3024
|
|