codeceptjs 3.2.2 → 3.2.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 +7 -0
- package/docs/advanced.md +5 -1
- package/docs/build/Appium.js +62 -0
- package/docs/build/FileSystem.js +11 -1
- package/docs/build/Playwright.js +12 -7
- package/docs/changelog.md +7 -0
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +9 -9
- package/docs/helpers/Appium.md +239 -197
- package/docs/helpers/FileSystem.md +11 -1
- package/docs/helpers/Playwright.md +210 -207
- package/docs/installation.md +1 -1
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/playwright.md +4 -4
- package/docs/plugins.md +11 -7
- package/docs/puppeteer.md +5 -5
- package/docs/reports.md +1 -1
- package/docs/testcafe.md +1 -1
- package/docs/translation.md +1 -1
- package/docs/visual.md +2 -2
- package/docs/vue.md +1 -1
- package/docs/webdriver.md +2 -2
- package/lib/cli.js +25 -20
- package/lib/command/workers/runTests.js +25 -7
- package/lib/helper/Appium.js +62 -0
- package/lib/helper/FileSystem.js +11 -1
- package/lib/helper/Playwright.js +12 -7
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/tryTo.js +6 -0
- package/package.json +1 -1
- package/typings/index.d.ts +2 -0
- package/typings/types.d.ts +83 -100
|
@@ -51,6 +51,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
51
51
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
52
52
|
- `chromium`: (optional) pass additional chromium options
|
|
53
53
|
- `electron`: (optional) pass additional electron options
|
|
54
|
+
- `channel`: (optional) 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][4].
|
|
54
55
|
|
|
55
56
|
#### Video Recording Customization
|
|
56
57
|
|
|
@@ -58,7 +59,7 @@ By default, video is saved to `output/video` dir. You can customize this path by
|
|
|
58
59
|
|
|
59
60
|
- `video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
60
61
|
- `keepVideoForPassedTests`: - save videos for passed tests
|
|
61
|
-
- `recordVideo`: [additional options for videos customization][
|
|
62
|
+
- `recordVideo`: [additional options for videos customization][5]
|
|
62
63
|
|
|
63
64
|
#### Trace Recording Customization
|
|
64
65
|
|
|
@@ -111,7 +112,7 @@ Traces will be saved to `output/trace`
|
|
|
111
112
|
}
|
|
112
113
|
```
|
|
113
114
|
|
|
114
|
-
#### Example #4: Connect to remote browser by specifying [websocket endpoint][
|
|
115
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][6]
|
|
115
116
|
|
|
116
117
|
```js
|
|
117
118
|
{
|
|
@@ -128,7 +129,7 @@ Traces will be saved to `output/trace`
|
|
|
128
129
|
|
|
129
130
|
#### Example #5: Testing with Chromium extensions
|
|
130
131
|
|
|
131
|
-
[official docs][
|
|
132
|
+
[official docs][7]
|
|
132
133
|
|
|
133
134
|
```js
|
|
134
135
|
{
|
|
@@ -277,13 +278,13 @@ Set current page
|
|
|
277
278
|
|
|
278
279
|
#### Parameters
|
|
279
280
|
|
|
280
|
-
- `page` **[object][
|
|
281
|
+
- `page` **[object][8]** page to set
|
|
281
282
|
|
|
282
283
|
### acceptPopup
|
|
283
284
|
|
|
284
285
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
285
286
|
Don't confuse popups with modal windows, as created by [various
|
|
286
|
-
libraries][
|
|
287
|
+
libraries][9].
|
|
287
288
|
|
|
288
289
|
### amAcceptingPopups
|
|
289
290
|
|
|
@@ -320,7 +321,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
320
321
|
|
|
321
322
|
#### Parameters
|
|
322
323
|
|
|
323
|
-
- `url` **[string][
|
|
324
|
+
- `url` **[string][10]** url path or global url.
|
|
324
325
|
|
|
325
326
|
### appendField
|
|
326
327
|
|
|
@@ -333,8 +334,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
333
334
|
|
|
334
335
|
#### Parameters
|
|
335
336
|
|
|
336
|
-
- `field` **([string][
|
|
337
|
-
- `value` **[string][
|
|
337
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator
|
|
338
|
+
- `value` **[string][10]** text value to append.
|
|
338
339
|
|
|
339
340
|
### attachFile
|
|
340
341
|
|
|
@@ -349,8 +350,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
349
350
|
|
|
350
351
|
#### Parameters
|
|
351
352
|
|
|
352
|
-
- `locator` **([string][
|
|
353
|
-
- `pathToFile` **[string][
|
|
353
|
+
- `locator` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
354
|
+
- `pathToFile` **[string][10]** local file path relative to codecept.json config file.
|
|
354
355
|
|
|
355
356
|
### cancelPopup
|
|
356
357
|
|
|
@@ -371,8 +372,8 @@ I.checkOption('agree', '//form');
|
|
|
371
372
|
|
|
372
373
|
#### Parameters
|
|
373
374
|
|
|
374
|
-
- `field` **([string][
|
|
375
|
-
- `context` **([string][
|
|
375
|
+
- `field` **([string][10] | [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
376
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
376
377
|
|
|
377
378
|
### clearCookie
|
|
378
379
|
|
|
@@ -386,7 +387,7 @@ I.clearCookie('test');
|
|
|
386
387
|
|
|
387
388
|
#### Parameters
|
|
388
389
|
|
|
389
|
-
- `cookie` **[string][
|
|
390
|
+
- `cookie` **[string][10]?** (optional, `null` by default) cookie name
|
|
390
391
|
|
|
391
392
|
### clearField
|
|
392
393
|
|
|
@@ -401,7 +402,7 @@ I.clearField('#email');
|
|
|
401
402
|
#### Parameters
|
|
402
403
|
|
|
403
404
|
- `field`
|
|
404
|
-
- `editable` **([string][
|
|
405
|
+
- `editable` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
405
406
|
|
|
406
407
|
### click
|
|
407
408
|
|
|
@@ -429,8 +430,8 @@ I.click({css: 'nav a.login'});
|
|
|
429
430
|
|
|
430
431
|
#### Parameters
|
|
431
432
|
|
|
432
|
-
- `locator` **([string][
|
|
433
|
-
- `context` **([string][
|
|
433
|
+
- `locator` **([string][10] | [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
434
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
434
435
|
|
|
435
436
|
### clickLink
|
|
436
437
|
|
|
@@ -469,8 +470,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
469
470
|
|
|
470
471
|
#### Parameters
|
|
471
472
|
|
|
472
|
-
- `text` **[string][
|
|
473
|
-
- `context` **([string][
|
|
473
|
+
- `text` **[string][10]** which is not present.
|
|
474
|
+
- `context` **([string][10] | [object][8])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
474
475
|
|
|
475
476
|
### dontSeeCheckboxIsChecked
|
|
476
477
|
|
|
@@ -484,7 +485,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
484
485
|
|
|
485
486
|
#### Parameters
|
|
486
487
|
|
|
487
|
-
- `field` **([string][
|
|
488
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
488
489
|
|
|
489
490
|
### dontSeeCookie
|
|
490
491
|
|
|
@@ -496,7 +497,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
496
497
|
|
|
497
498
|
#### Parameters
|
|
498
499
|
|
|
499
|
-
- `name` **[string][
|
|
500
|
+
- `name` **[string][10]** cookie name.
|
|
500
501
|
|
|
501
502
|
### dontSeeCurrentUrlEquals
|
|
502
503
|
|
|
@@ -510,7 +511,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
510
511
|
|
|
511
512
|
#### Parameters
|
|
512
513
|
|
|
513
|
-
- `url` **[string][
|
|
514
|
+
- `url` **[string][10]** value to check.
|
|
514
515
|
|
|
515
516
|
### dontSeeElement
|
|
516
517
|
|
|
@@ -522,7 +523,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
522
523
|
|
|
523
524
|
#### Parameters
|
|
524
525
|
|
|
525
|
-
- `locator` **([string][
|
|
526
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|Strict locator.
|
|
526
527
|
|
|
527
528
|
### dontSeeElementInDOM
|
|
528
529
|
|
|
@@ -534,7 +535,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
534
535
|
|
|
535
536
|
#### Parameters
|
|
536
537
|
|
|
537
|
-
- `locator` **([string][
|
|
538
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|Strict locator.
|
|
538
539
|
|
|
539
540
|
### dontSeeInCurrentUrl
|
|
540
541
|
|
|
@@ -542,7 +543,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
542
543
|
|
|
543
544
|
#### Parameters
|
|
544
545
|
|
|
545
|
-
- `url` **[string][
|
|
546
|
+
- `url` **[string][10]** value to check.
|
|
546
547
|
|
|
547
548
|
### dontSeeInField
|
|
548
549
|
|
|
@@ -556,8 +557,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
556
557
|
|
|
557
558
|
#### Parameters
|
|
558
559
|
|
|
559
|
-
- `field` **([string][
|
|
560
|
-
- `value` **[string][
|
|
560
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
561
|
+
- `value` **[string][10]** value to check.
|
|
561
562
|
|
|
562
563
|
### dontSeeInSource
|
|
563
564
|
|
|
@@ -570,7 +571,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
570
571
|
#### Parameters
|
|
571
572
|
|
|
572
573
|
- `text`
|
|
573
|
-
- `value` **[string][
|
|
574
|
+
- `value` **[string][10]** to check.
|
|
574
575
|
|
|
575
576
|
### dontSeeInTitle
|
|
576
577
|
|
|
@@ -582,7 +583,7 @@ I.dontSeeInTitle('Error');
|
|
|
582
583
|
|
|
583
584
|
#### Parameters
|
|
584
585
|
|
|
585
|
-
- `text` **[string][
|
|
586
|
+
- `text` **[string][10]** value to check.
|
|
586
587
|
|
|
587
588
|
### doubleClick
|
|
588
589
|
|
|
@@ -598,8 +599,8 @@ I.doubleClick('.btn.edit');
|
|
|
598
599
|
|
|
599
600
|
#### Parameters
|
|
600
601
|
|
|
601
|
-
- `locator` **([string][
|
|
602
|
-
- `context` **([string][
|
|
602
|
+
- `locator` **([string][10] | [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
603
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
603
604
|
|
|
604
605
|
### dragAndDrop
|
|
605
606
|
|
|
@@ -611,8 +612,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
611
612
|
|
|
612
613
|
#### Parameters
|
|
613
614
|
|
|
614
|
-
- `srcElement` **([string][
|
|
615
|
-
- `destElement` **([string][
|
|
615
|
+
- `srcElement` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
616
|
+
- `destElement` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
616
617
|
|
|
617
618
|
### dragSlider
|
|
618
619
|
|
|
@@ -626,8 +627,8 @@ I.dragSlider('#slider', -70);
|
|
|
626
627
|
|
|
627
628
|
#### Parameters
|
|
628
629
|
|
|
629
|
-
- `locator` **([string][
|
|
630
|
-
- `offsetX` **[number][
|
|
630
|
+
- `locator` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
631
|
+
- `offsetX` **[number][11]** position to drag.
|
|
631
632
|
|
|
632
633
|
### executeScript
|
|
633
634
|
|
|
@@ -654,10 +655,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
654
655
|
|
|
655
656
|
#### Parameters
|
|
656
657
|
|
|
657
|
-
- `fn` **([string][
|
|
658
|
+
- `fn` **([string][10] | [function][12])** function to be executed in browser context.
|
|
658
659
|
- `arg` **any?** optional argument to pass to the function
|
|
659
660
|
|
|
660
|
-
Returns **[Promise][
|
|
661
|
+
Returns **[Promise][13]<any>**
|
|
661
662
|
|
|
662
663
|
### fillField
|
|
663
664
|
|
|
@@ -677,8 +678,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
677
678
|
|
|
678
679
|
#### Parameters
|
|
679
680
|
|
|
680
|
-
- `field` **([string][
|
|
681
|
-
- `value` **([string][
|
|
681
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
682
|
+
- `value` **([string][10] | [object][8])** text value to fill.
|
|
682
683
|
|
|
683
684
|
### forceClick
|
|
684
685
|
|
|
@@ -709,8 +710,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
709
710
|
|
|
710
711
|
#### Parameters
|
|
711
712
|
|
|
712
|
-
- `locator` **([string][
|
|
713
|
-
- `context` **([string][
|
|
713
|
+
- `locator` **([string][10] | [object][8])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
714
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
714
715
|
|
|
715
716
|
### grabAttributeFrom
|
|
716
717
|
|
|
@@ -724,10 +725,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
724
725
|
|
|
725
726
|
#### Parameters
|
|
726
727
|
|
|
727
|
-
- `locator` **([string][
|
|
728
|
-
- `attr` **[string][
|
|
728
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
729
|
+
- `attr` **[string][10]** attribute name.
|
|
729
730
|
|
|
730
|
-
Returns **[Promise][
|
|
731
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
731
732
|
|
|
732
733
|
### grabAttributeFromAll
|
|
733
734
|
|
|
@@ -740,10 +741,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
740
741
|
|
|
741
742
|
#### Parameters
|
|
742
743
|
|
|
743
|
-
- `locator` **([string][
|
|
744
|
-
- `attr` **[string][
|
|
744
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
745
|
+
- `attr` **[string][10]** attribute name.
|
|
745
746
|
|
|
746
|
-
Returns **[Promise][
|
|
747
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
747
748
|
|
|
748
749
|
### grabBrowserLogs
|
|
749
750
|
|
|
@@ -754,7 +755,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
754
755
|
console.log(JSON.stringify(logs))
|
|
755
756
|
```
|
|
756
757
|
|
|
757
|
-
Returns **[Promise][
|
|
758
|
+
Returns **[Promise][13]<[Array][14]<any>>**
|
|
758
759
|
|
|
759
760
|
### grabCookie
|
|
760
761
|
|
|
@@ -769,9 +770,9 @@ assert(cookie.value, '123456');
|
|
|
769
770
|
|
|
770
771
|
#### Parameters
|
|
771
772
|
|
|
772
|
-
- `name` **[string][
|
|
773
|
+
- `name` **[string][10]?** cookie name.
|
|
773
774
|
|
|
774
|
-
Returns **([Promise][
|
|
775
|
+
Returns **([Promise][13]<[string][10]> | [Promise][13]<[Array][14]<[string][10]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
775
776
|
|
|
776
777
|
### grabCssPropertyFrom
|
|
777
778
|
|
|
@@ -785,10 +786,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
785
786
|
|
|
786
787
|
#### Parameters
|
|
787
788
|
|
|
788
|
-
- `locator` **([string][
|
|
789
|
-
- `cssProperty` **[string][
|
|
789
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
790
|
+
- `cssProperty` **[string][10]** CSS property name.
|
|
790
791
|
|
|
791
|
-
Returns **[Promise][
|
|
792
|
+
Returns **[Promise][13]<[string][10]>** CSS value
|
|
792
793
|
|
|
793
794
|
### grabCssPropertyFromAll
|
|
794
795
|
|
|
@@ -801,10 +802,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
801
802
|
|
|
802
803
|
#### Parameters
|
|
803
804
|
|
|
804
|
-
- `locator` **([string][
|
|
805
|
-
- `cssProperty` **[string][
|
|
805
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
806
|
+
- `cssProperty` **[string][10]** CSS property name.
|
|
806
807
|
|
|
807
|
-
Returns **[Promise][
|
|
808
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** CSS value
|
|
808
809
|
|
|
809
810
|
### grabCurrentUrl
|
|
810
811
|
|
|
@@ -816,7 +817,7 @@ let url = await I.grabCurrentUrl();
|
|
|
816
817
|
console.log(`Current URL is [${url}]`);
|
|
817
818
|
```
|
|
818
819
|
|
|
819
|
-
Returns **[Promise][
|
|
820
|
+
Returns **[Promise][13]<[string][10]>** current URL
|
|
820
821
|
|
|
821
822
|
### grabDataFromPerformanceTiming
|
|
822
823
|
|
|
@@ -863,11 +864,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
863
864
|
|
|
864
865
|
#### Parameters
|
|
865
866
|
|
|
866
|
-
- `locator` **([string][
|
|
867
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
867
868
|
- `prop`
|
|
868
|
-
- `elementSize` **[string][
|
|
869
|
+
- `elementSize` **[string][10]?** x, y, width or height of the given element.
|
|
869
870
|
|
|
870
|
-
Returns **([Promise][
|
|
871
|
+
Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][11]>)** Element bounding rectangle
|
|
871
872
|
|
|
872
873
|
### grabHTMLFrom
|
|
873
874
|
|
|
@@ -882,9 +883,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
882
883
|
#### Parameters
|
|
883
884
|
|
|
884
885
|
- `locator`
|
|
885
|
-
- `element` **([string][
|
|
886
|
+
- `element` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
886
887
|
|
|
887
|
-
Returns **[Promise][
|
|
888
|
+
Returns **[Promise][13]<[string][10]>** HTML code for an element
|
|
888
889
|
|
|
889
890
|
### grabHTMLFromAll
|
|
890
891
|
|
|
@@ -898,9 +899,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
898
899
|
#### Parameters
|
|
899
900
|
|
|
900
901
|
- `locator`
|
|
901
|
-
- `element` **([string][
|
|
902
|
+
- `element` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
902
903
|
|
|
903
|
-
Returns **[Promise][
|
|
904
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** HTML code for an element
|
|
904
905
|
|
|
905
906
|
### grabNumberOfOpenTabs
|
|
906
907
|
|
|
@@ -911,7 +912,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
911
912
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
912
913
|
```
|
|
913
914
|
|
|
914
|
-
Returns **[Promise][
|
|
915
|
+
Returns **[Promise][13]<[number][11]>** number of open tabs
|
|
915
916
|
|
|
916
917
|
### grabNumberOfVisibleElements
|
|
917
918
|
|
|
@@ -924,9 +925,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
924
925
|
|
|
925
926
|
#### Parameters
|
|
926
927
|
|
|
927
|
-
- `locator` **([string][
|
|
928
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
928
929
|
|
|
929
|
-
Returns **[Promise][
|
|
930
|
+
Returns **[Promise][13]<[number][11]>** number of visible elements
|
|
930
931
|
|
|
931
932
|
### grabPageScrollPosition
|
|
932
933
|
|
|
@@ -937,7 +938,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
937
938
|
let { x, y } = await I.grabPageScrollPosition();
|
|
938
939
|
```
|
|
939
940
|
|
|
940
|
-
Returns **[Promise][
|
|
941
|
+
Returns **[Promise][13]<PageScrollPosition>** scroll position
|
|
941
942
|
|
|
942
943
|
### grabPopupText
|
|
943
944
|
|
|
@@ -947,7 +948,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
947
948
|
await I.grabPopupText();
|
|
948
949
|
```
|
|
949
950
|
|
|
950
|
-
Returns **[Promise][
|
|
951
|
+
Returns **[Promise][13]<([string][10] | null)>**
|
|
951
952
|
|
|
952
953
|
### grabSource
|
|
953
954
|
|
|
@@ -958,7 +959,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
958
959
|
let pageSource = await I.grabSource();
|
|
959
960
|
```
|
|
960
961
|
|
|
961
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][13]<[string][10]>** source code
|
|
962
963
|
|
|
963
964
|
### grabTextFrom
|
|
964
965
|
|
|
@@ -973,9 +974,9 @@ If multiple elements found returns first element.
|
|
|
973
974
|
|
|
974
975
|
#### Parameters
|
|
975
976
|
|
|
976
|
-
- `locator` **([string][
|
|
977
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
977
978
|
|
|
978
|
-
Returns **[Promise][
|
|
979
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
979
980
|
|
|
980
981
|
### grabTextFromAll
|
|
981
982
|
|
|
@@ -988,9 +989,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
988
989
|
|
|
989
990
|
#### Parameters
|
|
990
991
|
|
|
991
|
-
- `locator` **([string][
|
|
992
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
992
993
|
|
|
993
|
-
Returns **[Promise][
|
|
994
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
994
995
|
|
|
995
996
|
### grabTitle
|
|
996
997
|
|
|
@@ -1001,7 +1002,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1001
1002
|
let title = await I.grabTitle();
|
|
1002
1003
|
```
|
|
1003
1004
|
|
|
1004
|
-
Returns **[Promise][
|
|
1005
|
+
Returns **[Promise][13]<[string][10]>** title
|
|
1005
1006
|
|
|
1006
1007
|
### grabValueFrom
|
|
1007
1008
|
|
|
@@ -1015,9 +1016,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1015
1016
|
|
|
1016
1017
|
#### Parameters
|
|
1017
1018
|
|
|
1018
|
-
- `locator` **([string][
|
|
1019
|
+
- `locator` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1019
1020
|
|
|
1020
|
-
Returns **[Promise][
|
|
1021
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
1021
1022
|
|
|
1022
1023
|
### grabValueFromAll
|
|
1023
1024
|
|
|
@@ -1030,16 +1031,16 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1030
1031
|
|
|
1031
1032
|
#### Parameters
|
|
1032
1033
|
|
|
1033
|
-
- `locator` **([string][
|
|
1034
|
+
- `locator` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1034
1035
|
|
|
1035
|
-
Returns **[Promise][
|
|
1036
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
1036
1037
|
|
|
1037
1038
|
### handleDownloads
|
|
1038
1039
|
|
|
1039
1040
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
1040
1041
|
Files are saved to "output" directory.
|
|
1041
1042
|
|
|
1042
|
-
Should be used with [FileSystem helper][
|
|
1043
|
+
Should be used with [FileSystem helper][15] to check that file were downloaded correctly.
|
|
1043
1044
|
|
|
1044
1045
|
```js
|
|
1045
1046
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1050,7 +1051,7 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1050
1051
|
|
|
1051
1052
|
#### Parameters
|
|
1052
1053
|
|
|
1053
|
-
- `fileName` **[string][
|
|
1054
|
+
- `fileName` **[string][10]?** set filename for downloaded file
|
|
1054
1055
|
|
|
1055
1056
|
### haveRequestHeaders
|
|
1056
1057
|
|
|
@@ -1064,22 +1065,22 @@ I.haveRequestHeaders({
|
|
|
1064
1065
|
|
|
1065
1066
|
#### Parameters
|
|
1066
1067
|
|
|
1067
|
-
- `customHeaders` **[object][
|
|
1068
|
+
- `customHeaders` **[object][8]** headers to set
|
|
1068
1069
|
|
|
1069
1070
|
### mockRoute
|
|
1070
1071
|
|
|
1071
|
-
Mocks network request using [`browserContext.route`][
|
|
1072
|
+
Mocks network request using [`browserContext.route`][16] of Playwright
|
|
1072
1073
|
|
|
1073
1074
|
```js
|
|
1074
1075
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1075
1076
|
```
|
|
1076
1077
|
|
|
1077
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1078
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][17]
|
|
1078
1079
|
|
|
1079
1080
|
#### Parameters
|
|
1080
1081
|
|
|
1081
|
-
- `url` **[string][
|
|
1082
|
-
- `handler` **[function][
|
|
1082
|
+
- `url` **[string][10]?** URL, regex or pattern for to match URL
|
|
1083
|
+
- `handler` **[function][12]?** a function to process request
|
|
1083
1084
|
|
|
1084
1085
|
### moveCursorTo
|
|
1085
1086
|
|
|
@@ -1093,9 +1094,9 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1093
1094
|
|
|
1094
1095
|
#### Parameters
|
|
1095
1096
|
|
|
1096
|
-
- `locator` **([string][
|
|
1097
|
-
- `offsetX` **[number][
|
|
1098
|
-
- `offsetY` **[number][
|
|
1097
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1098
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1099
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1099
1100
|
|
|
1100
1101
|
### openNewTab
|
|
1101
1102
|
|
|
@@ -1105,7 +1106,7 @@ Open new tab and automatically switched to new tab
|
|
|
1105
1106
|
I.openNewTab();
|
|
1106
1107
|
```
|
|
1107
1108
|
|
|
1108
|
-
You can pass in [page options][
|
|
1109
|
+
You can pass in [page options][18] to emulate device on this page
|
|
1109
1110
|
|
|
1110
1111
|
```js
|
|
1111
1112
|
// enable mobile
|
|
@@ -1120,7 +1121,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1120
1121
|
|
|
1121
1122
|
Presses a key in the browser (on a focused element).
|
|
1122
1123
|
|
|
1123
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1124
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][19].
|
|
1124
1125
|
|
|
1125
1126
|
```js
|
|
1126
1127
|
I.pressKey('Backspace');
|
|
@@ -1179,13 +1180,13 @@ Some of the supported key names are:
|
|
|
1179
1180
|
|
|
1180
1181
|
#### Parameters
|
|
1181
1182
|
|
|
1182
|
-
- `key` **([string][
|
|
1183
|
+
- `key` **([string][10] | [Array][14]<[string][10]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][20]).
|
|
1183
1184
|
|
|
1184
1185
|
### pressKeyDown
|
|
1185
1186
|
|
|
1186
1187
|
Presses a key in the browser and leaves it in a down state.
|
|
1187
1188
|
|
|
1188
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1189
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][21]).
|
|
1189
1190
|
|
|
1190
1191
|
```js
|
|
1191
1192
|
I.pressKeyDown('Control');
|
|
@@ -1195,13 +1196,13 @@ I.pressKeyUp('Control');
|
|
|
1195
1196
|
|
|
1196
1197
|
#### Parameters
|
|
1197
1198
|
|
|
1198
|
-
- `key` **[string][
|
|
1199
|
+
- `key` **[string][10]** name of key to press down.
|
|
1199
1200
|
|
|
1200
1201
|
### pressKeyUp
|
|
1201
1202
|
|
|
1202
1203
|
Releases a key in the browser which was previously set to a down state.
|
|
1203
1204
|
|
|
1204
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1205
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][21]).
|
|
1205
1206
|
|
|
1206
1207
|
```js
|
|
1207
1208
|
I.pressKeyDown('Control');
|
|
@@ -1211,7 +1212,7 @@ I.pressKeyUp('Control');
|
|
|
1211
1212
|
|
|
1212
1213
|
#### Parameters
|
|
1213
1214
|
|
|
1214
|
-
- `key` **[string][
|
|
1215
|
+
- `key` **[string][10]** name of key to release.
|
|
1215
1216
|
|
|
1216
1217
|
### refreshPage
|
|
1217
1218
|
|
|
@@ -1228,8 +1229,8 @@ First parameter can be set to `maximize`.
|
|
|
1228
1229
|
|
|
1229
1230
|
#### Parameters
|
|
1230
1231
|
|
|
1231
|
-
- `width` **[number][
|
|
1232
|
-
- `height` **[number][
|
|
1232
|
+
- `width` **[number][11]** width in pixels or `maximize`.
|
|
1233
|
+
- `height` **[number][11]** height in pixels.Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1233
1234
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1234
1235
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1235
1236
|
// inside codecept.conf.js
|
|
@@ -1252,8 +1253,8 @@ I.rightClick('Click me', '.context');
|
|
|
1252
1253
|
|
|
1253
1254
|
#### Parameters
|
|
1254
1255
|
|
|
1255
|
-
- `locator` **([string][
|
|
1256
|
-
- `context` **([string][
|
|
1256
|
+
- `locator` **([string][10] | [object][8])** clickable element located by CSS|XPath|strict locator.
|
|
1257
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1257
1258
|
|
|
1258
1259
|
### saveElementScreenshot
|
|
1259
1260
|
|
|
@@ -1266,8 +1267,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1266
1267
|
|
|
1267
1268
|
#### Parameters
|
|
1268
1269
|
|
|
1269
|
-
- `locator` **([string][
|
|
1270
|
-
- `fileName` **[string][
|
|
1270
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1271
|
+
- `fileName` **[string][10]** file name to save.
|
|
1271
1272
|
|
|
1272
1273
|
### saveScreenshot
|
|
1273
1274
|
|
|
@@ -1282,8 +1283,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1282
1283
|
|
|
1283
1284
|
#### Parameters
|
|
1284
1285
|
|
|
1285
|
-
- `fileName` **[string][
|
|
1286
|
-
- `fullPage` **[boolean][
|
|
1286
|
+
- `fileName` **[string][10]** file name to save.
|
|
1287
|
+
- `fullPage` **[boolean][22]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1287
1288
|
|
|
1288
1289
|
### scrollPageToBottom
|
|
1289
1290
|
|
|
@@ -1313,9 +1314,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1313
1314
|
|
|
1314
1315
|
#### Parameters
|
|
1315
1316
|
|
|
1316
|
-
- `locator` **([string][
|
|
1317
|
-
- `offsetX` **[number][
|
|
1318
|
-
- `offsetY` **[number][
|
|
1317
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1318
|
+
- `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1319
|
+
- `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1319
1320
|
|
|
1320
1321
|
### see
|
|
1321
1322
|
|
|
@@ -1330,8 +1331,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1330
1331
|
|
|
1331
1332
|
#### Parameters
|
|
1332
1333
|
|
|
1333
|
-
- `text` **[string][
|
|
1334
|
-
- `context` **([string][
|
|
1334
|
+
- `text` **[string][10]** expected on page.
|
|
1335
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1335
1336
|
|
|
1336
1337
|
### seeAttributesOnElements
|
|
1337
1338
|
|
|
@@ -1343,8 +1344,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1343
1344
|
|
|
1344
1345
|
#### Parameters
|
|
1345
1346
|
|
|
1346
|
-
- `locator` **([string][
|
|
1347
|
-
- `attributes` **[object][
|
|
1347
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1348
|
+
- `attributes` **[object][8]** attributes and their values to check.
|
|
1348
1349
|
|
|
1349
1350
|
### seeCheckboxIsChecked
|
|
1350
1351
|
|
|
@@ -1358,7 +1359,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1358
1359
|
|
|
1359
1360
|
#### Parameters
|
|
1360
1361
|
|
|
1361
|
-
- `field` **([string][
|
|
1362
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1362
1363
|
|
|
1363
1364
|
### seeCookie
|
|
1364
1365
|
|
|
@@ -1370,7 +1371,7 @@ I.seeCookie('Auth');
|
|
|
1370
1371
|
|
|
1371
1372
|
#### Parameters
|
|
1372
1373
|
|
|
1373
|
-
- `name` **[string][
|
|
1374
|
+
- `name` **[string][10]** cookie name.
|
|
1374
1375
|
|
|
1375
1376
|
### seeCssPropertiesOnElements
|
|
1376
1377
|
|
|
@@ -1382,8 +1383,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1382
1383
|
|
|
1383
1384
|
#### Parameters
|
|
1384
1385
|
|
|
1385
|
-
- `locator` **([string][
|
|
1386
|
-
- `cssProperties` **[object][
|
|
1386
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1387
|
+
- `cssProperties` **[object][8]** object with CSS properties and their values to check.
|
|
1387
1388
|
|
|
1388
1389
|
### seeCurrentUrlEquals
|
|
1389
1390
|
|
|
@@ -1398,7 +1399,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1398
1399
|
|
|
1399
1400
|
#### Parameters
|
|
1400
1401
|
|
|
1401
|
-
- `url` **[string][
|
|
1402
|
+
- `url` **[string][10]** value to check.
|
|
1402
1403
|
|
|
1403
1404
|
### seeElement
|
|
1404
1405
|
|
|
@@ -1411,7 +1412,7 @@ I.seeElement('#modal');
|
|
|
1411
1412
|
|
|
1412
1413
|
#### Parameters
|
|
1413
1414
|
|
|
1414
|
-
- `locator` **([string][
|
|
1415
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1415
1416
|
|
|
1416
1417
|
### seeElementInDOM
|
|
1417
1418
|
|
|
@@ -1424,7 +1425,7 @@ I.seeElementInDOM('#modal');
|
|
|
1424
1425
|
|
|
1425
1426
|
#### Parameters
|
|
1426
1427
|
|
|
1427
|
-
- `locator` **([string][
|
|
1428
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1428
1429
|
|
|
1429
1430
|
### seeInCurrentUrl
|
|
1430
1431
|
|
|
@@ -1436,7 +1437,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1436
1437
|
|
|
1437
1438
|
#### Parameters
|
|
1438
1439
|
|
|
1439
|
-
- `url` **[string][
|
|
1440
|
+
- `url` **[string][10]** a fragment to check
|
|
1440
1441
|
|
|
1441
1442
|
### seeInField
|
|
1442
1443
|
|
|
@@ -1452,8 +1453,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1452
1453
|
|
|
1453
1454
|
#### Parameters
|
|
1454
1455
|
|
|
1455
|
-
- `field` **([string][
|
|
1456
|
-
- `value` **[string][
|
|
1456
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1457
|
+
- `value` **[string][10]** value to check.
|
|
1457
1458
|
|
|
1458
1459
|
### seeInPopup
|
|
1459
1460
|
|
|
@@ -1466,7 +1467,7 @@ I.seeInPopup('Popup text');
|
|
|
1466
1467
|
|
|
1467
1468
|
#### Parameters
|
|
1468
1469
|
|
|
1469
|
-
- `text` **[string][
|
|
1470
|
+
- `text` **[string][10]** value to check.
|
|
1470
1471
|
|
|
1471
1472
|
### seeInSource
|
|
1472
1473
|
|
|
@@ -1478,7 +1479,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1478
1479
|
|
|
1479
1480
|
#### Parameters
|
|
1480
1481
|
|
|
1481
|
-
- `text` **[string][
|
|
1482
|
+
- `text` **[string][10]** value to check.
|
|
1482
1483
|
|
|
1483
1484
|
### seeInTitle
|
|
1484
1485
|
|
|
@@ -1490,7 +1491,7 @@ I.seeInTitle('Home Page');
|
|
|
1490
1491
|
|
|
1491
1492
|
#### Parameters
|
|
1492
1493
|
|
|
1493
|
-
- `text` **[string][
|
|
1494
|
+
- `text` **[string][10]** text value to check.
|
|
1494
1495
|
|
|
1495
1496
|
### seeNumberOfElements
|
|
1496
1497
|
|
|
@@ -1503,8 +1504,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1503
1504
|
|
|
1504
1505
|
#### Parameters
|
|
1505
1506
|
|
|
1506
|
-
- `locator` **([string][
|
|
1507
|
-
- `num` **[number][
|
|
1507
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1508
|
+
- `num` **[number][11]** number of elements.
|
|
1508
1509
|
|
|
1509
1510
|
### seeNumberOfVisibleElements
|
|
1510
1511
|
|
|
@@ -1517,8 +1518,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1517
1518
|
|
|
1518
1519
|
#### Parameters
|
|
1519
1520
|
|
|
1520
|
-
- `locator` **([string][
|
|
1521
|
-
- `num` **[number][
|
|
1521
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1522
|
+
- `num` **[number][11]** number of elements.
|
|
1522
1523
|
|
|
1523
1524
|
### seeTextEquals
|
|
1524
1525
|
|
|
@@ -1530,8 +1531,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1530
1531
|
|
|
1531
1532
|
#### Parameters
|
|
1532
1533
|
|
|
1533
|
-
- `text` **[string][
|
|
1534
|
-
- `context` **([string][
|
|
1534
|
+
- `text` **[string][10]** element value to check.
|
|
1535
|
+
- `context` **([string][10] | [object][8])?** element located by CSS|XPath|strict locator.
|
|
1535
1536
|
|
|
1536
1537
|
### seeTitleEquals
|
|
1537
1538
|
|
|
@@ -1543,7 +1544,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1543
1544
|
|
|
1544
1545
|
#### Parameters
|
|
1545
1546
|
|
|
1546
|
-
- `text` **[string][
|
|
1547
|
+
- `text` **[string][10]** value to check.
|
|
1547
1548
|
|
|
1548
1549
|
### selectOption
|
|
1549
1550
|
|
|
@@ -1568,8 +1569,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1568
1569
|
|
|
1569
1570
|
#### Parameters
|
|
1570
1571
|
|
|
1571
|
-
- `select` **([string][
|
|
1572
|
-
- `option` **([string][
|
|
1572
|
+
- `select` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1573
|
+
- `option` **([string][10] | [Array][14]<any>)** visible text or value of option.
|
|
1573
1574
|
|
|
1574
1575
|
### setCookie
|
|
1575
1576
|
|
|
@@ -1589,7 +1590,7 @@ I.setCookie([
|
|
|
1589
1590
|
|
|
1590
1591
|
#### Parameters
|
|
1591
1592
|
|
|
1592
|
-
- `cookie` **(Cookie | [Array][
|
|
1593
|
+
- `cookie` **(Cookie | [Array][14]<Cookie>)** a cookie object or array of cookie objects.
|
|
1593
1594
|
|
|
1594
1595
|
### stopMockingRoute
|
|
1595
1596
|
|
|
@@ -1604,8 +1605,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1604
1605
|
|
|
1605
1606
|
#### Parameters
|
|
1606
1607
|
|
|
1607
|
-
- `url` **[string][
|
|
1608
|
-
- `handler` **[function][
|
|
1608
|
+
- `url` **[string][10]?** URL, regex or pattern for to match URL
|
|
1609
|
+
- `handler` **[function][12]?** a function to process request
|
|
1609
1610
|
|
|
1610
1611
|
### switchTo
|
|
1611
1612
|
|
|
@@ -1618,7 +1619,7 @@ I.switchTo(); // switch back to main page
|
|
|
1618
1619
|
|
|
1619
1620
|
#### Parameters
|
|
1620
1621
|
|
|
1621
|
-
- `locator` **([string][
|
|
1622
|
+
- `locator` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1622
1623
|
|
|
1623
1624
|
### switchToNextTab
|
|
1624
1625
|
|
|
@@ -1631,7 +1632,7 @@ I.switchToNextTab(2);
|
|
|
1631
1632
|
|
|
1632
1633
|
#### Parameters
|
|
1633
1634
|
|
|
1634
|
-
- `num` **[number][
|
|
1635
|
+
- `num` **[number][11]**
|
|
1635
1636
|
|
|
1636
1637
|
### switchToPreviousTab
|
|
1637
1638
|
|
|
@@ -1644,13 +1645,13 @@ I.switchToPreviousTab(2);
|
|
|
1644
1645
|
|
|
1645
1646
|
#### Parameters
|
|
1646
1647
|
|
|
1647
|
-
- `num` **[number][
|
|
1648
|
+
- `num` **[number][11]**
|
|
1648
1649
|
|
|
1649
1650
|
### type
|
|
1650
1651
|
|
|
1651
1652
|
Types out the given text into an active field.
|
|
1652
1653
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1653
|
-
_Note:_ Should be used when [`fillField`][
|
|
1654
|
+
_Note:_ Should be used when [`fillField`][19] is not an option.
|
|
1654
1655
|
|
|
1655
1656
|
```js
|
|
1656
1657
|
// passing in a string
|
|
@@ -1666,8 +1667,8 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1666
1667
|
#### Parameters
|
|
1667
1668
|
|
|
1668
1669
|
- `keys`
|
|
1669
|
-
- `delay` **[number][
|
|
1670
|
-
- `key` **([string][
|
|
1670
|
+
- `delay` **[number][11]?** (optional) delay in ms between key presses
|
|
1671
|
+
- `key` **([string][10] | [Array][14]<[string][10]>)** or array of keys to type.
|
|
1671
1672
|
|
|
1672
1673
|
### uncheckOption
|
|
1673
1674
|
|
|
@@ -1684,8 +1685,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1684
1685
|
|
|
1685
1686
|
#### Parameters
|
|
1686
1687
|
|
|
1687
|
-
- `field` **([string][
|
|
1688
|
-
- `context` **([string][
|
|
1688
|
+
- `field` **([string][10] | [object][8])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1689
|
+
- `context` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1689
1690
|
|
|
1690
1691
|
### usePlaywrightTo
|
|
1691
1692
|
|
|
@@ -1694,18 +1695,18 @@ Use Playwright API inside a test.
|
|
|
1694
1695
|
First argument is a description of an action.
|
|
1695
1696
|
Second argument is async function that gets this helper as parameter.
|
|
1696
1697
|
|
|
1697
|
-
{ [`page`][
|
|
1698
|
+
{ [`page`][23], [`context`][24] [`browser`][25] } objects from Playwright API are available.
|
|
1698
1699
|
|
|
1699
1700
|
```js
|
|
1700
|
-
I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
1701
|
+
I.usePlaywrightTo('emulate offline mode', async ({ context }) => {
|
|
1701
1702
|
await context.setOffline(true);
|
|
1702
1703
|
});
|
|
1703
1704
|
```
|
|
1704
1705
|
|
|
1705
1706
|
#### Parameters
|
|
1706
1707
|
|
|
1707
|
-
- `description` **[string][
|
|
1708
|
-
- `fn` **[function][
|
|
1708
|
+
- `description` **[string][10]** used to show in logs.
|
|
1709
|
+
- `fn` **[function][12]** async functuion that executed with Playwright helper as argument
|
|
1709
1710
|
|
|
1710
1711
|
### wait
|
|
1711
1712
|
|
|
@@ -1717,7 +1718,7 @@ I.wait(2); // wait 2 secs
|
|
|
1717
1718
|
|
|
1718
1719
|
#### Parameters
|
|
1719
1720
|
|
|
1720
|
-
- `sec` **[number][
|
|
1721
|
+
- `sec` **[number][11]** number of second to wait.
|
|
1721
1722
|
|
|
1722
1723
|
### waitForClickable
|
|
1723
1724
|
|
|
@@ -1731,9 +1732,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1731
1732
|
|
|
1732
1733
|
#### Parameters
|
|
1733
1734
|
|
|
1734
|
-
- `locator` **([string][
|
|
1735
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1735
1736
|
- `waitTimeout`
|
|
1736
|
-
- `sec` **[number][
|
|
1737
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1737
1738
|
|
|
1738
1739
|
### waitForDetached
|
|
1739
1740
|
|
|
@@ -1746,8 +1747,8 @@ I.waitForDetached('#popup');
|
|
|
1746
1747
|
|
|
1747
1748
|
#### Parameters
|
|
1748
1749
|
|
|
1749
|
-
- `locator` **([string][
|
|
1750
|
-
- `sec` **[number][
|
|
1750
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1751
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1751
1752
|
|
|
1752
1753
|
### waitForElement
|
|
1753
1754
|
|
|
@@ -1761,8 +1762,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1761
1762
|
|
|
1762
1763
|
#### Parameters
|
|
1763
1764
|
|
|
1764
|
-
- `locator` **([string][
|
|
1765
|
-
- `sec` **[number][
|
|
1765
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1766
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1766
1767
|
|
|
1767
1768
|
### waitForEnabled
|
|
1768
1769
|
|
|
@@ -1771,8 +1772,8 @@ Element can be located by CSS or XPath.
|
|
|
1771
1772
|
|
|
1772
1773
|
#### Parameters
|
|
1773
1774
|
|
|
1774
|
-
- `locator` **([string][
|
|
1775
|
-
- `sec` **[number][
|
|
1775
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1776
|
+
- `sec` **[number][11]** (optional) time in seconds to wait, 1 by default.
|
|
1776
1777
|
|
|
1777
1778
|
### waitForFunction
|
|
1778
1779
|
|
|
@@ -1791,9 +1792,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1791
1792
|
|
|
1792
1793
|
#### Parameters
|
|
1793
1794
|
|
|
1794
|
-
- `fn` **([string][
|
|
1795
|
-
- `argsOrSec` **([Array][
|
|
1796
|
-
- `sec` **[number][
|
|
1795
|
+
- `fn` **([string][10] | [function][12])** to be executed in browser context.
|
|
1796
|
+
- `argsOrSec` **([Array][14]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
1797
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1797
1798
|
|
|
1798
1799
|
### waitForInvisible
|
|
1799
1800
|
|
|
@@ -1806,14 +1807,14 @@ I.waitForInvisible('#popup');
|
|
|
1806
1807
|
|
|
1807
1808
|
#### Parameters
|
|
1808
1809
|
|
|
1809
|
-
- `locator` **([string][
|
|
1810
|
-
- `sec` **[number][
|
|
1810
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1811
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1811
1812
|
|
|
1812
1813
|
### waitForNavigation
|
|
1813
1814
|
|
|
1814
1815
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1815
1816
|
|
|
1816
|
-
See [Playwright's reference][
|
|
1817
|
+
See [Playwright's reference][26]
|
|
1817
1818
|
|
|
1818
1819
|
#### Parameters
|
|
1819
1820
|
|
|
@@ -1830,8 +1831,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1830
1831
|
|
|
1831
1832
|
#### Parameters
|
|
1832
1833
|
|
|
1833
|
-
- `urlOrPredicate` **([string][
|
|
1834
|
-
- `sec` **[number][
|
|
1834
|
+
- `urlOrPredicate` **([string][10] | [function][12])**
|
|
1835
|
+
- `sec` **[number][11]?** seconds to wait
|
|
1835
1836
|
|
|
1836
1837
|
### waitForResponse
|
|
1837
1838
|
|
|
@@ -1844,8 +1845,8 @@ I.waitForResponse(response => response.url() === 'https://example.com' && respon
|
|
|
1844
1845
|
|
|
1845
1846
|
#### Parameters
|
|
1846
1847
|
|
|
1847
|
-
- `urlOrPredicate` **([string][
|
|
1848
|
-
- `sec` **[number][
|
|
1848
|
+
- `urlOrPredicate` **([string][10] | [function][12])**
|
|
1849
|
+
- `sec` **[number][11]?** number of seconds to wait
|
|
1849
1850
|
|
|
1850
1851
|
### waitForText
|
|
1851
1852
|
|
|
@@ -1860,9 +1861,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1860
1861
|
|
|
1861
1862
|
#### Parameters
|
|
1862
1863
|
|
|
1863
|
-
- `text` **[string][
|
|
1864
|
-
- `sec` **[number][
|
|
1865
|
-
- `context` **([string][
|
|
1864
|
+
- `text` **[string][10]** to wait for.
|
|
1865
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1866
|
+
- `context` **([string][10] | [object][8])?** (optional) element located by CSS|XPath|strict locator.
|
|
1866
1867
|
|
|
1867
1868
|
### waitForValue
|
|
1868
1869
|
|
|
@@ -1874,9 +1875,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1874
1875
|
|
|
1875
1876
|
#### Parameters
|
|
1876
1877
|
|
|
1877
|
-
- `field` **([string][
|
|
1878
|
-
- `value` **[string][
|
|
1879
|
-
- `sec` **[number][
|
|
1878
|
+
- `field` **([string][10] | [object][8])** input field.
|
|
1879
|
+
- `value` **[string][10]** expected value.
|
|
1880
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1880
1881
|
|
|
1881
1882
|
### waitForVisible
|
|
1882
1883
|
|
|
@@ -1889,8 +1890,8 @@ I.waitForVisible('#popup');
|
|
|
1889
1890
|
|
|
1890
1891
|
#### Parameters
|
|
1891
1892
|
|
|
1892
|
-
- `locator` **([string][
|
|
1893
|
-
- `sec` **[number][
|
|
1893
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1894
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to waitThis method accepts [React selectors][27].
|
|
1894
1895
|
|
|
1895
1896
|
### waitInUrl
|
|
1896
1897
|
|
|
@@ -1902,8 +1903,8 @@ I.waitInUrl('/info', 2);
|
|
|
1902
1903
|
|
|
1903
1904
|
#### Parameters
|
|
1904
1905
|
|
|
1905
|
-
- `urlPart` **[string][
|
|
1906
|
-
- `sec` **[number][
|
|
1906
|
+
- `urlPart` **[string][10]** value to check.
|
|
1907
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1907
1908
|
|
|
1908
1909
|
### waitNumberOfVisibleElements
|
|
1909
1910
|
|
|
@@ -1915,9 +1916,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1915
1916
|
|
|
1916
1917
|
#### Parameters
|
|
1917
1918
|
|
|
1918
|
-
- `locator` **([string][
|
|
1919
|
-
- `num` **[number][
|
|
1920
|
-
- `sec` **[number][
|
|
1919
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1920
|
+
- `num` **[number][11]** number of elements.
|
|
1921
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1921
1922
|
|
|
1922
1923
|
### waitToHide
|
|
1923
1924
|
|
|
@@ -1930,8 +1931,8 @@ I.waitToHide('#popup');
|
|
|
1930
1931
|
|
|
1931
1932
|
#### Parameters
|
|
1932
1933
|
|
|
1933
|
-
- `locator` **([string][
|
|
1934
|
-
- `sec` **[number][
|
|
1934
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1935
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1935
1936
|
|
|
1936
1937
|
### waitUrlEquals
|
|
1937
1938
|
|
|
@@ -1944,57 +1945,59 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1944
1945
|
|
|
1945
1946
|
#### Parameters
|
|
1946
1947
|
|
|
1947
|
-
- `urlPart` **[string][
|
|
1948
|
-
- `sec` **[number][
|
|
1948
|
+
- `urlPart` **[string][10]** value to check.
|
|
1949
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1949
1950
|
|
|
1950
1951
|
[1]: https://github.com/microsoft/playwright
|
|
1951
1952
|
|
|
1952
1953
|
[2]: https://playwright.dev/docs/trace-viewer
|
|
1953
1954
|
|
|
1954
|
-
[3]: https://github.com/microsoft/playwright/blob/
|
|
1955
|
+
[3]: https://github.com/microsoft/playwright/blob/main/docs/api.md#pagewaitfornavigationoptions
|
|
1955
1956
|
|
|
1956
|
-
[4]: https://playwright.dev/docs/
|
|
1957
|
+
[4]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
1957
1958
|
|
|
1958
|
-
[5]: https://playwright.dev/docs/api/class-
|
|
1959
|
+
[5]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
1959
1960
|
|
|
1960
|
-
[6]: https://
|
|
1961
|
+
[6]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
1961
1962
|
|
|
1962
|
-
[7]: https://
|
|
1963
|
+
[7]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
1963
1964
|
|
|
1964
|
-
[8]:
|
|
1965
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1965
1966
|
|
|
1966
|
-
[9]:
|
|
1967
|
+
[9]: http://jster.net/category/windows-modals-popups
|
|
1967
1968
|
|
|
1968
|
-
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1969
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1969
1970
|
|
|
1970
|
-
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1971
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1971
1972
|
|
|
1972
|
-
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
1973
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1973
1974
|
|
|
1974
|
-
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
1975
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1975
1976
|
|
|
1976
|
-
[14]: https://
|
|
1977
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1977
1978
|
|
|
1978
|
-
[15]: https://
|
|
1979
|
+
[15]: https://codecept.io/helpers/FileSystem
|
|
1979
1980
|
|
|
1980
|
-
[16]: https://playwright.dev/docs/
|
|
1981
|
+
[16]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
1981
1982
|
|
|
1982
|
-
[17]: https://
|
|
1983
|
+
[17]: https://playwright.dev/docs/network#handle-requests
|
|
1983
1984
|
|
|
1984
|
-
[18]: #
|
|
1985
|
+
[18]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
1985
1986
|
|
|
1986
|
-
[19]:
|
|
1987
|
+
[19]: #fillfield
|
|
1987
1988
|
|
|
1988
|
-
[20]:
|
|
1989
|
+
[20]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
1989
1990
|
|
|
1990
|
-
[21]:
|
|
1991
|
+
[21]: #click
|
|
1991
1992
|
|
|
1992
|
-
[22]: https://
|
|
1993
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1993
1994
|
|
|
1994
|
-
[23]: https://github.com/microsoft/playwright/blob/
|
|
1995
|
+
[23]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
1995
1996
|
|
|
1996
|
-
[24]: https://github.com/microsoft/playwright/blob/
|
|
1997
|
+
[24]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
1997
1998
|
|
|
1998
|
-
[25]: https://
|
|
1999
|
+
[25]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
1999
2000
|
|
|
2000
|
-
[26]: https://
|
|
2001
|
+
[26]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2002
|
+
|
|
2003
|
+
[27]: https://codecept.io/react
|