codeceptjs 3.0.7 → 3.1.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 +96 -2
- package/README.md +9 -1
- package/bin/codecept.js +27 -17
- package/docs/bdd.md +55 -1
- package/docs/build/Appium.js +76 -4
- package/docs/build/Playwright.js +186 -69
- package/docs/build/Protractor.js +2 -0
- package/docs/build/Puppeteer.js +56 -18
- package/docs/build/REST.js +12 -0
- package/docs/build/WebDriver.js +1 -3
- package/docs/changelog.md +96 -2
- package/docs/commands.md +21 -7
- package/docs/configuration.md +15 -2
- package/docs/helpers/Appium.md +96 -94
- package/docs/helpers/Playwright.md +259 -202
- package/docs/helpers/Puppeteer.md +17 -1
- package/docs/helpers/REST.md +23 -9
- package/docs/helpers/WebDriver.md +2 -2
- package/docs/mobile.md +2 -1
- package/docs/playwright.md +156 -6
- package/docs/plugins.md +61 -69
- package/docs/react.md +1 -1
- package/docs/reports.md +21 -3
- package/lib/actor.js +2 -3
- package/lib/codecept.js +13 -2
- package/lib/command/definitions.js +8 -1
- package/lib/command/run-multiple/collection.js +4 -0
- package/lib/config.js +1 -1
- package/lib/container.js +3 -3
- package/lib/data/dataTableArgument.js +35 -0
- package/lib/helper/Appium.js +49 -4
- package/lib/helper/Playwright.js +186 -69
- package/lib/helper/Protractor.js +2 -0
- package/lib/helper/Puppeteer.js +56 -18
- package/lib/helper/REST.js +12 -0
- package/lib/helper/WebDriver.js +1 -3
- package/lib/helper/errors/ConnectionRefused.js +1 -1
- package/lib/helper/extras/Popup.js +1 -1
- package/lib/helper/extras/React.js +44 -32
- package/lib/index.js +2 -0
- package/lib/interfaces/gherkin.js +8 -1
- package/lib/listener/exit.js +2 -4
- package/lib/listener/helpers.js +4 -4
- package/lib/locator.js +7 -0
- package/lib/mochaFactory.js +13 -9
- package/lib/output.js +2 -2
- package/lib/plugin/allure.js +7 -18
- package/lib/plugin/commentStep.js +1 -1
- package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
- package/lib/plugin/customLocator.js +2 -2
- package/lib/plugin/subtitles.js +88 -0
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +5 -3
- package/lib/step.js +4 -2
- package/package.json +4 -3
- package/typings/index.d.ts +2 -0
- package/typings/types.d.ts +158 -18
|
@@ -33,12 +33,14 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
33
33
|
- `restart`: - restart browser between tests.
|
|
34
34
|
- `disableScreenshots`: - don't save screenshot on failure.
|
|
35
35
|
- `emulate`: launch browser in device emulation mode.
|
|
36
|
+
- `video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
37
|
+
- `trace`: record [tracing information][2] with screenshots and snapshots.
|
|
36
38
|
- `fullPageScreenshots` - make full page screenshots on failure.
|
|
37
39
|
- `uniqueScreenshotNames`: - option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
38
40
|
- `keepBrowserState`: - keep browser state between tests when `restart` is set to false.
|
|
39
41
|
- `keepCookies`: - keep cookies between tests when `restart` is set to false.
|
|
40
42
|
- `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
41
|
-
- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][
|
|
43
|
+
- `waitForNavigation`: . When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][3].
|
|
42
44
|
- `pressKeyDelay`: . Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
|
|
43
45
|
- `getPageTimeout` config option to set maximum navigation time in milliseconds.
|
|
44
46
|
- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
|
|
@@ -49,6 +51,22 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
49
51
|
- `chromium`: (optional) pass additional chromium options
|
|
50
52
|
- `electron`: (optional) pass additional electron options
|
|
51
53
|
|
|
54
|
+
#### Video Recording Customization
|
|
55
|
+
|
|
56
|
+
By default, video is saved to `output/video` dir. You can customize this path by passing `dir` option to `recordVideo` option.
|
|
57
|
+
|
|
58
|
+
- `video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
59
|
+
- `keepVideoForPassedTests`: - save videos for passed tests
|
|
60
|
+
- `recordVideo`: [additional options for videos customization][4]
|
|
61
|
+
|
|
62
|
+
#### Trace Recording Customization
|
|
63
|
+
|
|
64
|
+
Trace recording provides a complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
|
|
65
|
+
Traces will be saved to `output/trace`
|
|
66
|
+
|
|
67
|
+
- `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
|
|
68
|
+
- `keepTraceForPassedTests`: - save trace for passed tests
|
|
69
|
+
|
|
52
70
|
#### Example #1: Wait for 0 network connections.
|
|
53
71
|
|
|
54
72
|
```js
|
|
@@ -92,7 +110,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
92
110
|
}
|
|
93
111
|
```
|
|
94
112
|
|
|
95
|
-
#### Example #4: Connect to remote browser by specifying [websocket endpoint][
|
|
113
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][5]
|
|
96
114
|
|
|
97
115
|
```js
|
|
98
116
|
{
|
|
@@ -100,7 +118,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
100
118
|
Playwright: {
|
|
101
119
|
url: "http://localhost",
|
|
102
120
|
chromium: {
|
|
103
|
-
browserWSEndpoint:
|
|
121
|
+
browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a'
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
}
|
|
@@ -109,7 +127,7 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
109
127
|
|
|
110
128
|
#### Example #5: Testing with Chromium extensions
|
|
111
129
|
|
|
112
|
-
[official docs][
|
|
130
|
+
[official docs][6]
|
|
113
131
|
|
|
114
132
|
```js
|
|
115
133
|
{
|
|
@@ -245,13 +263,13 @@ Set current page
|
|
|
245
263
|
|
|
246
264
|
#### Parameters
|
|
247
265
|
|
|
248
|
-
- `page` **[object][
|
|
266
|
+
- `page` **[object][7]** page to set
|
|
249
267
|
|
|
250
268
|
### acceptPopup
|
|
251
269
|
|
|
252
270
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
253
271
|
Don't confuse popups with modal windows, as created by [various
|
|
254
|
-
libraries][
|
|
272
|
+
libraries][8].
|
|
255
273
|
|
|
256
274
|
### amAcceptingPopups
|
|
257
275
|
|
|
@@ -288,7 +306,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
288
306
|
|
|
289
307
|
#### Parameters
|
|
290
308
|
|
|
291
|
-
- `url` **[string][
|
|
309
|
+
- `url` **[string][9]** url path or global url.
|
|
292
310
|
|
|
293
311
|
### appendField
|
|
294
312
|
|
|
@@ -301,8 +319,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
301
319
|
|
|
302
320
|
#### Parameters
|
|
303
321
|
|
|
304
|
-
- `field` **([string][
|
|
305
|
-
- `value` **[string][
|
|
322
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator
|
|
323
|
+
- `value` **[string][9]** text value to append.
|
|
306
324
|
|
|
307
325
|
### attachFile
|
|
308
326
|
|
|
@@ -317,8 +335,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
317
335
|
|
|
318
336
|
#### Parameters
|
|
319
337
|
|
|
320
|
-
- `locator` **([string][
|
|
321
|
-
- `pathToFile` **[string][
|
|
338
|
+
- `locator` **([string][9] | [object][7])** field located by label|name|CSS|XPath|strict locator.
|
|
339
|
+
- `pathToFile` **[string][9]** local file path relative to codecept.json config file.
|
|
322
340
|
|
|
323
341
|
### cancelPopup
|
|
324
342
|
|
|
@@ -339,8 +357,8 @@ I.checkOption('agree', '//form');
|
|
|
339
357
|
|
|
340
358
|
#### Parameters
|
|
341
359
|
|
|
342
|
-
- `field` **([string][
|
|
343
|
-
- `context` **([string][
|
|
360
|
+
- `field` **([string][9] | [object][7])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
361
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
344
362
|
|
|
345
363
|
### clearCookie
|
|
346
364
|
|
|
@@ -354,7 +372,7 @@ I.clearCookie('test');
|
|
|
354
372
|
|
|
355
373
|
#### Parameters
|
|
356
374
|
|
|
357
|
-
- `cookie` **[string][
|
|
375
|
+
- `cookie` **[string][9]?** (optional, `null` by default) cookie name
|
|
358
376
|
|
|
359
377
|
### clearField
|
|
360
378
|
|
|
@@ -369,7 +387,7 @@ I.clearField('#email');
|
|
|
369
387
|
#### Parameters
|
|
370
388
|
|
|
371
389
|
- `field`
|
|
372
|
-
- `editable` **([string][
|
|
390
|
+
- `editable` **([string][9] | [object][7])** field located by label|name|CSS|XPath|strict locator.
|
|
373
391
|
|
|
374
392
|
### click
|
|
375
393
|
|
|
@@ -397,8 +415,8 @@ I.click({css: 'nav a.login'});
|
|
|
397
415
|
|
|
398
416
|
#### Parameters
|
|
399
417
|
|
|
400
|
-
- `locator` **([string][
|
|
401
|
-
- `context` **([string][
|
|
418
|
+
- `locator` **([string][9] | [object][7])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
419
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
402
420
|
|
|
403
421
|
### clickLink
|
|
404
422
|
|
|
@@ -437,8 +455,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
437
455
|
|
|
438
456
|
#### Parameters
|
|
439
457
|
|
|
440
|
-
- `text` **[string][
|
|
441
|
-
- `context` **([string][
|
|
458
|
+
- `text` **[string][9]** which is not present.
|
|
459
|
+
- `context` **([string][9] | [object][7])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
442
460
|
|
|
443
461
|
### dontSeeCheckboxIsChecked
|
|
444
462
|
|
|
@@ -452,7 +470,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
452
470
|
|
|
453
471
|
#### Parameters
|
|
454
472
|
|
|
455
|
-
- `field` **([string][
|
|
473
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
456
474
|
|
|
457
475
|
### dontSeeCookie
|
|
458
476
|
|
|
@@ -464,7 +482,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
464
482
|
|
|
465
483
|
#### Parameters
|
|
466
484
|
|
|
467
|
-
- `name` **[string][
|
|
485
|
+
- `name` **[string][9]** cookie name.
|
|
468
486
|
|
|
469
487
|
### dontSeeCurrentUrlEquals
|
|
470
488
|
|
|
@@ -478,7 +496,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
478
496
|
|
|
479
497
|
#### Parameters
|
|
480
498
|
|
|
481
|
-
- `url` **[string][
|
|
499
|
+
- `url` **[string][9]** value to check.
|
|
482
500
|
|
|
483
501
|
### dontSeeElement
|
|
484
502
|
|
|
@@ -490,7 +508,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
490
508
|
|
|
491
509
|
#### Parameters
|
|
492
510
|
|
|
493
|
-
- `locator` **([string][
|
|
511
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|Strict locator.
|
|
494
512
|
|
|
495
513
|
### dontSeeElementInDOM
|
|
496
514
|
|
|
@@ -502,7 +520,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
502
520
|
|
|
503
521
|
#### Parameters
|
|
504
522
|
|
|
505
|
-
- `locator` **([string][
|
|
523
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|Strict locator.
|
|
506
524
|
|
|
507
525
|
### dontSeeInCurrentUrl
|
|
508
526
|
|
|
@@ -510,7 +528,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
510
528
|
|
|
511
529
|
#### Parameters
|
|
512
530
|
|
|
513
|
-
- `url` **[string][
|
|
531
|
+
- `url` **[string][9]** value to check.
|
|
514
532
|
|
|
515
533
|
### dontSeeInField
|
|
516
534
|
|
|
@@ -524,8 +542,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
524
542
|
|
|
525
543
|
#### Parameters
|
|
526
544
|
|
|
527
|
-
- `field` **([string][
|
|
528
|
-
- `value` **[string][
|
|
545
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
546
|
+
- `value` **[string][9]** value to check.
|
|
529
547
|
|
|
530
548
|
### dontSeeInSource
|
|
531
549
|
|
|
@@ -538,7 +556,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
538
556
|
#### Parameters
|
|
539
557
|
|
|
540
558
|
- `text`
|
|
541
|
-
- `value` **[string][
|
|
559
|
+
- `value` **[string][9]** to check.
|
|
542
560
|
|
|
543
561
|
### dontSeeInTitle
|
|
544
562
|
|
|
@@ -550,7 +568,7 @@ I.dontSeeInTitle('Error');
|
|
|
550
568
|
|
|
551
569
|
#### Parameters
|
|
552
570
|
|
|
553
|
-
- `text` **[string][
|
|
571
|
+
- `text` **[string][9]** value to check.
|
|
554
572
|
|
|
555
573
|
### doubleClick
|
|
556
574
|
|
|
@@ -566,8 +584,8 @@ I.doubleClick('.btn.edit');
|
|
|
566
584
|
|
|
567
585
|
#### Parameters
|
|
568
586
|
|
|
569
|
-
- `locator` **([string][
|
|
570
|
-
- `context` **([string][
|
|
587
|
+
- `locator` **([string][9] | [object][7])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
588
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
571
589
|
|
|
572
590
|
### dragAndDrop
|
|
573
591
|
|
|
@@ -579,8 +597,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
579
597
|
|
|
580
598
|
#### Parameters
|
|
581
599
|
|
|
582
|
-
- `srcElement` **([string][
|
|
583
|
-
- `destElement` **([string][
|
|
600
|
+
- `srcElement` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
601
|
+
- `destElement` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
584
602
|
|
|
585
603
|
### dragSlider
|
|
586
604
|
|
|
@@ -594,8 +612,8 @@ I.dragSlider('#slider', -70);
|
|
|
594
612
|
|
|
595
613
|
#### Parameters
|
|
596
614
|
|
|
597
|
-
- `locator` **([string][
|
|
598
|
-
- `offsetX` **[number][
|
|
615
|
+
- `locator` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
616
|
+
- `offsetX` **[number][10]** position to drag.
|
|
599
617
|
|
|
600
618
|
### executeScript
|
|
601
619
|
|
|
@@ -622,10 +640,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
622
640
|
|
|
623
641
|
#### Parameters
|
|
624
642
|
|
|
625
|
-
- `fn` **([string][
|
|
643
|
+
- `fn` **([string][9] | [function][11])** function to be executed in browser context.
|
|
626
644
|
- `arg` **any?** optional argument to pass to the function
|
|
627
645
|
|
|
628
|
-
Returns **[Promise][
|
|
646
|
+
Returns **[Promise][12]<any>**
|
|
629
647
|
|
|
630
648
|
### fillField
|
|
631
649
|
|
|
@@ -645,8 +663,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
645
663
|
|
|
646
664
|
#### Parameters
|
|
647
665
|
|
|
648
|
-
- `field` **([string][
|
|
649
|
-
- `value` **([string][
|
|
666
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
667
|
+
- `value` **([string][9] | [object][7])** text value to fill.
|
|
650
668
|
|
|
651
669
|
### forceClick
|
|
652
670
|
|
|
@@ -677,8 +695,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
677
695
|
|
|
678
696
|
#### Parameters
|
|
679
697
|
|
|
680
|
-
- `locator` **([string][
|
|
681
|
-
- `context` **([string][
|
|
698
|
+
- `locator` **([string][9] | [object][7])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
699
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
682
700
|
|
|
683
701
|
### grabAttributeFrom
|
|
684
702
|
|
|
@@ -692,10 +710,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
692
710
|
|
|
693
711
|
#### Parameters
|
|
694
712
|
|
|
695
|
-
- `locator` **([string][
|
|
696
|
-
- `attr` **[string][
|
|
713
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
714
|
+
- `attr` **[string][9]** attribute name.
|
|
697
715
|
|
|
698
|
-
Returns **[Promise][
|
|
716
|
+
Returns **[Promise][12]<[string][9]>** attribute value
|
|
699
717
|
|
|
700
718
|
### grabAttributeFromAll
|
|
701
719
|
|
|
@@ -708,10 +726,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
708
726
|
|
|
709
727
|
#### Parameters
|
|
710
728
|
|
|
711
|
-
- `locator` **([string][
|
|
712
|
-
- `attr` **[string][
|
|
729
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
730
|
+
- `attr` **[string][9]** attribute name.
|
|
713
731
|
|
|
714
|
-
Returns **[Promise][
|
|
732
|
+
Returns **[Promise][12]<[Array][13]<[string][9]>>** attribute value
|
|
715
733
|
|
|
716
734
|
### grabBrowserLogs
|
|
717
735
|
|
|
@@ -722,7 +740,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
722
740
|
console.log(JSON.stringify(logs))
|
|
723
741
|
```
|
|
724
742
|
|
|
725
|
-
Returns **[Promise][
|
|
743
|
+
Returns **[Promise][12]<[Array][13]<any>>**
|
|
726
744
|
|
|
727
745
|
### grabCookie
|
|
728
746
|
|
|
@@ -737,9 +755,9 @@ assert(cookie.value, '123456');
|
|
|
737
755
|
|
|
738
756
|
#### Parameters
|
|
739
757
|
|
|
740
|
-
- `name` **[string][
|
|
758
|
+
- `name` **[string][9]?** cookie name.
|
|
741
759
|
|
|
742
|
-
Returns **([Promise][
|
|
760
|
+
Returns **([Promise][12]<[string][9]> | [Promise][12]<[Array][13]<[string][9]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
|
|
743
761
|
|
|
744
762
|
### grabCssPropertyFrom
|
|
745
763
|
|
|
@@ -753,10 +771,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
753
771
|
|
|
754
772
|
#### Parameters
|
|
755
773
|
|
|
756
|
-
- `locator` **([string][
|
|
757
|
-
- `cssProperty` **[string][
|
|
774
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
775
|
+
- `cssProperty` **[string][9]** CSS property name.
|
|
758
776
|
|
|
759
|
-
Returns **[Promise][
|
|
777
|
+
Returns **[Promise][12]<[string][9]>** CSS value
|
|
760
778
|
|
|
761
779
|
### grabCssPropertyFromAll
|
|
762
780
|
|
|
@@ -769,10 +787,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
769
787
|
|
|
770
788
|
#### Parameters
|
|
771
789
|
|
|
772
|
-
- `locator` **([string][
|
|
773
|
-
- `cssProperty` **[string][
|
|
790
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
791
|
+
- `cssProperty` **[string][9]** CSS property name.
|
|
774
792
|
|
|
775
|
-
Returns **[Promise][
|
|
793
|
+
Returns **[Promise][12]<[Array][13]<[string][9]>>** CSS value
|
|
776
794
|
|
|
777
795
|
### grabCurrentUrl
|
|
778
796
|
|
|
@@ -784,7 +802,7 @@ let url = await I.grabCurrentUrl();
|
|
|
784
802
|
console.log(`Current URL is [${url}]`);
|
|
785
803
|
```
|
|
786
804
|
|
|
787
|
-
Returns **[Promise][
|
|
805
|
+
Returns **[Promise][12]<[string][9]>** current URL
|
|
788
806
|
|
|
789
807
|
### grabDataFromPerformanceTiming
|
|
790
808
|
|
|
@@ -831,11 +849,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
831
849
|
|
|
832
850
|
#### Parameters
|
|
833
851
|
|
|
834
|
-
- `locator` **([string][
|
|
852
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
835
853
|
- `prop`
|
|
836
|
-
- `elementSize` **[string][
|
|
854
|
+
- `elementSize` **[string][9]?** x, y, width or height of the given element.
|
|
837
855
|
|
|
838
|
-
Returns **([Promise][
|
|
856
|
+
Returns **([Promise][12]<DOMRect> | [Promise][12]<[number][10]>)** Element bounding rectangle
|
|
839
857
|
|
|
840
858
|
### grabHTMLFrom
|
|
841
859
|
|
|
@@ -850,9 +868,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
850
868
|
#### Parameters
|
|
851
869
|
|
|
852
870
|
- `locator`
|
|
853
|
-
- `element` **([string][
|
|
871
|
+
- `element` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
854
872
|
|
|
855
|
-
Returns **[Promise][
|
|
873
|
+
Returns **[Promise][12]<[string][9]>** HTML code for an element
|
|
856
874
|
|
|
857
875
|
### grabHTMLFromAll
|
|
858
876
|
|
|
@@ -866,9 +884,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
866
884
|
#### Parameters
|
|
867
885
|
|
|
868
886
|
- `locator`
|
|
869
|
-
- `element` **([string][
|
|
887
|
+
- `element` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
870
888
|
|
|
871
|
-
Returns **[Promise][
|
|
889
|
+
Returns **[Promise][12]<[Array][13]<[string][9]>>** HTML code for an element
|
|
872
890
|
|
|
873
891
|
### grabNumberOfOpenTabs
|
|
874
892
|
|
|
@@ -879,7 +897,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
879
897
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
880
898
|
```
|
|
881
899
|
|
|
882
|
-
Returns **[Promise][
|
|
900
|
+
Returns **[Promise][12]<[number][10]>** number of open tabs
|
|
883
901
|
|
|
884
902
|
### grabNumberOfVisibleElements
|
|
885
903
|
|
|
@@ -892,9 +910,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
892
910
|
|
|
893
911
|
#### Parameters
|
|
894
912
|
|
|
895
|
-
- `locator` **([string][
|
|
913
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
896
914
|
|
|
897
|
-
Returns **[Promise][
|
|
915
|
+
Returns **[Promise][12]<[number][10]>** number of visible elements
|
|
898
916
|
|
|
899
917
|
### grabPageScrollPosition
|
|
900
918
|
|
|
@@ -905,7 +923,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
905
923
|
let { x, y } = await I.grabPageScrollPosition();
|
|
906
924
|
```
|
|
907
925
|
|
|
908
|
-
Returns **[Promise][
|
|
926
|
+
Returns **[Promise][12]<PageScrollPosition>** scroll position
|
|
909
927
|
|
|
910
928
|
### grabPopupText
|
|
911
929
|
|
|
@@ -915,7 +933,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
915
933
|
await I.grabPopupText();
|
|
916
934
|
```
|
|
917
935
|
|
|
918
|
-
Returns **[Promise][
|
|
936
|
+
Returns **[Promise][12]<([string][9] | null)>**
|
|
919
937
|
|
|
920
938
|
### grabSource
|
|
921
939
|
|
|
@@ -926,7 +944,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
926
944
|
let pageSource = await I.grabSource();
|
|
927
945
|
```
|
|
928
946
|
|
|
929
|
-
Returns **[Promise][
|
|
947
|
+
Returns **[Promise][12]<[string][9]>** source code
|
|
930
948
|
|
|
931
949
|
### grabTextFrom
|
|
932
950
|
|
|
@@ -941,9 +959,9 @@ If multiple elements found returns first element.
|
|
|
941
959
|
|
|
942
960
|
#### Parameters
|
|
943
961
|
|
|
944
|
-
- `locator` **([string][
|
|
962
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
945
963
|
|
|
946
|
-
Returns **[Promise][
|
|
964
|
+
Returns **[Promise][12]<[string][9]>** attribute value
|
|
947
965
|
|
|
948
966
|
### grabTextFromAll
|
|
949
967
|
|
|
@@ -956,9 +974,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
956
974
|
|
|
957
975
|
#### Parameters
|
|
958
976
|
|
|
959
|
-
- `locator` **([string][
|
|
977
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
960
978
|
|
|
961
|
-
Returns **[Promise][
|
|
979
|
+
Returns **[Promise][12]<[Array][13]<[string][9]>>** attribute value
|
|
962
980
|
|
|
963
981
|
### grabTitle
|
|
964
982
|
|
|
@@ -969,7 +987,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
969
987
|
let title = await I.grabTitle();
|
|
970
988
|
```
|
|
971
989
|
|
|
972
|
-
Returns **[Promise][
|
|
990
|
+
Returns **[Promise][12]<[string][9]>** title
|
|
973
991
|
|
|
974
992
|
### grabValueFrom
|
|
975
993
|
|
|
@@ -983,9 +1001,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
983
1001
|
|
|
984
1002
|
#### Parameters
|
|
985
1003
|
|
|
986
|
-
- `locator` **([string][
|
|
1004
|
+
- `locator` **([string][9] | [object][7])** field located by label|name|CSS|XPath|strict locator.
|
|
987
1005
|
|
|
988
|
-
Returns **[Promise][
|
|
1006
|
+
Returns **[Promise][12]<[string][9]>** attribute value
|
|
989
1007
|
|
|
990
1008
|
### grabValueFromAll
|
|
991
1009
|
|
|
@@ -998,16 +1016,16 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
998
1016
|
|
|
999
1017
|
#### Parameters
|
|
1000
1018
|
|
|
1001
|
-
- `locator` **([string][
|
|
1019
|
+
- `locator` **([string][9] | [object][7])** field located by label|name|CSS|XPath|strict locator.
|
|
1002
1020
|
|
|
1003
|
-
Returns **[Promise][
|
|
1021
|
+
Returns **[Promise][12]<[Array][13]<[string][9]>>** attribute value
|
|
1004
1022
|
|
|
1005
1023
|
### handleDownloads
|
|
1006
1024
|
|
|
1007
1025
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
1008
1026
|
Files are saved to "output" directory.
|
|
1009
1027
|
|
|
1010
|
-
Should be used with [FileSystem helper][
|
|
1028
|
+
Should be used with [FileSystem helper][14] to check that file were downloaded correctly.
|
|
1011
1029
|
|
|
1012
1030
|
```js
|
|
1013
1031
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1018,7 +1036,7 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1018
1036
|
|
|
1019
1037
|
#### Parameters
|
|
1020
1038
|
|
|
1021
|
-
- `fileName` **[string][
|
|
1039
|
+
- `fileName` **[string][9]?** set filename for downloaded file
|
|
1022
1040
|
|
|
1023
1041
|
### haveRequestHeaders
|
|
1024
1042
|
|
|
@@ -1032,7 +1050,22 @@ I.haveRequestHeaders({
|
|
|
1032
1050
|
|
|
1033
1051
|
#### Parameters
|
|
1034
1052
|
|
|
1035
|
-
- `customHeaders` **[object][
|
|
1053
|
+
- `customHeaders` **[object][7]** headers to set
|
|
1054
|
+
|
|
1055
|
+
### mockRoute
|
|
1056
|
+
|
|
1057
|
+
Mocks network request using [`browserContext.route`][15] of Playwright
|
|
1058
|
+
|
|
1059
|
+
```js
|
|
1060
|
+
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][16]
|
|
1064
|
+
|
|
1065
|
+
#### Parameters
|
|
1066
|
+
|
|
1067
|
+
- `url` **[string][9]?** URL, regex or pattern for to match URL
|
|
1068
|
+
- `handler` **[function][11]?** a function to process request
|
|
1036
1069
|
|
|
1037
1070
|
### moveCursorTo
|
|
1038
1071
|
|
|
@@ -1046,9 +1079,9 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1046
1079
|
|
|
1047
1080
|
#### Parameters
|
|
1048
1081
|
|
|
1049
|
-
- `locator` **([string][
|
|
1050
|
-
- `offsetX` **[number][
|
|
1051
|
-
- `offsetY` **[number][
|
|
1082
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
1083
|
+
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
|
|
1084
|
+
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
|
|
1052
1085
|
|
|
1053
1086
|
### openNewTab
|
|
1054
1087
|
|
|
@@ -1058,7 +1091,7 @@ Open new tab and automatically switched to new tab
|
|
|
1058
1091
|
I.openNewTab();
|
|
1059
1092
|
```
|
|
1060
1093
|
|
|
1061
|
-
You can pass in [page options][
|
|
1094
|
+
You can pass in [page options][17] to emulate device on this page
|
|
1062
1095
|
|
|
1063
1096
|
```js
|
|
1064
1097
|
// enable mobile
|
|
@@ -1073,7 +1106,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1073
1106
|
|
|
1074
1107
|
Presses a key in the browser (on a focused element).
|
|
1075
1108
|
|
|
1076
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1109
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][18].
|
|
1077
1110
|
|
|
1078
1111
|
```js
|
|
1079
1112
|
I.pressKey('Backspace');
|
|
@@ -1132,13 +1165,13 @@ Some of the supported key names are:
|
|
|
1132
1165
|
|
|
1133
1166
|
#### Parameters
|
|
1134
1167
|
|
|
1135
|
-
- `key` **([string][
|
|
1168
|
+
- `key` **([string][9] | [Array][13]<[string][9]>)** key or array of keys to press._Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][19]).
|
|
1136
1169
|
|
|
1137
1170
|
### pressKeyDown
|
|
1138
1171
|
|
|
1139
1172
|
Presses a key in the browser and leaves it in a down state.
|
|
1140
1173
|
|
|
1141
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1174
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][20]).
|
|
1142
1175
|
|
|
1143
1176
|
```js
|
|
1144
1177
|
I.pressKeyDown('Control');
|
|
@@ -1148,13 +1181,13 @@ I.pressKeyUp('Control');
|
|
|
1148
1181
|
|
|
1149
1182
|
#### Parameters
|
|
1150
1183
|
|
|
1151
|
-
- `key` **[string][
|
|
1184
|
+
- `key` **[string][9]** name of key to press down.
|
|
1152
1185
|
|
|
1153
1186
|
### pressKeyUp
|
|
1154
1187
|
|
|
1155
1188
|
Releases a key in the browser which was previously set to a down state.
|
|
1156
1189
|
|
|
1157
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1190
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][20]).
|
|
1158
1191
|
|
|
1159
1192
|
```js
|
|
1160
1193
|
I.pressKeyDown('Control');
|
|
@@ -1164,7 +1197,7 @@ I.pressKeyUp('Control');
|
|
|
1164
1197
|
|
|
1165
1198
|
#### Parameters
|
|
1166
1199
|
|
|
1167
|
-
- `key` **[string][
|
|
1200
|
+
- `key` **[string][9]** name of key to release.
|
|
1168
1201
|
|
|
1169
1202
|
### refreshPage
|
|
1170
1203
|
|
|
@@ -1181,8 +1214,8 @@ First parameter can be set to `maximize`.
|
|
|
1181
1214
|
|
|
1182
1215
|
#### Parameters
|
|
1183
1216
|
|
|
1184
|
-
- `width` **[number][
|
|
1185
|
-
- `height` **[number][
|
|
1217
|
+
- `width` **[number][10]** width in pixels or `maximize`.
|
|
1218
|
+
- `height` **[number][10]** height in pixels.Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
1186
1219
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1187
1220
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1188
1221
|
// inside codecept.conf.js
|
|
@@ -1205,8 +1238,8 @@ I.rightClick('Click me', '.context');
|
|
|
1205
1238
|
|
|
1206
1239
|
#### Parameters
|
|
1207
1240
|
|
|
1208
|
-
- `locator` **([string][
|
|
1209
|
-
- `context` **([string][
|
|
1241
|
+
- `locator` **([string][9] | [object][7])** clickable element located by CSS|XPath|strict locator.
|
|
1242
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1210
1243
|
|
|
1211
1244
|
### saveElementScreenshot
|
|
1212
1245
|
|
|
@@ -1219,8 +1252,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1219
1252
|
|
|
1220
1253
|
#### Parameters
|
|
1221
1254
|
|
|
1222
|
-
- `locator` **([string][
|
|
1223
|
-
- `fileName` **[string][
|
|
1255
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1256
|
+
- `fileName` **[string][9]** file name to save.
|
|
1224
1257
|
|
|
1225
1258
|
### saveScreenshot
|
|
1226
1259
|
|
|
@@ -1235,8 +1268,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1235
1268
|
|
|
1236
1269
|
#### Parameters
|
|
1237
1270
|
|
|
1238
|
-
- `fileName` **[string][
|
|
1239
|
-
- `fullPage` **[boolean][
|
|
1271
|
+
- `fileName` **[string][9]** file name to save.
|
|
1272
|
+
- `fullPage` **[boolean][21]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1240
1273
|
|
|
1241
1274
|
### scrollPageToBottom
|
|
1242
1275
|
|
|
@@ -1266,9 +1299,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1266
1299
|
|
|
1267
1300
|
#### Parameters
|
|
1268
1301
|
|
|
1269
|
-
- `locator` **([string][
|
|
1270
|
-
- `offsetX` **[number][
|
|
1271
|
-
- `offsetY` **[number][
|
|
1302
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
1303
|
+
- `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
|
|
1304
|
+
- `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
|
|
1272
1305
|
|
|
1273
1306
|
### see
|
|
1274
1307
|
|
|
@@ -1283,8 +1316,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1283
1316
|
|
|
1284
1317
|
#### Parameters
|
|
1285
1318
|
|
|
1286
|
-
- `text` **[string][
|
|
1287
|
-
- `context` **([string][
|
|
1319
|
+
- `text` **[string][9]** expected on page.
|
|
1320
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1288
1321
|
|
|
1289
1322
|
### seeAttributesOnElements
|
|
1290
1323
|
|
|
@@ -1296,8 +1329,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1296
1329
|
|
|
1297
1330
|
#### Parameters
|
|
1298
1331
|
|
|
1299
|
-
- `locator` **([string][
|
|
1300
|
-
- `attributes` **[object][
|
|
1332
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
1333
|
+
- `attributes` **[object][7]** attributes and their values to check.
|
|
1301
1334
|
|
|
1302
1335
|
### seeCheckboxIsChecked
|
|
1303
1336
|
|
|
@@ -1311,7 +1344,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1311
1344
|
|
|
1312
1345
|
#### Parameters
|
|
1313
1346
|
|
|
1314
|
-
- `field` **([string][
|
|
1347
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
1315
1348
|
|
|
1316
1349
|
### seeCookie
|
|
1317
1350
|
|
|
@@ -1323,7 +1356,7 @@ I.seeCookie('Auth');
|
|
|
1323
1356
|
|
|
1324
1357
|
#### Parameters
|
|
1325
1358
|
|
|
1326
|
-
- `name` **[string][
|
|
1359
|
+
- `name` **[string][9]** cookie name.
|
|
1327
1360
|
|
|
1328
1361
|
### seeCssPropertiesOnElements
|
|
1329
1362
|
|
|
@@ -1335,8 +1368,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1335
1368
|
|
|
1336
1369
|
#### Parameters
|
|
1337
1370
|
|
|
1338
|
-
- `locator` **([string][
|
|
1339
|
-
- `cssProperties` **[object][
|
|
1371
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
1372
|
+
- `cssProperties` **[object][7]** object with CSS properties and their values to check.
|
|
1340
1373
|
|
|
1341
1374
|
### seeCurrentUrlEquals
|
|
1342
1375
|
|
|
@@ -1351,7 +1384,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1351
1384
|
|
|
1352
1385
|
#### Parameters
|
|
1353
1386
|
|
|
1354
|
-
- `url` **[string][
|
|
1387
|
+
- `url` **[string][9]** value to check.
|
|
1355
1388
|
|
|
1356
1389
|
### seeElement
|
|
1357
1390
|
|
|
@@ -1364,7 +1397,7 @@ I.seeElement('#modal');
|
|
|
1364
1397
|
|
|
1365
1398
|
#### Parameters
|
|
1366
1399
|
|
|
1367
|
-
- `locator` **([string][
|
|
1400
|
+
- `locator` **([string][9] | [object][7])** located by CSS|XPath|strict locator.
|
|
1368
1401
|
|
|
1369
1402
|
### seeElementInDOM
|
|
1370
1403
|
|
|
@@ -1377,7 +1410,7 @@ I.seeElementInDOM('#modal');
|
|
|
1377
1410
|
|
|
1378
1411
|
#### Parameters
|
|
1379
1412
|
|
|
1380
|
-
- `locator` **([string][
|
|
1413
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1381
1414
|
|
|
1382
1415
|
### seeInCurrentUrl
|
|
1383
1416
|
|
|
@@ -1389,7 +1422,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1389
1422
|
|
|
1390
1423
|
#### Parameters
|
|
1391
1424
|
|
|
1392
|
-
- `url` **[string][
|
|
1425
|
+
- `url` **[string][9]** a fragment to check
|
|
1393
1426
|
|
|
1394
1427
|
### seeInField
|
|
1395
1428
|
|
|
@@ -1405,8 +1438,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1405
1438
|
|
|
1406
1439
|
#### Parameters
|
|
1407
1440
|
|
|
1408
|
-
- `field` **([string][
|
|
1409
|
-
- `value` **[string][
|
|
1441
|
+
- `field` **([string][9] | [object][7])** located by label|name|CSS|XPath|strict locator.
|
|
1442
|
+
- `value` **[string][9]** value to check.
|
|
1410
1443
|
|
|
1411
1444
|
### seeInPopup
|
|
1412
1445
|
|
|
@@ -1419,7 +1452,7 @@ I.seeInPopup('Popup text');
|
|
|
1419
1452
|
|
|
1420
1453
|
#### Parameters
|
|
1421
1454
|
|
|
1422
|
-
- `text` **[string][
|
|
1455
|
+
- `text` **[string][9]** value to check.
|
|
1423
1456
|
|
|
1424
1457
|
### seeInSource
|
|
1425
1458
|
|
|
@@ -1431,7 +1464,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1431
1464
|
|
|
1432
1465
|
#### Parameters
|
|
1433
1466
|
|
|
1434
|
-
- `text` **[string][
|
|
1467
|
+
- `text` **[string][9]** value to check.
|
|
1435
1468
|
|
|
1436
1469
|
### seeInTitle
|
|
1437
1470
|
|
|
@@ -1443,7 +1476,7 @@ I.seeInTitle('Home Page');
|
|
|
1443
1476
|
|
|
1444
1477
|
#### Parameters
|
|
1445
1478
|
|
|
1446
|
-
- `text` **[string][
|
|
1479
|
+
- `text` **[string][9]** text value to check.
|
|
1447
1480
|
|
|
1448
1481
|
### seeNumberOfElements
|
|
1449
1482
|
|
|
@@ -1456,8 +1489,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1456
1489
|
|
|
1457
1490
|
#### Parameters
|
|
1458
1491
|
|
|
1459
|
-
- `locator` **([string][
|
|
1460
|
-
- `num` **[number][
|
|
1492
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1493
|
+
- `num` **[number][10]** number of elements.
|
|
1461
1494
|
|
|
1462
1495
|
### seeNumberOfVisibleElements
|
|
1463
1496
|
|
|
@@ -1470,8 +1503,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1470
1503
|
|
|
1471
1504
|
#### Parameters
|
|
1472
1505
|
|
|
1473
|
-
- `locator` **([string][
|
|
1474
|
-
- `num` **[number][
|
|
1506
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1507
|
+
- `num` **[number][10]** number of elements.
|
|
1475
1508
|
|
|
1476
1509
|
### seeTextEquals
|
|
1477
1510
|
|
|
@@ -1483,8 +1516,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1483
1516
|
|
|
1484
1517
|
#### Parameters
|
|
1485
1518
|
|
|
1486
|
-
- `text` **[string][
|
|
1487
|
-
- `context` **([string][
|
|
1519
|
+
- `text` **[string][9]** element value to check.
|
|
1520
|
+
- `context` **([string][9] | [object][7])?** element located by CSS|XPath|strict locator.
|
|
1488
1521
|
|
|
1489
1522
|
### seeTitleEquals
|
|
1490
1523
|
|
|
@@ -1496,7 +1529,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1496
1529
|
|
|
1497
1530
|
#### Parameters
|
|
1498
1531
|
|
|
1499
|
-
- `text` **[string][
|
|
1532
|
+
- `text` **[string][9]** value to check.
|
|
1500
1533
|
|
|
1501
1534
|
### selectOption
|
|
1502
1535
|
|
|
@@ -1521,8 +1554,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1521
1554
|
|
|
1522
1555
|
#### Parameters
|
|
1523
1556
|
|
|
1524
|
-
- `select` **([string][
|
|
1525
|
-
- `option` **([string][
|
|
1557
|
+
- `select` **([string][9] | [object][7])** field located by label|name|CSS|XPath|strict locator.
|
|
1558
|
+
- `option` **([string][9] | [Array][13]<any>)** visible text or value of option.
|
|
1526
1559
|
|
|
1527
1560
|
### setCookie
|
|
1528
1561
|
|
|
@@ -1542,7 +1575,23 @@ I.setCookie([
|
|
|
1542
1575
|
|
|
1543
1576
|
#### Parameters
|
|
1544
1577
|
|
|
1545
|
-
- `cookie` **(Cookie | [Array][
|
|
1578
|
+
- `cookie` **(Cookie | [Array][13]<Cookie>)** a cookie object or array of cookie objects.
|
|
1579
|
+
|
|
1580
|
+
### stopMockingRoute
|
|
1581
|
+
|
|
1582
|
+
Stops network mocking created by `mockRoute`.
|
|
1583
|
+
|
|
1584
|
+
```js
|
|
1585
|
+
I.stopMockingRoute(/(.png$)|(.jpg$)/);
|
|
1586
|
+
I.stopMockingRoute(/(.png$)|(.jpg$)/, previouslySetHandler);
|
|
1587
|
+
```
|
|
1588
|
+
|
|
1589
|
+
If no handler is passed, all mock requests for the rote are disabled.
|
|
1590
|
+
|
|
1591
|
+
#### Parameters
|
|
1592
|
+
|
|
1593
|
+
- `url` **[string][9]?** URL, regex or pattern for to match URL
|
|
1594
|
+
- `handler` **[function][11]?** a function to process request
|
|
1546
1595
|
|
|
1547
1596
|
### switchTo
|
|
1548
1597
|
|
|
@@ -1555,7 +1604,7 @@ I.switchTo(); // switch back to main page
|
|
|
1555
1604
|
|
|
1556
1605
|
#### Parameters
|
|
1557
1606
|
|
|
1558
|
-
- `locator` **([string][
|
|
1607
|
+
- `locator` **([string][9]? | [object][7])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1559
1608
|
|
|
1560
1609
|
### switchToNextTab
|
|
1561
1610
|
|
|
@@ -1568,7 +1617,7 @@ I.switchToNextTab(2);
|
|
|
1568
1617
|
|
|
1569
1618
|
#### Parameters
|
|
1570
1619
|
|
|
1571
|
-
- `num` **[number][
|
|
1620
|
+
- `num` **[number][10]**
|
|
1572
1621
|
|
|
1573
1622
|
### switchToPreviousTab
|
|
1574
1623
|
|
|
@@ -1581,13 +1630,13 @@ I.switchToPreviousTab(2);
|
|
|
1581
1630
|
|
|
1582
1631
|
#### Parameters
|
|
1583
1632
|
|
|
1584
|
-
- `num` **[number][
|
|
1633
|
+
- `num` **[number][10]**
|
|
1585
1634
|
|
|
1586
1635
|
### type
|
|
1587
1636
|
|
|
1588
1637
|
Types out the given text into an active field.
|
|
1589
1638
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1590
|
-
_Note:_ Should be used when [`fillField`][
|
|
1639
|
+
_Note:_ Should be used when [`fillField`][18] is not an option.
|
|
1591
1640
|
|
|
1592
1641
|
```js
|
|
1593
1642
|
// passing in a string
|
|
@@ -1603,8 +1652,8 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1603
1652
|
#### Parameters
|
|
1604
1653
|
|
|
1605
1654
|
- `keys`
|
|
1606
|
-
- `delay` **[number][
|
|
1607
|
-
- `key` **([string][
|
|
1655
|
+
- `delay` **[number][10]?** (optional) delay in ms between key presses
|
|
1656
|
+
- `key` **([string][9] | [Array][13]<[string][9]>)** or array of keys to type.
|
|
1608
1657
|
|
|
1609
1658
|
### uncheckOption
|
|
1610
1659
|
|
|
@@ -1621,8 +1670,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1621
1670
|
|
|
1622
1671
|
#### Parameters
|
|
1623
1672
|
|
|
1624
|
-
- `field` **([string][
|
|
1625
|
-
- `context` **([string][
|
|
1673
|
+
- `field` **([string][9] | [object][7])** checkbox located by label | name | CSS | XPath | strict locator.
|
|
1674
|
+
- `context` **([string][9]? | [object][7])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1626
1675
|
|
|
1627
1676
|
### usePlaywrightTo
|
|
1628
1677
|
|
|
@@ -1631,7 +1680,7 @@ Use Playwright API inside a test.
|
|
|
1631
1680
|
First argument is a description of an action.
|
|
1632
1681
|
Second argument is async function that gets this helper as parameter.
|
|
1633
1682
|
|
|
1634
|
-
{ [`page`][
|
|
1683
|
+
{ [`page`][22], [`context`][23] [`browser`][24] } objects from Playwright API are available.
|
|
1635
1684
|
|
|
1636
1685
|
```js
|
|
1637
1686
|
I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
@@ -1641,8 +1690,8 @@ I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
|
1641
1690
|
|
|
1642
1691
|
#### Parameters
|
|
1643
1692
|
|
|
1644
|
-
- `description` **[string][
|
|
1645
|
-
- `fn` **[function][
|
|
1693
|
+
- `description` **[string][9]** used to show in logs.
|
|
1694
|
+
- `fn` **[function][11]** async functuion that executed with Playwright helper as argument
|
|
1646
1695
|
|
|
1647
1696
|
### wait
|
|
1648
1697
|
|
|
@@ -1654,7 +1703,7 @@ I.wait(2); // wait 2 secs
|
|
|
1654
1703
|
|
|
1655
1704
|
#### Parameters
|
|
1656
1705
|
|
|
1657
|
-
- `sec` **[number][
|
|
1706
|
+
- `sec` **[number][10]** number of second to wait.
|
|
1658
1707
|
|
|
1659
1708
|
### waitForClickable
|
|
1660
1709
|
|
|
@@ -1668,9 +1717,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1668
1717
|
|
|
1669
1718
|
#### Parameters
|
|
1670
1719
|
|
|
1671
|
-
- `locator` **([string][
|
|
1720
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1672
1721
|
- `waitTimeout`
|
|
1673
|
-
- `sec` **[number][
|
|
1722
|
+
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
|
|
1674
1723
|
|
|
1675
1724
|
### waitForDetached
|
|
1676
1725
|
|
|
@@ -1683,8 +1732,8 @@ I.waitForDetached('#popup');
|
|
|
1683
1732
|
|
|
1684
1733
|
#### Parameters
|
|
1685
1734
|
|
|
1686
|
-
- `locator` **([string][
|
|
1687
|
-
- `sec` **[number][
|
|
1735
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1736
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1688
1737
|
|
|
1689
1738
|
### waitForElement
|
|
1690
1739
|
|
|
@@ -1698,8 +1747,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1698
1747
|
|
|
1699
1748
|
#### Parameters
|
|
1700
1749
|
|
|
1701
|
-
- `locator` **([string][
|
|
1702
|
-
- `sec` **[number][
|
|
1750
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1751
|
+
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
|
|
1703
1752
|
|
|
1704
1753
|
### waitForEnabled
|
|
1705
1754
|
|
|
@@ -1708,8 +1757,8 @@ Element can be located by CSS or XPath.
|
|
|
1708
1757
|
|
|
1709
1758
|
#### Parameters
|
|
1710
1759
|
|
|
1711
|
-
- `locator` **([string][
|
|
1712
|
-
- `sec` **[number][
|
|
1760
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1761
|
+
- `sec` **[number][10]** (optional) time in seconds to wait, 1 by default.
|
|
1713
1762
|
|
|
1714
1763
|
### waitForFunction
|
|
1715
1764
|
|
|
@@ -1728,9 +1777,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1728
1777
|
|
|
1729
1778
|
#### Parameters
|
|
1730
1779
|
|
|
1731
|
-
- `fn` **([string][
|
|
1732
|
-
- `argsOrSec` **([Array][
|
|
1733
|
-
- `sec` **[number][
|
|
1780
|
+
- `fn` **([string][9] | [function][11])** to be executed in browser context.
|
|
1781
|
+
- `argsOrSec` **([Array][13]<any> | [number][10])?** (optional, `1` by default) arguments for function or seconds.
|
|
1782
|
+
- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
|
|
1734
1783
|
|
|
1735
1784
|
### waitForInvisible
|
|
1736
1785
|
|
|
@@ -1743,14 +1792,14 @@ I.waitForInvisible('#popup');
|
|
|
1743
1792
|
|
|
1744
1793
|
#### Parameters
|
|
1745
1794
|
|
|
1746
|
-
- `locator` **([string][
|
|
1747
|
-
- `sec` **[number][
|
|
1795
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1796
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1748
1797
|
|
|
1749
1798
|
### waitForNavigation
|
|
1750
1799
|
|
|
1751
1800
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1752
1801
|
|
|
1753
|
-
See [Playwright's reference][
|
|
1802
|
+
See [Playwright's reference][25]
|
|
1754
1803
|
|
|
1755
1804
|
#### Parameters
|
|
1756
1805
|
|
|
@@ -1767,8 +1816,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1767
1816
|
|
|
1768
1817
|
#### Parameters
|
|
1769
1818
|
|
|
1770
|
-
- `urlOrPredicate` **([string][
|
|
1771
|
-
- `sec` **[number][
|
|
1819
|
+
- `urlOrPredicate` **([string][9] | [function][11])**
|
|
1820
|
+
- `sec` **[number][10]?** seconds to wait
|
|
1772
1821
|
|
|
1773
1822
|
### waitForResponse
|
|
1774
1823
|
|
|
@@ -1781,8 +1830,8 @@ I.waitForResponse(request => request.url() === 'http://example.com' && request.m
|
|
|
1781
1830
|
|
|
1782
1831
|
#### Parameters
|
|
1783
1832
|
|
|
1784
|
-
- `urlOrPredicate` **([string][
|
|
1785
|
-
- `sec` **[number][
|
|
1833
|
+
- `urlOrPredicate` **([string][9] | [function][11])**
|
|
1834
|
+
- `sec` **[number][10]?** number of seconds to wait
|
|
1786
1835
|
|
|
1787
1836
|
### waitForText
|
|
1788
1837
|
|
|
@@ -1797,9 +1846,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1797
1846
|
|
|
1798
1847
|
#### Parameters
|
|
1799
1848
|
|
|
1800
|
-
- `text` **[string][
|
|
1801
|
-
- `sec` **[number][
|
|
1802
|
-
- `context` **([string][
|
|
1849
|
+
- `text` **[string][9]** to wait for.
|
|
1850
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1851
|
+
- `context` **([string][9] | [object][7])?** (optional) element located by CSS|XPath|strict locator.
|
|
1803
1852
|
|
|
1804
1853
|
### waitForValue
|
|
1805
1854
|
|
|
@@ -1811,9 +1860,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1811
1860
|
|
|
1812
1861
|
#### Parameters
|
|
1813
1862
|
|
|
1814
|
-
- `field` **([string][
|
|
1815
|
-
- `value` **[string][
|
|
1816
|
-
- `sec` **[number][
|
|
1863
|
+
- `field` **([string][9] | [object][7])** input field.
|
|
1864
|
+
- `value` **[string][9]** expected value.
|
|
1865
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1817
1866
|
|
|
1818
1867
|
### waitForVisible
|
|
1819
1868
|
|
|
@@ -1826,8 +1875,8 @@ I.waitForVisible('#popup');
|
|
|
1826
1875
|
|
|
1827
1876
|
#### Parameters
|
|
1828
1877
|
|
|
1829
|
-
- `locator` **([string][
|
|
1830
|
-
- `sec` **[number][
|
|
1878
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1879
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to waitThis method accepts [React selectors][26].
|
|
1831
1880
|
|
|
1832
1881
|
### waitInUrl
|
|
1833
1882
|
|
|
@@ -1839,8 +1888,8 @@ I.waitInUrl('/info', 2);
|
|
|
1839
1888
|
|
|
1840
1889
|
#### Parameters
|
|
1841
1890
|
|
|
1842
|
-
- `urlPart` **[string][
|
|
1843
|
-
- `sec` **[number][
|
|
1891
|
+
- `urlPart` **[string][9]** value to check.
|
|
1892
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1844
1893
|
|
|
1845
1894
|
### waitNumberOfVisibleElements
|
|
1846
1895
|
|
|
@@ -1852,9 +1901,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1852
1901
|
|
|
1853
1902
|
#### Parameters
|
|
1854
1903
|
|
|
1855
|
-
- `locator` **([string][
|
|
1856
|
-
- `num` **[number][
|
|
1857
|
-
- `sec` **[number][
|
|
1904
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1905
|
+
- `num` **[number][10]** number of elements.
|
|
1906
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1858
1907
|
|
|
1859
1908
|
### waitToHide
|
|
1860
1909
|
|
|
@@ -1867,8 +1916,8 @@ I.waitToHide('#popup');
|
|
|
1867
1916
|
|
|
1868
1917
|
#### Parameters
|
|
1869
1918
|
|
|
1870
|
-
- `locator` **([string][
|
|
1871
|
-
- `sec` **[number][
|
|
1919
|
+
- `locator` **([string][9] | [object][7])** element located by CSS|XPath|strict locator.
|
|
1920
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1872
1921
|
|
|
1873
1922
|
### waitUntil
|
|
1874
1923
|
|
|
@@ -1881,10 +1930,10 @@ I.waitUntil(() => window.requests == 0, 5);
|
|
|
1881
1930
|
|
|
1882
1931
|
#### Parameters
|
|
1883
1932
|
|
|
1884
|
-
- `fn` **([function][
|
|
1885
|
-
- `sec` **[number][
|
|
1886
|
-
- `timeoutMsg` **[string][
|
|
1887
|
-
- `interval` **[number][
|
|
1933
|
+
- `fn` **([function][11] | [string][9])** function which is executed in browser context.
|
|
1934
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1935
|
+
- `timeoutMsg` **[string][9]** message to show in case of timeout fail.
|
|
1936
|
+
- `interval` **[number][10]?**
|
|
1888
1937
|
|
|
1889
1938
|
### waitUrlEquals
|
|
1890
1939
|
|
|
@@ -1897,49 +1946,57 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1897
1946
|
|
|
1898
1947
|
#### Parameters
|
|
1899
1948
|
|
|
1900
|
-
- `urlPart` **[string][
|
|
1901
|
-
- `sec` **[number][
|
|
1949
|
+
- `urlPart` **[string][9]** value to check.
|
|
1950
|
+
- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
|
|
1902
1951
|
|
|
1903
1952
|
[1]: https://github.com/microsoft/playwright
|
|
1904
1953
|
|
|
1905
|
-
[2]: https://
|
|
1954
|
+
[2]: https://playwright.dev/docs/trace-viewer
|
|
1955
|
+
|
|
1956
|
+
[3]: https://github.com/microsoft/playwright/blob/master/docs/api.md#pagewaitfornavigationoptions
|
|
1957
|
+
|
|
1958
|
+
[4]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
1959
|
+
|
|
1960
|
+
[5]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
1961
|
+
|
|
1962
|
+
[6]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
1906
1963
|
|
|
1907
|
-
[
|
|
1964
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1908
1965
|
|
|
1909
|
-
[
|
|
1966
|
+
[8]: http://jster.net/category/windows-modals-popups
|
|
1910
1967
|
|
|
1911
|
-
[
|
|
1968
|
+
[9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1912
1969
|
|
|
1913
|
-
[
|
|
1970
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1914
1971
|
|
|
1915
|
-
[
|
|
1972
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1916
1973
|
|
|
1917
|
-
[
|
|
1974
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1918
1975
|
|
|
1919
|
-
[
|
|
1976
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1920
1977
|
|
|
1921
|
-
[
|
|
1978
|
+
[14]: https://codecept.io/helpers/FileSystem
|
|
1922
1979
|
|
|
1923
|
-
[
|
|
1980
|
+
[15]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
1924
1981
|
|
|
1925
|
-
[
|
|
1982
|
+
[16]: https://playwright.dev/docs/network#handle-requests
|
|
1926
1983
|
|
|
1927
|
-
[
|
|
1984
|
+
[17]: https://github.com/microsoft/playwright/blob/master/docs/api.md#browsernewpageoptions
|
|
1928
1985
|
|
|
1929
|
-
[
|
|
1986
|
+
[18]: #fillfield
|
|
1930
1987
|
|
|
1931
|
-
[
|
|
1988
|
+
[19]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
1932
1989
|
|
|
1933
|
-
[
|
|
1990
|
+
[20]: #click
|
|
1934
1991
|
|
|
1935
|
-
[
|
|
1992
|
+
[21]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1936
1993
|
|
|
1937
|
-
[
|
|
1994
|
+
[22]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-page
|
|
1938
1995
|
|
|
1939
|
-
[
|
|
1996
|
+
[23]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-context
|
|
1940
1997
|
|
|
1941
|
-
[
|
|
1998
|
+
[24]: https://github.com/microsoft/playwright/blob/master/docs/api.md#class-browser
|
|
1942
1999
|
|
|
1943
|
-
[
|
|
2000
|
+
[25]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
1944
2001
|
|
|
1945
|
-
[
|
|
2002
|
+
[26]: https://codecept.io/react
|