codeceptjs 4.2.1-beta.3 → 4.2.1
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/docs/helpers/Appium.md +4 -0
- package/docs/helpers/Kitesurf.md +42 -20
- package/docs/helpers/Obscura.md +43 -21
- package/docs/helpers/Playwright.md +4 -0
- package/docs/helpers/Puppeteer.md +74 -52
- package/docs/helpers/WebDriver.md +4 -0
- package/package.json +1 -1
package/docs/helpers/Appium.md
CHANGED
|
@@ -256,6 +256,10 @@ I.dontSee('#add-to-cart-btn');
|
|
|
256
256
|
|
|
257
257
|
Returns **void** automatically synchronized promise through #recorder
|
|
258
258
|
|
|
259
|
+
### capabilities
|
|
260
|
+
|
|
261
|
+
Type: CodeceptJS.HelperCapabilities
|
|
262
|
+
|
|
259
263
|
### checkIfAppIsInstalled
|
|
260
264
|
|
|
261
265
|
Returns app installation status.
|
package/docs/helpers/Kitesurf.md
CHANGED
|
@@ -79,7 +79,7 @@ Type: [object][4]
|
|
|
79
79
|
* `apiBase` **[string][3]?** Cloudflare API base URL
|
|
80
80
|
* `input` **[string][3]?** how actions are dispatched: `cdp` (real mouse and keyboard events) or `synthetic` (DOM events).
|
|
81
81
|
* `capabilities` **[object][4]?** browser capabilities; Kitesurf sets `{ layout: 'real', screenshot: true }`.
|
|
82
|
-
* `xpathPolyfill` **([string][3] | [boolean][
|
|
82
|
+
* `xpathPolyfill` **([string][3] | [boolean][18])?** inject an XPath polyfill for browsers with incomplete XPath support. `auto` detects when it is needed.
|
|
83
83
|
* `waitForTimeout` **[number][8]?** default timeout for wait* actions, in seconds.
|
|
84
84
|
* `waitForAction` **[number][8]?** fixed delay after each action, in milliseconds. When unset, actions wait only for the navigation they trigger.
|
|
85
85
|
* `pollInterval` **[number][8]?** interval between checks while waiting, in milliseconds.
|
|
@@ -190,6 +190,10 @@ I.dontSee('#add-to-cart-btn');
|
|
|
190
190
|
|
|
191
191
|
Returns **void** automatically synchronized promise through #recorder
|
|
192
192
|
|
|
193
|
+
### capabilities
|
|
194
|
+
|
|
195
|
+
Type: CodeceptJS.HelperCapabilities
|
|
196
|
+
|
|
193
197
|
### checkOption
|
|
194
198
|
|
|
195
199
|
Selects a checkbox or radio button.
|
|
@@ -683,6 +687,22 @@ I.forceClick({css: 'nav a.login'});
|
|
|
683
687
|
|
|
684
688
|
Returns **void** automatically synchronized promise through #recorder
|
|
685
689
|
|
|
690
|
+
### grabAriaSnapshot
|
|
691
|
+
|
|
692
|
+
Retrieves the ARIA snapshot of the page, or of an element, built from the browser accessibility tree.
|
|
693
|
+
The format matches Playwright's [ARIA snapshots][14].
|
|
694
|
+
|
|
695
|
+
```js
|
|
696
|
+
const snapshot = await I.grabAriaSnapshot();
|
|
697
|
+
const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
#### Parameters
|
|
701
|
+
|
|
702
|
+
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator. Defaults to body element.
|
|
703
|
+
|
|
704
|
+
Returns **[Promise][12]<[string][3]>** YAML representation of the accessibility tree
|
|
705
|
+
|
|
686
706
|
### grabAttributeFrom
|
|
687
707
|
|
|
688
708
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
@@ -714,7 +734,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
714
734
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
715
735
|
* `attr` **[string][3]** attribute name.
|
|
716
736
|
|
|
717
|
-
Returns **[Promise][12]<[Array][
|
|
737
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
718
738
|
|
|
719
739
|
### grabCookie
|
|
720
740
|
|
|
@@ -742,7 +762,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
742
762
|
let cookies = await I.grabCookies();
|
|
743
763
|
```
|
|
744
764
|
|
|
745
|
-
Returns **[Promise][12]<[Array][
|
|
765
|
+
Returns **[Promise][12]<[Array][15]<CodeceptJS.Cookie>>** array of cookie objects.
|
|
746
766
|
|
|
747
767
|
### grabCssPropertyFrom
|
|
748
768
|
|
|
@@ -775,7 +795,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
775
795
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
776
796
|
* `cssProperty` **[string][3]** CSS property name.
|
|
777
797
|
|
|
778
|
-
Returns **[Promise][12]<[Array][
|
|
798
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** CSS value
|
|
779
799
|
|
|
780
800
|
### grabCurrentUrl
|
|
781
801
|
|
|
@@ -835,7 +855,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
835
855
|
* `locator`  
|
|
836
856
|
* `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
837
857
|
|
|
838
|
-
Returns **[Promise][12]<[Array][
|
|
858
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** HTML code for an element
|
|
839
859
|
|
|
840
860
|
### grabNumberOfElements
|
|
841
861
|
|
|
@@ -889,7 +909,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
889
909
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
890
910
|
```
|
|
891
911
|
|
|
892
|
-
Returns **[Array][
|
|
912
|
+
Returns **[Array][15]** recorded network traffics
|
|
893
913
|
|
|
894
914
|
### grabSource
|
|
895
915
|
|
|
@@ -932,7 +952,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
932
952
|
|
|
933
953
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
934
954
|
|
|
935
|
-
Returns **[Promise][12]<[Array][
|
|
955
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
936
956
|
|
|
937
957
|
### grabTitle
|
|
938
958
|
|
|
@@ -974,7 +994,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
974
994
|
|
|
975
995
|
* `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
976
996
|
|
|
977
|
-
Returns **[Promise][12]<[Array][
|
|
997
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
978
998
|
|
|
979
999
|
### grabWebElement
|
|
980
1000
|
|
|
@@ -1017,7 +1037,7 @@ I.pressKey(['Control', 'a']);
|
|
|
1017
1037
|
|
|
1018
1038
|
#### Parameters
|
|
1019
1039
|
|
|
1020
|
-
* `key` **([string][3] | [Array][
|
|
1040
|
+
* `key` **([string][3] | [Array][15]<[string][3]>)** a key or an array of keys to combine (modifiers first).
|
|
1021
1041
|
|
|
1022
1042
|
Returns **void** automatically synchronized promise through #recorder
|
|
1023
1043
|
|
|
@@ -1471,7 +1491,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1471
1491
|
#### Parameters
|
|
1472
1492
|
|
|
1473
1493
|
* `select` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1474
|
-
* `option` **([string][3] | [Array][
|
|
1494
|
+
* `option` **([string][3] | [Array][15]<any>)** visible text or value of option.
|
|
1475
1495
|
* `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1476
1496
|
|
|
1477
1497
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -1494,7 +1514,7 @@ I.setCookie([
|
|
|
1494
1514
|
|
|
1495
1515
|
#### Parameters
|
|
1496
1516
|
|
|
1497
|
-
* `cookie` **(Cookie | [Array][
|
|
1517
|
+
* `cookie` **(Cookie | [Array][15]<Cookie>)** a cookie object or array of cookie objects.
|
|
1498
1518
|
|
|
1499
1519
|
Returns **void** automatically synchronized promise through #recorder
|
|
1500
1520
|
|
|
@@ -1544,13 +1564,13 @@ const video = await I.stopScreencast();
|
|
|
1544
1564
|
|
|
1545
1565
|
* `options` **[object][4]?** `{ lastFrameDelayMs }`: how long the last frame is shown, in milliseconds (1000 by default).
|
|
1546
1566
|
|
|
1547
|
-
Returns **[Promise][12]<([Buffer][
|
|
1567
|
+
Returns **[Promise][12]<([Buffer][16] | null)>** APNG data, or `null` if no frames were recorded.
|
|
1548
1568
|
|
|
1549
1569
|
### type
|
|
1550
1570
|
|
|
1551
1571
|
Types out the given text into an active field.
|
|
1552
1572
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1553
|
-
*Note:* Should be used when [`fillField`][
|
|
1573
|
+
*Note:* Should be used when [`fillField`][17] is not an option.
|
|
1554
1574
|
|
|
1555
1575
|
```js
|
|
1556
1576
|
// passing in a string
|
|
@@ -1570,7 +1590,7 @@ I.type(secret('123456'));
|
|
|
1570
1590
|
|
|
1571
1591
|
* `keys`  
|
|
1572
1592
|
* `delay` **[number][8]?** (optional) delay in ms between key presses
|
|
1573
|
-
* `key` **([string][3] | [Array][
|
|
1593
|
+
* `key` **([string][3] | [Array][15]<[string][3]>)** or array of keys to type.
|
|
1574
1594
|
|
|
1575
1595
|
Returns **void** automatically synchronized promise through #recorder
|
|
1576
1596
|
|
|
@@ -1690,7 +1710,7 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1690
1710
|
#### Parameters
|
|
1691
1711
|
|
|
1692
1712
|
* `fn` **([string][3] | [function][11])** to be executed in browser context.
|
|
1693
|
-
* `argsOrSec` **([Array][
|
|
1713
|
+
* `argsOrSec` **([Array][15]<any> | [number][8])?** (optional, `1` by default) arguments for function or seconds.
|
|
1694
1714
|
* `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
|
|
1695
1715
|
|
|
1696
1716
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -1835,7 +1855,7 @@ Probes a `/json/version`-style URL with a short timeout, used for the courtesy-a
|
|
|
1835
1855
|
|
|
1836
1856
|
* `url` **[string][3]** 
|
|
1837
1857
|
|
|
1838
|
-
Returns **[Promise][12]<[boolean][
|
|
1858
|
+
Returns **[Promise][12]<[boolean][18]>** true if the URL answered.
|
|
1839
1859
|
|
|
1840
1860
|
### _resolveBinary
|
|
1841
1861
|
|
|
@@ -1892,10 +1912,12 @@ per run and counts directly toward real-world startup latency.
|
|
|
1892
1912
|
|
|
1893
1913
|
[13]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
1894
1914
|
|
|
1895
|
-
[14]: https://
|
|
1915
|
+
[14]: https://playwright.dev/docs/aria-snapshots
|
|
1916
|
+
|
|
1917
|
+
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1896
1918
|
|
|
1897
|
-
[
|
|
1919
|
+
[16]: https://nodejs.org/api/buffer.html
|
|
1898
1920
|
|
|
1899
|
-
[
|
|
1921
|
+
[17]: #fillfield
|
|
1900
1922
|
|
|
1901
|
-
[
|
|
1923
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
package/docs/helpers/Obscura.md
CHANGED
|
@@ -111,8 +111,8 @@ Type: [object][4]
|
|
|
111
111
|
* `url` **[string][3]?** base url of website to be tested.
|
|
112
112
|
* `headers` **[object][4]?** headers sent when connecting to the endpoint, e.g. for authenticated remote browsers.
|
|
113
113
|
* `input` **[string][3]?** how actions are dispatched: `cdp` (real mouse and keyboard events) or `synthetic` (DOM events). `auto` picks `cdp` when the browser renders layout.
|
|
114
|
-
* `xpathPolyfill` **([string][3] | [boolean][
|
|
115
|
-
* `capabilities` **[object][4]?** browser capabilities (`layout`, `xpath`, `screenshot`, `innerText`) to use instead of detecting them at runtime.
|
|
114
|
+
* `xpathPolyfill` **([string][3] | [boolean][18])?** inject an XPath polyfill for browsers with incomplete XPath support. `auto` detects when it is needed.
|
|
115
|
+
* `capabilities` **[object][4]?** browser capabilities (`layout`, `xpath`, `screenshot`, `video`, `innerText`, `aria`) to use instead of detecting them at runtime.
|
|
116
116
|
* `waitForTimeout` **[number][8]?** default timeout for wait* actions, in seconds.
|
|
117
117
|
* `waitForAction` **[number][8]?** fixed delay after each action, in milliseconds. When unset, actions wait only for the navigation they trigger.
|
|
118
118
|
* `pollInterval` **[number][8]?** interval between checks while waiting, in milliseconds.
|
|
@@ -250,6 +250,10 @@ I.dontSee('#add-to-cart-btn');
|
|
|
250
250
|
|
|
251
251
|
Returns **void** automatically synchronized promise through #recorder
|
|
252
252
|
|
|
253
|
+
### capabilities
|
|
254
|
+
|
|
255
|
+
Type: CodeceptJS.HelperCapabilities
|
|
256
|
+
|
|
253
257
|
### checkOption
|
|
254
258
|
|
|
255
259
|
Selects a checkbox or radio button.
|
|
@@ -743,6 +747,22 @@ I.forceClick({css: 'nav a.login'});
|
|
|
743
747
|
|
|
744
748
|
Returns **void** automatically synchronized promise through #recorder
|
|
745
749
|
|
|
750
|
+
### grabAriaSnapshot
|
|
751
|
+
|
|
752
|
+
Retrieves the ARIA snapshot of the page, or of an element, built from the browser accessibility tree.
|
|
753
|
+
The format matches Playwright's [ARIA snapshots][14].
|
|
754
|
+
|
|
755
|
+
```js
|
|
756
|
+
const snapshot = await I.grabAriaSnapshot();
|
|
757
|
+
const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
#### Parameters
|
|
761
|
+
|
|
762
|
+
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator. Defaults to body element.
|
|
763
|
+
|
|
764
|
+
Returns **[Promise][12]<[string][3]>** YAML representation of the accessibility tree
|
|
765
|
+
|
|
746
766
|
### grabAttributeFrom
|
|
747
767
|
|
|
748
768
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
@@ -774,7 +794,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
774
794
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
775
795
|
* `attr` **[string][3]** attribute name.
|
|
776
796
|
|
|
777
|
-
Returns **[Promise][12]<[Array][
|
|
797
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
778
798
|
|
|
779
799
|
### grabCookie
|
|
780
800
|
|
|
@@ -802,7 +822,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
802
822
|
let cookies = await I.grabCookies();
|
|
803
823
|
```
|
|
804
824
|
|
|
805
|
-
Returns **[Promise][12]<[Array][
|
|
825
|
+
Returns **[Promise][12]<[Array][15]<CodeceptJS.Cookie>>** array of cookie objects.
|
|
806
826
|
|
|
807
827
|
### grabCssPropertyFrom
|
|
808
828
|
|
|
@@ -835,7 +855,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
835
855
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
836
856
|
* `cssProperty` **[string][3]** CSS property name.
|
|
837
857
|
|
|
838
|
-
Returns **[Promise][12]<[Array][
|
|
858
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** CSS value
|
|
839
859
|
|
|
840
860
|
### grabCurrentUrl
|
|
841
861
|
|
|
@@ -895,7 +915,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
895
915
|
* `locator`  
|
|
896
916
|
* `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
|
|
897
917
|
|
|
898
|
-
Returns **[Promise][12]<[Array][
|
|
918
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** HTML code for an element
|
|
899
919
|
|
|
900
920
|
### grabNumberOfElements
|
|
901
921
|
|
|
@@ -949,7 +969,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
949
969
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
950
970
|
```
|
|
951
971
|
|
|
952
|
-
Returns **[Array][
|
|
972
|
+
Returns **[Array][15]** recorded network traffics
|
|
953
973
|
|
|
954
974
|
### grabSource
|
|
955
975
|
|
|
@@ -992,7 +1012,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
992
1012
|
|
|
993
1013
|
* `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
|
|
994
1014
|
|
|
995
|
-
Returns **[Promise][12]<[Array][
|
|
1015
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
996
1016
|
|
|
997
1017
|
### grabTitle
|
|
998
1018
|
|
|
@@ -1034,7 +1054,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1034
1054
|
|
|
1035
1055
|
* `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1036
1056
|
|
|
1037
|
-
Returns **[Promise][12]<[Array][
|
|
1057
|
+
Returns **[Promise][12]<[Array][15]<[string][3]>>** attribute value
|
|
1038
1058
|
|
|
1039
1059
|
### grabWebElement
|
|
1040
1060
|
|
|
@@ -1077,7 +1097,7 @@ I.pressKey(['Control', 'a']);
|
|
|
1077
1097
|
|
|
1078
1098
|
#### Parameters
|
|
1079
1099
|
|
|
1080
|
-
* `key` **([string][3] | [Array][
|
|
1100
|
+
* `key` **([string][3] | [Array][15]<[string][3]>)** a key or an array of keys to combine (modifiers first).
|
|
1081
1101
|
|
|
1082
1102
|
Returns **void** automatically synchronized promise through #recorder
|
|
1083
1103
|
|
|
@@ -1531,7 +1551,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1531
1551
|
#### Parameters
|
|
1532
1552
|
|
|
1533
1553
|
* `select` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
|
|
1534
|
-
* `option` **([string][3] | [Array][
|
|
1554
|
+
* `option` **([string][3] | [Array][15]<any>)** visible text or value of option.
|
|
1535
1555
|
* `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1536
1556
|
|
|
1537
1557
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -1554,7 +1574,7 @@ I.setCookie([
|
|
|
1554
1574
|
|
|
1555
1575
|
#### Parameters
|
|
1556
1576
|
|
|
1557
|
-
* `cookie` **(Cookie | [Array][
|
|
1577
|
+
* `cookie` **(Cookie | [Array][15]<Cookie>)** a cookie object or array of cookie objects.
|
|
1558
1578
|
|
|
1559
1579
|
Returns **void** automatically synchronized promise through #recorder
|
|
1560
1580
|
|
|
@@ -1604,13 +1624,13 @@ const video = await I.stopScreencast();
|
|
|
1604
1624
|
|
|
1605
1625
|
* `options` **[object][4]?** `{ lastFrameDelayMs }`: how long the last frame is shown, in milliseconds (1000 by default).
|
|
1606
1626
|
|
|
1607
|
-
Returns **[Promise][12]<([Buffer][
|
|
1627
|
+
Returns **[Promise][12]<([Buffer][16] | null)>** APNG data, or `null` if no frames were recorded.
|
|
1608
1628
|
|
|
1609
1629
|
### type
|
|
1610
1630
|
|
|
1611
1631
|
Types out the given text into an active field.
|
|
1612
1632
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1613
|
-
*Note:* Should be used when [`fillField`][
|
|
1633
|
+
*Note:* Should be used when [`fillField`][17] is not an option.
|
|
1614
1634
|
|
|
1615
1635
|
```js
|
|
1616
1636
|
// passing in a string
|
|
@@ -1630,7 +1650,7 @@ I.type(secret('123456'));
|
|
|
1630
1650
|
|
|
1631
1651
|
* `keys`  
|
|
1632
1652
|
* `delay` **[number][8]?** (optional) delay in ms between key presses
|
|
1633
|
-
* `key` **([string][3] | [Array][
|
|
1653
|
+
* `key` **([string][3] | [Array][15]<[string][3]>)** or array of keys to type.
|
|
1634
1654
|
|
|
1635
1655
|
Returns **void** automatically synchronized promise through #recorder
|
|
1636
1656
|
|
|
@@ -1750,7 +1770,7 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
1750
1770
|
#### Parameters
|
|
1751
1771
|
|
|
1752
1772
|
* `fn` **([string][3] | [function][11])** to be executed in browser context.
|
|
1753
|
-
* `argsOrSec` **([Array][
|
|
1773
|
+
* `argsOrSec` **([Array][15]<any> | [number][8])?** (optional, `1` by default) arguments for function or seconds.
|
|
1754
1774
|
* `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
|
|
1755
1775
|
|
|
1756
1776
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -1895,7 +1915,7 @@ Probes a `/json/version`-style URL with a short timeout, used for the courtesy-a
|
|
|
1895
1915
|
|
|
1896
1916
|
* `url` **[string][3]** 
|
|
1897
1917
|
|
|
1898
|
-
Returns **[Promise][12]<[boolean][
|
|
1918
|
+
Returns **[Promise][12]<[boolean][18]>** true if the URL answered.
|
|
1899
1919
|
|
|
1900
1920
|
### _resolveBinary
|
|
1901
1921
|
|
|
@@ -1952,10 +1972,12 @@ per run and counts directly toward real-world startup latency.
|
|
|
1952
1972
|
|
|
1953
1973
|
[13]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
1954
1974
|
|
|
1955
|
-
[14]: https://
|
|
1975
|
+
[14]: https://playwright.dev/docs/aria-snapshots
|
|
1976
|
+
|
|
1977
|
+
[15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
1956
1978
|
|
|
1957
|
-
[
|
|
1979
|
+
[16]: https://nodejs.org/api/buffer.html
|
|
1958
1980
|
|
|
1959
|
-
[
|
|
1981
|
+
[17]: #fillfield
|
|
1960
1982
|
|
|
1961
|
-
[
|
|
1983
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
@@ -440,6 +440,10 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
440
440
|
|
|
441
441
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
442
442
|
|
|
443
|
+
### capabilities
|
|
444
|
+
|
|
445
|
+
Type: CodeceptJS.HelperCapabilities
|
|
446
|
+
|
|
443
447
|
### checkOption
|
|
444
448
|
|
|
445
449
|
[Additional options][14] for check available as 3rd argument.
|
|
@@ -39,26 +39,26 @@ Type: [object][6]
|
|
|
39
39
|
|
|
40
40
|
* `url` **[string][5]** base url of website to be tested
|
|
41
41
|
* `basicAuth` **[object][6]?** (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][
|
|
42
|
+
* `show` **[boolean][25]?** show Google Chrome window for debug.
|
|
43
|
+
* `restart` **[boolean][25]?** restart browser between tests.
|
|
44
|
+
* `disableScreenshots` **[boolean][25]?** don't save screenshot on failure.
|
|
45
|
+
* `fullPageScreenshots` **[boolean][25]?** make full page screenshots on failure.
|
|
46
|
+
* `uniqueScreenshotNames` **[boolean][25]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
47
|
+
* `trace` **[boolean][25]?** record [tracing information][29] with screenshots.
|
|
48
|
+
* `keepTraceForPassedTests` **[boolean][25]?** save trace for passed tests.
|
|
49
|
+
* `keepBrowserState` **[boolean][25]?** keep browser state between tests when `restart` is set to false.
|
|
50
|
+
* `keepCookies` **[boolean][25]?** keep cookies between tests when `restart` is set to false.
|
|
51
51
|
* `waitForAction` **[number][11]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
|
|
52
|
-
* `waitForNavigation` **([string][5] | [Array][
|
|
52
|
+
* `waitForNavigation` **([string][5] | [Array][18]<[string][5]>)?** when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][30]. Array values are accepted as well.
|
|
53
53
|
* `pressKeyDelay` **[number][11]?** delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
|
|
54
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
55
|
* `waitForTimeout` **[number][11]?** default wait* timeout in ms.
|
|
56
56
|
* `windowSize` **[string][5]?** default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
|
|
57
57
|
* `userAgent` **[string][5]?** user-agent string.
|
|
58
|
-
* `manualStart` **[boolean][
|
|
58
|
+
* `manualStart` **[boolean][25]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
|
|
59
59
|
* `browser` **[string][5]?** can be changed to `firefox` when using [puppeteer-firefox][2].
|
|
60
|
-
* `chrome` **[object][6]?** pass additional [Puppeteer run options][
|
|
61
|
-
* `highlightElement` **[boolean][
|
|
60
|
+
* `chrome` **[object][6]?** pass additional [Puppeteer run options][31].
|
|
61
|
+
* `highlightElement` **[boolean][25]?** highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
62
62
|
|
|
63
63
|
## findElement
|
|
64
64
|
|
|
@@ -82,7 +82,7 @@ Note: Unlike Playwright, Puppeteer's Locator API doesn't have .all() method for
|
|
|
82
82
|
* `matcher` **[Object][6]** Puppeteer context to search within
|
|
83
83
|
* `locator` **([Object][6] | [string][5])** Locator specification
|
|
84
84
|
|
|
85
|
-
Returns **[Promise][12]<[Array][
|
|
85
|
+
Returns **[Promise][12]<[Array][18]>** Array of ElementHandle objects
|
|
86
86
|
|
|
87
87
|
## wrapError
|
|
88
88
|
|
|
@@ -340,6 +340,10 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
340
340
|
|
|
341
341
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
342
342
|
|
|
343
|
+
### capabilities
|
|
344
|
+
|
|
345
|
+
Type: CodeceptJS.HelperCapabilities
|
|
346
|
+
|
|
343
347
|
### checkOption
|
|
344
348
|
|
|
345
349
|
Selects a checkbox or radio button.
|
|
@@ -917,6 +921,22 @@ I.forceClick({css: 'nav a.login'});
|
|
|
917
921
|
|
|
918
922
|
Returns **void** automatically synchronized promise through #recorder
|
|
919
923
|
|
|
924
|
+
### grabAriaSnapshot
|
|
925
|
+
|
|
926
|
+
Retrieves the ARIA snapshot of the page, or of an element, built from the browser accessibility tree.
|
|
927
|
+
The format matches Playwright's [ARIA snapshots][17].
|
|
928
|
+
|
|
929
|
+
```js
|
|
930
|
+
const snapshot = await I.grabAriaSnapshot();
|
|
931
|
+
const formSnapshot = await I.grabAriaSnapshot('#login-form');
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
#### Parameters
|
|
935
|
+
|
|
936
|
+
* `locator` **([string][5] | [object][6])** element located by CSS|XPath|strict locator. Defaults to body element.
|
|
937
|
+
|
|
938
|
+
Returns **[Promise][12]<[string][5]>** YAML representation of the accessibility tree
|
|
939
|
+
|
|
920
940
|
### grabAttributeFrom
|
|
921
941
|
|
|
922
942
|
Retrieves an attribute from an element located by CSS or XPath and returns it to test.
|
|
@@ -948,7 +968,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
948
968
|
* `locator` **([string][5] | [object][6])** element located by CSS|XPath|strict locator.
|
|
949
969
|
* `attr` **[string][5]** attribute name.
|
|
950
970
|
|
|
951
|
-
Returns **[Promise][12]<[Array][
|
|
971
|
+
Returns **[Promise][12]<[Array][18]<[string][5]>>** attribute value
|
|
952
972
|
|
|
953
973
|
### grabBrowserLogs
|
|
954
974
|
|
|
@@ -959,7 +979,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
959
979
|
console.log(JSON.stringify(logs))
|
|
960
980
|
```
|
|
961
981
|
|
|
962
|
-
Returns **[Promise][12]<[Array][
|
|
982
|
+
Returns **[Promise][12]<[Array][18]<any>>** 
|
|
963
983
|
|
|
964
984
|
### grabCookie
|
|
965
985
|
|
|
@@ -1009,7 +1029,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1009
1029
|
* `locator` **([string][5] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1010
1030
|
* `cssProperty` **[string][5]** CSS property name.
|
|
1011
1031
|
|
|
1012
|
-
Returns **[Promise][12]<[Array][
|
|
1032
|
+
Returns **[Promise][12]<[Array][18]<[string][5]>>** CSS value
|
|
1013
1033
|
|
|
1014
1034
|
### grabCurrentUrl
|
|
1015
1035
|
|
|
@@ -1122,7 +1142,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1122
1142
|
* `locator`  
|
|
1123
1143
|
* `element` **([string][5] | [object][6])** located by CSS|XPath|strict locator.
|
|
1124
1144
|
|
|
1125
|
-
Returns **[Promise][12]<[Array][
|
|
1145
|
+
Returns **[Promise][12]<[Array][18]<[string][5]>>** HTML code for an element
|
|
1126
1146
|
|
|
1127
1147
|
### grabNumberOfOpenTabs
|
|
1128
1148
|
|
|
@@ -1182,7 +1202,7 @@ expect(traffics[0].response.status).to.equal(200);
|
|
|
1182
1202
|
expect(traffics[0].response.body).to.contain({ name: 'this was mocked' });
|
|
1183
1203
|
```
|
|
1184
1204
|
|
|
1185
|
-
Returns **[Array][
|
|
1205
|
+
Returns **[Array][18]** recorded network traffics
|
|
1186
1206
|
|
|
1187
1207
|
### grabSource
|
|
1188
1208
|
|
|
@@ -1225,7 +1245,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1225
1245
|
|
|
1226
1246
|
* `locator` **([string][5] | [object][6])** element located by CSS|XPath|strict locator.
|
|
1227
1247
|
|
|
1228
|
-
Returns **[Promise][12]<[Array][
|
|
1248
|
+
Returns **[Promise][12]<[Array][18]<[string][5]>>** attribute value
|
|
1229
1249
|
|
|
1230
1250
|
### grabTitle
|
|
1231
1251
|
|
|
@@ -1267,7 +1287,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1267
1287
|
|
|
1268
1288
|
* `locator` **([string][5] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1269
1289
|
|
|
1270
|
-
Returns **[Promise][12]<[Array][
|
|
1290
|
+
Returns **[Promise][12]<[Array][18]<[string][5]>>** attribute value
|
|
1271
1291
|
|
|
1272
1292
|
### grabWebElement
|
|
1273
1293
|
|
|
@@ -1303,12 +1323,12 @@ Returns **[Promise][12]<any>** WebElement of being used Web helper
|
|
|
1303
1323
|
|
|
1304
1324
|
Grab the recording WS messages
|
|
1305
1325
|
|
|
1306
|
-
Returns **([Array][
|
|
1326
|
+
Returns **([Array][18]<any> | [undefined][19])** 
|
|
1307
1327
|
|
|
1308
1328
|
### handleDownloads
|
|
1309
1329
|
|
|
1310
1330
|
Sets a directory to where save files. Allows to test file downloads.
|
|
1311
|
-
Should be used with [FileSystem helper][
|
|
1331
|
+
Should be used with [FileSystem helper][20] to check that file were downloaded correctly.
|
|
1312
1332
|
|
|
1313
1333
|
By default, files are saved to `output/downloads`.
|
|
1314
1334
|
This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
@@ -1327,13 +1347,13 @@ I.seeFile('avatar.jpg');
|
|
|
1327
1347
|
|
|
1328
1348
|
### mockRoute
|
|
1329
1349
|
|
|
1330
|
-
Mocks network request using [`Request Interception`][
|
|
1350
|
+
Mocks network request using [`Request Interception`][21]
|
|
1331
1351
|
|
|
1332
1352
|
```js
|
|
1333
1353
|
I.mockRoute(/(.png$)|(.jpg$)/, route => route.abort());
|
|
1334
1354
|
```
|
|
1335
1355
|
|
|
1336
|
-
This method allows intercepting and mocking requests & responses. [Learn more about it][
|
|
1356
|
+
This method allows intercepting and mocking requests & responses. [Learn more about it][21]
|
|
1337
1357
|
|
|
1338
1358
|
#### Parameters
|
|
1339
1359
|
|
|
@@ -1372,11 +1392,11 @@ I.openNewTab();
|
|
|
1372
1392
|
|
|
1373
1393
|
### pressKey
|
|
1374
1394
|
|
|
1375
|
-
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][
|
|
1395
|
+
*Note:* Shortcuts like `'Meta'` + `'A'` do not work on macOS ([puppeteer/puppeteer#1313][22]).
|
|
1376
1396
|
|
|
1377
1397
|
Presses a key in the browser (on a focused element).
|
|
1378
1398
|
|
|
1379
|
-
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1399
|
+
*Hint:* For populating text field or textarea, it is recommended to use [`fillField`][23].
|
|
1380
1400
|
|
|
1381
1401
|
```js
|
|
1382
1402
|
I.pressKey('Backspace');
|
|
@@ -1435,7 +1455,7 @@ Some of the supported key names are:
|
|
|
1435
1455
|
|
|
1436
1456
|
#### Parameters
|
|
1437
1457
|
|
|
1438
|
-
* `key` **([string][5] | [Array][
|
|
1458
|
+
* `key` **([string][5] | [Array][18]<[string][5]>)** key or array of keys to press.
|
|
1439
1459
|
|
|
1440
1460
|
Returns **void** automatically synchronized promise through #recorder
|
|
1441
1461
|
|
|
@@ -1443,7 +1463,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1443
1463
|
|
|
1444
1464
|
Presses a key in the browser and leaves it in a down state.
|
|
1445
1465
|
|
|
1446
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1466
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][24]).
|
|
1447
1467
|
|
|
1448
1468
|
```js
|
|
1449
1469
|
I.pressKeyDown('Control');
|
|
@@ -1461,7 +1481,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
1461
1481
|
|
|
1462
1482
|
Releases a key in the browser which was previously set to a down state.
|
|
1463
1483
|
|
|
1464
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1484
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][24]).
|
|
1465
1485
|
|
|
1466
1486
|
```js
|
|
1467
1487
|
I.pressKeyDown('Control');
|
|
@@ -1551,7 +1571,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1551
1571
|
#### Parameters
|
|
1552
1572
|
|
|
1553
1573
|
* `fileName` **[string][5]** file name to save.
|
|
1554
|
-
* `fullPage` **[boolean][
|
|
1574
|
+
* `fullPage` **[boolean][25]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1555
1575
|
|
|
1556
1576
|
Returns **void** automatically synchronized promise through #recorder
|
|
1557
1577
|
|
|
@@ -1991,7 +2011,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1991
2011
|
#### Parameters
|
|
1992
2012
|
|
|
1993
2013
|
* `select` **([string][5] | [object][6])** field located by label|name|CSS|XPath|strict locator.
|
|
1994
|
-
* `option` **([string][5] | [Array][
|
|
2014
|
+
* `option` **([string][5] | [Array][18]<any>)** visible text or value of option.
|
|
1995
2015
|
* `context` **([string][5]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1996
2016
|
|
|
1997
2017
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2014,7 +2034,7 @@ I.setCookie([
|
|
|
2014
2034
|
|
|
2015
2035
|
#### Parameters
|
|
2016
2036
|
|
|
2017
|
-
* `cookie` **(Cookie | [Array][
|
|
2037
|
+
* `cookie` **(Cookie | [Array][18]<Cookie>)** a cookie object or array of cookie objects.
|
|
2018
2038
|
|
|
2019
2039
|
Returns **void** automatically synchronized promise through #recorder
|
|
2020
2040
|
|
|
@@ -2129,7 +2149,7 @@ I.switchToPreviousTab(2);
|
|
|
2129
2149
|
|
|
2130
2150
|
Types out the given text into an active field.
|
|
2131
2151
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
2132
|
-
*Note:* Should be used when [`fillField`][
|
|
2152
|
+
*Note:* Should be used when [`fillField`][23] is not an option.
|
|
2133
2153
|
|
|
2134
2154
|
```js
|
|
2135
2155
|
// passing in a string
|
|
@@ -2149,7 +2169,7 @@ I.type(secret('123456'));
|
|
|
2149
2169
|
|
|
2150
2170
|
* `keys`  
|
|
2151
2171
|
* `delay` **[number][11]?** (optional) delay in ms between key presses
|
|
2152
|
-
* `key` **([string][5] | [Array][
|
|
2172
|
+
* `key` **([string][5] | [Array][18]<[string][5]>)** or array of keys to type.
|
|
2153
2173
|
|
|
2154
2174
|
Returns **void** automatically synchronized promise through #recorder
|
|
2155
2175
|
|
|
@@ -2180,7 +2200,7 @@ Use Puppeteer API inside a test.
|
|
|
2180
2200
|
First argument is a description of an action.
|
|
2181
2201
|
Second argument is async function that gets this helper as parameter.
|
|
2182
2202
|
|
|
2183
|
-
{ [`page`][
|
|
2203
|
+
{ [`page`][26], [`browser`][27] } from Puppeteer API are available.
|
|
2184
2204
|
|
|
2185
2205
|
```js
|
|
2186
2206
|
I.usePuppeteerTo('emulate offline mode', async ({ page }) {
|
|
@@ -2312,7 +2332,7 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2312
2332
|
#### Parameters
|
|
2313
2333
|
|
|
2314
2334
|
* `fn` **([string][5] | [function][15])** to be executed in browser context.
|
|
2315
|
-
* `argsOrSec` **([Array][
|
|
2335
|
+
* `argsOrSec` **([Array][18]<any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
|
|
2316
2336
|
* `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
|
|
2317
2337
|
|
|
2318
2338
|
Returns **void** automatically synchronized promise through #recorder
|
|
@@ -2337,7 +2357,7 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
2337
2357
|
|
|
2338
2358
|
Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
2339
2359
|
|
|
2340
|
-
See [Puppeteer's reference][
|
|
2360
|
+
See [Puppeteer's reference][28]
|
|
2341
2361
|
|
|
2342
2362
|
#### Parameters
|
|
2343
2363
|
|
|
@@ -2616,30 +2636,32 @@ Set current page
|
|
|
2616
2636
|
|
|
2617
2637
|
[16]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2618
2638
|
|
|
2619
|
-
[17]: https://
|
|
2639
|
+
[17]: https://playwright.dev/docs/aria-snapshots
|
|
2640
|
+
|
|
2641
|
+
[18]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2620
2642
|
|
|
2621
|
-
[
|
|
2643
|
+
[19]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
2622
2644
|
|
|
2623
|
-
[
|
|
2645
|
+
[20]: https://codecept.io/helpers/FileSystem
|
|
2624
2646
|
|
|
2625
|
-
[
|
|
2647
|
+
[21]: https://pptr.dev/guides/network-interception
|
|
2626
2648
|
|
|
2627
|
-
[
|
|
2649
|
+
[22]: https://github.com/puppeteer/puppeteer/issues/1313
|
|
2628
2650
|
|
|
2629
|
-
[
|
|
2651
|
+
[23]: #fillfield
|
|
2630
2652
|
|
|
2631
|
-
[
|
|
2653
|
+
[24]: #click
|
|
2632
2654
|
|
|
2633
|
-
[
|
|
2655
|
+
[25]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2634
2656
|
|
|
2635
|
-
[
|
|
2657
|
+
[26]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page
|
|
2636
2658
|
|
|
2637
|
-
[
|
|
2659
|
+
[27]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser
|
|
2638
2660
|
|
|
2639
|
-
[
|
|
2661
|
+
[28]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.page.waitfornavigation.md
|
|
2640
2662
|
|
|
2641
|
-
[
|
|
2663
|
+
[29]: https://pptr.dev/api/puppeteer.tracing
|
|
2642
2664
|
|
|
2643
|
-
[
|
|
2665
|
+
[30]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.waitforoptions.md
|
|
2644
2666
|
|
|
2645
|
-
[
|
|
2667
|
+
[31]: https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.launchoptions.md
|
|
@@ -519,6 +519,10 @@ Returns **void** automatically synchronized promise through #recorder
|
|
|
519
519
|
|
|
520
520
|
Dismisses the active JavaScript popup, as created by `window.alert|window.confirm|window.prompt`.
|
|
521
521
|
|
|
522
|
+
### capabilities
|
|
523
|
+
|
|
524
|
+
Type: CodeceptJS.HelperCapabilities
|
|
525
|
+
|
|
522
526
|
### checkOption
|
|
523
527
|
|
|
524
528
|
Appium: not tested
|