codeceptjs 3.5.4-beta.1 → 3.5.5

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +368 -0
  2. package/README.md +0 -2
  3. package/docs/build/Appium.js +48 -7
  4. package/docs/build/GraphQL.js +25 -0
  5. package/docs/build/Nightmare.js +15 -6
  6. package/docs/build/Playwright.js +436 -197
  7. package/docs/build/Protractor.js +17 -8
  8. package/docs/build/Puppeteer.js +37 -20
  9. package/docs/build/TestCafe.js +19 -10
  10. package/docs/build/WebDriver.js +45 -37
  11. package/docs/changelog.md +375 -0
  12. package/docs/community-helpers.md +8 -4
  13. package/docs/examples.md +8 -2
  14. package/docs/helpers/Appium.md +39 -2
  15. package/docs/helpers/GraphQL.md +21 -0
  16. package/docs/helpers/Nightmare.md +1260 -0
  17. package/docs/helpers/Playwright.md +223 -119
  18. package/docs/helpers/Protractor.md +1711 -0
  19. package/docs/helpers/Puppeteer.md +31 -29
  20. package/docs/helpers/TestCafe.md +18 -17
  21. package/docs/helpers/WebDriver.md +34 -32
  22. package/docs/playwright.md +24 -1
  23. package/docs/webapi/dontSeeInField.mustache +1 -1
  24. package/docs/webapi/executeAsyncScript.mustache +2 -0
  25. package/docs/webapi/executeScript.mustache +2 -0
  26. package/docs/webapi/seeInField.mustache +1 -1
  27. package/docs/wiki/Books-&-Posts.md +0 -0
  28. package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
  29. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
  30. package/docs/wiki/Examples.md +8 -2
  31. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
  32. package/docs/wiki/Home.md +0 -0
  33. package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
  34. package/docs/wiki/Release-Process.md +0 -0
  35. package/docs/wiki/Roadmap.md +0 -0
  36. package/docs/wiki/Tests.md +0 -0
  37. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
  38. package/docs/wiki/Videos.md +0 -0
  39. package/lib/codecept.js +1 -0
  40. package/lib/command/definitions.js +2 -7
  41. package/lib/command/init.js +40 -4
  42. package/lib/command/run-multiple/collection.js +17 -5
  43. package/lib/command/run-workers.js +4 -0
  44. package/lib/command/run.js +6 -0
  45. package/lib/helper/Appium.js +46 -5
  46. package/lib/helper/GraphQL.js +25 -0
  47. package/lib/helper/Nightmare.js +1415 -0
  48. package/lib/helper/Playwright.js +336 -62
  49. package/lib/helper/Protractor.js +1837 -0
  50. package/lib/helper/Puppeteer.js +31 -18
  51. package/lib/helper/TestCafe.js +15 -8
  52. package/lib/helper/WebDriver.js +39 -35
  53. package/lib/helper/clientscripts/nightmare.js +213 -0
  54. package/lib/helper/errors/ElementNotFound.js +2 -1
  55. package/lib/helper/scripts/highlightElement.js +1 -1
  56. package/lib/interfaces/bdd.js +1 -1
  57. package/lib/mochaFactory.js +2 -1
  58. package/lib/pause.js +6 -4
  59. package/lib/plugin/heal.js +2 -3
  60. package/lib/plugin/selenoid.js +6 -1
  61. package/lib/step.js +27 -10
  62. package/lib/utils.js +4 -0
  63. package/lib/workers.js +3 -1
  64. package/package.json +87 -87
  65. package/typings/promiseBasedTypes.d.ts +163 -126
  66. package/typings/types.d.ts +183 -144
  67. package/docs/build/Polly.js +0 -42
  68. package/docs/build/SeleniumWebdriver.js +0 -76
@@ -0,0 +1,1260 @@
1
+ ---
2
+ permalink: /helpers/Nightmare
3
+ editLink: false
4
+ sidebar: auto
5
+ title: Nightmare
6
+ ---
7
+
8
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
9
+
10
+ ## Nightmare
11
+
12
+ **Extends Helper**
13
+
14
+ Nightmare helper wraps [Nightmare][1] library to provide
15
+ fastest headless testing using Electron engine. Unlike Selenium-based drivers this uses
16
+ Chromium-based browser with Electron with lots of client side scripts, thus should be less stable and
17
+ less trusted.
18
+
19
+ Requires `nightmare` package to be installed.
20
+
21
+ ## Configuration
22
+
23
+ This helper should be configured in codecept.conf.ts or codecept.conf.js
24
+
25
+ - `url` - base url of website to be tested
26
+ - `restart` - restart browser between tests.
27
+ - `disableScreenshots` - don't save screenshot on failure.
28
+ - `uniqueScreenshotNames` - option to prevent screenshot override if you have scenarios with the same name in different suites.
29
+ - `fullPageScreenshots` - make full page screenshots on failure.
30
+ - `keepBrowserState` - keep browser state between tests when `restart` set to false.
31
+ - `keepCookies` - keep cookies between tests when `restart` set to false.
32
+ - `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 500.
33
+ - `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
34
+ - `windowSize`: (optional) default window size. Set a dimension like `640x480`.
35
+
36
+
37
+ - options from [Nightmare configuration][2]
38
+
39
+ ## Methods
40
+
41
+ ### Parameters
42
+
43
+ - `config`
44
+
45
+ ### _locate
46
+
47
+ Locate elements by different locator types, including strict locator.
48
+ Should be used in custom helpers.
49
+
50
+ This method return promise with array of IDs of found elements.
51
+ Actual elements can be accessed inside `evaluate` by using `codeceptjs.fetchElement()`
52
+ client-side function:
53
+
54
+ ```js
55
+ // get an inner text of an element
56
+
57
+ let browser = this.helpers['Nightmare'].browser;
58
+ let value = this.helpers['Nightmare']._locate({name: 'password'}).then(function(els) {
59
+ return browser.evaluate(function(el) {
60
+ return codeceptjs.fetchElement(el).value;
61
+ }, els[0]);
62
+ });
63
+ ```
64
+
65
+ #### Parameters
66
+
67
+ - `locator`
68
+
69
+ ### amOnPage
70
+
71
+ Opens a web page in a browser. Requires relative or absolute url.
72
+ If url starts with `/`, opens a web page of a site defined in `url` config parameter.
73
+
74
+ ```js
75
+ I.amOnPage('/'); // opens main page of website
76
+ I.amOnPage('https://github.com'); // opens github
77
+ I.amOnPage('/login'); // opens a login page
78
+ ```
79
+
80
+ #### Parameters
81
+
82
+ - `url` **[string][3]** url path or global url.
83
+ - `headers` **[object][4]?** list of request headers can be passed
84
+
85
+ Returns **void** automatically synchronized promise with recorder #!
86
+
87
+ ### appendField
88
+
89
+ Appends text to a input field or textarea.
90
+ Field is located by name, label, CSS or XPath
91
+
92
+ ```js
93
+ I.appendField('#myTextField', 'appended');
94
+ // typing secret
95
+ I.appendField('password', secret('123456'));
96
+ ```
97
+
98
+ #### Parameters
99
+
100
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator
101
+ - `value` **[string][3]** text value to append.
102
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
103
+
104
+ ### attachFile
105
+
106
+ Attaches a file to element located by label, name, CSS or XPath
107
+ Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
108
+ File will be uploaded to remote system (if tests are running remotely).
109
+
110
+ ```js
111
+ I.attachFile('Avatar', 'data/avatar.jpg');
112
+ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
113
+ ```
114
+
115
+ #### Parameters
116
+
117
+ - `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
118
+ - `pathToFile` **[string][3]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
119
+ ⚠️ returns a _promise_ which is synchronized internally by recorderDoesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more][5])
120
+
121
+ ### checkOption
122
+
123
+ Selects a checkbox or radio button.
124
+ Element is located by label or name or CSS or XPath.
125
+
126
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
127
+
128
+ ```js
129
+ I.checkOption('#agree');
130
+ I.checkOption('I Agree to Terms and Conditions');
131
+ I.checkOption('agree', '//form');
132
+ ```
133
+
134
+ #### Parameters
135
+
136
+ - `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator.
137
+ - `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
138
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
139
+
140
+ ### clearCookie
141
+
142
+ Clears a cookie by name,
143
+ if none provided clears all cookies.
144
+
145
+ ```js
146
+ I.clearCookie();
147
+ I.clearCookie('test');
148
+ ```
149
+
150
+ #### Parameters
151
+
152
+ - `cookie` **[string][3]?** (optional, `null` by default) cookie name
153
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
154
+
155
+ ### clearField
156
+
157
+ Clears a `<textarea>` or text `<input>` element's value.
158
+
159
+ ```js
160
+ I.clearField('Email');
161
+ I.clearField('user[email]');
162
+ I.clearField('#email');
163
+ ```
164
+
165
+ #### Parameters
166
+
167
+ - `field`
168
+ - `editable` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
169
+ ⚠️ returns a _promise_ which is synchronized internally by recorder.
170
+
171
+ ### click
172
+
173
+ Perform a click on a link or a button, given by a locator.
174
+ If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
175
+ For buttons, the "value" attribute, "name" attribute, and inner text are searched. For links, the link text is searched.
176
+ For images, the "alt" attribute and inner text of any parent links are searched.
177
+
178
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
179
+
180
+ ```js
181
+ // simple link
182
+ I.click('Logout');
183
+ // button of form
184
+ I.click('Submit');
185
+ // CSS button
186
+ I.click('#form input[type=submit]');
187
+ // XPath
188
+ I.click('//form/*[@type=submit]');
189
+ // link in context
190
+ I.click('Logout', '#nav');
191
+ // using strict locator
192
+ I.click({css: 'nav a.login'});
193
+ ```
194
+
195
+ #### Parameters
196
+
197
+ - `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
198
+ - `context` **([string][3]? | [object][4] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
199
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
200
+
201
+ ### dontSee
202
+
203
+ Opposite to `see`. Checks that a text is not present on a page.
204
+ Use context parameter to narrow down the search.
205
+
206
+ ```js
207
+ I.dontSee('Login'); // assume we are already logged in.
208
+ I.dontSee('Login', '.nav'); // no login inside .nav element
209
+ ```
210
+
211
+ #### Parameters
212
+
213
+ - `text` **[string][3]** which is not present.
214
+ - `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search.
215
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
216
+
217
+ ### dontSeeCheckboxIsChecked
218
+
219
+ Verifies that the specified checkbox is not checked.
220
+
221
+ ```js
222
+ I.dontSeeCheckboxIsChecked('#agree'); // located by ID
223
+ I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label
224
+ I.dontSeeCheckboxIsChecked('agree'); // located by name
225
+ ```
226
+
227
+ #### Parameters
228
+
229
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
230
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
231
+
232
+ ### dontSeeCookie
233
+
234
+ Checks that cookie with given name does not exist.
235
+
236
+ ```js
237
+ I.dontSeeCookie('auth'); // no auth cookie
238
+ ```
239
+
240
+ #### Parameters
241
+
242
+ - `name` **[string][3]** cookie name.
243
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
244
+
245
+ ### dontSeeCurrentUrlEquals
246
+
247
+ Checks that current url is not equal to provided one.
248
+ If a relative url provided, a configured url will be prepended to it.
249
+
250
+ ```js
251
+ I.dontSeeCurrentUrlEquals('/login'); // relative url are ok
252
+ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok
253
+ ```
254
+
255
+ #### Parameters
256
+
257
+ - `url` **[string][3]** value to check.
258
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
259
+
260
+ ### dontSeeElement
261
+
262
+ Opposite to `seeElement`. Checks that element is not visible (or in DOM)
263
+
264
+ ```js
265
+ I.dontSeeElement('.modal'); // modal is not shown
266
+ ```
267
+
268
+ #### Parameters
269
+
270
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator.
271
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
272
+
273
+ ### dontSeeElementInDOM
274
+
275
+ Opposite to `seeElementInDOM`. Checks that element is not on page.
276
+
277
+ ```js
278
+ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
279
+ ```
280
+
281
+ #### Parameters
282
+
283
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator.
284
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
285
+
286
+ ### dontSeeInCurrentUrl
287
+
288
+ Checks that current url does not contain a provided fragment.
289
+
290
+ #### Parameters
291
+
292
+ - `url` **[string][3]** value to check.
293
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
294
+
295
+ ### dontSeeInField
296
+
297
+ Checks that value of input field or textarea doesn't equal to given value
298
+ Opposite to `seeInField`.
299
+
300
+ ```js
301
+ I.dontSeeInField('email', 'user@user.com'); // field by name
302
+ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
303
+ ```
304
+
305
+ #### Parameters
306
+
307
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
308
+ - `value` **([string][3] | [object][4])** value to check.
309
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
310
+
311
+ ### dontSeeInSource
312
+
313
+ Checks that the current page does not contains the given string in its raw source code.
314
+
315
+ ```js
316
+ I.dontSeeInSource('<!--'); // no comments in source
317
+ ```
318
+
319
+ #### Parameters
320
+
321
+ - `text`
322
+ - `value` **[string][3]** to check.
323
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
324
+
325
+ ### dontSeeInTitle
326
+
327
+ Checks that title does not contain text.
328
+
329
+ ```js
330
+ I.dontSeeInTitle('Error');
331
+ ```
332
+
333
+ #### Parameters
334
+
335
+ - `text` **[string][3]** value to check.
336
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
337
+
338
+ ### doubleClick
339
+
340
+ Performs a double-click on an element matched by link|button|label|CSS or XPath.
341
+ Context can be specified as second parameter to narrow search.
342
+
343
+ ```js
344
+ I.doubleClick('Edit');
345
+ I.doubleClick('Edit', '.actions');
346
+ I.doubleClick({css: 'button.accept'});
347
+ I.doubleClick('.btn.edit');
348
+ ```
349
+
350
+ #### Parameters
351
+
352
+ - `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator.
353
+ - `context` **([string][3]? | [object][4])** (optional, `null` by default) element to search in CSS|XPath|Strict locator.
354
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
355
+
356
+ ### executeAsyncScript
357
+
358
+ Executes async script on page.
359
+ Provided function should execute a passed callback (as first argument) to signal it is finished.
360
+
361
+ Example: In Vue.js to make components completely rendered we are waiting for [nextTick][6].
362
+
363
+ ```js
364
+ I.executeAsyncScript(function(done) {
365
+ Vue.nextTick(done); // waiting for next tick
366
+ });
367
+ ```
368
+
369
+ By passing value to `done()` function you can return values.
370
+ Additional arguments can be passed as well, while `done` function is always last parameter in arguments list.
371
+
372
+ ```js
373
+ let val = await I.executeAsyncScript(function(url, done) {
374
+ // in browser context
375
+ $.ajax(url, { success: (data) => done(data); }
376
+ }, 'http://ajax.callback.url/');
377
+ ```
378
+
379
+ #### Parameters
380
+
381
+ - `args` **...any** to be passed to function.
382
+ - `fn` **([string][3] | [function][7])** function to be executed in browser context.
383
+
384
+ Returns **[Promise][8]&lt;any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderWrapper for asynchronous [evaluate][9].
385
+ Unlike NightmareJS implementation calling `done` will return its first argument.
386
+
387
+ ### executeScript
388
+
389
+ Executes sync script on a page.
390
+ Pass arguments to function as additional parameters.
391
+ Will return execution result to a test.
392
+ In this case you should use async function and await to receive results.
393
+
394
+ Example with jQuery DatePicker:
395
+
396
+ ```js
397
+ // change date of jQuery DatePicker
398
+ I.executeScript(function() {
399
+ // now we are inside browser context
400
+ $('date').datetimepicker('setDate', new Date());
401
+ });
402
+ ```
403
+
404
+ Can return values. Don't forget to use `await` to get them.
405
+
406
+ ```js
407
+ let date = await I.executeScript(function(el) {
408
+ // only basic types can be returned
409
+ return $(el).datetimepicker('getDate').toString();
410
+ }, '#date'); // passing jquery selector
411
+ ```
412
+
413
+ #### Parameters
414
+
415
+ - `args` **...any** to be passed to function.
416
+ - `fn` **([string][3] | [function][7])** function to be executed in browser context.
417
+
418
+ Returns **[Promise][8]&lt;any>** script return value⚠️ returns a _promise_ which is synchronized internally by recorderWrapper for synchronous [evaluate][9]
419
+
420
+ ### fillField
421
+
422
+ Fills a text field or textarea, after clearing its value, with the given string.
423
+ Field is located by name, label, CSS, or XPath.
424
+
425
+ ```js
426
+ // by label
427
+ I.fillField('Email', 'hello@world.com');
428
+ // by name
429
+ I.fillField('password', secret('123456'));
430
+ // by CSS
431
+ I.fillField('form#login input[name=username]', 'John');
432
+ // or by strict locator
433
+ I.fillField({css: 'form#login input[name=username]'}, 'John');
434
+ ```
435
+
436
+ #### Parameters
437
+
438
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
439
+ - `value` **([string][3] | [object][4])** text value to fill.
440
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
441
+
442
+ ### grabAttributeFrom
443
+
444
+ Retrieves an attribute from an element located by CSS or XPath and returns it to test.
445
+ Resumes test execution, so **should be used inside async with `await`** operator.
446
+ If more than one element is found - attribute of first element is returned.
447
+
448
+ ```js
449
+ let hint = await I.grabAttributeFrom('#tooltip', 'title');
450
+ ```
451
+
452
+ #### Parameters
453
+
454
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
455
+ - `attr` **[string][3]** attribute name.
456
+
457
+ Returns **[Promise][8]&lt;[string][3]>** attribute value
458
+
459
+ ### grabAttributeFromAll
460
+
461
+ Retrieves an array of attributes from elements located by CSS or XPath and returns it to test.
462
+ Resumes test execution, so **should be used inside async with `await`** operator.
463
+
464
+ ```js
465
+ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
466
+ ```
467
+
468
+ #### Parameters
469
+
470
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
471
+ - `attr` **[string][3]** attribute name.
472
+
473
+ Returns **[Promise][8]&lt;[Array][10]&lt;[string][3]>>** attribute value
474
+
475
+ ### grabCookie
476
+
477
+ Gets a cookie object by name.
478
+ If none provided gets all cookies.
479
+ Resumes test execution, so **should be used inside async function with `await`** operator.
480
+
481
+ ```js
482
+ let cookie = await I.grabCookie('auth');
483
+ assert(cookie.value, '123456');
484
+ ```
485
+
486
+ #### Parameters
487
+
488
+ - `name` **[string][3]?** cookie name.
489
+
490
+ Returns **([Promise][8]&lt;[string][3]> | [Promise][8]&lt;[Array][10]&lt;[string][3]>>)** attribute valueCookie in JSON format. If name not passed returns all cookies for this domain.Multiple cookies can be received by passing query object `I.grabCookie({ secure: true});`. If you'd like get all cookies for all urls, use: `.grabCookie({ url: null }).`
491
+
492
+ ### grabCssPropertyFrom
493
+
494
+ Grab CSS property for given locator
495
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
496
+ If more than one element is found - value of first element is returned.
497
+
498
+ ```js
499
+ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
500
+ ```
501
+
502
+ #### Parameters
503
+
504
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
505
+ - `cssProperty` **[string][3]** CSS property name.
506
+
507
+ Returns **[Promise][8]&lt;[string][3]>** CSS value
508
+
509
+ ### grabCurrentUrl
510
+
511
+ Get current URL from browser.
512
+ Resumes test execution, so should be used inside an async function.
513
+
514
+ ```js
515
+ let url = await I.grabCurrentUrl();
516
+ console.log(`Current URL is [${url}]`);
517
+ ```
518
+
519
+ Returns **[Promise][8]&lt;[string][3]>** current URL
520
+
521
+ ### grabElementBoundingRect
522
+
523
+ Grab the width, height, location of given locator.
524
+ Provide `width` or `height`as second param to get your desired prop.
525
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
526
+
527
+ Returns an object with `x`, `y`, `width`, `height` keys.
528
+
529
+ ```js
530
+ const value = await I.grabElementBoundingRect('h3');
531
+ // value is like { x: 226.5, y: 89, width: 527, height: 220 }
532
+ ```
533
+
534
+ To get only one metric use second parameter:
535
+
536
+ ```js
537
+ const width = await I.grabElementBoundingRect('h3', 'width');
538
+ // width == 527
539
+ ```
540
+
541
+ #### Parameters
542
+
543
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
544
+ - `prop`
545
+ - `elementSize` **[string][3]?** x, y, width or height of the given element.
546
+
547
+ Returns **([Promise][8]&lt;DOMRect> | [Promise][8]&lt;[number][11]>)** Element bounding rectangle
548
+
549
+ ### grabHAR
550
+
551
+ Get HAR
552
+
553
+ ```js
554
+ let har = await I.grabHAR();
555
+ fs.writeFileSync('sample.har', JSON.stringify({log: har}));
556
+ ```
557
+
558
+ ### grabHTMLFrom
559
+
560
+ Retrieves the innerHTML from an element located by CSS or XPath and returns it to test.
561
+ Resumes test execution, so **should be used inside async function with `await`** operator.
562
+ If more than one element is found - HTML of first element is returned.
563
+
564
+ ```js
565
+ let postHTML = await I.grabHTMLFrom('#post');
566
+ ```
567
+
568
+ #### Parameters
569
+
570
+ - `locator`
571
+ - `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
572
+
573
+ Returns **[Promise][8]&lt;[string][3]>** HTML code for an element
574
+
575
+ ### grabHTMLFromAll
576
+
577
+ Retrieves all the innerHTML from elements located by CSS or XPath and returns it to test.
578
+ Resumes test execution, so **should be used inside async function with `await`** operator.
579
+
580
+ ```js
581
+ let postHTMLs = await I.grabHTMLFromAll('.post');
582
+ ```
583
+
584
+ #### Parameters
585
+
586
+ - `locator`
587
+ - `element` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
588
+
589
+ Returns **[Promise][8]&lt;[Array][10]&lt;[string][3]>>** HTML code for an element
590
+
591
+ ### grabNumberOfVisibleElements
592
+
593
+ Grab number of visible elements by locator.
594
+ Resumes test execution, so **should be used inside async function with `await`** operator.
595
+
596
+ ```js
597
+ let numOfElements = await I.grabNumberOfVisibleElements('p');
598
+ ```
599
+
600
+ #### Parameters
601
+
602
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
603
+
604
+ Returns **[Promise][8]&lt;[number][11]>** number of visible elements
605
+
606
+ ### grabPageScrollPosition
607
+
608
+ Retrieves a page scroll position and returns it to test.
609
+ Resumes test execution, so **should be used inside an async function with `await`** operator.
610
+
611
+ ```js
612
+ let { x, y } = await I.grabPageScrollPosition();
613
+ ```
614
+
615
+ Returns **[Promise][8]&lt;PageScrollPosition>** scroll position
616
+
617
+ ### grabTextFrom
618
+
619
+ Retrieves a text from an element located by CSS or XPath and returns it to test.
620
+ Resumes test execution, so **should be used inside async with `await`** operator.
621
+
622
+ ```js
623
+ let pin = await I.grabTextFrom('#pin');
624
+ ```
625
+
626
+ If multiple elements found returns first element.
627
+
628
+ #### Parameters
629
+
630
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
631
+
632
+ Returns **[Promise][8]&lt;[string][3]>** attribute value
633
+
634
+ ### grabTextFromAll
635
+
636
+ Retrieves all texts from an element located by CSS or XPath and returns it to test.
637
+ Resumes test execution, so **should be used inside async with `await`** operator.
638
+
639
+ ```js
640
+ let pins = await I.grabTextFromAll('#pin li');
641
+ ```
642
+
643
+ #### Parameters
644
+
645
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
646
+
647
+ Returns **[Promise][8]&lt;[Array][10]&lt;[string][3]>>** attribute value
648
+
649
+ ### grabTitle
650
+
651
+ Retrieves a page title and returns it to test.
652
+ Resumes test execution, so **should be used inside async with `await`** operator.
653
+
654
+ ```js
655
+ let title = await I.grabTitle();
656
+ ```
657
+
658
+ Returns **[Promise][8]&lt;[string][3]>** title
659
+
660
+ ### grabValueFrom
661
+
662
+ Retrieves a value from a form element located by CSS or XPath and returns it to test.
663
+ Resumes test execution, so **should be used inside async function with `await`** operator.
664
+ If more than one element is found - value of first element is returned.
665
+
666
+ ```js
667
+ let email = await I.grabValueFrom('input[name=email]');
668
+ ```
669
+
670
+ #### Parameters
671
+
672
+ - `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
673
+
674
+ Returns **[Promise][8]&lt;[string][3]>** attribute value
675
+
676
+ ### grabValueFromAll
677
+
678
+ Retrieves an array of value from a form located by CSS or XPath and returns it to test.
679
+ Resumes test execution, so **should be used inside async function with `await`** operator.
680
+
681
+ ```js
682
+ let inputs = await I.grabValueFromAll('//form/input');
683
+ ```
684
+
685
+ #### Parameters
686
+
687
+ - `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
688
+
689
+ Returns **[Promise][8]&lt;[Array][10]&lt;[string][3]>>** attribute value
690
+
691
+ ### haveHeader
692
+
693
+ Add a header override for all HTTP requests. If header is undefined, the header overrides will be reset.
694
+
695
+ ```js
696
+ I.haveHeader('x-my-custom-header', 'some value');
697
+ I.haveHeader(); // clear headers
698
+ ```
699
+
700
+ #### Parameters
701
+
702
+ - `header`
703
+ - `value`
704
+
705
+ ### moveCursorTo
706
+
707
+ Moves cursor to element matched by locator.
708
+ Extra shift can be set with offsetX and offsetY options.
709
+
710
+ ```js
711
+ I.moveCursorTo('.tooltip');
712
+ I.moveCursorTo('#submit', 5,5);
713
+ ```
714
+
715
+ #### Parameters
716
+
717
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
718
+ - `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
719
+ - `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
720
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
721
+
722
+ ### pressKey
723
+
724
+ Sends [input event][12] on a page.
725
+ Can submit special keys like 'Enter', 'Backspace', etc
726
+
727
+ #### Parameters
728
+
729
+ - `key`
730
+
731
+ ### refresh
732
+
733
+ Reload the page
734
+
735
+ ### refreshPage
736
+
737
+ Reload the current page.
738
+
739
+ ```js
740
+ I.refreshPage();
741
+ ```
742
+
743
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
744
+
745
+ ### resizeWindow
746
+
747
+ Resize the current window to provided width and height.
748
+ First parameter can be set to `maximize`.
749
+
750
+ #### Parameters
751
+
752
+ - `width` **[number][11]** width in pixels or `maximize`.
753
+ - `height` **[number][11]** height in pixels.
754
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
755
+
756
+ ### rightClick
757
+
758
+ Performs right click on a clickable element matched by semantic locator, CSS or XPath.
759
+
760
+ ```js
761
+ // right click element with id el
762
+ I.rightClick('#el');
763
+ // right click link or button with text "Click me"
764
+ I.rightClick('Click me');
765
+ // right click button with text "Click me" inside .context
766
+ I.rightClick('Click me', '.context');
767
+ ```
768
+
769
+ #### Parameters
770
+
771
+ - `locator` **([string][3] | [object][4])** clickable element located by CSS|XPath|strict locator.
772
+ - `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS|XPath|strict locator.
773
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
774
+
775
+ ### saveElementScreenshot
776
+
777
+ Saves screenshot of the specified locator to ouput folder (set in codecept.conf.ts or codecept.conf.js).
778
+ Filename is relative to output folder.
779
+
780
+ ```js
781
+ I.saveElementScreenshot(`#submit`,'debug.png');
782
+ ```
783
+
784
+ #### Parameters
785
+
786
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
787
+ - `fileName` **[string][3]** file name to save.
788
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
789
+
790
+ ### saveScreenshot
791
+
792
+ Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js).
793
+ Filename is relative to output folder.
794
+ Optionally resize the window to the full available page `scrollHeight` and `scrollWidth` to capture the entire page by passing `true` in as the second argument.
795
+
796
+ ```js
797
+ I.saveScreenshot('debug.png');
798
+ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scrollWidth before taking screenshot
799
+ ```
800
+
801
+ #### Parameters
802
+
803
+ - `fileName` **[string][3]** file name to save.
804
+ - `fullPage` **[boolean][13]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
805
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
806
+
807
+ ### scrollPageToBottom
808
+
809
+ Scroll page to the bottom.
810
+
811
+ ```js
812
+ I.scrollPageToBottom();
813
+ ```
814
+
815
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
816
+
817
+ ### scrollPageToTop
818
+
819
+ Scroll page to the top.
820
+
821
+ ```js
822
+ I.scrollPageToTop();
823
+ ```
824
+
825
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
826
+
827
+ ### scrollTo
828
+
829
+ Scrolls to element matched by locator.
830
+ Extra shift can be set with offsetX and offsetY options.
831
+
832
+ ```js
833
+ I.scrollTo('footer');
834
+ I.scrollTo('#submit', 5, 5);
835
+ ```
836
+
837
+ #### Parameters
838
+
839
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
840
+ - `offsetX` **[number][11]** (optional, `0` by default) X-axis offset.
841
+ - `offsetY` **[number][11]** (optional, `0` by default) Y-axis offset.
842
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
843
+
844
+ ### see
845
+
846
+ Checks that a page contains a visible text.
847
+ Use context parameter to narrow down the search.
848
+
849
+ ```js
850
+ I.see('Welcome'); // text welcome on a page
851
+ I.see('Welcome', '.content'); // text inside .content div
852
+ I.see('Register', {css: 'form.register'}); // use strict locator
853
+ ```
854
+
855
+ #### Parameters
856
+
857
+ - `text` **[string][3]** expected on page.
858
+ - `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
859
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
860
+
861
+ ### seeCheckboxIsChecked
862
+
863
+ Verifies that the specified checkbox is checked.
864
+
865
+ ```js
866
+ I.seeCheckboxIsChecked('Agree');
867
+ I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
868
+ I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
869
+ ```
870
+
871
+ #### Parameters
872
+
873
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
874
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
875
+
876
+ ### seeCookie
877
+
878
+ Checks that cookie with given name exists.
879
+
880
+ ```js
881
+ I.seeCookie('Auth');
882
+ ```
883
+
884
+ #### Parameters
885
+
886
+ - `name` **[string][3]** cookie name.
887
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
888
+
889
+ ### seeCurrentUrlEquals
890
+
891
+ Checks that current url is equal to provided one.
892
+ If a relative url provided, a configured url will be prepended to it.
893
+ So both examples will work:
894
+
895
+ ```js
896
+ I.seeCurrentUrlEquals('/register');
897
+ I.seeCurrentUrlEquals('http://my.site.com/register');
898
+ ```
899
+
900
+ #### Parameters
901
+
902
+ - `url` **[string][3]** value to check.
903
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
904
+
905
+ ### seeElement
906
+
907
+ Checks that a given Element is visible
908
+ Element is located by CSS or XPath.
909
+
910
+ ```js
911
+ I.seeElement('#modal');
912
+ ```
913
+
914
+ #### Parameters
915
+
916
+ - `locator` **([string][3] | [object][4])** located by CSS|XPath|strict locator.
917
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
918
+
919
+ ### seeElementInDOM
920
+
921
+ Checks that a given Element is present in the DOM
922
+ Element is located by CSS or XPath.
923
+
924
+ ```js
925
+ I.seeElementInDOM('#modal');
926
+ ```
927
+
928
+ #### Parameters
929
+
930
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
931
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
932
+
933
+ ### seeInCurrentUrl
934
+
935
+ Checks that current url contains a provided fragment.
936
+
937
+ ```js
938
+ I.seeInCurrentUrl('/register'); // we are on registration page
939
+ ```
940
+
941
+ #### Parameters
942
+
943
+ - `url` **[string][3]** a fragment to check
944
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
945
+
946
+ ### seeInField
947
+
948
+ Checks that the given input field or textarea equals to given value.
949
+ For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
950
+
951
+ ```js
952
+ I.seeInField('Username', 'davert');
953
+ I.seeInField({css: 'form textarea'},'Type your comment here');
954
+ I.seeInField('form input[type=hidden]','hidden_value');
955
+ I.seeInField('#searchform input','Search');
956
+ ```
957
+
958
+ #### Parameters
959
+
960
+ - `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator.
961
+ - `value` **([string][3] | [object][4])** value to check.
962
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
963
+
964
+ ### seeInSource
965
+
966
+ Checks that the current page contains the given string in its raw source code.
967
+
968
+ ```js
969
+ I.seeInSource('<h1>Green eggs &amp; ham</h1>');
970
+ ```
971
+
972
+ #### Parameters
973
+
974
+ - `text` **[string][3]** value to check.
975
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
976
+
977
+ ### seeInTitle
978
+
979
+ Checks that title contains text.
980
+
981
+ ```js
982
+ I.seeInTitle('Home Page');
983
+ ```
984
+
985
+ #### Parameters
986
+
987
+ - `text` **[string][3]** text value to check.
988
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
989
+
990
+ ### seeNumberOfElements
991
+
992
+ Asserts that an element appears a given number of times in the DOM.
993
+ Element is located by label or name or CSS or XPath.
994
+
995
+ ```js
996
+ I.seeNumberOfElements('#submitBtn', 1);
997
+ ```
998
+
999
+ #### Parameters
1000
+
1001
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1002
+ - `num` **[number][11]** number of elements.
1003
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1004
+
1005
+ ### seeNumberOfVisibleElements
1006
+
1007
+ Asserts that an element is visible a given number of times.
1008
+ Element is located by CSS or XPath.
1009
+
1010
+ ```js
1011
+ I.seeNumberOfVisibleElements('.buttons', 3);
1012
+ ```
1013
+
1014
+ #### Parameters
1015
+
1016
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1017
+ - `num` **[number][11]** number of elements.
1018
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1019
+
1020
+ ### selectOption
1021
+
1022
+ Selects an option in a drop-down select.
1023
+ Field is searched by label | name | CSS | XPath.
1024
+ Option is selected by visible text or by value.
1025
+
1026
+ ```js
1027
+ I.selectOption('Choose Plan', 'Monthly'); // select by label
1028
+ I.selectOption('subscription', 'Monthly'); // match option by text
1029
+ I.selectOption('subscription', '0'); // or by value
1030
+ I.selectOption('//form/select[@name=account]','Premium');
1031
+ I.selectOption('form select[name=account]', 'Premium');
1032
+ I.selectOption({css: 'form select[name=account]'}, 'Premium');
1033
+ ```
1034
+
1035
+ Provide an array for the second argument to select multiple options.
1036
+
1037
+ ```js
1038
+ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1039
+ ```
1040
+
1041
+ #### Parameters
1042
+
1043
+ - `select` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator.
1044
+ - `option` **([string][3] | [Array][10]&lt;any>)** visible text or value of option.
1045
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1046
+
1047
+ ### setCookie
1048
+
1049
+ Sets cookie(s).
1050
+
1051
+ Can be a single cookie object or an array of cookies:
1052
+
1053
+ ```js
1054
+ I.setCookie({name: 'auth', value: true});
1055
+
1056
+ // as array
1057
+ I.setCookie([
1058
+ {name: 'auth', value: true},
1059
+ {name: 'agree', value: true}
1060
+ ]);
1061
+ ```
1062
+
1063
+ #### Parameters
1064
+
1065
+ - `cookie` **(Cookie | [Array][10]&lt;Cookie>)** a cookie object or array of cookie objects.
1066
+ ⚠️ returns a _promise_ which is synchronized internally by recorderWrapper for `.cookies.set(cookie)`.
1067
+ [See more][14]
1068
+
1069
+ ### triggerMouseEvent
1070
+
1071
+ Sends [input event][15] on a page.
1072
+ Should be a mouse event like:
1073
+ {
1074
+ type: 'mouseDown',
1075
+ x: args.x,
1076
+ y: args.y,
1077
+ button: "left"
1078
+ }
1079
+
1080
+ #### Parameters
1081
+
1082
+ - `event`
1083
+
1084
+ ### uncheckOption
1085
+
1086
+ Unselects a checkbox or radio button.
1087
+ Element is located by label or name or CSS or XPath.
1088
+
1089
+ The second parameter is a context (CSS or XPath locator) to narrow the search.
1090
+
1091
+ ```js
1092
+ I.uncheckOption('#agree');
1093
+ I.uncheckOption('I Agree to Terms and Conditions');
1094
+ I.uncheckOption('agree', '//form');
1095
+ ```
1096
+
1097
+ #### Parameters
1098
+
1099
+ - `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator.
1100
+ - `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator.
1101
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1102
+
1103
+ ### wait
1104
+
1105
+ Pauses execution for a number of seconds.
1106
+
1107
+ ```js
1108
+ I.wait(2); // wait 2 secs
1109
+ ```
1110
+
1111
+ #### Parameters
1112
+
1113
+ - `sec` **[number][11]** number of second to wait.
1114
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1115
+
1116
+ ### waitForDetached
1117
+
1118
+ Waits for an element to become not attached to the DOM on a page (by default waits for 1sec).
1119
+ Element can be located by CSS or XPath.
1120
+
1121
+ ```js
1122
+ I.waitForDetached('#popup');
1123
+ ```
1124
+
1125
+ #### Parameters
1126
+
1127
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1128
+ - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1129
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1130
+
1131
+ ### waitForElement
1132
+
1133
+ Waits for element to be present on page (by default waits for 1sec).
1134
+ Element can be located by CSS or XPath.
1135
+
1136
+ ```js
1137
+ I.waitForElement('.btn.continue');
1138
+ I.waitForElement('.btn.continue', 5); // wait for 5 secs
1139
+ ```
1140
+
1141
+ #### Parameters
1142
+
1143
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1144
+ - `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
1145
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1146
+
1147
+ ### waitForFunction
1148
+
1149
+ Waits for a function to return true (waits for 1 sec by default).
1150
+ Running in browser context.
1151
+
1152
+ ```js
1153
+ I.waitForFunction(fn[, [args[, timeout]])
1154
+ ```
1155
+
1156
+ ```js
1157
+ I.waitForFunction(() => window.requests == 0);
1158
+ I.waitForFunction(() => window.requests == 0, 5); // waits for 5 sec
1159
+ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and wait for 5 sec
1160
+ ```
1161
+
1162
+ #### Parameters
1163
+
1164
+ - `fn` **([string][3] | [function][7])** to be executed in browser context.
1165
+ - `argsOrSec` **([Array][10]&lt;any> | [number][11])?** (optional, `1` by default) arguments for function or seconds.
1166
+ - `sec` **[number][11]?** (optional, `1` by default) time in seconds to wait
1167
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1168
+
1169
+ ### waitForInvisible
1170
+
1171
+ Waits for an element to be removed or become invisible on a page (by default waits for 1sec).
1172
+ Element can be located by CSS or XPath.
1173
+
1174
+ ```js
1175
+ I.waitForInvisible('#popup');
1176
+ ```
1177
+
1178
+ #### Parameters
1179
+
1180
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1181
+ - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1182
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1183
+
1184
+ ### waitForText
1185
+
1186
+ Waits for a text to appear (by default waits for 1sec).
1187
+ Element can be located by CSS or XPath.
1188
+ Narrow down search results by providing context.
1189
+
1190
+ ```js
1191
+ I.waitForText('Thank you, form has been submitted');
1192
+ I.waitForText('Thank you, form has been submitted', 5, '#modal');
1193
+ ```
1194
+
1195
+ #### Parameters
1196
+
1197
+ - `text` **[string][3]** to wait for.
1198
+ - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1199
+ - `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator.
1200
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1201
+
1202
+ ### waitForVisible
1203
+
1204
+ Waits for an element to become visible on a page (by default waits for 1sec).
1205
+ Element can be located by CSS or XPath.
1206
+
1207
+ ```js
1208
+ I.waitForVisible('#popup');
1209
+ ```
1210
+
1211
+ #### Parameters
1212
+
1213
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1214
+ - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1215
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1216
+
1217
+ ### waitToHide
1218
+
1219
+ Waits for an element to hide (by default waits for 1sec).
1220
+ Element can be located by CSS or XPath.
1221
+
1222
+ ```js
1223
+ I.waitToHide('#popup');
1224
+ ```
1225
+
1226
+ #### Parameters
1227
+
1228
+ - `locator` **([string][3] | [object][4])** element located by CSS|XPath|strict locator.
1229
+ - `sec` **[number][11]** (optional, `1` by default) time in seconds to wait
1230
+ ⚠️ returns a _promise_ which is synchronized internally by recorder
1231
+
1232
+ [1]: https://github.com/segmentio/nightmare
1233
+
1234
+ [2]: https://github.com/segmentio/nightmare#api
1235
+
1236
+ [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1237
+
1238
+ [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
1239
+
1240
+ [5]: https://github.com/rosshinkley/nightmare-upload#important-note-about-setting-file-upload-inputs
1241
+
1242
+ [6]: https://vuejs.org/v2/api/#Vue-nextTick
1243
+
1244
+ [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1245
+
1246
+ [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1247
+
1248
+ [9]: https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2
1249
+
1250
+ [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
1251
+
1252
+ [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
1253
+
1254
+ [12]: http://electron.atom.io/docs/api/web-contents/#webcontentssendinputeventevent
1255
+
1256
+ [13]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
1257
+
1258
+ [14]: https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie
1259
+
1260
+ [15]: http://electron.atom.io/docs/api/web-contents/#contentssendinputeventevent