codeceptjs 4.0.0-rc.23 → 4.0.0-rc.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/docs/ai.md +3 -51
- package/docs/architecture.md +16 -0
- package/docs/bootstrap.md +1 -1
- package/docs/continuous-integration.md +16 -44
- package/docs/custom-helpers.md +1 -1
- package/docs/detox.md +1 -1
- package/docs/docker.md +1 -30
- package/docs/examples.md +0 -1
- package/docs/helpers/Appium.md +16 -2
- package/docs/helpers/Playwright.md +161 -160
- package/docs/helpers/Puppeteer.md +143 -250
- package/docs/helpers/WebDriver.md +134 -177
- package/docs/hooks.md +11 -1
- package/docs/index.md +1 -1
- package/docs/installation.md +2 -19
- package/docs/locators.md +1 -1
- package/docs/migrate-from-cypress.md +98 -0
- package/docs/migrate-from-java.md +108 -0
- package/docs/migrate-from-protractor.md +101 -0
- package/docs/migrate-from-testcafe.md +99 -0
- package/docs/migration-4.md +195 -8
- package/docs/plugins/aiTrace.md +49 -0
- package/docs/plugins/analyze.md +66 -0
- package/docs/plugins/auth.md +241 -0
- package/docs/plugins/autoDelay.md +48 -0
- package/docs/plugins/browser.md +41 -0
- package/docs/plugins/coverage.md +39 -0
- package/docs/plugins/customLocator.md +119 -0
- package/docs/plugins/customReporter.md +16 -0
- package/docs/plugins/expose.md +75 -0
- package/docs/plugins/heal.md +44 -0
- package/docs/plugins/junitReporter.md +51 -0
- package/docs/plugins/pageInfo.md +34 -0
- package/docs/plugins/pause.md +43 -0
- package/docs/plugins/pauseOnFail.md +18 -0
- package/docs/plugins/retryFailedStep.md +75 -0
- package/docs/plugins/screencast.md +55 -0
- package/docs/plugins/screenshot.md +58 -0
- package/docs/plugins/screenshotOnFail.md +18 -0
- package/docs/plugins/stepTimeout.md +65 -0
- package/docs/plugins.md +40 -862
- package/docs/reports.md +18 -4
- package/docs/retry.md +48 -18
- package/docs/store.md +94 -0
- package/docs/timeouts.md +1 -1
- package/docs/tutorial.md +207 -155
- package/docs/webdriver.md +6 -73
- package/lib/actor.js +0 -35
- package/lib/command/run-multiple.js +1 -2
- package/lib/helper/Playwright.js +1 -15
- package/lib/helper/Puppeteer.js +0 -103
- package/lib/helper/WebDriver.js +1 -28
- package/lib/helper/extras/PlaywrightLocator.js +10 -0
- package/lib/locator.js +0 -13
- package/lib/plugin/analyze.js +3 -4
- package/lib/plugin/pauseOnFail.js +3 -1
- package/lib/plugin/retryFailedStep.js +7 -7
- package/lib/plugin/screenshot.js +0 -5
- package/lib/plugin/screenshotOnFail.js +3 -1
- package/lib/plugin/stepTimeout.js +1 -1
- package/lib/recorder.js +1 -1
- package/lib/workers.js +0 -4
- package/package.json +3 -4
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockServer.md +0 -212
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/SoftExpectHelper.md +0 -352
- package/docs/react.md +0 -70
- package/lib/helper/Mochawesome.js +0 -96
- package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -61
- package/lib/helper/extras/React.js +0 -65
|
@@ -39,26 +39,26 @@ Type: [object][4]
|
|
|
39
39
|
|
|
40
40
|
* `url` **[string][6]** base url of website to be tested
|
|
41
41
|
* `basicAuth` **[object][4]?** (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
42
|
-
* `show` **[boolean][
|
|
43
|
-
* `restart` **[boolean][
|
|
44
|
-
* `disableScreenshots` **[boolean][
|
|
45
|
-
* `fullPageScreenshots` **[boolean][
|
|
46
|
-
* `uniqueScreenshotNames` **[boolean][
|
|
47
|
-
* `trace` **[boolean][
|
|
48
|
-
* `keepTraceForPassedTests` **[boolean][
|
|
49
|
-
* `keepBrowserState` **[boolean][
|
|
50
|
-
* `keepCookies` **[boolean][
|
|
51
|
-
* `waitForAction` **[number][
|
|
52
|
-
* `waitForNavigation` **([string][6] | [Array][
|
|
53
|
-
* `pressKeyDelay` **[number][
|
|
54
|
-
* `getPageTimeout` **[number][
|
|
55
|
-
* `waitForTimeout` **[number][
|
|
42
|
+
* `show` **[boolean][24]?** show Google Chrome window for debug.
|
|
43
|
+
* `restart` **[boolean][24]?** restart browser between tests.
|
|
44
|
+
* `disableScreenshots` **[boolean][24]?** don't save screenshot on failure.
|
|
45
|
+
* `fullPageScreenshots` **[boolean][24]?** make full page screenshots on failure.
|
|
46
|
+
* `uniqueScreenshotNames` **[boolean][24]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
47
|
+
* `trace` **[boolean][24]?** record [tracing information][28] with screenshots.
|
|
48
|
+
* `keepTraceForPassedTests` **[boolean][24]?** save trace for passed tests.
|
|
49
|
+
* `keepBrowserState` **[boolean][24]?** keep browser state between tests when `restart` is set to false.
|
|
50
|
+
* `keepCookies` **[boolean][24]?** keep cookies between tests when `restart` is set to false.
|
|
51
|
+
* `waitForAction` **[number][11]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
52
|
+
* `waitForNavigation` **([string][6] | [Array][17]<[string][6]>)?** when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][29]. Array values are accepted as well.
|
|
53
|
+
* `pressKeyDelay` **[number][11]?** delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
54
|
+
* `getPageTimeout` **[number][11]?** config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
|
|
55
|
+
* `waitForTimeout` **[number][11]?** default wait* timeout in ms.
|
|
56
56
|
* `windowSize` **[string][6]?** default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
|
|
57
57
|
* `userAgent` **[string][6]?** user-agent string.
|
|
58
|
-
* `manualStart` **[boolean][
|
|
58
|
+
* `manualStart` **[boolean][24]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
59
59
|
* `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
60
|
-
* `chrome` **[object][4]?** pass additional [Puppeteer run options][
|
|
61
|
-
* `highlightElement` **[boolean][
|
|
60
|
+
* `chrome` **[object][4]?** pass additional [Puppeteer run options][30].
|
|
61
|
+
* `highlightElement` **[boolean][24]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
62
62
|
|
|
63
63
|
## findElement
|
|
64
64
|
|
|
@@ -70,7 +70,7 @@ Note: Puppeteer Locator API doesn't have .first() method like Playwright
|
|
|
70
70
|
* `matcher` **[Object][4]** Puppeteer context to search within
|
|
71
71
|
* `locator` **([Object][4] | [string][6])** Locator specification
|
|
72
72
|
|
|
73
|
-
Returns **[Promise][
|
|
73
|
+
Returns **[Promise][12]<[Object][4]>** Single ElementHandle object
|
|
74
74
|
|
|
75
75
|
## findElements
|
|
76
76
|
|
|
@@ -82,7 +82,7 @@ Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for
|
|
|
82
82
|
* `matcher` **[Object][4]** Puppeteer context to search within
|
|
83
83
|
* `locator` **([Object][4] | [string][6])** Locator specification
|
|
84
84
|
|
|
85
|
-
Returns **[Promise][
|
|
85
|
+
Returns **[Promise][12]<[Array][17]>** Array of ElementHandle objects
|
|
86
86
|
|
|
87
87
|
## wrapError
|
|
88
88
|
|
|
@@ -232,12 +232,6 @@ Should be used in custom helpers:
|
|
|
232
232
|
const elements = await this.helpers['Puppeteer']._locate({name: 'password'});
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
239
|
-
|
|
240
|
-
|
|
241
235
|
#### Parameters
|
|
242
236
|
|
|
243
237
|
* `locator`  
|
|
@@ -277,12 +271,6 @@ Should be used in custom helpers:
|
|
|
277
271
|
const element = await this.helpers['Puppeteer']._locateElement({name: 'password'});
|
|
278
272
|
```
|
|
279
273
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
284
|
-
|
|
285
|
-
|
|
286
274
|
#### Parameters
|
|
287
275
|
|
|
288
276
|
* `locator`  
|
|
@@ -375,10 +363,6 @@ I.appendField('name', 'John', '.form-container');
|
|
|
375
363
|
|
|
376
364
|
Returns **void** automatically synchronized promise through #recorder
|
|
377
365
|
|
|
378
|
-
|
|
379
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
380
|
-
|
|
381
|
-
|
|
382
366
|
### attachFile
|
|
383
367
|
|
|
384
368
|
> ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1][7], downgrade to 2.0.0 if you face it.
|
|
@@ -523,8 +507,12 @@ I.click('//form/*[@type=submit]');
|
|
|
523
507
|
I.click('Logout', '#nav');
|
|
524
508
|
// using strict locator
|
|
525
509
|
I.click({css: 'nav a.login'});
|
|
510
|
+
// using ARIA role locator
|
|
511
|
+
I.click({role: 'button', name: 'Submit'});
|
|
526
512
|
```
|
|
527
513
|
|
|
514
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][10].
|
|
515
|
+
|
|
528
516
|
#### Parameters
|
|
529
517
|
|
|
530
518
|
* `locator` **([string][6] | [object][4])** (optional, `'//body'` by default) clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
@@ -532,10 +520,6 @@ I.click({css: 'nav a.login'});
|
|
|
532
520
|
|
|
533
521
|
Returns **void** automatically synchronized promise through #recorder
|
|
534
522
|
|
|
535
|
-
|
|
536
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
537
|
-
|
|
538
|
-
|
|
539
523
|
### clickLink
|
|
540
524
|
|
|
541
525
|
Performs a click on a link and waits for navigation before moving on.
|
|
@@ -551,10 +535,6 @@ I.clickLink('Logout', '#nav');
|
|
|
551
535
|
|
|
552
536
|
Returns **void** automatically synchronized promise through #recorder
|
|
553
537
|
|
|
554
|
-
|
|
555
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
556
|
-
|
|
557
|
-
|
|
558
538
|
### clickXY
|
|
559
539
|
|
|
560
540
|
Performs click at specific coordinates.
|
|
@@ -571,11 +551,11 @@ I.clickXY('#someElement', 50, 30);
|
|
|
571
551
|
|
|
572
552
|
#### Parameters
|
|
573
553
|
|
|
574
|
-
* `locator` **([string][6] | [object][4] | [number][
|
|
575
|
-
* `x` **[number][
|
|
576
|
-
* `y` **[number][
|
|
554
|
+
* `locator` **([string][6] | [object][4] | [number][11])** Element to click on or X coordinate if no element.
|
|
555
|
+
* `x` **[number][11]?** X coordinate relative to element, or Y coordinate if locator is a number.
|
|
556
|
+
* `y` **[number][11]?** Y coordinate relative to element.
|
|
577
557
|
|
|
578
|
-
Returns **[Promise][
|
|
558
|
+
Returns **[Promise][12]<void>** 
|
|
579
559
|
|
|
580
560
|
### closeCurrentTab
|
|
581
561
|
|
|
@@ -610,10 +590,6 @@ I.dontSee('Login', '.nav'); // no login inside .nav element
|
|
|
610
590
|
|
|
611
591
|
Returns **void** automatically synchronized promise through #recorder
|
|
612
592
|
|
|
613
|
-
|
|
614
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
615
|
-
|
|
616
|
-
|
|
617
593
|
### dontSeeCheckboxIsChecked
|
|
618
594
|
|
|
619
595
|
Verifies that the specified checkbox is not checked.
|
|
@@ -694,10 +670,6 @@ I.dontSeeElement('.modal', '#container');
|
|
|
694
670
|
|
|
695
671
|
Returns **void** automatically synchronized promise through #recorder
|
|
696
672
|
|
|
697
|
-
|
|
698
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
699
|
-
|
|
700
|
-
|
|
701
673
|
### dontSeeElementInDOM
|
|
702
674
|
|
|
703
675
|
Opposite to `seeElementInDOM`. Checks that element is not on page.
|
|
@@ -789,7 +761,7 @@ I.dontSeeTraffic({ name: 'Unexpected API Call of "user" endpoint', url: /api.exa
|
|
|
789
761
|
* `opts` **[Object][4]** options when checking the traffic network.
|
|
790
762
|
|
|
791
763
|
* `opts.name` **[string][6]** A name of that request. Can be any value. Only relevant to have a more meaningful error message in case of fail.
|
|
792
|
-
* `opts.url` **([string][6] | [RegExp][
|
|
764
|
+
* `opts.url` **([string][6] | [RegExp][13])** Expected URL of request in network traffic. Can be a string or a regular expression.
|
|
793
765
|
|
|
794
766
|
Returns **void** automatically synchronized promise through #recorder
|
|
795
767
|
|
|
@@ -812,10 +784,6 @@ I.doubleClick('.btn.edit');
|
|
|
812
784
|
|
|
813
785
|
Returns **void** automatically synchronized promise through #recorder
|
|
814
786
|
|
|
815
|
-
|
|
816
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
817
|
-
|
|
818
|
-
|
|
819
787
|
### downloadFile
|
|
820
788
|
|
|
821
789
|
This method is **deprecated**.
|
|
@@ -855,21 +823,17 @@ I.dragSlider('#slider', -70);
|
|
|
855
823
|
#### Parameters
|
|
856
824
|
|
|
857
825
|
* `locator` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
858
|
-
* `offsetX` **[number][
|
|
826
|
+
* `offsetX` **[number][11]** position to drag.
|
|
859
827
|
|
|
860
828
|
Returns **void** automatically synchronized promise through #recorder
|
|
861
829
|
|
|
862
|
-
|
|
863
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
864
|
-
|
|
865
|
-
|
|
866
830
|
### executeAsyncScript
|
|
867
831
|
|
|
868
832
|
Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
869
833
|
Executes async script on page.
|
|
870
834
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
871
835
|
|
|
872
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
836
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][14].
|
|
873
837
|
|
|
874
838
|
```js
|
|
875
839
|
I.executeAsyncScript(function(done) {
|
|
@@ -890,9 +854,9 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
890
854
|
#### Parameters
|
|
891
855
|
|
|
892
856
|
* `args` **...any** to be passed to function.
|
|
893
|
-
* `fn` **([string][6] | [function][
|
|
857
|
+
* `fn` **([string][6] | [function][15])** function to be executed in browser context.
|
|
894
858
|
|
|
895
|
-
Returns **[Promise][
|
|
859
|
+
Returns **[Promise][12]<any>** script return value
|
|
896
860
|
|
|
897
861
|
### executeScript
|
|
898
862
|
|
|
@@ -925,9 +889,9 @@ let date = await I.executeScript(function(el) {
|
|
|
925
889
|
#### Parameters
|
|
926
890
|
|
|
927
891
|
* `args` **...any** to be passed to function.
|
|
928
|
-
* `fn` **([string][6] | [function][
|
|
892
|
+
* `fn` **([string][6] | [function][15])** function to be executed in browser context.
|
|
929
893
|
|
|
930
|
-
Returns **[Promise][
|
|
894
|
+
Returns **[Promise][12]<any>** script return value
|
|
931
895
|
|
|
932
896
|
### fillField
|
|
933
897
|
|
|
@@ -945,10 +909,14 @@ I.fillField('password', secret('123456'));
|
|
|
945
909
|
I.fillField('form#login input[name=username]', 'John');
|
|
946
910
|
// or by strict locator
|
|
947
911
|
I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
912
|
+
// by ARIA role locator
|
|
913
|
+
I.fillField({role: 'textbox', name: 'Email'}, 'hello@world.com');
|
|
948
914
|
// within a context
|
|
949
915
|
I.fillField('Name', 'John', '#section2');
|
|
950
916
|
```
|
|
951
917
|
|
|
918
|
+
> ℹ️ ARIA role locators (`{role, name}`) match fields by their accessible name and survive markup refactors. See [Locators][10].
|
|
919
|
+
|
|
952
920
|
#### Parameters
|
|
953
921
|
|
|
954
922
|
* `field` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
|
|
@@ -957,10 +925,6 @@ I.fillField('Name', 'John', '#section2');
|
|
|
957
925
|
|
|
958
926
|
Returns **void** automatically synchronized promise through #recorder
|
|
959
927
|
|
|
960
|
-
|
|
961
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
962
|
-
|
|
963
|
-
|
|
964
928
|
### flushNetworkTraffics
|
|
965
929
|
|
|
966
930
|
Resets all recorded network requests.
|
|
@@ -988,7 +952,7 @@ I.see('#add-to-cart-bnt');
|
|
|
988
952
|
#### Parameters
|
|
989
953
|
|
|
990
954
|
* `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
991
|
-
* `options` **any?** Playwright only: [Additional options][
|
|
955
|
+
* `options` **any?** Playwright only: [Additional options][16] for available options object as 2nd argument.
|
|
992
956
|
|
|
993
957
|
Returns **void** automatically synchronized promise through #recorder
|
|
994
958
|
|
|
@@ -1026,10 +990,6 @@ I.forceClick({css: 'nav a.login'});
|
|
|
1026
990
|
|
|
1027
991
|
Returns **void** automatically synchronized promise through #recorder
|
|
1028
992
|
|
|
1029
|
-
|
|
1030
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
993
|
### grabAttributeFrom
|
|
1034
994
|
|
|
1035
995
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
@@ -1045,11 +1005,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
1045
1005
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1046
1006
|
* `attr` **[string][6]** attribute name.
|
|
1047
1007
|
|
|
1048
|
-
Returns **[Promise][
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1052
|
-
|
|
1008
|
+
Returns **[Promise][12]<[string][6]>** attribute value
|
|
1053
1009
|
|
|
1054
1010
|
### grabAttributeFromAll
|
|
1055
1011
|
|
|
@@ -1065,11 +1021,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1065
1021
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1066
1022
|
* `attr` **[string][6]** attribute name.
|
|
1067
1023
|
|
|
1068
|
-
Returns **[Promise][
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1072
|
-
|
|
1024
|
+
Returns **[Promise][12]<[Array][17]<[string][6]>>** attribute value
|
|
1073
1025
|
|
|
1074
1026
|
### grabBrowserLogs
|
|
1075
1027
|
|
|
@@ -1080,7 +1032,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1080
1032
|
console.log(JSON.stringify(logs))
|
|
1081
1033
|
```
|
|
1082
1034
|
|
|
1083
|
-
Returns **[Promise][
|
|
1035
|
+
Returns **[Promise][12]<[Array][17]<any>>** 
|
|
1084
1036
|
|
|
1085
1037
|
### grabCookie
|
|
1086
1038
|
|
|
@@ -1114,11 +1066,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1114
1066
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1115
1067
|
* `cssProperty` **[string][6]** CSS property name.
|
|
1116
1068
|
|
|
1117
|
-
Returns **[Promise][
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1121
|
-
|
|
1069
|
+
Returns **[Promise][12]<[string][6]>** CSS value
|
|
1122
1070
|
|
|
1123
1071
|
### grabCssPropertyFromAll
|
|
1124
1072
|
|
|
@@ -1134,11 +1082,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1134
1082
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1135
1083
|
* `cssProperty` **[string][6]** CSS property name.
|
|
1136
1084
|
|
|
1137
|
-
Returns **[Promise][
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1141
|
-
|
|
1085
|
+
Returns **[Promise][12]<[Array][17]<[string][6]>>** CSS value
|
|
1142
1086
|
|
|
1143
1087
|
### grabCurrentUrl
|
|
1144
1088
|
|
|
@@ -1150,7 +1094,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1150
1094
|
console.log(`Current URL is [${url}]`);
|
|
1151
1095
|
```
|
|
1152
1096
|
|
|
1153
|
-
Returns **[Promise][
|
|
1097
|
+
Returns **[Promise][12]<[string][6]>** current URL
|
|
1154
1098
|
|
|
1155
1099
|
### grabDataFromPerformanceTiming
|
|
1156
1100
|
|
|
@@ -1203,7 +1147,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1203
1147
|
* `prop`  
|
|
1204
1148
|
* `elementSize` **[string][6]?** x, y, width or height of the given element.
|
|
1205
1149
|
|
|
1206
|
-
Returns **([Promise][
|
|
1150
|
+
Returns **([Promise][12]<DOMRect> | [Promise][12]<[number][11]>)** Element bounding rectangle
|
|
1207
1151
|
|
|
1208
1152
|
### grabHTMLFrom
|
|
1209
1153
|
|
|
@@ -1220,7 +1164,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1220
1164
|
* `locator`  
|
|
1221
1165
|
* `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1222
1166
|
|
|
1223
|
-
Returns **[Promise][
|
|
1167
|
+
Returns **[Promise][12]<[string][6]>** HTML code for an element
|
|
1224
1168
|
|
|
1225
1169
|
### grabHTMLFromAll
|
|
1226
1170
|
|
|
@@ -1236,7 +1180,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1236
1180
|
* `locator`  
|
|
1237
1181
|
* `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1238
1182
|
|
|
1239
|
-
Returns **[Promise][
|
|
1183
|
+
Returns **[Promise][12]<[Array][17]<[string][6]>>** HTML code for an element
|
|
1240
1184
|
|
|
1241
1185
|
### grabNumberOfOpenTabs
|
|
1242
1186
|
|
|
@@ -1247,7 +1191,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1247
1191
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1248
1192
|
```
|
|
1249
1193
|
|
|
1250
|
-
Returns **[Promise][
|
|
1194
|
+
Returns **[Promise][12]<[number][11]>** number of open tabs
|
|
1251
1195
|
|
|
1252
1196
|
### grabNumberOfVisibleElements
|
|
1253
1197
|
|
|
@@ -1262,12 +1206,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1262
1206
|
|
|
1263
1207
|
* `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1264
1208
|
|
|
1265
|
-
Returns **[Promise][
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1270
|
-
|
|
1209
|
+
Returns **[Promise][12]<[number][11]>** number of visible elements
|
|
1271
1210
|
|
|
1272
1211
|
### grabPageScrollPosition
|
|
1273
1212
|
|
|
@@ -1278,7 +1217,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1278
1217
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1279
1218
|
```
|
|
1280
1219
|
|
|
1281
|
-
Returns **[Promise][
|
|
1220
|
+
Returns **[Promise][12]<PageScrollPosition>** scroll position
|
|
1282
1221
|
|
|
1283
1222
|
### grabPopupText
|
|
1284
1223
|
|
|
@@ -1288,7 +1227,7 @@ Grab the text within the popup. If no popup is visible then it will return null
|
|
|
1288
1227
|
await I.grabPopupText();
|
|
1289
1228
|
```
|
|
1290
1229
|
|
|
1291
|
-
Returns **[Promise][
|
|
1230
|
+
Returns **[Promise][12]<([string][6] | null)>** 
|
|
1292
1231
|
|
|
1293
1232
|
### grabRecordedNetworkTraffics
|
|
1294
1233
|
|
|
@@ -1301,7 +1240,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
1301
1240
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1302
1241
|
```
|
|
1303
1242
|
|
|
1304
|
-
Returns **[Array][
|
|
1243
|
+
Returns **[Array][17]** recorded network traffics
|
|
1305
1244
|
|
|
1306
1245
|
### grabSource
|
|
1307
1246
|
|
|
@@ -1312,7 +1251,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1312
1251
|
let pageSource = await I.grabSource();
|
|
1313
1252
|
```
|
|
1314
1253
|
|
|
1315
|
-
Returns **[Promise][
|
|
1254
|
+
Returns **[Promise][12]<[string][6]>** source code
|
|
1316
1255
|
|
|
1317
1256
|
### grabTextFrom
|
|
1318
1257
|
|
|
@@ -1329,11 +1268,7 @@ If multiple elements found returns first element.
|
|
|
1329
1268
|
|
|
1330
1269
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1331
1270
|
|
|
1332
|
-
Returns **[Promise][
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1336
|
-
|
|
1271
|
+
Returns **[Promise][12]<[string][6]>** attribute value
|
|
1337
1272
|
|
|
1338
1273
|
### grabTextFromAll
|
|
1339
1274
|
|
|
@@ -1348,11 +1283,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1348
1283
|
|
|
1349
1284
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1350
1285
|
|
|
1351
|
-
Returns **[Promise][
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1355
|
-
|
|
1286
|
+
Returns **[Promise][12]<[Array][17]<[string][6]>>** attribute value
|
|
1356
1287
|
|
|
1357
1288
|
### grabTitle
|
|
1358
1289
|
|
|
@@ -1363,7 +1294,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1363
1294
|
let title = await I.grabTitle();
|
|
1364
1295
|
```
|
|
1365
1296
|
|
|
1366
|
-
Returns **[Promise][
|
|
1297
|
+
Returns **[Promise][12]<[string][6]>** title
|
|
1367
1298
|
|
|
1368
1299
|
### grabValueFrom
|
|
1369
1300
|
|
|
@@ -1379,7 +1310,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1379
1310
|
|
|
1380
1311
|
* `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1381
1312
|
|
|
1382
|
-
Returns **[Promise][
|
|
1313
|
+
Returns **[Promise][12]<[string][6]>** attribute value
|
|
1383
1314
|
|
|
1384
1315
|
### grabValueFromAll
|
|
1385
1316
|
|
|
@@ -1394,7 +1325,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1394
1325
|
|
|
1395
1326
|
* `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1396
1327
|
|
|
1397
|
-
Returns **[Promise][
|
|
1328
|
+
Returns **[Promise][12]<[Array][17]<[string][6]>>** attribute value
|
|
1398
1329
|
|
|
1399
1330
|
### grabWebElement
|
|
1400
1331
|
|
|
@@ -1409,7 +1340,7 @@ const webElement = await I.grabWebElement('#button');
|
|
|
1409
1340
|
|
|
1410
1341
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1411
1342
|
|
|
1412
|
-
Returns **[Promise][
|
|
1343
|
+
Returns **[Promise][12]<any>** WebElement of being used Web helper
|
|
1413
1344
|
|
|
1414
1345
|
### grabWebElements
|
|
1415
1346
|
|
|
@@ -1424,18 +1355,18 @@ const webElements = await I.grabWebElements('#button');
|
|
|
1424
1355
|
|
|
1425
1356
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1426
1357
|
|
|
1427
|
-
Returns **[Promise][
|
|
1358
|
+
Returns **[Promise][12]<any>** WebElement of being used Web helper
|
|
1428
1359
|
|
|
1429
1360
|
### grabWebSocketMessages
|
|
1430
1361
|
|
|
1431
1362
|
Grab the recording WS messages
|
|
1432
1363
|
|
|
1433
|
-
Returns **([Array][
|
|
1364
|
+
Returns **([Array][17]<any> | [undefined][18])** 
|
|
1434
1365
|
|
|
1435
1366
|
### handleDownloads
|
|
1436
1367
|
|
|
1437
1368
|
Sets a directory to where save files. Allows to test file downloads.
|
|
1438
|
-
Should be used with [FileSystem helper][
|
|
1369
|
+
Should be used with [FileSystem helper][19] to check that file were downloaded correctly.
|
|
1439
1370
|
|
|
1440
1371
|
By default, files are saved to `output/downloads`.
|
|
1441
1372
|
This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
@@ -1454,18 +1385,18 @@ I.seeFile('avatar.jpg');
|
|
|
1454
1385
|
|
|
1455
1386
|
### mockRoute
|
|
1456
1387
|
|
|
1457
|
-
Mocks network request using [`Request Interception`][
|
|
1388
|
+
Mocks network request using [`Request Interception`][20]
|
|
1458
1389
|
|
|
1459
1390
|
```js
|
|
1460
1391
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1461
1392
|
```
|
|
1462
1393
|
|
|
1463
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1394
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][20]
|
|
1464
1395
|
|
|
1465
1396
|
#### Parameters
|
|
1466
1397
|
|
|
1467
|
-
* `url` **([string][6] | [RegExp][
|
|
1468
|
-
* `handler` **[function][
|
|
1398
|
+
* `url` **([string][6] | [RegExp][13])?** URL, regex or pattern for to match URL
|
|
1399
|
+
* `handler` **[function][15]?** a function to process request
|
|
1469
1400
|
|
|
1470
1401
|
### moveCursorTo
|
|
1471
1402
|
|
|
@@ -1484,15 +1415,11 @@ I.moveCursorTo('#submit', '.container');
|
|
|
1484
1415
|
#### Parameters
|
|
1485
1416
|
|
|
1486
1417
|
* `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1487
|
-
* `offsetX` **([number][
|
|
1488
|
-
* `offsetY` **[number][
|
|
1418
|
+
* `offsetX` **([number][11] | [string][6] | [object][4])** (optional, `0` by default) X-axis offset or context locator.
|
|
1419
|
+
* `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1489
1420
|
|
|
1490
1421
|
Returns **void** automatically synchronized promise through #recorder
|
|
1491
1422
|
|
|
1492
|
-
|
|
1493
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
1423
|
### openNewTab
|
|
1497
1424
|
|
|
1498
1425
|
Open new tab and switch to it
|
|
@@ -1503,11 +1430,11 @@ I.openNewTab();
|
|
|
1503
1430
|
|
|
1504
1431
|
### pressKey
|
|
1505
1432
|
|
|
1506
|
-
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][
|
|
1433
|
+
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][21]).
|
|
1507
1434
|
|
|
1508
1435
|
Presses a key in the browser (on a focused element).
|
|
1509
1436
|
|
|
1510
|
-
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1437
|
+
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][22].
|
|
1511
1438
|
|
|
1512
1439
|
```js
|
|
1513
1440
|
I.pressKey('Backspace');
|
|
@@ -1566,7 +1493,7 @@ Some of the supported key names are:
|
|
|
1566
1493
|
|
|
1567
1494
|
#### Parameters
|
|
1568
1495
|
|
|
1569
|
-
* `key` **([string][6] | [Array][
|
|
1496
|
+
* `key` **([string][6] | [Array][17]<[string][6]>)** key or array of keys to press.
|
|
1570
1497
|
|
|
1571
1498
|
Returns **void** automatically synchronized promise through #recorder
|
|
1572
1499
|
|
|
@@ -1574,7 +1501,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1574
1501
|
|
|
1575
1502
|
Presses a key in the browser and leaves it in a down state.
|
|
1576
1503
|
|
|
1577
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1504
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][23]).
|
|
1578
1505
|
|
|
1579
1506
|
```js
|
|
1580
1507
|
I.pressKeyDown('Control');
|
|
@@ -1592,7 +1519,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1592
1519
|
|
|
1593
1520
|
Releases a key in the browser which was previously set to a down state.
|
|
1594
1521
|
|
|
1595
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1522
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][23]).
|
|
1596
1523
|
|
|
1597
1524
|
```js
|
|
1598
1525
|
I.pressKeyDown('Control');
|
|
@@ -1627,8 +1554,8 @@ First parameter can be set to `maximize`.
|
|
|
1627
1554
|
|
|
1628
1555
|
#### Parameters
|
|
1629
1556
|
|
|
1630
|
-
* `width` **[number][
|
|
1631
|
-
* `height` **[number][
|
|
1557
|
+
* `width` **[number][11]** width in pixels or `maximize`.
|
|
1558
|
+
* `height` **[number][11]** height in pixels.
|
|
1632
1559
|
|
|
1633
1560
|
Returns **void** automatically synchronized promise through #recorder
|
|
1634
1561
|
|
|
@@ -1652,10 +1579,6 @@ I.rightClick('Click me', '.context');
|
|
|
1652
1579
|
|
|
1653
1580
|
Returns **void** automatically synchronized promise through #recorder
|
|
1654
1581
|
|
|
1655
|
-
|
|
1656
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
1582
|
### saveElementScreenshot
|
|
1660
1583
|
|
|
1661
1584
|
Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
|
|
@@ -1686,7 +1609,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1686
1609
|
#### Parameters
|
|
1687
1610
|
|
|
1688
1611
|
* `fileName` **[string][6]** file name to save.
|
|
1689
|
-
* `fullPage` **[boolean][
|
|
1612
|
+
* `fullPage` **[boolean][24]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1690
1613
|
|
|
1691
1614
|
Returns **void** automatically synchronized promise through #recorder
|
|
1692
1615
|
|
|
@@ -1723,8 +1646,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1723
1646
|
#### Parameters
|
|
1724
1647
|
|
|
1725
1648
|
* `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
1726
|
-
* `offsetX` **[number][
|
|
1727
|
-
* `offsetY` **[number][
|
|
1649
|
+
* `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
|
|
1650
|
+
* `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
|
|
1728
1651
|
|
|
1729
1652
|
Returns **void** automatically synchronized promise through #recorder
|
|
1730
1653
|
|
|
@@ -1746,10 +1669,6 @@ I.see('Register', {css: 'form.register'}); // use strict locator
|
|
|
1746
1669
|
|
|
1747
1670
|
Returns **void** automatically synchronized promise through #recorder
|
|
1748
1671
|
|
|
1749
|
-
|
|
1750
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
1672
|
### seeAttributesOnElements
|
|
1754
1673
|
|
|
1755
1674
|
Checks that all elements with given locator have given attributes.
|
|
@@ -1765,10 +1684,6 @@ I.seeAttributesOnElements('//form', { method: "post"});
|
|
|
1765
1684
|
|
|
1766
1685
|
Returns **void** automatically synchronized promise through #recorder
|
|
1767
1686
|
|
|
1768
|
-
|
|
1769
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
1687
|
### seeCheckboxIsChecked
|
|
1773
1688
|
|
|
1774
1689
|
Verifies that the specified checkbox is checked.
|
|
@@ -1814,10 +1729,6 @@ I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
|
1814
1729
|
|
|
1815
1730
|
Returns **void** automatically synchronized promise through #recorder
|
|
1816
1731
|
|
|
1817
|
-
|
|
1818
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
1732
|
### seeCurrentPathEquals
|
|
1822
1733
|
|
|
1823
1734
|
Checks that current URL path matches the expected path.
|
|
@@ -1861,8 +1772,12 @@ The second parameter is a context (CSS or XPath locator) to narrow the search.
|
|
|
1861
1772
|
```js
|
|
1862
1773
|
I.seeElement('#modal');
|
|
1863
1774
|
I.seeElement('#modal', '#container');
|
|
1775
|
+
// using ARIA role locator
|
|
1776
|
+
I.seeElement({role: 'dialog'});
|
|
1864
1777
|
```
|
|
1865
1778
|
|
|
1779
|
+
> ℹ️ ARIA role locators (`{role, name}`) match elements the way assistive technology does and survive markup refactors. See [Locators][10].
|
|
1780
|
+
|
|
1866
1781
|
#### Parameters
|
|
1867
1782
|
|
|
1868
1783
|
* `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
|
|
@@ -1870,10 +1785,6 @@ I.seeElement('#modal', '#container');
|
|
|
1870
1785
|
|
|
1871
1786
|
Returns **void** automatically synchronized promise through #recorder
|
|
1872
1787
|
|
|
1873
|
-
|
|
1874
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
1788
|
### seeElementInDOM
|
|
1878
1789
|
|
|
1879
1790
|
Checks that a given Element is present in the DOM
|
|
@@ -1982,14 +1893,10 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1982
1893
|
#### Parameters
|
|
1983
1894
|
|
|
1984
1895
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
1985
|
-
* `num` **[number][
|
|
1896
|
+
* `num` **[number][11]** number of elements.
|
|
1986
1897
|
|
|
1987
1898
|
Returns **void** automatically synchronized promise through #recorder
|
|
1988
1899
|
|
|
1989
|
-
|
|
1990
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
1900
|
### seeNumberOfVisibleElements
|
|
1994
1901
|
|
|
1995
1902
|
Asserts that an element is visible a given number of times.
|
|
@@ -2002,14 +1909,10 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
2002
1909
|
#### Parameters
|
|
2003
1910
|
|
|
2004
1911
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2005
|
-
* `num` **[number][
|
|
1912
|
+
* `num` **[number][11]** number of elements.
|
|
2006
1913
|
|
|
2007
1914
|
Returns **void** automatically synchronized promise through #recorder
|
|
2008
1915
|
|
|
2009
|
-
|
|
2010
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
1916
|
### seeTextEquals
|
|
2014
1917
|
|
|
2015
1918
|
Checks that text is equal to provided one.
|
|
@@ -2078,7 +1981,7 @@ await I.seeTraffic({
|
|
|
2078
1981
|
* `opts.url` **[string][6]** Expected URL of request in network traffic
|
|
2079
1982
|
* `opts.parameters` **[Object][4]?** Expected parameters of that request in network traffic
|
|
2080
1983
|
* `opts.requestPostData` **[Object][4]?** Expected that request contains post data in network traffic
|
|
2081
|
-
* `opts.timeout` **[number][
|
|
1984
|
+
* `opts.timeout` **[number][11]?** Timeout to wait for request in seconds. Default is 10 seconds.
|
|
2082
1985
|
|
|
2083
1986
|
Returns **void** automatically synchronized promise through #recorder
|
|
2084
1987
|
|
|
@@ -2110,7 +2013,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
2110
2013
|
#### Parameters
|
|
2111
2014
|
|
|
2112
2015
|
* `select` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
2113
|
-
* `option` **([string][6] | [Array][
|
|
2016
|
+
* `option` **([string][6] | [Array][17]<any>)** visible text or value of option.
|
|
2114
2017
|
* `context` **([string][6]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
2115
2018
|
|
|
2116
2019
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2133,7 +2036,7 @@ I.setCookie([
|
|
|
2133
2036
|
|
|
2134
2037
|
#### Parameters
|
|
2135
2038
|
|
|
2136
|
-
* `cookie` **(Cookie | [Array][
|
|
2039
|
+
* `cookie` **(Cookie | [Array][17]<Cookie>)** a cookie object or array of cookie objects.
|
|
2137
2040
|
|
|
2138
2041
|
Returns **void** automatically synchronized promise through #recorder
|
|
2139
2042
|
|
|
@@ -2183,7 +2086,7 @@ I.stopMockingRoute(/(.png$)|(.jpg$)/);
|
|
|
2183
2086
|
|
|
2184
2087
|
#### Parameters
|
|
2185
2088
|
|
|
2186
|
-
* `url` **([string][6] | [RegExp][
|
|
2089
|
+
* `url` **([string][6] | [RegExp][13])?** URL, regex or pattern for to match URL
|
|
2187
2090
|
|
|
2188
2091
|
### stopRecordingTraffic
|
|
2189
2092
|
|
|
@@ -2229,7 +2132,7 @@ I.switchToNextTab(2);
|
|
|
2229
2132
|
|
|
2230
2133
|
#### Parameters
|
|
2231
2134
|
|
|
2232
|
-
* `num` **[number][
|
|
2135
|
+
* `num` **[number][11]**
|
|
2233
2136
|
|
|
2234
2137
|
### switchToPreviousTab
|
|
2235
2138
|
|
|
@@ -2242,13 +2145,13 @@ I.switchToPreviousTab(2);
|
|
|
2242
2145
|
|
|
2243
2146
|
#### Parameters
|
|
2244
2147
|
|
|
2245
|
-
* `num` **[number][
|
|
2148
|
+
* `num` **[number][11]**
|
|
2246
2149
|
|
|
2247
2150
|
### type
|
|
2248
2151
|
|
|
2249
2152
|
Types out the given text into an active field.
|
|
2250
2153
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
2251
|
-
*Note:* Should be used when [`fillField`][
|
|
2154
|
+
*Note:* Should be used when [`fillField`][22] is not an option.
|
|
2252
2155
|
|
|
2253
2156
|
```js
|
|
2254
2157
|
// passing in a string
|
|
@@ -2267,8 +2170,8 @@ I.type(secret('123456'));
|
|
|
2267
2170
|
#### Parameters
|
|
2268
2171
|
|
|
2269
2172
|
* `keys`  
|
|
2270
|
-
* `delay` **[number][
|
|
2271
|
-
* `key` **([string][6] | [Array][
|
|
2173
|
+
* `delay` **[number][11]?** (optional) delay in ms between key presses
|
|
2174
|
+
* `key` **([string][6] | [Array][17]<[string][6]>)** or array of keys to type.
|
|
2272
2175
|
|
|
2273
2176
|
Returns **void** automatically synchronized promise through #recorder
|
|
2274
2177
|
|
|
@@ -2299,7 +2202,7 @@ Use Puppeteer API inside a test.
|
|
|
2299
2202
|
First argument is a description of an action.
|
|
2300
2203
|
Second argument is async function that gets this helper as parameter.
|
|
2301
2204
|
|
|
2302
|
-
{ [`page`][
|
|
2205
|
+
{ [`page`][25], [`browser`][26] } from Puppeteer API are available.
|
|
2303
2206
|
|
|
2304
2207
|
```js
|
|
2305
2208
|
I.usePuppeteerTo('emulate offline mode', async ({ page }) {
|
|
@@ -2310,7 +2213,7 @@ I.usePuppeteerTo('emulate offline mode', async ({ page }) {
|
|
|
2310
2213
|
#### Parameters
|
|
2311
2214
|
|
|
2312
2215
|
* `description` **[string][6]** used to show in logs.
|
|
2313
|
-
* `fn` **[function][
|
|
2216
|
+
* `fn` **[function][15]** async function that is executed with Puppeteer as argument
|
|
2314
2217
|
|
|
2315
2218
|
### wait
|
|
2316
2219
|
|
|
@@ -2322,7 +2225,7 @@ I.wait(2); // wait 2 secs
|
|
|
2322
2225
|
|
|
2323
2226
|
#### Parameters
|
|
2324
2227
|
|
|
2325
|
-
* `sec` **[number][
|
|
2228
|
+
* `sec` **[number][11]** number of second to wait.
|
|
2326
2229
|
|
|
2327
2230
|
Returns **void** automatically synchronized promise through #recorder
|
|
2328
2231
|
|
|
@@ -2349,7 +2252,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2349
2252
|
|
|
2350
2253
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2351
2254
|
* `waitTimeout`  
|
|
2352
|
-
* `sec` **[number][
|
|
2255
|
+
* `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
2353
2256
|
|
|
2354
2257
|
Returns **void** automatically synchronized promise through #recorder
|
|
2355
2258
|
|
|
@@ -2364,7 +2267,7 @@ I.waitForCookie("token");
|
|
|
2364
2267
|
#### Parameters
|
|
2365
2268
|
|
|
2366
2269
|
* `name` **[string][6]** expected cookie name.
|
|
2367
|
-
* `sec` **[number][
|
|
2270
|
+
* `sec` **[number][11]** (optional, `3` by default) time in seconds to wait
|
|
2368
2271
|
|
|
2369
2272
|
Returns **void** automatically synchronized promise through #recorder
|
|
2370
2273
|
|
|
@@ -2380,7 +2283,7 @@ I.waitForDetached('#popup');
|
|
|
2380
2283
|
#### Parameters
|
|
2381
2284
|
|
|
2382
2285
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2383
|
-
* `sec` **[number][
|
|
2286
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2384
2287
|
|
|
2385
2288
|
Returns **void** automatically synchronized promise through #recorder
|
|
2386
2289
|
|
|
@@ -2397,14 +2300,10 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2397
2300
|
#### Parameters
|
|
2398
2301
|
|
|
2399
2302
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2400
|
-
* `sec` **[number][
|
|
2303
|
+
* `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
2401
2304
|
|
|
2402
2305
|
Returns **void** automatically synchronized promise through #recorder
|
|
2403
2306
|
|
|
2404
|
-
|
|
2405
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
2307
|
### waitForEnabled
|
|
2409
2308
|
|
|
2410
2309
|
Waits for element to become enabled (by default waits for 1sec).
|
|
@@ -2413,7 +2312,7 @@ Element can be located by CSS or XPath.
|
|
|
2413
2312
|
#### Parameters
|
|
2414
2313
|
|
|
2415
2314
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2416
|
-
* `sec` **[number][
|
|
2315
|
+
* `sec` **[number][11]** (optional) time in seconds to wait, 1 by default.
|
|
2417
2316
|
|
|
2418
2317
|
Returns **void** automatically synchronized promise through #recorder
|
|
2419
2318
|
|
|
@@ -2434,9 +2333,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2434
2333
|
|
|
2435
2334
|
#### Parameters
|
|
2436
2335
|
|
|
2437
|
-
* `fn` **([string][6] | [function][
|
|
2438
|
-
* `argsOrSec` **([Array][
|
|
2439
|
-
* `sec` **[number][
|
|
2336
|
+
* `fn` **([string][6] | [function][15])** to be executed in browser context.
|
|
2337
|
+
* `argsOrSec` **([Array][17]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
2338
|
+
* `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
2440
2339
|
|
|
2441
2340
|
Returns **void** automatically synchronized promise through #recorder
|
|
2442
2341
|
|
|
@@ -2452,7 +2351,7 @@ I.waitForInvisible('#popup');
|
|
|
2452
2351
|
#### Parameters
|
|
2453
2352
|
|
|
2454
2353
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2455
|
-
* `sec` **[number][
|
|
2354
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2456
2355
|
|
|
2457
2356
|
Returns **void** automatically synchronized promise through #recorder
|
|
2458
2357
|
|
|
@@ -2460,7 +2359,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2460
2359
|
|
|
2461
2360
|
Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
2462
2361
|
|
|
2463
|
-
See [Puppeteer's reference][
|
|
2362
|
+
See [Puppeteer's reference][27]
|
|
2464
2363
|
|
|
2465
2364
|
#### Parameters
|
|
2466
2365
|
|
|
@@ -2476,8 +2375,8 @@ I.waitForNumberOfTabs(2);
|
|
|
2476
2375
|
|
|
2477
2376
|
#### Parameters
|
|
2478
2377
|
|
|
2479
|
-
* `expectedTabs` **[number][
|
|
2480
|
-
* `sec` **[number][
|
|
2378
|
+
* `expectedTabs` **[number][11]** expecting the number of tabs.
|
|
2379
|
+
* `sec` **[number][11]** number of secs to wait.
|
|
2481
2380
|
|
|
2482
2381
|
Returns **void** automatically synchronized promise through #recorder
|
|
2483
2382
|
|
|
@@ -2492,8 +2391,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
|
|
|
2492
2391
|
|
|
2493
2392
|
#### Parameters
|
|
2494
2393
|
|
|
2495
|
-
* `urlOrPredicate` **([string][6] | [function][
|
|
2496
|
-
* `sec` **[number][
|
|
2394
|
+
* `urlOrPredicate` **([string][6] | [function][15])** 
|
|
2395
|
+
* `sec` **[number][11]?** seconds to wait
|
|
2497
2396
|
|
|
2498
2397
|
### waitForResponse
|
|
2499
2398
|
|
|
@@ -2506,8 +2405,8 @@ I.waitForResponse(response => response.url() === 'http://example.com' && respons
|
|
|
2506
2405
|
|
|
2507
2406
|
#### Parameters
|
|
2508
2407
|
|
|
2509
|
-
* `urlOrPredicate` **([string][6] | [function][
|
|
2510
|
-
* `sec` **[number][
|
|
2408
|
+
* `urlOrPredicate` **([string][6] | [function][15])** 
|
|
2409
|
+
* `sec` **[number][11]?** number of seconds to wait
|
|
2511
2410
|
|
|
2512
2411
|
### waitForText
|
|
2513
2412
|
|
|
@@ -2523,7 +2422,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2523
2422
|
#### Parameters
|
|
2524
2423
|
|
|
2525
2424
|
* `text` **[string][6]** to wait for.
|
|
2526
|
-
* `sec` **[number][
|
|
2425
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2527
2426
|
* `context` **([string][6] | [object][4])?** (optional) element located by CSS|XPath|strict locator.
|
|
2528
2427
|
|
|
2529
2428
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2540,7 +2439,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2540
2439
|
|
|
2541
2440
|
* `field` **([string][6] | [object][4])** input field.
|
|
2542
2441
|
* `value` **[string][6]** expected value.
|
|
2543
|
-
* `sec` **[number][
|
|
2442
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2544
2443
|
|
|
2545
2444
|
Returns **void** automatically synchronized promise through #recorder
|
|
2546
2445
|
|
|
@@ -2556,14 +2455,10 @@ I.waitForVisible('#popup');
|
|
|
2556
2455
|
#### Parameters
|
|
2557
2456
|
|
|
2558
2457
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2559
|
-
* `sec` **[number][
|
|
2458
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2560
2459
|
|
|
2561
2460
|
Returns **void** automatically synchronized promise through #recorder
|
|
2562
2461
|
|
|
2563
|
-
|
|
2564
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
2462
|
### waitInUrl
|
|
2568
2463
|
|
|
2569
2464
|
Waiting for the part of the URL to match the expected. Useful for SPA to understand that page was changed.
|
|
@@ -2575,7 +2470,7 @@ I.waitInUrl('/info', 2);
|
|
|
2575
2470
|
#### Parameters
|
|
2576
2471
|
|
|
2577
2472
|
* `urlPart` **[string][6]** value to check.
|
|
2578
|
-
* `sec` **[number][
|
|
2473
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2579
2474
|
|
|
2580
2475
|
Returns **void** automatically synchronized promise through #recorder
|
|
2581
2476
|
|
|
@@ -2590,15 +2485,11 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2590
2485
|
#### Parameters
|
|
2591
2486
|
|
|
2592
2487
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2593
|
-
* `num` **[number][
|
|
2594
|
-
* `sec` **[number][
|
|
2488
|
+
* `num` **[number][11]** number of elements.
|
|
2489
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2595
2490
|
|
|
2596
2491
|
Returns **void** automatically synchronized promise through #recorder
|
|
2597
2492
|
|
|
2598
|
-
|
|
2599
|
-
This action supports [React locators](https://codecept.io/react#locators)
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
2493
|
### waitToHide
|
|
2603
2494
|
|
|
2604
2495
|
Waits for an element to hide (by default waits for 1sec).
|
|
@@ -2611,7 +2502,7 @@ I.waitToHide('#popup');
|
|
|
2611
2502
|
#### Parameters
|
|
2612
2503
|
|
|
2613
2504
|
* `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
|
|
2614
|
-
* `sec` **[number][
|
|
2505
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2615
2506
|
|
|
2616
2507
|
Returns **void** automatically synchronized promise through #recorder
|
|
2617
2508
|
|
|
@@ -2627,7 +2518,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2627
2518
|
#### Parameters
|
|
2628
2519
|
|
|
2629
2520
|
* `urlPart` **[string][6]** value to check.
|
|
2630
|
-
* `sec` **[number][
|
|
2521
|
+
* `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
|
|
2631
2522
|
|
|
2632
2523
|
Returns **void** automatically synchronized promise through #recorder
|
|
2633
2524
|
|
|
@@ -2649,42 +2540,44 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2649
2540
|
|
|
2650
2541
|
[9]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2651
2542
|
|
|
2652
|
-
[10]:
|
|
2543
|
+
[10]: /locators#aria-locators
|
|
2544
|
+
|
|
2545
|
+
[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2653
2546
|
|
|
2654
|
-
[
|
|
2547
|
+
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2655
2548
|
|
|
2656
|
-
[
|
|
2549
|
+
[13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp
|
|
2657
2550
|
|
|
2658
|
-
[
|
|
2551
|
+
[14]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
2659
2552
|
|
|
2660
|
-
[
|
|
2553
|
+
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2661
2554
|
|
|
2662
|
-
[
|
|
2555
|
+
[16]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2663
2556
|
|
|
2664
|
-
[
|
|
2557
|
+
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2665
2558
|
|
|
2666
|
-
[
|
|
2559
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
2667
2560
|
|
|
2668
|
-
[
|
|
2561
|
+
[19]: https://codecept.io/helpers/FileSystem
|
|
2669
2562
|
|
|
2670
|
-
[
|
|
2563
|
+
[20]: https://pptr.dev/guides/network-interception
|
|
2671
2564
|
|
|
2672
|
-
[
|
|
2565
|
+
[21]: https://github.com/puppeteer/puppeteer/issues/1313
|
|
2673
2566
|
|
|
2674
|
-
[
|
|
2567
|
+
[22]: #fillfield
|
|
2675
2568
|
|
|
2676
|
-
[
|
|
2569
|
+
[23]: #click
|
|
2677
2570
|
|
|
2678
|
-
[
|
|
2571
|
+
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2679
2572
|
|
|
2680
|
-
[
|
|
2573
|
+
[25]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page
|
|
2681
2574
|
|
|
2682
|
-
[
|
|
2575
|
+
[26]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser
|
|
2683
2576
|
|
|
2684
|
-
[
|
|
2577
|
+
[27]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md
|
|
2685
2578
|
|
|
2686
|
-
[
|
|
2579
|
+
[28]: https://pptr.dev/api/puppeteer.tracing
|
|
2687
2580
|
|
|
2688
|
-
[
|
|
2581
|
+
[29]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md
|
|
2689
2582
|
|
|
2690
|
-
[
|
|
2583
|
+
[30]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md
|