codeceptjs 3.1.3 → 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 +75 -1
- package/README.md +2 -3
- package/bin/codecept.js +1 -0
- package/docs/advanced.md +99 -61
- package/docs/basics.md +27 -2
- package/docs/bdd.md +2 -2
- package/docs/build/Appium.js +62 -0
- package/docs/build/FileSystem.js +12 -1
- package/docs/build/Playwright.js +37 -33
- package/docs/build/Protractor.js +9 -24
- package/docs/build/Puppeteer.js +10 -28
- package/docs/build/REST.js +1 -0
- package/docs/build/WebDriver.js +2 -24
- package/docs/changelog.md +75 -1
- package/docs/configuration.md +8 -8
- package/docs/custom-helpers.md +2 -37
- package/docs/data.md +9 -9
- package/docs/helpers/Appium.md +240 -198
- package/docs/helpers/FileSystem.md +12 -2
- package/docs/helpers/Playwright.md +226 -225
- package/docs/helpers/Puppeteer.md +1 -17
- package/docs/helpers/REST.md +3 -1
- package/docs/helpers/WebDriver.md +1 -17
- package/docs/installation.md +1 -1
- package/docs/mobile-react-native-locators.md +3 -0
- package/docs/mobile.md +11 -11
- package/docs/nightmare.md +3 -3
- package/docs/pageobjects.md +2 -0
- package/docs/playwright.md +4 -4
- package/docs/plugins.md +138 -9
- package/docs/puppeteer.md +5 -5
- package/docs/reports.md +3 -3
- 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/actor.js +19 -1
- package/lib/cli.js +25 -20
- package/lib/codecept.js +2 -0
- package/lib/command/info.js +1 -1
- package/lib/command/workers/runTests.js +25 -7
- package/lib/config.js +12 -0
- package/lib/container.js +3 -1
- package/lib/helper/Appium.js +62 -0
- package/lib/helper/FileSystem.js +12 -1
- package/lib/helper/Playwright.js +37 -23
- package/lib/helper/Protractor.js +2 -14
- package/lib/helper/Puppeteer.js +3 -18
- package/lib/helper/REST.js +1 -0
- package/lib/helper/WebDriver.js +2 -14
- package/lib/interfaces/featureConfig.js +3 -0
- package/lib/interfaces/scenarioConfig.js +4 -0
- package/lib/listener/steps.js +21 -3
- package/lib/listener/timeout.js +72 -0
- package/lib/locator.js +3 -0
- package/lib/plugin/allure.js +6 -1
- package/lib/plugin/autoLogin.js +1 -1
- package/lib/plugin/retryFailedStep.js +4 -3
- package/lib/plugin/retryTo.js +130 -0
- package/lib/plugin/screenshotOnFail.js +1 -0
- package/lib/plugin/stepByStepReport.js +7 -0
- package/lib/plugin/stepTimeout.js +91 -0
- package/lib/plugin/tryTo.js +6 -0
- package/lib/recorder.js +18 -6
- package/lib/step.js +58 -0
- package/lib/store.js +2 -0
- package/lib/ui.js +2 -2
- package/package.json +4 -6
- package/typings/index.d.ts +8 -1
- package/typings/types.d.ts +149 -164
- package/docs/angular.md +0 -325
- package/docs/helpers/Protractor.md +0 -1658
- package/docs/webapi/waitUntil.mustache +0 -11
- package/typings/Protractor.d.ts +0 -16
|
@@ -47,9 +47,11 @@ This helper should be configured in codecept.json or codecept.conf.js
|
|
|
47
47
|
- `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
48
48
|
- `windowSize`: (optional) default window size. Set a dimension like `640x480`.
|
|
49
49
|
- `userAgent`: (optional) user-agent string.
|
|
50
|
+
- `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
|
|
50
51
|
- `manualStart`: - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
|
|
51
52
|
- `chromium`: (optional) pass additional chromium options
|
|
52
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].
|
|
53
55
|
|
|
54
56
|
#### Video Recording Customization
|
|
55
57
|
|
|
@@ -57,7 +59,7 @@ By default, video is saved to `output/video` dir. You can customize this path by
|
|
|
57
59
|
|
|
58
60
|
- `video`: enables video recording for failed tests; videos are saved into `output/videos` folder
|
|
59
61
|
- `keepVideoForPassedTests`: - save videos for passed tests
|
|
60
|
-
- `recordVideo`: [additional options for videos customization][
|
|
62
|
+
- `recordVideo`: [additional options for videos customization][5]
|
|
61
63
|
|
|
62
64
|
#### Trace Recording Customization
|
|
63
65
|
|
|
@@ -110,7 +112,7 @@ Traces will be saved to `output/trace`
|
|
|
110
112
|
}
|
|
111
113
|
```
|
|
112
114
|
|
|
113
|
-
#### Example #4: Connect to remote browser by specifying [websocket endpoint][
|
|
115
|
+
#### Example #4: Connect to remote browser by specifying [websocket endpoint][6]
|
|
114
116
|
|
|
115
117
|
```js
|
|
116
118
|
{
|
|
@@ -127,7 +129,7 @@ Traces will be saved to `output/trace`
|
|
|
127
129
|
|
|
128
130
|
#### Example #5: Testing with Chromium extensions
|
|
129
131
|
|
|
130
|
-
[official docs][
|
|
132
|
+
[official docs][7]
|
|
131
133
|
|
|
132
134
|
```js
|
|
133
135
|
{
|
|
@@ -162,6 +164,19 @@ const { devices } = require('playwright');
|
|
|
162
164
|
}
|
|
163
165
|
```
|
|
164
166
|
|
|
167
|
+
#### Example #7: Launch test with a specifc user locale
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
{
|
|
171
|
+
helpers: {
|
|
172
|
+
Playwright : {
|
|
173
|
+
url: "http://localhost",
|
|
174
|
+
locale: "fr-FR",
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
165
180
|
Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
|
|
166
181
|
|
|
167
182
|
## Access From Helpers
|
|
@@ -263,13 +278,13 @@ Set current page
|
|
|
263
278
|
|
|
264
279
|
#### Parameters
|
|
265
280
|
|
|
266
|
-
- `page` **[object][
|
|
281
|
+
- `page` **[object][8]** page to set
|
|
267
282
|
|
|
268
283
|
### acceptPopup
|
|
269
284
|
|
|
270
285
|
Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
271
286
|
Don't confuse popups with modal windows, as created by [various
|
|
272
|
-
libraries][
|
|
287
|
+
libraries][9].
|
|
273
288
|
|
|
274
289
|
### amAcceptingPopups
|
|
275
290
|
|
|
@@ -306,7 +321,7 @@ I.amOnPage('/login'); // opens a login page
|
|
|
306
321
|
|
|
307
322
|
#### Parameters
|
|
308
323
|
|
|
309
|
-
- `url` **[string][
|
|
324
|
+
- `url` **[string][10]** url path or global url.
|
|
310
325
|
|
|
311
326
|
### appendField
|
|
312
327
|
|
|
@@ -319,8 +334,8 @@ I.appendField('#myTextField', 'appended');
|
|
|
319
334
|
|
|
320
335
|
#### Parameters
|
|
321
336
|
|
|
322
|
-
- `field` **([string][
|
|
323
|
-
- `value` **[string][
|
|
337
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator
|
|
338
|
+
- `value` **[string][10]** text value to append.
|
|
324
339
|
|
|
325
340
|
### attachFile
|
|
326
341
|
|
|
@@ -335,8 +350,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
335
350
|
|
|
336
351
|
#### Parameters
|
|
337
352
|
|
|
338
|
-
- `locator` **([string][
|
|
339
|
-
- `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.
|
|
340
355
|
|
|
341
356
|
### cancelPopup
|
|
342
357
|
|
|
@@ -357,8 +372,8 @@ I.checkOption('agree', '//form');
|
|
|
357
372
|
|
|
358
373
|
#### Parameters
|
|
359
374
|
|
|
360
|
-
- `field` **([string][
|
|
361
|
-
- `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.
|
|
362
377
|
|
|
363
378
|
### clearCookie
|
|
364
379
|
|
|
@@ -372,7 +387,7 @@ I.clearCookie('test');
|
|
|
372
387
|
|
|
373
388
|
#### Parameters
|
|
374
389
|
|
|
375
|
-
- `cookie` **[string][
|
|
390
|
+
- `cookie` **[string][10]?** (optional, `null` by default) cookie name
|
|
376
391
|
|
|
377
392
|
### clearField
|
|
378
393
|
|
|
@@ -387,7 +402,7 @@ I.clearField('#email');
|
|
|
387
402
|
#### Parameters
|
|
388
403
|
|
|
389
404
|
- `field`
|
|
390
|
-
- `editable` **([string][
|
|
405
|
+
- `editable` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
391
406
|
|
|
392
407
|
### click
|
|
393
408
|
|
|
@@ -415,8 +430,8 @@ I.click({css: 'nav a.login'});
|
|
|
415
430
|
|
|
416
431
|
#### Parameters
|
|
417
432
|
|
|
418
|
-
- `locator` **([string][
|
|
419
|
-
- `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.
|
|
420
435
|
|
|
421
436
|
### clickLink
|
|
422
437
|
|
|
@@ -455,8 +470,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
455
470
|
|
|
456
471
|
#### Parameters
|
|
457
472
|
|
|
458
|
-
- `text` **[string][
|
|
459
|
-
- `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.
|
|
460
475
|
|
|
461
476
|
### dontSeeCheckboxIsChecked
|
|
462
477
|
|
|
@@ -470,7 +485,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
|
470
485
|
|
|
471
486
|
#### Parameters
|
|
472
487
|
|
|
473
|
-
- `field` **([string][
|
|
488
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
474
489
|
|
|
475
490
|
### dontSeeCookie
|
|
476
491
|
|
|
@@ -482,7 +497,7 @@ I.dontSeeCookie('auth'); // no auth cookie
|
|
|
482
497
|
|
|
483
498
|
#### Parameters
|
|
484
499
|
|
|
485
|
-
- `name` **[string][
|
|
500
|
+
- `name` **[string][10]** cookie name.
|
|
486
501
|
|
|
487
502
|
### dontSeeCurrentUrlEquals
|
|
488
503
|
|
|
@@ -496,7 +511,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also
|
|
|
496
511
|
|
|
497
512
|
#### Parameters
|
|
498
513
|
|
|
499
|
-
- `url` **[string][
|
|
514
|
+
- `url` **[string][10]** value to check.
|
|
500
515
|
|
|
501
516
|
### dontSeeElement
|
|
502
517
|
|
|
@@ -508,7 +523,7 @@ I.dontSeeElement('.modal'); // modal is not shown
|
|
|
508
523
|
|
|
509
524
|
#### Parameters
|
|
510
525
|
|
|
511
|
-
- `locator` **([string][
|
|
526
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|Strict locator.
|
|
512
527
|
|
|
513
528
|
### dontSeeElementInDOM
|
|
514
529
|
|
|
@@ -520,7 +535,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or
|
|
|
520
535
|
|
|
521
536
|
#### Parameters
|
|
522
537
|
|
|
523
|
-
- `locator` **([string][
|
|
538
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|Strict locator.
|
|
524
539
|
|
|
525
540
|
### dontSeeInCurrentUrl
|
|
526
541
|
|
|
@@ -528,7 +543,7 @@ Checks that current url does not contain a provided fragment.
|
|
|
528
543
|
|
|
529
544
|
#### Parameters
|
|
530
545
|
|
|
531
|
-
- `url` **[string][
|
|
546
|
+
- `url` **[string][10]** value to check.
|
|
532
547
|
|
|
533
548
|
### dontSeeInField
|
|
534
549
|
|
|
@@ -542,8 +557,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
|
542
557
|
|
|
543
558
|
#### Parameters
|
|
544
559
|
|
|
545
|
-
- `field` **([string][
|
|
546
|
-
- `value` **[string][
|
|
560
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
561
|
+
- `value` **[string][10]** value to check.
|
|
547
562
|
|
|
548
563
|
### dontSeeInSource
|
|
549
564
|
|
|
@@ -556,7 +571,7 @@ I.dontSeeInSource('<!--'); // no comments in source
|
|
|
556
571
|
#### Parameters
|
|
557
572
|
|
|
558
573
|
- `text`
|
|
559
|
-
- `value` **[string][
|
|
574
|
+
- `value` **[string][10]** to check.
|
|
560
575
|
|
|
561
576
|
### dontSeeInTitle
|
|
562
577
|
|
|
@@ -568,7 +583,7 @@ I.dontSeeInTitle('Error');
|
|
|
568
583
|
|
|
569
584
|
#### Parameters
|
|
570
585
|
|
|
571
|
-
- `text` **[string][
|
|
586
|
+
- `text` **[string][10]** value to check.
|
|
572
587
|
|
|
573
588
|
### doubleClick
|
|
574
589
|
|
|
@@ -584,8 +599,8 @@ I.doubleClick('.btn.edit');
|
|
|
584
599
|
|
|
585
600
|
#### Parameters
|
|
586
601
|
|
|
587
|
-
- `locator` **([string][
|
|
588
|
-
- `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.
|
|
589
604
|
|
|
590
605
|
### dragAndDrop
|
|
591
606
|
|
|
@@ -597,8 +612,8 @@ I.dragAndDrop('#dragHandle', '#container');
|
|
|
597
612
|
|
|
598
613
|
#### Parameters
|
|
599
614
|
|
|
600
|
-
- `srcElement` **([string][
|
|
601
|
-
- `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.
|
|
602
617
|
|
|
603
618
|
### dragSlider
|
|
604
619
|
|
|
@@ -612,8 +627,8 @@ I.dragSlider('#slider', -70);
|
|
|
612
627
|
|
|
613
628
|
#### Parameters
|
|
614
629
|
|
|
615
|
-
- `locator` **([string][
|
|
616
|
-
- `offsetX` **[number][
|
|
630
|
+
- `locator` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
631
|
+
- `offsetX` **[number][11]** position to drag.
|
|
617
632
|
|
|
618
633
|
### executeScript
|
|
619
634
|
|
|
@@ -640,10 +655,10 @@ If a function returns a Promise it will wait for its resolution.
|
|
|
640
655
|
|
|
641
656
|
#### Parameters
|
|
642
657
|
|
|
643
|
-
- `fn` **([string][
|
|
658
|
+
- `fn` **([string][10] | [function][12])** function to be executed in browser context.
|
|
644
659
|
- `arg` **any?** optional argument to pass to the function
|
|
645
660
|
|
|
646
|
-
Returns **[Promise][
|
|
661
|
+
Returns **[Promise][13]<any>**
|
|
647
662
|
|
|
648
663
|
### fillField
|
|
649
664
|
|
|
@@ -663,8 +678,8 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
|
663
678
|
|
|
664
679
|
#### Parameters
|
|
665
680
|
|
|
666
|
-
- `field` **([string][
|
|
667
|
-
- `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.
|
|
668
683
|
|
|
669
684
|
### forceClick
|
|
670
685
|
|
|
@@ -695,8 +710,8 @@ I.forceClick({css: 'nav a.login'});
|
|
|
695
710
|
|
|
696
711
|
#### Parameters
|
|
697
712
|
|
|
698
|
-
- `locator` **([string][
|
|
699
|
-
- `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.
|
|
700
715
|
|
|
701
716
|
### grabAttributeFrom
|
|
702
717
|
|
|
@@ -710,10 +725,10 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
710
725
|
|
|
711
726
|
#### Parameters
|
|
712
727
|
|
|
713
|
-
- `locator` **([string][
|
|
714
|
-
- `attr` **[string][
|
|
728
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
729
|
+
- `attr` **[string][10]** attribute name.
|
|
715
730
|
|
|
716
|
-
Returns **[Promise][
|
|
731
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
717
732
|
|
|
718
733
|
### grabAttributeFromAll
|
|
719
734
|
|
|
@@ -726,10 +741,10 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
726
741
|
|
|
727
742
|
#### Parameters
|
|
728
743
|
|
|
729
|
-
- `locator` **([string][
|
|
730
|
-
- `attr` **[string][
|
|
744
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
745
|
+
- `attr` **[string][10]** attribute name.
|
|
731
746
|
|
|
732
|
-
Returns **[Promise][
|
|
747
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
733
748
|
|
|
734
749
|
### grabBrowserLogs
|
|
735
750
|
|
|
@@ -740,7 +755,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
740
755
|
console.log(JSON.stringify(logs))
|
|
741
756
|
```
|
|
742
757
|
|
|
743
|
-
Returns **[Promise][
|
|
758
|
+
Returns **[Promise][13]<[Array][14]<any>>**
|
|
744
759
|
|
|
745
760
|
### grabCookie
|
|
746
761
|
|
|
@@ -755,9 +770,9 @@ assert(cookie.value, '123456');
|
|
|
755
770
|
|
|
756
771
|
#### Parameters
|
|
757
772
|
|
|
758
|
-
- `name` **[string][
|
|
773
|
+
- `name` **[string][10]?** cookie name.
|
|
759
774
|
|
|
760
|
-
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.
|
|
761
776
|
|
|
762
777
|
### grabCssPropertyFrom
|
|
763
778
|
|
|
@@ -771,10 +786,10 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
771
786
|
|
|
772
787
|
#### Parameters
|
|
773
788
|
|
|
774
|
-
- `locator` **([string][
|
|
775
|
-
- `cssProperty` **[string][
|
|
789
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
790
|
+
- `cssProperty` **[string][10]** CSS property name.
|
|
776
791
|
|
|
777
|
-
Returns **[Promise][
|
|
792
|
+
Returns **[Promise][13]<[string][10]>** CSS value
|
|
778
793
|
|
|
779
794
|
### grabCssPropertyFromAll
|
|
780
795
|
|
|
@@ -787,10 +802,10 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
787
802
|
|
|
788
803
|
#### Parameters
|
|
789
804
|
|
|
790
|
-
- `locator` **([string][
|
|
791
|
-
- `cssProperty` **[string][
|
|
805
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
806
|
+
- `cssProperty` **[string][10]** CSS property name.
|
|
792
807
|
|
|
793
|
-
Returns **[Promise][
|
|
808
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** CSS value
|
|
794
809
|
|
|
795
810
|
### grabCurrentUrl
|
|
796
811
|
|
|
@@ -802,7 +817,7 @@ let url = await I.grabCurrentUrl();
|
|
|
802
817
|
console.log(`Current URL is [${url}]`);
|
|
803
818
|
```
|
|
804
819
|
|
|
805
|
-
Returns **[Promise][
|
|
820
|
+
Returns **[Promise][13]<[string][10]>** current URL
|
|
806
821
|
|
|
807
822
|
### grabDataFromPerformanceTiming
|
|
808
823
|
|
|
@@ -849,11 +864,11 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
849
864
|
|
|
850
865
|
#### Parameters
|
|
851
866
|
|
|
852
|
-
- `locator` **([string][
|
|
867
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
853
868
|
- `prop`
|
|
854
|
-
- `elementSize` **[string][
|
|
869
|
+
- `elementSize` **[string][10]?** x, y, width or height of the given element.
|
|
855
870
|
|
|
856
|
-
Returns **([Promise][
|
|
871
|
+
Returns **([Promise][13]<DOMRect> | [Promise][13]<[number][11]>)** Element bounding rectangle
|
|
857
872
|
|
|
858
873
|
### grabHTMLFrom
|
|
859
874
|
|
|
@@ -868,9 +883,9 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
868
883
|
#### Parameters
|
|
869
884
|
|
|
870
885
|
- `locator`
|
|
871
|
-
- `element` **([string][
|
|
886
|
+
- `element` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
872
887
|
|
|
873
|
-
Returns **[Promise][
|
|
888
|
+
Returns **[Promise][13]<[string][10]>** HTML code for an element
|
|
874
889
|
|
|
875
890
|
### grabHTMLFromAll
|
|
876
891
|
|
|
@@ -884,9 +899,9 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
884
899
|
#### Parameters
|
|
885
900
|
|
|
886
901
|
- `locator`
|
|
887
|
-
- `element` **([string][
|
|
902
|
+
- `element` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
888
903
|
|
|
889
|
-
Returns **[Promise][
|
|
904
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** HTML code for an element
|
|
890
905
|
|
|
891
906
|
### grabNumberOfOpenTabs
|
|
892
907
|
|
|
@@ -897,7 +912,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
897
912
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
898
913
|
```
|
|
899
914
|
|
|
900
|
-
Returns **[Promise][
|
|
915
|
+
Returns **[Promise][13]<[number][11]>** number of open tabs
|
|
901
916
|
|
|
902
917
|
### grabNumberOfVisibleElements
|
|
903
918
|
|
|
@@ -910,9 +925,9 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
910
925
|
|
|
911
926
|
#### Parameters
|
|
912
927
|
|
|
913
|
-
- `locator` **([string][
|
|
928
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
914
929
|
|
|
915
|
-
Returns **[Promise][
|
|
930
|
+
Returns **[Promise][13]<[number][11]>** number of visible elements
|
|
916
931
|
|
|
917
932
|
### grabPageScrollPosition
|
|
918
933
|
|
|
@@ -923,7 +938,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
923
938
|
let { x, y } = await I.grabPageScrollPosition();
|
|
924
939
|
```
|
|
925
940
|
|
|
926
|
-
Returns **[Promise][
|
|
941
|
+
Returns **[Promise][13]<PageScrollPosition>** scroll position
|
|
927
942
|
|
|
928
943
|
### grabPopupText
|
|
929
944
|
|
|
@@ -933,7 +948,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
933
948
|
await I.grabPopupText();
|
|
934
949
|
```
|
|
935
950
|
|
|
936
|
-
Returns **[Promise][
|
|
951
|
+
Returns **[Promise][13]<([string][10] | null)>**
|
|
937
952
|
|
|
938
953
|
### grabSource
|
|
939
954
|
|
|
@@ -944,7 +959,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
944
959
|
let pageSource = await I.grabSource();
|
|
945
960
|
```
|
|
946
961
|
|
|
947
|
-
Returns **[Promise][
|
|
962
|
+
Returns **[Promise][13]<[string][10]>** source code
|
|
948
963
|
|
|
949
964
|
### grabTextFrom
|
|
950
965
|
|
|
@@ -959,9 +974,9 @@ If multiple elements found returns first element.
|
|
|
959
974
|
|
|
960
975
|
#### Parameters
|
|
961
976
|
|
|
962
|
-
- `locator` **([string][
|
|
977
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
963
978
|
|
|
964
|
-
Returns **[Promise][
|
|
979
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
965
980
|
|
|
966
981
|
### grabTextFromAll
|
|
967
982
|
|
|
@@ -974,9 +989,9 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
974
989
|
|
|
975
990
|
#### Parameters
|
|
976
991
|
|
|
977
|
-
- `locator` **([string][
|
|
992
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
978
993
|
|
|
979
|
-
Returns **[Promise][
|
|
994
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
980
995
|
|
|
981
996
|
### grabTitle
|
|
982
997
|
|
|
@@ -987,7 +1002,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
987
1002
|
let title = await I.grabTitle();
|
|
988
1003
|
```
|
|
989
1004
|
|
|
990
|
-
Returns **[Promise][
|
|
1005
|
+
Returns **[Promise][13]<[string][10]>** title
|
|
991
1006
|
|
|
992
1007
|
### grabValueFrom
|
|
993
1008
|
|
|
@@ -1001,9 +1016,9 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1001
1016
|
|
|
1002
1017
|
#### Parameters
|
|
1003
1018
|
|
|
1004
|
-
- `locator` **([string][
|
|
1019
|
+
- `locator` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1005
1020
|
|
|
1006
|
-
Returns **[Promise][
|
|
1021
|
+
Returns **[Promise][13]<[string][10]>** attribute value
|
|
1007
1022
|
|
|
1008
1023
|
### grabValueFromAll
|
|
1009
1024
|
|
|
@@ -1016,16 +1031,16 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1016
1031
|
|
|
1017
1032
|
#### Parameters
|
|
1018
1033
|
|
|
1019
|
-
- `locator` **([string][
|
|
1034
|
+
- `locator` **([string][10] | [object][8])** field located by label|name|CSS|XPath|strict locator.
|
|
1020
1035
|
|
|
1021
|
-
Returns **[Promise][
|
|
1036
|
+
Returns **[Promise][13]<[Array][14]<[string][10]>>** attribute value
|
|
1022
1037
|
|
|
1023
1038
|
### handleDownloads
|
|
1024
1039
|
|
|
1025
1040
|
Handles a file download.Aa file name is required to save the file on disk.
|
|
1026
1041
|
Files are saved to "output" directory.
|
|
1027
1042
|
|
|
1028
|
-
Should be used with [FileSystem helper][
|
|
1043
|
+
Should be used with [FileSystem helper][15] to check that file were downloaded correctly.
|
|
1029
1044
|
|
|
1030
1045
|
```js
|
|
1031
1046
|
I.handleDownloads('downloads/avatar.jpg');
|
|
@@ -1036,7 +1051,7 @@ I.waitForFile('downloads/avatar.jpg', 5);
|
|
|
1036
1051
|
|
|
1037
1052
|
#### Parameters
|
|
1038
1053
|
|
|
1039
|
-
- `fileName` **[string][
|
|
1054
|
+
- `fileName` **[string][10]?** set filename for downloaded file
|
|
1040
1055
|
|
|
1041
1056
|
### haveRequestHeaders
|
|
1042
1057
|
|
|
@@ -1050,22 +1065,22 @@ I.haveRequestHeaders({
|
|
|
1050
1065
|
|
|
1051
1066
|
#### Parameters
|
|
1052
1067
|
|
|
1053
|
-
- `customHeaders` **[object][
|
|
1068
|
+
- `customHeaders` **[object][8]** headers to set
|
|
1054
1069
|
|
|
1055
1070
|
### mockRoute
|
|
1056
1071
|
|
|
1057
|
-
Mocks network request using [`browserContext.route`][
|
|
1072
|
+
Mocks network request using [`browserContext.route`][16] of Playwright
|
|
1058
1073
|
|
|
1059
1074
|
```js
|
|
1060
1075
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1061
1076
|
```
|
|
1062
1077
|
|
|
1063
|
-
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]
|
|
1064
1079
|
|
|
1065
1080
|
#### Parameters
|
|
1066
1081
|
|
|
1067
|
-
- `url` **[string][
|
|
1068
|
-
- `handler` **[function][
|
|
1082
|
+
- `url` **[string][10]?** URL, regex or pattern for to match URL
|
|
1083
|
+
- `handler` **[function][12]?** a function to process request
|
|
1069
1084
|
|
|
1070
1085
|
### moveCursorTo
|
|
1071
1086
|
|
|
@@ -1079,9 +1094,9 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1079
1094
|
|
|
1080
1095
|
#### Parameters
|
|
1081
1096
|
|
|
1082
|
-
- `locator` **([string][
|
|
1083
|
-
- `offsetX` **[number][
|
|
1084
|
-
- `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.
|
|
1085
1100
|
|
|
1086
1101
|
### openNewTab
|
|
1087
1102
|
|
|
@@ -1091,7 +1106,7 @@ Open new tab and automatically switched to new tab
|
|
|
1091
1106
|
I.openNewTab();
|
|
1092
1107
|
```
|
|
1093
1108
|
|
|
1094
|
-
You can pass in [page options][
|
|
1109
|
+
You can pass in [page options][18] to emulate device on this page
|
|
1095
1110
|
|
|
1096
1111
|
```js
|
|
1097
1112
|
// enable mobile
|
|
@@ -1106,7 +1121,7 @@ I.openNewTab({ isMobile: true });
|
|
|
1106
1121
|
|
|
1107
1122
|
Presses a key in the browser (on a focused element).
|
|
1108
1123
|
|
|
1109
|
-
_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].
|
|
1110
1125
|
|
|
1111
1126
|
```js
|
|
1112
1127
|
I.pressKey('Backspace');
|
|
@@ -1165,13 +1180,13 @@ Some of the supported key names are:
|
|
|
1165
1180
|
|
|
1166
1181
|
#### Parameters
|
|
1167
1182
|
|
|
1168
|
-
- `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]).
|
|
1169
1184
|
|
|
1170
1185
|
### pressKeyDown
|
|
1171
1186
|
|
|
1172
1187
|
Presses a key in the browser and leaves it in a down state.
|
|
1173
1188
|
|
|
1174
|
-
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]).
|
|
1175
1190
|
|
|
1176
1191
|
```js
|
|
1177
1192
|
I.pressKeyDown('Control');
|
|
@@ -1181,13 +1196,13 @@ I.pressKeyUp('Control');
|
|
|
1181
1196
|
|
|
1182
1197
|
#### Parameters
|
|
1183
1198
|
|
|
1184
|
-
- `key` **[string][
|
|
1199
|
+
- `key` **[string][10]** name of key to press down.
|
|
1185
1200
|
|
|
1186
1201
|
### pressKeyUp
|
|
1187
1202
|
|
|
1188
1203
|
Releases a key in the browser which was previously set to a down state.
|
|
1189
1204
|
|
|
1190
|
-
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]).
|
|
1191
1206
|
|
|
1192
1207
|
```js
|
|
1193
1208
|
I.pressKeyDown('Control');
|
|
@@ -1197,7 +1212,7 @@ I.pressKeyUp('Control');
|
|
|
1197
1212
|
|
|
1198
1213
|
#### Parameters
|
|
1199
1214
|
|
|
1200
|
-
- `key` **[string][
|
|
1215
|
+
- `key` **[string][10]** name of key to release.
|
|
1201
1216
|
|
|
1202
1217
|
### refreshPage
|
|
1203
1218
|
|
|
@@ -1214,8 +1229,8 @@ First parameter can be set to `maximize`.
|
|
|
1214
1229
|
|
|
1215
1230
|
#### Parameters
|
|
1216
1231
|
|
|
1217
|
-
- `width` **[number][
|
|
1218
|
-
- `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!
|
|
1219
1234
|
Playwright does not control the window of a browser so it can't adjust its real size.
|
|
1220
1235
|
It also can't maximize a window.Update configuration to change real window size on start:```js
|
|
1221
1236
|
// inside codecept.conf.js
|
|
@@ -1238,8 +1253,8 @@ I.rightClick('Click me', '.context');
|
|
|
1238
1253
|
|
|
1239
1254
|
#### Parameters
|
|
1240
1255
|
|
|
1241
|
-
- `locator` **([string][
|
|
1242
|
-
- `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.
|
|
1243
1258
|
|
|
1244
1259
|
### saveElementScreenshot
|
|
1245
1260
|
|
|
@@ -1252,8 +1267,8 @@ I.saveElementScreenshot(`#submit`,'debug.png');
|
|
|
1252
1267
|
|
|
1253
1268
|
#### Parameters
|
|
1254
1269
|
|
|
1255
|
-
- `locator` **([string][
|
|
1256
|
-
- `fileName` **[string][
|
|
1270
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1271
|
+
- `fileName` **[string][10]** file name to save.
|
|
1257
1272
|
|
|
1258
1273
|
### saveScreenshot
|
|
1259
1274
|
|
|
@@ -1268,8 +1283,8 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1268
1283
|
|
|
1269
1284
|
#### Parameters
|
|
1270
1285
|
|
|
1271
|
-
- `fileName` **[string][
|
|
1272
|
-
- `fullPage` **[boolean][
|
|
1286
|
+
- `fileName` **[string][10]** file name to save.
|
|
1287
|
+
- `fullPage` **[boolean][22]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1273
1288
|
|
|
1274
1289
|
### scrollPageToBottom
|
|
1275
1290
|
|
|
@@ -1299,9 +1314,9 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1299
1314
|
|
|
1300
1315
|
#### Parameters
|
|
1301
1316
|
|
|
1302
|
-
- `locator` **([string][
|
|
1303
|
-
- `offsetX` **[number][
|
|
1304
|
-
- `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.
|
|
1305
1320
|
|
|
1306
1321
|
### see
|
|
1307
1322
|
|
|
@@ -1316,8 +1331,8 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1316
1331
|
|
|
1317
1332
|
#### Parameters
|
|
1318
1333
|
|
|
1319
|
-
- `text` **[string][
|
|
1320
|
-
- `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.
|
|
1321
1336
|
|
|
1322
1337
|
### seeAttributesOnElements
|
|
1323
1338
|
|
|
@@ -1329,8 +1344,8 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1329
1344
|
|
|
1330
1345
|
#### Parameters
|
|
1331
1346
|
|
|
1332
|
-
- `locator` **([string][
|
|
1333
|
-
- `attributes` **[object][
|
|
1347
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1348
|
+
- `attributes` **[object][8]** attributes and their values to check.
|
|
1334
1349
|
|
|
1335
1350
|
### seeCheckboxIsChecked
|
|
1336
1351
|
|
|
@@ -1344,7 +1359,7 @@ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
|
1344
1359
|
|
|
1345
1360
|
#### Parameters
|
|
1346
1361
|
|
|
1347
|
-
- `field` **([string][
|
|
1362
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1348
1363
|
|
|
1349
1364
|
### seeCookie
|
|
1350
1365
|
|
|
@@ -1356,7 +1371,7 @@ I.seeCookie('Auth');
|
|
|
1356
1371
|
|
|
1357
1372
|
#### Parameters
|
|
1358
1373
|
|
|
1359
|
-
- `name` **[string][
|
|
1374
|
+
- `name` **[string][10]** cookie name.
|
|
1360
1375
|
|
|
1361
1376
|
### seeCssPropertiesOnElements
|
|
1362
1377
|
|
|
@@ -1368,8 +1383,8 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1368
1383
|
|
|
1369
1384
|
#### Parameters
|
|
1370
1385
|
|
|
1371
|
-
- `locator` **([string][
|
|
1372
|
-
- `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.
|
|
1373
1388
|
|
|
1374
1389
|
### seeCurrentUrlEquals
|
|
1375
1390
|
|
|
@@ -1384,7 +1399,7 @@ I.seeCurrentUrlEquals('http://my.site.com/register');
|
|
|
1384
1399
|
|
|
1385
1400
|
#### Parameters
|
|
1386
1401
|
|
|
1387
|
-
- `url` **[string][
|
|
1402
|
+
- `url` **[string][10]** value to check.
|
|
1388
1403
|
|
|
1389
1404
|
### seeElement
|
|
1390
1405
|
|
|
@@ -1397,7 +1412,7 @@ I.seeElement('#modal');
|
|
|
1397
1412
|
|
|
1398
1413
|
#### Parameters
|
|
1399
1414
|
|
|
1400
|
-
- `locator` **([string][
|
|
1415
|
+
- `locator` **([string][10] | [object][8])** located by CSS|XPath|strict locator.
|
|
1401
1416
|
|
|
1402
1417
|
### seeElementInDOM
|
|
1403
1418
|
|
|
@@ -1410,7 +1425,7 @@ I.seeElementInDOM('#modal');
|
|
|
1410
1425
|
|
|
1411
1426
|
#### Parameters
|
|
1412
1427
|
|
|
1413
|
-
- `locator` **([string][
|
|
1428
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1414
1429
|
|
|
1415
1430
|
### seeInCurrentUrl
|
|
1416
1431
|
|
|
@@ -1422,7 +1437,7 @@ I.seeInCurrentUrl('/register'); // we are on registration page
|
|
|
1422
1437
|
|
|
1423
1438
|
#### Parameters
|
|
1424
1439
|
|
|
1425
|
-
- `url` **[string][
|
|
1440
|
+
- `url` **[string][10]** a fragment to check
|
|
1426
1441
|
|
|
1427
1442
|
### seeInField
|
|
1428
1443
|
|
|
@@ -1438,8 +1453,8 @@ I.seeInField('#searchform input','Search');
|
|
|
1438
1453
|
|
|
1439
1454
|
#### Parameters
|
|
1440
1455
|
|
|
1441
|
-
- `field` **([string][
|
|
1442
|
-
- `value` **[string][
|
|
1456
|
+
- `field` **([string][10] | [object][8])** located by label|name|CSS|XPath|strict locator.
|
|
1457
|
+
- `value` **[string][10]** value to check.
|
|
1443
1458
|
|
|
1444
1459
|
### seeInPopup
|
|
1445
1460
|
|
|
@@ -1452,7 +1467,7 @@ I.seeInPopup('Popup text');
|
|
|
1452
1467
|
|
|
1453
1468
|
#### Parameters
|
|
1454
1469
|
|
|
1455
|
-
- `text` **[string][
|
|
1470
|
+
- `text` **[string][10]** value to check.
|
|
1456
1471
|
|
|
1457
1472
|
### seeInSource
|
|
1458
1473
|
|
|
@@ -1464,7 +1479,7 @@ I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
|
1464
1479
|
|
|
1465
1480
|
#### Parameters
|
|
1466
1481
|
|
|
1467
|
-
- `text` **[string][
|
|
1482
|
+
- `text` **[string][10]** value to check.
|
|
1468
1483
|
|
|
1469
1484
|
### seeInTitle
|
|
1470
1485
|
|
|
@@ -1476,7 +1491,7 @@ I.seeInTitle('Home Page');
|
|
|
1476
1491
|
|
|
1477
1492
|
#### Parameters
|
|
1478
1493
|
|
|
1479
|
-
- `text` **[string][
|
|
1494
|
+
- `text` **[string][10]** text value to check.
|
|
1480
1495
|
|
|
1481
1496
|
### seeNumberOfElements
|
|
1482
1497
|
|
|
@@ -1489,8 +1504,8 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1489
1504
|
|
|
1490
1505
|
#### Parameters
|
|
1491
1506
|
|
|
1492
|
-
- `locator` **([string][
|
|
1493
|
-
- `num` **[number][
|
|
1507
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1508
|
+
- `num` **[number][11]** number of elements.
|
|
1494
1509
|
|
|
1495
1510
|
### seeNumberOfVisibleElements
|
|
1496
1511
|
|
|
@@ -1503,8 +1518,8 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1503
1518
|
|
|
1504
1519
|
#### Parameters
|
|
1505
1520
|
|
|
1506
|
-
- `locator` **([string][
|
|
1507
|
-
- `num` **[number][
|
|
1521
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1522
|
+
- `num` **[number][11]** number of elements.
|
|
1508
1523
|
|
|
1509
1524
|
### seeTextEquals
|
|
1510
1525
|
|
|
@@ -1516,8 +1531,8 @@ I.seeTextEquals('text', 'h1');
|
|
|
1516
1531
|
|
|
1517
1532
|
#### Parameters
|
|
1518
1533
|
|
|
1519
|
-
- `text` **[string][
|
|
1520
|
-
- `context` **([string][
|
|
1534
|
+
- `text` **[string][10]** element value to check.
|
|
1535
|
+
- `context` **([string][10] | [object][8])?** element located by CSS|XPath|strict locator.
|
|
1521
1536
|
|
|
1522
1537
|
### seeTitleEquals
|
|
1523
1538
|
|
|
@@ -1529,7 +1544,7 @@ I.seeTitleEquals('Test title.');
|
|
|
1529
1544
|
|
|
1530
1545
|
#### Parameters
|
|
1531
1546
|
|
|
1532
|
-
- `text` **[string][
|
|
1547
|
+
- `text` **[string][10]** value to check.
|
|
1533
1548
|
|
|
1534
1549
|
### selectOption
|
|
1535
1550
|
|
|
@@ -1554,8 +1569,8 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1554
1569
|
|
|
1555
1570
|
#### Parameters
|
|
1556
1571
|
|
|
1557
|
-
- `select` **([string][
|
|
1558
|
-
- `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.
|
|
1559
1574
|
|
|
1560
1575
|
### setCookie
|
|
1561
1576
|
|
|
@@ -1575,7 +1590,7 @@ I.setCookie([
|
|
|
1575
1590
|
|
|
1576
1591
|
#### Parameters
|
|
1577
1592
|
|
|
1578
|
-
- `cookie` **(Cookie | [Array][
|
|
1593
|
+
- `cookie` **(Cookie | [Array][14]<Cookie>)** a cookie object or array of cookie objects.
|
|
1579
1594
|
|
|
1580
1595
|
### stopMockingRoute
|
|
1581
1596
|
|
|
@@ -1590,8 +1605,8 @@ If no handler is passed, all mock requests for the rote are disabled.
|
|
|
1590
1605
|
|
|
1591
1606
|
#### Parameters
|
|
1592
1607
|
|
|
1593
|
-
- `url` **[string][
|
|
1594
|
-
- `handler` **[function][
|
|
1608
|
+
- `url` **[string][10]?** URL, regex or pattern for to match URL
|
|
1609
|
+
- `handler` **[function][12]?** a function to process request
|
|
1595
1610
|
|
|
1596
1611
|
### switchTo
|
|
1597
1612
|
|
|
@@ -1604,7 +1619,7 @@ I.switchTo(); // switch back to main page
|
|
|
1604
1619
|
|
|
1605
1620
|
#### Parameters
|
|
1606
1621
|
|
|
1607
|
-
- `locator` **([string][
|
|
1622
|
+
- `locator` **([string][10]? | [object][8])** (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1608
1623
|
|
|
1609
1624
|
### switchToNextTab
|
|
1610
1625
|
|
|
@@ -1617,7 +1632,7 @@ I.switchToNextTab(2);
|
|
|
1617
1632
|
|
|
1618
1633
|
#### Parameters
|
|
1619
1634
|
|
|
1620
|
-
- `num` **[number][
|
|
1635
|
+
- `num` **[number][11]**
|
|
1621
1636
|
|
|
1622
1637
|
### switchToPreviousTab
|
|
1623
1638
|
|
|
@@ -1630,13 +1645,13 @@ I.switchToPreviousTab(2);
|
|
|
1630
1645
|
|
|
1631
1646
|
#### Parameters
|
|
1632
1647
|
|
|
1633
|
-
- `num` **[number][
|
|
1648
|
+
- `num` **[number][11]**
|
|
1634
1649
|
|
|
1635
1650
|
### type
|
|
1636
1651
|
|
|
1637
1652
|
Types out the given text into an active field.
|
|
1638
1653
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1639
|
-
_Note:_ Should be used when [`fillField`][
|
|
1654
|
+
_Note:_ Should be used when [`fillField`][19] is not an option.
|
|
1640
1655
|
|
|
1641
1656
|
```js
|
|
1642
1657
|
// passing in a string
|
|
@@ -1652,8 +1667,8 @@ I.type(['T', 'E', 'X', 'T']);
|
|
|
1652
1667
|
#### Parameters
|
|
1653
1668
|
|
|
1654
1669
|
- `keys`
|
|
1655
|
-
- `delay` **[number][
|
|
1656
|
-
- `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.
|
|
1657
1672
|
|
|
1658
1673
|
### uncheckOption
|
|
1659
1674
|
|
|
@@ -1670,8 +1685,8 @@ I.uncheckOption('agree', '//form');
|
|
|
1670
1685
|
|
|
1671
1686
|
#### Parameters
|
|
1672
1687
|
|
|
1673
|
-
- `field` **([string][
|
|
1674
|
-
- `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.
|
|
1675
1690
|
|
|
1676
1691
|
### usePlaywrightTo
|
|
1677
1692
|
|
|
@@ -1680,18 +1695,18 @@ Use Playwright API inside a test.
|
|
|
1680
1695
|
First argument is a description of an action.
|
|
1681
1696
|
Second argument is async function that gets this helper as parameter.
|
|
1682
1697
|
|
|
1683
|
-
{ [`page`][
|
|
1698
|
+
{ [`page`][23], [`context`][24] [`browser`][25] } objects from Playwright API are available.
|
|
1684
1699
|
|
|
1685
1700
|
```js
|
|
1686
|
-
I.usePlaywrightTo('emulate offline mode', async ({ context }) {
|
|
1701
|
+
I.usePlaywrightTo('emulate offline mode', async ({ context }) => {
|
|
1687
1702
|
await context.setOffline(true);
|
|
1688
1703
|
});
|
|
1689
1704
|
```
|
|
1690
1705
|
|
|
1691
1706
|
#### Parameters
|
|
1692
1707
|
|
|
1693
|
-
- `description` **[string][
|
|
1694
|
-
- `fn` **[function][
|
|
1708
|
+
- `description` **[string][10]** used to show in logs.
|
|
1709
|
+
- `fn` **[function][12]** async functuion that executed with Playwright helper as argument
|
|
1695
1710
|
|
|
1696
1711
|
### wait
|
|
1697
1712
|
|
|
@@ -1703,7 +1718,7 @@ I.wait(2); // wait 2 secs
|
|
|
1703
1718
|
|
|
1704
1719
|
#### Parameters
|
|
1705
1720
|
|
|
1706
|
-
- `sec` **[number][
|
|
1721
|
+
- `sec` **[number][11]** number of second to wait.
|
|
1707
1722
|
|
|
1708
1723
|
### waitForClickable
|
|
1709
1724
|
|
|
@@ -1717,9 +1732,9 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
1717
1732
|
|
|
1718
1733
|
#### Parameters
|
|
1719
1734
|
|
|
1720
|
-
- `locator` **([string][
|
|
1735
|
+
- `locator` **([string][10] | [object][8])** element located by CSS|XPath|strict locator.
|
|
1721
1736
|
- `waitTimeout`
|
|
1722
|
-
- `sec` **[number][
|
|
1737
|
+
- `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
1723
1738
|
|
|
1724
1739
|
### waitForDetached
|
|
1725
1740
|
|
|
@@ -1732,8 +1747,8 @@ I.waitForDetached('#popup');
|
|
|
1732
1747
|
|
|
1733
1748
|
#### Parameters
|
|
1734
1749
|
|
|
1735
|
-
- `locator` **([string][
|
|
1736
|
-
- `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
|
|
1737
1752
|
|
|
1738
1753
|
### waitForElement
|
|
1739
1754
|
|
|
@@ -1747,8 +1762,8 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
1747
1762
|
|
|
1748
1763
|
#### Parameters
|
|
1749
1764
|
|
|
1750
|
-
- `locator` **([string][
|
|
1751
|
-
- `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
|
|
1752
1767
|
|
|
1753
1768
|
### waitForEnabled
|
|
1754
1769
|
|
|
@@ -1757,8 +1772,8 @@ Element can be located by CSS or XPath.
|
|
|
1757
1772
|
|
|
1758
1773
|
#### Parameters
|
|
1759
1774
|
|
|
1760
|
-
- `locator` **([string][
|
|
1761
|
-
- `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.
|
|
1762
1777
|
|
|
1763
1778
|
### waitForFunction
|
|
1764
1779
|
|
|
@@ -1777,9 +1792,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1777
1792
|
|
|
1778
1793
|
#### Parameters
|
|
1779
1794
|
|
|
1780
|
-
- `fn` **([string][
|
|
1781
|
-
- `argsOrSec` **([Array][
|
|
1782
|
-
- `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
|
|
1783
1798
|
|
|
1784
1799
|
### waitForInvisible
|
|
1785
1800
|
|
|
@@ -1792,14 +1807,14 @@ I.waitForInvisible('#popup');
|
|
|
1792
1807
|
|
|
1793
1808
|
#### Parameters
|
|
1794
1809
|
|
|
1795
|
-
- `locator` **([string][
|
|
1796
|
-
- `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
|
|
1797
1812
|
|
|
1798
1813
|
### waitForNavigation
|
|
1799
1814
|
|
|
1800
1815
|
Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
1801
1816
|
|
|
1802
|
-
See [Playwright's reference][
|
|
1817
|
+
See [Playwright's reference][26]
|
|
1803
1818
|
|
|
1804
1819
|
#### Parameters
|
|
1805
1820
|
|
|
@@ -1816,22 +1831,22 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
1816
1831
|
|
|
1817
1832
|
#### Parameters
|
|
1818
1833
|
|
|
1819
|
-
- `urlOrPredicate` **([string][
|
|
1820
|
-
- `sec` **[number][
|
|
1834
|
+
- `urlOrPredicate` **([string][10] | [function][12])**
|
|
1835
|
+
- `sec` **[number][11]?** seconds to wait
|
|
1821
1836
|
|
|
1822
1837
|
### waitForResponse
|
|
1823
1838
|
|
|
1824
|
-
Waits for a network
|
|
1839
|
+
Waits for a network response.
|
|
1825
1840
|
|
|
1826
1841
|
```js
|
|
1827
1842
|
I.waitForResponse('http://example.com/resource');
|
|
1828
|
-
I.waitForResponse(
|
|
1843
|
+
I.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
|
|
1829
1844
|
```
|
|
1830
1845
|
|
|
1831
1846
|
#### Parameters
|
|
1832
1847
|
|
|
1833
|
-
- `urlOrPredicate` **([string][
|
|
1834
|
-
- `sec` **[number][
|
|
1848
|
+
- `urlOrPredicate` **([string][10] | [function][12])**
|
|
1849
|
+
- `sec` **[number][11]?** number of seconds to wait
|
|
1835
1850
|
|
|
1836
1851
|
### waitForText
|
|
1837
1852
|
|
|
@@ -1846,9 +1861,9 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
1846
1861
|
|
|
1847
1862
|
#### Parameters
|
|
1848
1863
|
|
|
1849
|
-
- `text` **[string][
|
|
1850
|
-
- `sec` **[number][
|
|
1851
|
-
- `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.
|
|
1852
1867
|
|
|
1853
1868
|
### waitForValue
|
|
1854
1869
|
|
|
@@ -1860,9 +1875,9 @@ I.waitForValue('//input', "GoodValue");
|
|
|
1860
1875
|
|
|
1861
1876
|
#### Parameters
|
|
1862
1877
|
|
|
1863
|
-
- `field` **([string][
|
|
1864
|
-
- `value` **[string][
|
|
1865
|
-
- `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
|
|
1866
1881
|
|
|
1867
1882
|
### waitForVisible
|
|
1868
1883
|
|
|
@@ -1875,8 +1890,8 @@ I.waitForVisible('#popup');
|
|
|
1875
1890
|
|
|
1876
1891
|
#### Parameters
|
|
1877
1892
|
|
|
1878
|
-
- `locator` **([string][
|
|
1879
|
-
- `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].
|
|
1880
1895
|
|
|
1881
1896
|
### waitInUrl
|
|
1882
1897
|
|
|
@@ -1888,8 +1903,8 @@ I.waitInUrl('/info', 2);
|
|
|
1888
1903
|
|
|
1889
1904
|
#### Parameters
|
|
1890
1905
|
|
|
1891
|
-
- `urlPart` **[string][
|
|
1892
|
-
- `sec` **[number][
|
|
1906
|
+
- `urlPart` **[string][10]** value to check.
|
|
1907
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1893
1908
|
|
|
1894
1909
|
### waitNumberOfVisibleElements
|
|
1895
1910
|
|
|
@@ -1901,9 +1916,9 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
1901
1916
|
|
|
1902
1917
|
#### Parameters
|
|
1903
1918
|
|
|
1904
|
-
- `locator` **([string][
|
|
1905
|
-
- `num` **[number][
|
|
1906
|
-
- `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
|
|
1907
1922
|
|
|
1908
1923
|
### waitToHide
|
|
1909
1924
|
|
|
@@ -1916,24 +1931,8 @@ I.waitToHide('#popup');
|
|
|
1916
1931
|
|
|
1917
1932
|
#### Parameters
|
|
1918
1933
|
|
|
1919
|
-
- `locator` **([string][
|
|
1920
|
-
- `sec` **[number][
|
|
1921
|
-
|
|
1922
|
-
### waitUntil
|
|
1923
|
-
|
|
1924
|
-
Waits for a function to return true (waits for 1sec by default).
|
|
1925
|
-
|
|
1926
|
-
```js
|
|
1927
|
-
I.waitUntil(() => window.requests == 0);
|
|
1928
|
-
I.waitUntil(() => window.requests == 0, 5);
|
|
1929
|
-
```
|
|
1930
|
-
|
|
1931
|
-
#### Parameters
|
|
1932
|
-
|
|
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]?**
|
|
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
|
|
1937
1936
|
|
|
1938
1937
|
### waitUrlEquals
|
|
1939
1938
|
|
|
@@ -1946,57 +1945,59 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
1946
1945
|
|
|
1947
1946
|
#### Parameters
|
|
1948
1947
|
|
|
1949
|
-
- `urlPart` **[string][
|
|
1950
|
-
- `sec` **[number][
|
|
1948
|
+
- `urlPart` **[string][10]** value to check.
|
|
1949
|
+
- `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
1951
1950
|
|
|
1952
1951
|
[1]: https://github.com/microsoft/playwright
|
|
1953
1952
|
|
|
1954
1953
|
[2]: https://playwright.dev/docs/trace-viewer
|
|
1955
1954
|
|
|
1956
|
-
[3]: https://github.com/microsoft/playwright/blob/
|
|
1955
|
+
[3]: https://github.com/microsoft/playwright/blob/main/docs/api.md#pagewaitfornavigationoptions
|
|
1956
|
+
|
|
1957
|
+
[4]: https://playwright.dev/docs/browsers/#google-chrome--microsoft-edge
|
|
1957
1958
|
|
|
1958
|
-
[
|
|
1959
|
+
[5]: https://playwright.dev/docs/next/api/class-browser#browser-new-context
|
|
1959
1960
|
|
|
1960
|
-
[
|
|
1961
|
+
[6]: https://playwright.dev/docs/api/class-browsertype#browsertypeconnectparams
|
|
1961
1962
|
|
|
1962
|
-
[
|
|
1963
|
+
[7]: https://github.com/microsoft/playwright/blob/v0.11.0/docs/api.md#working-with-chrome-extensions
|
|
1963
1964
|
|
|
1964
|
-
[
|
|
1965
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
1965
1966
|
|
|
1966
|
-
[
|
|
1967
|
+
[9]: http://jster.net/category/windows-modals-popups
|
|
1967
1968
|
|
|
1968
|
-
[
|
|
1969
|
+
[10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
1969
1970
|
|
|
1970
|
-
[
|
|
1971
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
1971
1972
|
|
|
1972
|
-
[
|
|
1973
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
1973
1974
|
|
|
1974
|
-
[
|
|
1975
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
1975
1976
|
|
|
1976
|
-
[
|
|
1977
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1977
1978
|
|
|
1978
|
-
[
|
|
1979
|
+
[15]: https://codecept.io/helpers/FileSystem
|
|
1979
1980
|
|
|
1980
|
-
[
|
|
1981
|
+
[16]: https://playwright.dev/docs/api/class-browsercontext#browser-context-route
|
|
1981
1982
|
|
|
1982
|
-
[
|
|
1983
|
+
[17]: https://playwright.dev/docs/network#handle-requests
|
|
1983
1984
|
|
|
1984
|
-
[
|
|
1985
|
+
[18]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
|
|
1985
1986
|
|
|
1986
|
-
[
|
|
1987
|
+
[19]: #fillfield
|
|
1987
1988
|
|
|
1988
|
-
[
|
|
1989
|
+
[20]: https://github.com/GoogleChrome/puppeteer/issues/1313
|
|
1989
1990
|
|
|
1990
|
-
[
|
|
1991
|
+
[21]: #click
|
|
1991
1992
|
|
|
1992
|
-
[
|
|
1993
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
1993
1994
|
|
|
1994
|
-
[
|
|
1995
|
+
[23]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-page.md
|
|
1995
1996
|
|
|
1996
|
-
[
|
|
1997
|
+
[24]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsercontext.md
|
|
1997
1998
|
|
|
1998
|
-
[
|
|
1999
|
+
[25]: https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browser.md
|
|
1999
2000
|
|
|
2000
|
-
[
|
|
2001
|
+
[26]: https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions
|
|
2001
2002
|
|
|
2002
|
-
[
|
|
2003
|
+
[27]: https://codecept.io/react
|