codeceptjs 3.3.0 → 3.3.3
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 +50 -1
- package/README.md +6 -1
- package/docs/api.md +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +21 -16
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +54 -25
- package/docs/build/Playwright.js +105 -52
- package/docs/build/Protractor.js +72 -34
- package/docs/build/Puppeteer.js +80 -37
- package/docs/build/REST.js +5 -2
- package/docs/build/TestCafe.js +54 -23
- package/docs/build/WebDriver.js +115 -67
- package/docs/changelog.md +50 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +217 -175
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/Nightmare.md +98 -45
- package/docs/helpers/Playwright.md +151 -59
- package/docs/helpers/Puppeteer.md +103 -26
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +77 -22
- package/docs/helpers/WebDriver.md +150 -62
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/cli.js +1 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run-workers.js +1 -1
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +55 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +2 -7
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +28 -17
- package/lib/helper/REST.js +5 -2
- package/lib/helper/WebDriver.js +4 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/output.js +4 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +3 -3
- package/typings/types.d.ts +534 -112
|
@@ -56,6 +56,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
56
56
|
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
57
57
|
- `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
58
58
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
59
|
+
- `colorScheme`: (optional) default color scheme. Possible values: `dark` | `light` | `no-preference`.
|
|
59
60
|
- `userAgent`: (optional) user-agent string.
|
|
60
61
|
- `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
61
62
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
@@ -174,7 +175,7 @@ const { devices } = require('playwright');
|
|
|
174
175
|
}
|
|
175
176
|
```
|
|
176
177
|
|
|
177
|
-
#### Example #7: Launch test with a
|
|
178
|
+
#### Example #7: Launch test with a specific user locale
|
|
178
179
|
|
|
179
180
|
```js
|
|
180
181
|
{
|
|
@@ -187,6 +188,19 @@ const { devices } = require('playwright');
|
|
|
187
188
|
}
|
|
188
189
|
```
|
|
189
190
|
|
|
191
|
+
- #### Example #8: Launch test with a specific color scheme
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
{
|
|
195
|
+
helpers: {
|
|
196
|
+
Playwright : {
|
|
197
|
+
url: "http://localhost",
|
|
198
|
+
colorScheme: "dark",
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
190
204
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
191
205
|
|
|
192
206
|
## Access From Helpers
|
|
@@ -333,6 +347,8 @@ I.amOnPage('/login'); // opens a login page
|
|
|
333
347
|
|
|
334
348
|
- `url` **[string][12]** url path or global url.
|
|
335
349
|
|
|
350
|
+
Returns **void** automatically synchronized promise with recorder #!
|
|
351
|
+
|
|
336
352
|
### appendField
|
|
337
353
|
|
|
338
354
|
Appends text to a input field or textarea.
|
|
@@ -346,6 +362,7 @@ I.appendField('#myTextField', 'appended');
|
|
|
346
362
|
|
|
347
363
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator
|
|
348
364
|
- `value` **[string][12]** text value to append.
|
|
365
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
349
366
|
|
|
350
367
|
### attachFile
|
|
351
368
|
|
|
@@ -362,6 +379,7 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
362
379
|
|
|
363
380
|
- `locator` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
364
381
|
- `pathToFile` **[string][12]** local file path relative to codecept.json config file.
|
|
382
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
365
383
|
|
|
366
384
|
### cancelPopup
|
|
367
385
|
|
|
@@ -383,7 +401,8 @@ I.checkOption('agree', '//form');
|
|
|
383
401
|
#### Parameters
|
|
384
402
|
|
|
385
403
|
- `field` **([string][12] | [object][10])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
386
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
404
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
405
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][13] for check available as 3rd argument.Examples:```js
|
|
387
406
|
// click on element at position
|
|
388
407
|
I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
389
408
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -401,7 +420,8 @@ I.clearCookie('test');
|
|
|
401
420
|
|
|
402
421
|
#### Parameters
|
|
403
422
|
|
|
404
|
-
- `cookie` **[string][12]?** (optional, `null` by default) cookie name
|
|
423
|
+
- `cookie` **[string][12]?** (optional, `null` by default) cookie name
|
|
424
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
405
425
|
|
|
406
426
|
### clearField
|
|
407
427
|
|
|
@@ -417,6 +437,7 @@ I.clearField('#email');
|
|
|
417
437
|
|
|
418
438
|
- `field`
|
|
419
439
|
- `editable` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
440
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
420
441
|
|
|
421
442
|
### click
|
|
422
443
|
|
|
@@ -445,14 +466,15 @@ I.click({css: 'nav a.login'});
|
|
|
445
466
|
#### Parameters
|
|
446
467
|
|
|
447
468
|
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
448
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
469
|
+
- `context` **([string][12]? | [object][10] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
470
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
471
|
+
- `opts` **any?** [Additional options][14] for click available as 3rd argument.Examples:```js
|
|
449
472
|
// click on element at position
|
|
450
473
|
I.click('canvas', '.model', { position: { x: 20, y: 40 } })
|
|
451
474
|
|
|
452
475
|
// make ctrl-click
|
|
453
476
|
I.click('.edit', null, { modifiers: ['Ctrl'] } )
|
|
454
477
|
```
|
|
455
|
-
- `opts`
|
|
456
478
|
|
|
457
479
|
### clickLink
|
|
458
480
|
|
|
@@ -492,7 +514,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
492
514
|
#### Parameters
|
|
493
515
|
|
|
494
516
|
- `text` **[string][12]** which is not present.
|
|
495
|
-
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
517
|
+
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
518
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
496
519
|
|
|
497
520
|
### dontSeeCheckboxIsChecked
|
|
498
521
|
|
|
@@ -507,6 +530,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
507
530
|
#### Parameters
|
|
508
531
|
|
|
509
532
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
533
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
510
534
|
|
|
511
535
|
### dontSeeCookie
|
|
512
536
|
|
|
@@ -519,6 +543,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
519
543
|
#### Parameters
|
|
520
544
|
|
|
521
545
|
- `name` **[string][12]** cookie name.
|
|
546
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
522
547
|
|
|
523
548
|
### dontSeeCurrentUrlEquals
|
|
524
549
|
|
|
@@ -533,6 +558,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
533
558
|
#### Parameters
|
|
534
559
|
|
|
535
560
|
- `url` **[string][12]** value to check.
|
|
561
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
536
562
|
|
|
537
563
|
### dontSeeElement
|
|
538
564
|
|
|
@@ -545,6 +571,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
545
571
|
#### Parameters
|
|
546
572
|
|
|
547
573
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|Strict locator.
|
|
574
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
548
575
|
|
|
549
576
|
### dontSeeElementInDOM
|
|
550
577
|
|
|
@@ -557,6 +584,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
557
584
|
#### Parameters
|
|
558
585
|
|
|
559
586
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|Strict locator.
|
|
587
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
560
588
|
|
|
561
589
|
### dontSeeInCurrentUrl
|
|
562
590
|
|
|
@@ -565,6 +593,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
565
593
|
#### Parameters
|
|
566
594
|
|
|
567
595
|
- `url` **[string][12]** value to check.
|
|
596
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
568
597
|
|
|
569
598
|
### dontSeeInField
|
|
570
599
|
|
|
@@ -580,6 +609,7 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
580
609
|
|
|
581
610
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
582
611
|
- `value` **[string][12]** value to check.
|
|
612
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
583
613
|
|
|
584
614
|
### dontSeeInSource
|
|
585
615
|
|
|
@@ -593,6 +623,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
593
623
|
|
|
594
624
|
- `text`
|
|
595
625
|
- `value` **[string][12]** to check.
|
|
626
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
596
627
|
|
|
597
628
|
### dontSeeInTitle
|
|
598
629
|
|
|
@@ -605,6 +636,7 @@ I.dontSeeInTitle('Error');
|
|
|
605
636
|
#### Parameters
|
|
606
637
|
|
|
607
638
|
- `text` **[string][12]** value to check.
|
|
639
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
608
640
|
|
|
609
641
|
### doubleClick
|
|
610
642
|
|
|
@@ -621,7 +653,8 @@ I.doubleClick('.btn.edit');
|
|
|
621
653
|
#### Parameters
|
|
622
654
|
|
|
623
655
|
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
624
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
656
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
657
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
625
658
|
|
|
626
659
|
### dragAndDrop
|
|
627
660
|
|
|
@@ -634,11 +667,12 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
634
667
|
#### Parameters
|
|
635
668
|
|
|
636
669
|
- `srcElement` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
637
|
-
- `destElement` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
670
|
+
- `destElement` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
671
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
672
|
+
- `options` **any?** [Additional options][15] can be passed as 3rd argument.```js
|
|
638
673
|
// specify coordinates for source position
|
|
639
674
|
I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
|
|
640
|
-
```> By default option `force: true` is set
|
|
641
|
-
- `options`
|
|
675
|
+
```> By default option `force: true` is set
|
|
642
676
|
|
|
643
677
|
### dragSlider
|
|
644
678
|
|
|
@@ -653,7 +687,8 @@ I.dragSlider('#slider', -70);
|
|
|
653
687
|
#### Parameters
|
|
654
688
|
|
|
655
689
|
- `locator` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
656
|
-
- `offsetX` **[number][16]** position to drag.
|
|
690
|
+
- `offsetX` **[number][16]** position to drag.
|
|
691
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
657
692
|
|
|
658
693
|
### executeScript
|
|
659
694
|
|
|
@@ -683,8 +718,6 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
683
718
|
- `fn` **([string][12] | [function][17])** function to be executed in browser context.
|
|
684
719
|
- `arg` **any?** optional argument to pass to the function
|
|
685
720
|
|
|
686
|
-
Returns **[Promise][18]<any>**
|
|
687
|
-
|
|
688
721
|
### fillField
|
|
689
722
|
|
|
690
723
|
Fills a text field or textarea, after clearing its value, with the given string.
|
|
@@ -705,6 +738,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
705
738
|
|
|
706
739
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
707
740
|
- `value` **([string][12] | [object][10])** text value to fill.
|
|
741
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
708
742
|
|
|
709
743
|
### forceClick
|
|
710
744
|
|
|
@@ -736,7 +770,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
736
770
|
#### Parameters
|
|
737
771
|
|
|
738
772
|
- `locator` **([string][12] | [object][10])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
739
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
773
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
774
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
740
775
|
|
|
741
776
|
### grabAttributeFrom
|
|
742
777
|
|
|
@@ -867,6 +902,8 @@ let data = await I.grabDataFromPerformanceTiming();
|
|
|
867
902
|
}
|
|
868
903
|
```
|
|
869
904
|
|
|
905
|
+
Returns **[Promise][18]<any>** automatically synchronized promise through #recorder
|
|
906
|
+
|
|
870
907
|
### grabElementBoundingRect
|
|
871
908
|
|
|
872
909
|
Grab the width, height, location of given locator.
|
|
@@ -1078,6 +1115,8 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1078
1115
|
|
|
1079
1116
|
- `fileName` **[string][12]?** set filename for downloaded file
|
|
1080
1117
|
|
|
1118
|
+
Returns **[Promise][18]<void>**
|
|
1119
|
+
|
|
1081
1120
|
### haveRequestHeaders
|
|
1082
1121
|
|
|
1083
1122
|
Set headers for all next requests
|
|
@@ -1125,8 +1164,8 @@ This method allows intercepting and mocking requests & responses. [Learn more ab
|
|
|
1125
1164
|
|
|
1126
1165
|
#### Parameters
|
|
1127
1166
|
|
|
1128
|
-
- `url` **[string][12]?** URL, regex or pattern for to match URL
|
|
1129
|
-
- `handler` **[function][17]?** a function to process
|
|
1167
|
+
- `url` **([string][12] | [RegExp][24])?** URL, regex or pattern for to match URL
|
|
1168
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1130
1169
|
|
|
1131
1170
|
### moveCursorTo
|
|
1132
1171
|
|
|
@@ -1142,7 +1181,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1142
1181
|
|
|
1143
1182
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1144
1183
|
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1145
|
-
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1184
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1185
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1146
1186
|
|
|
1147
1187
|
### openNewTab
|
|
1148
1188
|
|
|
@@ -1152,7 +1192,7 @@ Open new tab and automatically switched to new tab
|
|
|
1152
1192
|
I.openNewTab();
|
|
1153
1193
|
```
|
|
1154
1194
|
|
|
1155
|
-
You can pass in [page options][
|
|
1195
|
+
You can pass in [page options][25] to emulate device on this page
|
|
1156
1196
|
|
|
1157
1197
|
```js
|
|
1158
1198
|
// enable mobile
|
|
@@ -1167,7 +1207,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1167
1207
|
|
|
1168
1208
|
Presses a key in the browser (on a focused element).
|
|
1169
1209
|
|
|
1170
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1210
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][26].
|
|
1171
1211
|
|
|
1172
1212
|
```js
|
|
1173
1213
|
I.pressKey('Backspace');
|
|
@@ -1226,13 +1266,14 @@ Some of the supported key names are:
|
|
|
1226
1266
|
|
|
1227
1267
|
#### Parameters
|
|
1228
1268
|
|
|
1229
|
-
- `key` **([string][12] | [Array][19]<[string][12]>)** key or array of keys to press.
|
|
1269
|
+
- `key` **([string][12] | [Array][19]<[string][12]>)** key or array of keys to press.
|
|
1270
|
+
[!] returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][27]).
|
|
1230
1271
|
|
|
1231
1272
|
### pressKeyDown
|
|
1232
1273
|
|
|
1233
1274
|
Presses a key in the browser and leaves it in a down state.
|
|
1234
1275
|
|
|
1235
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1276
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][28]).
|
|
1236
1277
|
|
|
1237
1278
|
```js
|
|
1238
1279
|
I.pressKeyDown('Control');
|
|
@@ -1243,12 +1284,13 @@ I.pressKeyUp('Control');
|
|
|
1243
1284
|
#### Parameters
|
|
1244
1285
|
|
|
1245
1286
|
- `key` **[string][12]** name of key to press down.
|
|
1287
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1246
1288
|
|
|
1247
1289
|
### pressKeyUp
|
|
1248
1290
|
|
|
1249
1291
|
Releases a key in the browser which was previously set to a down state.
|
|
1250
1292
|
|
|
1251
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1293
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][28]).
|
|
1252
1294
|
|
|
1253
1295
|
```js
|
|
1254
1296
|
I.pressKeyDown('Control');
|
|
@@ -1259,6 +1301,7 @@ I.pressKeyUp('Control');
|
|
|
1259
1301
|
#### Parameters
|
|
1260
1302
|
|
|
1261
1303
|
- `key` **[string][12]** name of key to release.
|
|
1304
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1262
1305
|
|
|
1263
1306
|
### refreshPage
|
|
1264
1307
|
|
|
@@ -1268,6 +1311,8 @@ Reload the current page.
|
|
|
1268
1311
|
I.refreshPage();
|
|
1269
1312
|
```
|
|
1270
1313
|
|
|
1314
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1315
|
+
|
|
1271
1316
|
### resizeWindow
|
|
1272
1317
|
|
|
1273
1318
|
Resize the current window to provided width and height.
|
|
@@ -1276,7 +1321,8 @@ First parameter can be set to `maximize`.
|
|
|
1276
1321
|
#### Parameters
|
|
1277
1322
|
|
|
1278
1323
|
- `width` **[number][16]** width in pixels or `maximize`.
|
|
1279
|
-
- `height` **[number][16]** height in pixels.
|
|
1324
|
+
- `height` **[number][16]** height in pixels.
|
|
1325
|
+
[!] returns a _promise_ which is synchronized internally by recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1280
1326
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1281
1327
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1282
1328
|
// inside codecept.conf.js
|
|
@@ -1300,7 +1346,8 @@ I.rightClick('Click me', '.context');
|
|
|
1300
1346
|
#### Parameters
|
|
1301
1347
|
|
|
1302
1348
|
- `locator` **([string][12] | [object][10])** clickable element located by CSS|XPath|strict locator.
|
|
1303
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1349
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1350
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1304
1351
|
|
|
1305
1352
|
### saveElementScreenshot
|
|
1306
1353
|
|
|
@@ -1315,6 +1362,7 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1315
1362
|
|
|
1316
1363
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1317
1364
|
- `fileName` **[string][12]** file name to save.
|
|
1365
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1318
1366
|
|
|
1319
1367
|
### saveScreenshot
|
|
1320
1368
|
|
|
@@ -1330,7 +1378,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1330
1378
|
#### Parameters
|
|
1331
1379
|
|
|
1332
1380
|
- `fileName` **[string][12]** file name to save.
|
|
1333
|
-
- `fullPage` **[boolean][
|
|
1381
|
+
- `fullPage` **[boolean][29]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1382
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1334
1383
|
|
|
1335
1384
|
### scrollPageToBottom
|
|
1336
1385
|
|
|
@@ -1340,6 +1389,8 @@ Scroll page to the bottom.
|
|
|
1340
1389
|
I.scrollPageToBottom();
|
|
1341
1390
|
```
|
|
1342
1391
|
|
|
1392
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1393
|
+
|
|
1343
1394
|
### scrollPageToTop
|
|
1344
1395
|
|
|
1345
1396
|
Scroll page to the top.
|
|
@@ -1348,6 +1399,8 @@ Scroll page to the top.
|
|
|
1348
1399
|
I.scrollPageToTop();
|
|
1349
1400
|
```
|
|
1350
1401
|
|
|
1402
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1403
|
+
|
|
1351
1404
|
### scrollTo
|
|
1352
1405
|
|
|
1353
1406
|
Scrolls to element matched by locator.
|
|
@@ -1362,7 +1415,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1362
1415
|
|
|
1363
1416
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1364
1417
|
- `offsetX` **[number][16]** (optional, `0` by default) X-axis offset.
|
|
1365
|
-
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1418
|
+
- `offsetY` **[number][16]** (optional, `0` by default) Y-axis offset.
|
|
1419
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1366
1420
|
|
|
1367
1421
|
### see
|
|
1368
1422
|
|
|
@@ -1378,7 +1432,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1378
1432
|
#### Parameters
|
|
1379
1433
|
|
|
1380
1434
|
- `text` **[string][12]** expected on page.
|
|
1381
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1435
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1436
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1382
1437
|
|
|
1383
1438
|
### seeAttributesOnElements
|
|
1384
1439
|
|
|
@@ -1392,6 +1447,7 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1392
1447
|
|
|
1393
1448
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1394
1449
|
- `attributes` **[object][10]** attributes and their values to check.
|
|
1450
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1395
1451
|
|
|
1396
1452
|
### seeCheckboxIsChecked
|
|
1397
1453
|
|
|
@@ -1406,6 +1462,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1406
1462
|
#### Parameters
|
|
1407
1463
|
|
|
1408
1464
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
1465
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1409
1466
|
|
|
1410
1467
|
### seeCookie
|
|
1411
1468
|
|
|
@@ -1418,6 +1475,7 @@ I.seeCookie('Auth');
|
|
|
1418
1475
|
#### Parameters
|
|
1419
1476
|
|
|
1420
1477
|
- `name` **[string][12]** cookie name.
|
|
1478
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1421
1479
|
|
|
1422
1480
|
### seeCssPropertiesOnElements
|
|
1423
1481
|
|
|
@@ -1431,6 +1489,7 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1431
1489
|
|
|
1432
1490
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1433
1491
|
- `cssProperties` **[object][10]** object with CSS properties and their values to check.
|
|
1492
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1434
1493
|
|
|
1435
1494
|
### seeCurrentUrlEquals
|
|
1436
1495
|
|
|
@@ -1446,6 +1505,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1446
1505
|
#### Parameters
|
|
1447
1506
|
|
|
1448
1507
|
- `url` **[string][12]** value to check.
|
|
1508
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1449
1509
|
|
|
1450
1510
|
### seeElement
|
|
1451
1511
|
|
|
@@ -1459,6 +1519,7 @@ I.seeElement('#modal');
|
|
|
1459
1519
|
#### Parameters
|
|
1460
1520
|
|
|
1461
1521
|
- `locator` **([string][12] | [object][10])** located by CSS|XPath|strict locator.
|
|
1522
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1462
1523
|
|
|
1463
1524
|
### seeElementInDOM
|
|
1464
1525
|
|
|
@@ -1472,6 +1533,7 @@ I.seeElementInDOM('#modal');
|
|
|
1472
1533
|
#### Parameters
|
|
1473
1534
|
|
|
1474
1535
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1536
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1475
1537
|
|
|
1476
1538
|
### seeInCurrentUrl
|
|
1477
1539
|
|
|
@@ -1484,6 +1546,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1484
1546
|
#### Parameters
|
|
1485
1547
|
|
|
1486
1548
|
- `url` **[string][12]** a fragment to check
|
|
1549
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1487
1550
|
|
|
1488
1551
|
### seeInField
|
|
1489
1552
|
|
|
@@ -1501,6 +1564,7 @@ I.seeInField('#searchform input','Search');
|
|
|
1501
1564
|
|
|
1502
1565
|
- `field` **([string][12] | [object][10])** located by label|name|CSS|XPath|strict locator.
|
|
1503
1566
|
- `value` **[string][12]** value to check.
|
|
1567
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1504
1568
|
|
|
1505
1569
|
### seeInPopup
|
|
1506
1570
|
|
|
@@ -1514,6 +1578,7 @@ I.seeInPopup('Popup text');
|
|
|
1514
1578
|
#### Parameters
|
|
1515
1579
|
|
|
1516
1580
|
- `text` **[string][12]** value to check.
|
|
1581
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1517
1582
|
|
|
1518
1583
|
### seeInSource
|
|
1519
1584
|
|
|
@@ -1526,6 +1591,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1526
1591
|
#### Parameters
|
|
1527
1592
|
|
|
1528
1593
|
- `text` **[string][12]** value to check.
|
|
1594
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1529
1595
|
|
|
1530
1596
|
### seeInTitle
|
|
1531
1597
|
|
|
@@ -1538,6 +1604,7 @@ I.seeInTitle('Home Page');
|
|
|
1538
1604
|
#### Parameters
|
|
1539
1605
|
|
|
1540
1606
|
- `text` **[string][12]** text value to check.
|
|
1607
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1541
1608
|
|
|
1542
1609
|
### seeNumberOfElements
|
|
1543
1610
|
|
|
@@ -1552,6 +1619,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1552
1619
|
|
|
1553
1620
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1554
1621
|
- `num` **[number][16]** number of elements.
|
|
1622
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1555
1623
|
|
|
1556
1624
|
### seeNumberOfVisibleElements
|
|
1557
1625
|
|
|
@@ -1566,6 +1634,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1566
1634
|
|
|
1567
1635
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1568
1636
|
- `num` **[number][16]** number of elements.
|
|
1637
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1569
1638
|
|
|
1570
1639
|
### seeTextEquals
|
|
1571
1640
|
|
|
@@ -1578,7 +1647,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1578
1647
|
#### Parameters
|
|
1579
1648
|
|
|
1580
1649
|
- `text` **[string][12]** element value to check.
|
|
1581
|
-
- `context` **([string][12] | [object][10])?** element located by CSS|XPath|strict locator.
|
|
1650
|
+
- `context` **([string][12] | [object][10])?** element located by CSS|XPath|strict locator.
|
|
1651
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1582
1652
|
|
|
1583
1653
|
### seeTitleEquals
|
|
1584
1654
|
|
|
@@ -1591,6 +1661,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1591
1661
|
#### Parameters
|
|
1592
1662
|
|
|
1593
1663
|
- `text` **[string][12]** value to check.
|
|
1664
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1594
1665
|
|
|
1595
1666
|
### selectOption
|
|
1596
1667
|
|
|
@@ -1617,6 +1688,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1617
1688
|
|
|
1618
1689
|
- `select` **([string][12] | [object][10])** field located by label|name|CSS|XPath|strict locator.
|
|
1619
1690
|
- `option` **([string][12] | [Array][19]<any>)** visible text or value of option.
|
|
1691
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1620
1692
|
|
|
1621
1693
|
### setCookie
|
|
1622
1694
|
|
|
@@ -1637,6 +1709,7 @@ I.setCookie([
|
|
|
1637
1709
|
#### Parameters
|
|
1638
1710
|
|
|
1639
1711
|
- `cookie` **(Cookie | [Array][19]<Cookie>)** a cookie object or array of cookie objects.
|
|
1712
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1640
1713
|
|
|
1641
1714
|
### stopMockingRoute
|
|
1642
1715
|
|
|
@@ -1651,8 +1724,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1651
1724
|
|
|
1652
1725
|
#### Parameters
|
|
1653
1726
|
|
|
1654
|
-
- `url` **[string][12]?** URL, regex or pattern for to match URL
|
|
1655
|
-
- `handler` **[function][17]?** a function to process
|
|
1727
|
+
- `url` **([string][12] | [RegExp][24])?** URL, regex or pattern for to match URL
|
|
1728
|
+
- `handler` **[function][17]?** a function to process reques
|
|
1656
1729
|
|
|
1657
1730
|
### switchTo
|
|
1658
1731
|
|
|
@@ -1665,7 +1738,8 @@ I.switchTo(); // switch back to main page
|
|
|
1665
1738
|
|
|
1666
1739
|
#### Parameters
|
|
1667
1740
|
|
|
1668
|
-
- `locator` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1741
|
+
- `locator` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1742
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1669
1743
|
|
|
1670
1744
|
### switchToNextTab
|
|
1671
1745
|
|
|
@@ -1697,7 +1771,7 @@ I.switchToPreviousTab(2);
|
|
|
1697
1771
|
|
|
1698
1772
|
Types out the given text into an active field.
|
|
1699
1773
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1700
|
-
_Note:_ Should be used when [`fillField`][
|
|
1774
|
+
_Note:_ Should be used when [`fillField`][26] is not an option.
|
|
1701
1775
|
|
|
1702
1776
|
```js
|
|
1703
1777
|
// passing in a string
|
|
@@ -1713,7 +1787,8 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1713
1787
|
#### Parameters
|
|
1714
1788
|
|
|
1715
1789
|
- `keys`
|
|
1716
|
-
- `delay` **[number][16]?** (optional) delay in ms between key presses
|
|
1790
|
+
- `delay` **[number][16]?** (optional) delay in ms between key presses
|
|
1791
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1717
1792
|
- `key` **([string][12] | [Array][19]<[string][12]>)** or array of keys to type.
|
|
1718
1793
|
|
|
1719
1794
|
### uncheckOption
|
|
@@ -1732,7 +1807,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1732
1807
|
#### Parameters
|
|
1733
1808
|
|
|
1734
1809
|
- `field` **([string][12] | [object][10])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1735
|
-
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1810
|
+
- `context` **([string][12]? | [object][10])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1811
|
+
[!] returns a _promise_ which is synchronized internally by recorder[Additional options][30] for uncheck available as 3rd argument.Examples:```js
|
|
1736
1812
|
// click on element at position
|
|
1737
1813
|
I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
|
|
1738
1814
|
```> ⚠️ To avoid flakiness, option `force: true` is set by default
|
|
@@ -1745,7 +1821,7 @@ Use Playwright API inside a test.
|
|
|
1745
1821
|
First argument is a description of an action.
|
|
1746
1822
|
Second argument is async function that gets this helper as parameter.
|
|
1747
1823
|
|
|
1748
|
-
{ [`page`][
|
|
1824
|
+
{ [`page`][31], [`browserContext`][32] [`browser`][33] } objects from Playwright API are available.
|
|
1749
1825
|
|
|
1750
1826
|
```js
|
|
1751
1827
|
I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
@@ -1756,7 +1832,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
|
|
|
1756
1832
|
#### Parameters
|
|
1757
1833
|
|
|
1758
1834
|
- `description` **[string][12]** used to show in logs.
|
|
1759
|
-
- `fn` **[function][17]** async function that executed with Playwright helper as
|
|
1835
|
+
- `fn` **[function][17]** async function that executed with Playwright helper as argumen
|
|
1760
1836
|
|
|
1761
1837
|
### wait
|
|
1762
1838
|
|
|
@@ -1769,6 +1845,7 @@ I.wait(2); // wait 2 secs
|
|
|
1769
1845
|
#### Parameters
|
|
1770
1846
|
|
|
1771
1847
|
- `sec` **[number][16]** number of second to wait.
|
|
1848
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1772
1849
|
|
|
1773
1850
|
### waitForClickable
|
|
1774
1851
|
|
|
@@ -1785,6 +1862,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1785
1862
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1786
1863
|
- `waitTimeout`
|
|
1787
1864
|
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1865
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1788
1866
|
|
|
1789
1867
|
### waitForDetached
|
|
1790
1868
|
|
|
@@ -1798,7 +1876,8 @@ I.waitForDetached('#popup');
|
|
|
1798
1876
|
#### Parameters
|
|
1799
1877
|
|
|
1800
1878
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1801
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1879
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1880
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1802
1881
|
|
|
1803
1882
|
### waitForElement
|
|
1804
1883
|
|
|
@@ -1814,6 +1893,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1814
1893
|
|
|
1815
1894
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1816
1895
|
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1896
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1817
1897
|
|
|
1818
1898
|
### waitForEnabled
|
|
1819
1899
|
|
|
@@ -1823,7 +1903,8 @@ Element can be located by CSS or XPath.
|
|
|
1823
1903
|
#### Parameters
|
|
1824
1904
|
|
|
1825
1905
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1826
|
-
- `sec` **[number][16]** (optional) time in seconds to wait, 1 by default.
|
|
1906
|
+
- `sec` **[number][16]** (optional) time in seconds to wait, 1 by default.
|
|
1907
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1827
1908
|
|
|
1828
1909
|
### waitForFunction
|
|
1829
1910
|
|
|
@@ -1844,7 +1925,8 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1844
1925
|
|
|
1845
1926
|
- `fn` **([string][12] | [function][17])** to be executed in browser context.
|
|
1846
1927
|
- `argsOrSec` **([Array][19]<any> | [number][16])?** (optional, `1` by default) arguments for function or seconds.
|
|
1847
|
-
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1928
|
+
- `sec` **[number][16]?** (optional, `1` by default) time in seconds to wait
|
|
1929
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1848
1930
|
|
|
1849
1931
|
### waitForInvisible
|
|
1850
1932
|
|
|
@@ -1858,13 +1940,14 @@ I.waitForInvisible('#popup');
|
|
|
1858
1940
|
#### Parameters
|
|
1859
1941
|
|
|
1860
1942
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1861
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1943
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1944
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1862
1945
|
|
|
1863
1946
|
### waitForNavigation
|
|
1864
1947
|
|
|
1865
1948
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1866
1949
|
|
|
1867
|
-
See [Playwright's reference][
|
|
1950
|
+
See [Playwright's reference][34]
|
|
1868
1951
|
|
|
1869
1952
|
#### Parameters
|
|
1870
1953
|
|
|
@@ -1913,7 +1996,8 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1913
1996
|
|
|
1914
1997
|
- `text` **[string][12]** to wait for.
|
|
1915
1998
|
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
1916
|
-
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator.
|
|
1999
|
+
- `context` **([string][12] | [object][10])?** (optional) element located by CSS|XPath|strict locator.
|
|
2000
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1917
2001
|
|
|
1918
2002
|
### waitForValue
|
|
1919
2003
|
|
|
@@ -1927,7 +2011,8 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1927
2011
|
|
|
1928
2012
|
- `field` **([string][12] | [object][10])** input field.
|
|
1929
2013
|
- `value` **[string][12]** expected value.
|
|
1930
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2014
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2015
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1931
2016
|
|
|
1932
2017
|
### waitForVisible
|
|
1933
2018
|
|
|
@@ -1941,7 +2026,8 @@ I.waitForVisible('#popup');
|
|
|
1941
2026
|
#### Parameters
|
|
1942
2027
|
|
|
1943
2028
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1944
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to
|
|
2029
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2030
|
+
[!] returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][35].
|
|
1945
2031
|
|
|
1946
2032
|
### waitInUrl
|
|
1947
2033
|
|
|
@@ -1954,7 +2040,8 @@ I.waitInUrl('/info', 2);
|
|
|
1954
2040
|
#### Parameters
|
|
1955
2041
|
|
|
1956
2042
|
- `urlPart` **[string][12]** value to check.
|
|
1957
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2043
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2044
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1958
2045
|
|
|
1959
2046
|
### waitNumberOfVisibleElements
|
|
1960
2047
|
|
|
@@ -1968,7 +2055,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1968
2055
|
|
|
1969
2056
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1970
2057
|
- `num` **[number][16]** number of elements.
|
|
1971
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2058
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2059
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1972
2060
|
|
|
1973
2061
|
### waitToHide
|
|
1974
2062
|
|
|
@@ -1982,7 +2070,8 @@ I.waitToHide('#popup');
|
|
|
1982
2070
|
#### Parameters
|
|
1983
2071
|
|
|
1984
2072
|
- `locator` **([string][12] | [object][10])** element located by CSS|XPath|strict locator.
|
|
1985
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2073
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2074
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
1986
2075
|
|
|
1987
2076
|
### waitUrlEquals
|
|
1988
2077
|
|
|
@@ -1996,7 +2085,8 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1996
2085
|
#### Parameters
|
|
1997
2086
|
|
|
1998
2087
|
- `urlPart` **[string][12]** value to check.
|
|
1999
|
-
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2088
|
+
- `sec` **[number][16]** (optional, `1` by default) time in seconds to wait
|
|
2089
|
+
[!] returns a _promise_ which is synchronized internally by recorder
|
|
2000
2090
|
|
|
2001
2091
|
[1]: https://github.com/microsoft/playwright
|
|
2002
2092
|
|
|
@@ -2044,24 +2134,26 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2044
2134
|
|
|
2045
2135
|
[23]: https://playwright.dev/docs/network#handle-requests
|
|
2046
2136
|
|
|
2047
|
-
[24]: https://
|
|
2137
|
+
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2138
|
+
|
|
2139
|
+
[25]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
2048
2140
|
|
|
2049
|
-
[
|
|
2141
|
+
[26]: #fillfield
|
|
2050
2142
|
|
|
2051
|
-
[
|
|
2143
|
+
[27]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
2052
2144
|
|
|
2053
|
-
[
|
|
2145
|
+
[28]: #click
|
|
2054
2146
|
|
|
2055
|
-
[
|
|
2147
|
+
[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2056
2148
|
|
|
2057
|
-
[
|
|
2149
|
+
[30]: https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck
|
|
2058
2150
|
|
|
2059
|
-
[
|
|
2151
|
+
[31]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
2060
2152
|
|
|
2061
|
-
[
|
|
2153
|
+
[32]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
2062
2154
|
|
|
2063
|
-
[
|
|
2155
|
+
[33]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
2064
2156
|
|
|
2065
|
-
[
|
|
2157
|
+
[34]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2066
2158
|
|
|
2067
|
-
[
|
|
2159
|
+
[35]: https://codecept.io/react
|