codeceptjs 3.5.10 → 3.5.11

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.
@@ -1171,7 +1171,7 @@ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "cent
1171
1171
  #### Parameters
1172
1172
 
1173
1173
  - `locator` **([string][5] \| [object][11])** located by CSS|XPath|strict locator.
1174
- - `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][17].
1174
+ - `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][7])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][17].
1175
1175
 
1176
1176
  Returns **void** automatically synchronized promise through #recorderSupported only for web testing
1177
1177
 
@@ -20,7 +20,7 @@ Zero-configuration when paired with other helpers like REST, Playwright:
20
20
  {
21
21
  helpers: {
22
22
  Playwright: {...},
23
- ExpectHelper: {},
23
+ Expect: {},
24
24
  }
25
25
  }
26
26
  ```
@@ -32,16 +32,16 @@ Zero-configuration when paired with other helpers like REST, Playwright:
32
32
  #### Parameters
33
33
 
34
34
  - `targetData` **any**
35
- - `aboveThan` **any** number | Date
36
- - `customErrorMsg` **any**
35
+ - `aboveThan` **any**
36
+ - `customErrorMsg` **any?**
37
37
 
38
38
  ### expectBelow
39
39
 
40
40
  #### Parameters
41
41
 
42
42
  - `targetData` **any**
43
- - `belowThan` **any** number | Date
44
- - `customErrorMsg` **any**
43
+ - `belowThan` **any**
44
+ - `customErrorMsg` **any?**
45
45
 
46
46
  ### expectContain
47
47
 
@@ -49,7 +49,7 @@ Zero-configuration when paired with other helpers like REST, Playwright:
49
49
 
50
50
  - `actualValue` **any**
51
51
  - `expectedValueToContain` **any**
52
- - `customErrorMsg` **any**
52
+ - `customErrorMsg` **any?**
53
53
 
54
54
  ### expectDeepEqual
55
55
 
@@ -57,7 +57,7 @@ Zero-configuration when paired with other helpers like REST, Playwright:
57
57
 
58
58
  - `actualValue` **any**
59
59
  - `expectedValue` **any**
60
- - `customErrorMsg` **any**
60
+ - `customErrorMsg` **any?**
61
61
 
62
62
  ### expectDeepEqualExcluding
63
63
 
@@ -68,7 +68,7 @@ expects members of two JSON objects are deeply equal excluding some properties
68
68
  - `actualValue` **any**
69
69
  - `expectedValue` **any**
70
70
  - `fieldsToExclude` **any**
71
- - `customErrorMsg` **any**
71
+ - `customErrorMsg` **any?**
72
72
 
73
73
  ### expectDeepIncludeMembers
74
74
 
@@ -78,7 +78,7 @@ expects an array to be a superset of another array
78
78
 
79
79
  - `superset` **any**
80
80
  - `set` **any**
81
- - `customErrorMsg` **any**
81
+ - `customErrorMsg` **any?**
82
82
 
83
83
  ### expectDeepMembers
84
84
 
@@ -88,14 +88,14 @@ expects members of two arrays are deeply equal
88
88
 
89
89
  - `actualValue` **any**
90
90
  - `expectedValue` **any**
91
- - `customErrorMsg` **any**
91
+ - `customErrorMsg` **any?**
92
92
 
93
93
  ### expectEmpty
94
94
 
95
95
  #### Parameters
96
96
 
97
97
  - `targetData` **any**
98
- - `customErrorMsg` **any**
98
+ - `customErrorMsg` **any?**
99
99
 
100
100
  ### expectEndsWith
101
101
 
@@ -103,7 +103,7 @@ expects members of two arrays are deeply equal
103
103
 
104
104
  - `actualValue` **any**
105
105
  - `expectedValueToEndWith` **any**
106
- - `customErrorMsg` **any**
106
+ - `customErrorMsg` **any?**
107
107
 
108
108
  ### expectEqual
109
109
 
@@ -111,7 +111,7 @@ expects members of two arrays are deeply equal
111
111
 
112
112
  - `actualValue` **any**
113
113
  - `expectedValue` **any**
114
- - `customErrorMsg` **any**
114
+ - `customErrorMsg` **any?**
115
115
 
116
116
  ### expectEqualIgnoreCase
117
117
 
@@ -119,14 +119,14 @@ expects members of two arrays are deeply equal
119
119
 
120
120
  - `actualValue` **any**
121
121
  - `expectedValue` **any**
122
- - `customErrorMsg` **any**
122
+ - `customErrorMsg` **any?**
123
123
 
124
124
  ### expectFalse
125
125
 
126
126
  #### Parameters
127
127
 
128
128
  - `targetData` **any**
129
- - `customErrorMsg` **any**
129
+ - `customErrorMsg` **any?**
130
130
 
131
131
  ### expectHasAProperty
132
132
 
@@ -134,7 +134,7 @@ expects members of two arrays are deeply equal
134
134
 
135
135
  - `targetData` **any**
136
136
  - `propertyName` **any**
137
- - `customErrorMsg` **any**
137
+ - `customErrorMsg` **any?**
138
138
 
139
139
  ### expectHasProperty
140
140
 
@@ -142,7 +142,7 @@ expects members of two arrays are deeply equal
142
142
 
143
143
  - `targetData` **any**
144
144
  - `propertyName` **any**
145
- - `customErrorMsg` **any**
145
+ - `customErrorMsg` **any?**
146
146
 
147
147
  ### expectJsonSchema
148
148
 
@@ -150,7 +150,7 @@ expects members of two arrays are deeply equal
150
150
 
151
151
  - `targetData` **any**
152
152
  - `jsonSchema` **any**
153
- - `customErrorMsg` **any**
153
+ - `customErrorMsg` **any?**
154
154
 
155
155
  ### expectJsonSchemaUsingAJV
156
156
 
@@ -158,7 +158,7 @@ expects members of two arrays are deeply equal
158
158
 
159
159
  - `targetData` **any**
160
160
  - `jsonSchema` **any**
161
- - `customErrorMsg` **any**
161
+ - `customErrorMsg` **any?**
162
162
  - `ajvOptions` **any** Pass AJV options
163
163
 
164
164
  ### expectLengthAboveThan
@@ -167,7 +167,7 @@ expects members of two arrays are deeply equal
167
167
 
168
168
  - `targetData` **any**
169
169
  - `lengthAboveThan` **any**
170
- - `customErrorMsg` **any**
170
+ - `customErrorMsg` **any?**
171
171
 
172
172
  ### expectLengthBelowThan
173
173
 
@@ -175,7 +175,7 @@ expects members of two arrays are deeply equal
175
175
 
176
176
  - `targetData` **any**
177
177
  - `lengthBelowThan` **any**
178
- - `customErrorMsg` **any**
178
+ - `customErrorMsg` **any?**
179
179
 
180
180
  ### expectLengthOf
181
181
 
@@ -183,7 +183,7 @@ expects members of two arrays are deeply equal
183
183
 
184
184
  - `targetData` **any**
185
185
  - `length` **any**
186
- - `customErrorMsg` **any**
186
+ - `customErrorMsg` **any?**
187
187
 
188
188
  ### expectMatchesPattern
189
189
 
@@ -193,7 +193,7 @@ expects a JSON object matches a provided pattern
193
193
 
194
194
  - `actualValue` **any**
195
195
  - `expectedPattern` **any**
196
- - `customErrorMsg` **any**
196
+ - `customErrorMsg` **any?**
197
197
 
198
198
  ### expectMatchRegex
199
199
 
@@ -201,7 +201,7 @@ expects a JSON object matches a provided pattern
201
201
 
202
202
  - `targetData` **any**
203
203
  - `regex` **any**
204
- - `customErrorMsg` **any**
204
+ - `customErrorMsg` **any?**
205
205
 
206
206
  ### expectNotContain
207
207
 
@@ -209,7 +209,7 @@ expects a JSON object matches a provided pattern
209
209
 
210
210
  - `actualValue` **any**
211
211
  - `expectedValueToNotContain` **any**
212
- - `customErrorMsg` **any**
212
+ - `customErrorMsg` **any?**
213
213
 
214
214
  ### expectNotDeepEqual
215
215
 
@@ -217,7 +217,7 @@ expects a JSON object matches a provided pattern
217
217
 
218
218
  - `actualValue` **any**
219
219
  - `expectedValue` **any**
220
- - `customErrorMsg` **any**
220
+ - `customErrorMsg` **any?**
221
221
 
222
222
  ### expectNotEndsWith
223
223
 
@@ -225,7 +225,7 @@ expects a JSON object matches a provided pattern
225
225
 
226
226
  - `actualValue` **any**
227
227
  - `expectedValueToNotEndWith` **any**
228
- - `customErrorMsg` **any**
228
+ - `customErrorMsg` **any?**
229
229
 
230
230
  ### expectNotEqual
231
231
 
@@ -233,7 +233,7 @@ expects a JSON object matches a provided pattern
233
233
 
234
234
  - `actualValue` **any**
235
235
  - `expectedValue` **any**
236
- - `customErrorMsg` **any**
236
+ - `customErrorMsg` **any?**
237
237
 
238
238
  ### expectNotStartsWith
239
239
 
@@ -241,7 +241,7 @@ expects a JSON object matches a provided pattern
241
241
 
242
242
  - `actualValue` **any**
243
243
  - `expectedValueToNotStartWith` **any**
244
- - `customErrorMsg` **any**
244
+ - `customErrorMsg` **any?**
245
245
 
246
246
  ### expectStartsWith
247
247
 
@@ -249,7 +249,7 @@ expects a JSON object matches a provided pattern
249
249
 
250
250
  - `actualValue` **any**
251
251
  - `expectedValueToStartWith` **any**
252
- - `customErrorMsg` **any**
252
+ - `customErrorMsg` **any?**
253
253
 
254
254
  ### expectToBeA
255
255
 
@@ -257,7 +257,7 @@ expects a JSON object matches a provided pattern
257
257
 
258
258
  - `targetData` **any**
259
259
  - `type` **any**
260
- - `customErrorMsg` **any**
260
+ - `customErrorMsg` **any?**
261
261
 
262
262
  ### expectToBeAn
263
263
 
@@ -265,11 +265,11 @@ expects a JSON object matches a provided pattern
265
265
 
266
266
  - `targetData` **any**
267
267
  - `type` **any**
268
- - `customErrorMsg` **any**
268
+ - `customErrorMsg` **any?**
269
269
 
270
270
  ### expectTrue
271
271
 
272
272
  #### Parameters
273
273
 
274
274
  - `targetData` **any**
275
- - `customErrorMsg` **any**
275
+ - `customErrorMsg` **any?**
@@ -508,6 +508,17 @@ Dismisses the active JavaScript popup, as created by window.alert|window.confirm
508
508
 
509
509
  ### checkOption
510
510
 
511
+ [Additional options][15] for check available as 3rd argument.
512
+
513
+ Examples:
514
+
515
+ ```js
516
+ // click on element at position
517
+ I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
518
+ ```
519
+
520
+ > ⚠️ To avoid flakiness, option `force: true` is set by default
521
+
511
522
  Selects a checkbox or radio button.
512
523
  Element is located by label or name or CSS or XPath.
513
524
 
@@ -525,10 +536,7 @@ I.checkOption('agree', '//form');
525
536
  - `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
526
537
  - `options`
527
538
 
528
- Returns **void** automatically synchronized promise through #recorder[Additional options][15] for check available as 3rd argument.Examples:```js
529
- // click on element at position
530
- I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } })
531
- ```> ⚠️ To avoid flakiness, option `force: true` is set by default
539
+ Returns **void** automatically synchronized promise through #recorder
532
540
 
533
541
  ### clearCookie
534
542
 
@@ -592,13 +600,19 @@ I.click({css: 'nav a.login'});
592
600
 
593
601
  - `locator` **([string][9] | [object][6])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
594
602
  - `context` **([string][9]? | [object][6] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
595
- - `options` **any?** [Additional options][18] for click available as 3rd argument.Examples:```js
596
- // click on element at position
597
- I.click('canvas', '.model', { position: { x: 20, y: 40 } })
603
+ - `options` **any?** [Additional options][18] for click available as 3rd argument.
604
+
605
+ #### Examples
598
606
 
599
- // make ctrl-click
600
- I.click('.edit', null, { modifiers: ['Ctrl'] } )
601
- ```
607
+ ````javascript
608
+ ```js
609
+ // click on element at position
610
+ I.click('canvas', '.model', { position: { x: 20, y: 40 } })
611
+
612
+ // make ctrl-click
613
+ I.click('.edit', null, { modifiers: ['Ctrl'] } )
614
+ ```
615
+ ````
602
616
 
603
617
  Returns **void** automatically synchronized promise through #recorder
604
618
 
@@ -812,6 +826,13 @@ Returns **void** automatically synchronized promise through #recorder
812
826
 
813
827
  ### dragAndDrop
814
828
 
829
+ ```js
830
+ // specify coordinates for source position
831
+ I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
832
+ ```
833
+
834
+ > When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
835
+
815
836
  Drag an item to a destination element.
816
837
 
817
838
  ```js
@@ -822,10 +843,7 @@ I.dragAndDrop('#dragHandle', '#container');
822
843
 
823
844
  - `srcElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
824
845
  - `destElement` **([string][9] | [object][6])** located by CSS|XPath|strict locator.
825
- - `options` **any?** [Additional options][19] can be passed as 3rd argument.```js
826
- // specify coordinates for source position
827
- I.dragAndDrop('img.src', 'img.dst', { sourcePosition: {x: 10, y: 10} })
828
- ```> When no option is set, custom drag and drop would be used, to use the dragAndDrop API from Playwright, please set options, for example `force: true`
846
+ - `options` **any?** [Additional options][19] can be passed as 3rd argument.
829
847
 
830
848
  Returns **void** automatically synchronized promise through #recorder
831
849
 
@@ -860,8 +878,8 @@ Additional parameters of the function can be passed as an object argument:
860
878
  I.executeScript(({x, y}) => x + y, {x, y});
861
879
  ```
862
880
 
863
- You can pass only one parameter into a function
864
- but you can pass in array or object.
881
+ You can pass only one parameter into a function,
882
+ or you can pass in array or object.
865
883
 
866
884
  ```js
867
885
  I.executeScript(([x, y]) => x + y, [x, y]);
@@ -1020,6 +1038,8 @@ Returns **[Promise][22]<[boolean][26]>**
1020
1038
 
1021
1039
  ### grabCookie
1022
1040
 
1041
+ Returns cookie in JSON format. If name not passed returns all cookies for this domain.
1042
+
1023
1043
  Gets a cookie object by name.
1024
1044
  If none provided gets all cookies.
1025
1045
  Resumes test execution, so **should be used inside async function with `await`** operator.
@@ -1033,7 +1053,7 @@ assert(cookie.value, '123456');
1033
1053
 
1034
1054
  - `name` **[string][9]?** cookie name.
1035
1055
 
1036
- Returns **any** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
1056
+ Returns **any** attribute value
1037
1057
 
1038
1058
  ### grabCssPropertyFrom
1039
1059
 
@@ -1539,9 +1559,11 @@ I.openNewTab({ isMobile: true });
1539
1559
 
1540
1560
  ### pressKey
1541
1561
 
1562
+ _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][33]).
1563
+
1542
1564
  Presses a key in the browser (on a focused element).
1543
1565
 
1544
- _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][33].
1566
+ _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][34].
1545
1567
 
1546
1568
  ```js
1547
1569
  I.pressKey('Backspace');
@@ -1602,7 +1624,7 @@ Some of the supported key names are:
1602
1624
 
1603
1625
  - `key` **([string][9] | [Array][10]<[string][9]>)** key or array of keys to press.
1604
1626
 
1605
- Returns **void** automatically synchronized promise through #recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313][34]).
1627
+ Returns **void** automatically synchronized promise through #recorder
1606
1628
 
1607
1629
  ### pressKeyDown
1608
1630
 
@@ -1672,6 +1694,18 @@ Returns **any** Promise<void>
1672
1694
 
1673
1695
  ### resizeWindow
1674
1696
 
1697
+ Unlike other drivers Playwright changes the size of a viewport, not the window!
1698
+ Playwright does not control the window of a browser, so it can't adjust its real size.
1699
+ It also can't maximize a window.
1700
+
1701
+ Update configuration to change real window size on start:
1702
+
1703
+ ```js
1704
+ // inside codecept.conf.js
1705
+ // @codeceptjs/configure package must be installed
1706
+ { setWindowSize } = require('@codeceptjs/configure');
1707
+ ```
1708
+
1675
1709
  Resize the current window to provided width and height.
1676
1710
  First parameter can be set to `maximize`.
1677
1711
 
@@ -1680,13 +1714,7 @@ First parameter can be set to `maximize`.
1680
1714
  - `width` **[number][20]** width in pixels or `maximize`.
1681
1715
  - `height` **[number][20]** height in pixels.
1682
1716
 
1683
- Returns **void** automatically synchronized promise through #recorderUnlike other drivers Playwright changes the size of a viewport, not the window!
1684
- Playwright does not control the window of a browser so it can't adjust its real size.
1685
- It also can't maximize a window.Update configuration to change real window size on start:```js
1686
- // inside codecept.conf.js
1687
- // @codeceptjs/configure package must be installed
1688
- { setWindowSize } = require('@codeceptjs/configure');
1689
- ```
1717
+ Returns **void** automatically synchronized promise through #recorder
1690
1718
 
1691
1719
  ### restartBrowser
1692
1720
 
@@ -2262,7 +2290,7 @@ I.switchToPreviousTab(2);
2262
2290
 
2263
2291
  Types out the given text into an active field.
2264
2292
  To slow down typing use a second parameter, to set interval between key presses.
2265
- _Note:_ Should be used when [`fillField`][33] is not an option.
2293
+ _Note:_ Should be used when [`fillField`][34] is not an option.
2266
2294
 
2267
2295
  ```js
2268
2296
  // passing in a string
@@ -2288,6 +2316,17 @@ Returns **void** automatically synchronized promise through #recorder
2288
2316
 
2289
2317
  ### uncheckOption
2290
2318
 
2319
+ [Additional options][37] for uncheck available as 3rd argument.
2320
+
2321
+ Examples:
2322
+
2323
+ ```js
2324
+ // click on element at position
2325
+ I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
2326
+ ```
2327
+
2328
+ > ⚠️ To avoid flakiness, option `force: true` is set by default
2329
+
2291
2330
  Unselects a checkbox or radio button.
2292
2331
  Element is located by label or name or CSS or XPath.
2293
2332
 
@@ -2305,10 +2344,7 @@ I.uncheckOption('agree', '//form');
2305
2344
  - `context` **([string][9]? | [object][6])** (optional, `null` by default) element located by CSS | XPath | strict locator.
2306
2345
  - `options`
2307
2346
 
2308
- Returns **void** automatically synchronized promise through #recorder[Additional options][37] for uncheck available as 3rd argument.Examples:```js
2309
- // click on element at position
2310
- I.uncheckOption('Agree', '.signup', { position: { x: 5, y: 5 } })
2311
- ```> ⚠️ To avoid flakiness, option `force: true` is set by default
2347
+ Returns **void** automatically synchronized promise through #recorder
2312
2348
 
2313
2349
  ### usePlaywrightTo
2314
2350
 
@@ -2328,7 +2364,7 @@ I.usePlaywrightTo('emulate offline mode', async ({ browserContext }) => {
2328
2364
  #### Parameters
2329
2365
 
2330
2366
  - `description` **[string][9]** used to show in logs.
2331
- - `fn` **[function][21]** async function that executed with Playwright helper as argumen
2367
+ - `fn` **[function][21]** async function that executed with Playwright helper as arguments
2332
2368
 
2333
2369
  ### wait
2334
2370
 
@@ -2532,6 +2568,8 @@ Returns **void** automatically synchronized promise through #recorder
2532
2568
 
2533
2569
  ### waitForVisible
2534
2570
 
2571
+ This method accepts [React selectors][43].
2572
+
2535
2573
  Waits for an element to become visible on a page (by default waits for 1sec).
2536
2574
  Element can be located by CSS or XPath.
2537
2575
 
@@ -2544,7 +2582,7 @@ I.waitForVisible('#popup');
2544
2582
  - `locator` **([string][9] | [object][6])** element located by CSS|XPath|strict locator.
2545
2583
  - `sec` **[number][20]** (optional, `1` by default) time in seconds to wait
2546
2584
 
2547
- Returns **void** automatically synchronized promise through #recorderThis method accepts [React selectors][43].
2585
+ Returns **void** automatically synchronized promise through #recorder
2548
2586
 
2549
2587
  ### waitInUrl
2550
2588
 
@@ -2673,9 +2711,9 @@ Returns **void** automatically synchronized promise through #recorder
2673
2711
 
2674
2712
  [32]: https://github.com/microsoft/playwright/blob/main/docs/api.md#browsernewpageoptions
2675
2713
 
2676
- [33]: #fillfield
2714
+ [33]: https://github.com/GoogleChrome/puppeteer/issues/1313
2677
2715
 
2678
- [34]: https://github.com/GoogleChrome/puppeteer/issues/1313
2716
+ [34]: #fillfield
2679
2717
 
2680
2718
  [35]: #click
2681
2719