codeceptjs 2.3.4 → 2.4.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.
Files changed (269) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +28 -6
  3. package/bin/codecept.js +42 -0
  4. package/docs/advanced.md +45 -1
  5. package/docs/angular.md +3 -3
  6. package/docs/basics.md +162 -118
  7. package/docs/bdd.md +30 -5
  8. package/docs/best.md +8 -6
  9. package/docs/books.md +6 -1
  10. package/docs/build/Appium.js +95 -85
  11. package/docs/build/FileSystem.js +48 -3
  12. package/docs/build/GraphQL.js +3 -2
  13. package/docs/build/GraphQLDataFactory.js +1 -0
  14. package/docs/build/Mochawesome.js +3 -2
  15. package/docs/build/MockRequest.js +23 -5
  16. package/docs/build/Nightmare.js +87 -128
  17. package/docs/build/Protractor.js +107 -155
  18. package/docs/build/Puppeteer.js +190 -174
  19. package/docs/build/REST.js +13 -9
  20. package/docs/build/SeleniumWebdriver.js +0 -17
  21. package/docs/build/TestCafe.js +164 -158
  22. package/docs/build/WebDriver.js +236 -211
  23. package/docs/build/WebDriverIO.js +218 -187
  24. package/docs/changelog.md +57 -1
  25. package/docs/commands.md +41 -2
  26. package/docs/community-helpers.md +12 -1
  27. package/docs/configuration.md +5 -2
  28. package/docs/continuous-integration.md +22 -0
  29. package/docs/{helpers.md → custom-helpers.md} +16 -10
  30. package/docs/data.md +7 -6
  31. package/docs/detox.md +6 -6
  32. package/docs/email.md +4 -2
  33. package/docs/examples.md +22 -3
  34. package/docs/helpers/ApiDataFactory.md +15 -13
  35. package/docs/helpers/Appium.md +1011 -468
  36. package/docs/helpers/Detox.md +33 -26
  37. package/docs/helpers/FileSystem.md +43 -13
  38. package/docs/helpers/GraphQL.md +17 -15
  39. package/docs/helpers/GraphQLDataFactory.md +15 -13
  40. package/docs/helpers/Mochawesome.md +3 -1
  41. package/docs/helpers/MockRequest.md +37 -19
  42. package/docs/helpers/Nightmare.md +129 -240
  43. package/docs/helpers/Polly.md +1 -1
  44. package/docs/helpers/Protractor.md +157 -298
  45. package/docs/helpers/Puppeteer.md +216 -335
  46. package/docs/helpers/REST.md +29 -24
  47. package/docs/helpers/TestCafe.md +137 -235
  48. package/docs/helpers/WebDriver.md +250 -347
  49. package/docs/hooks.md +14 -10
  50. package/docs/index.md +112 -0
  51. package/docs/installation.md +3 -1
  52. package/docs/locators.md +19 -8
  53. package/docs/mobile-react-native-locators.md +2 -2
  54. package/docs/mobile.md +5 -3
  55. package/docs/nightmare.md +2 -1
  56. package/docs/pageobjects.md +4 -2
  57. package/docs/parallel.md +4 -2
  58. package/docs/plugins.md +41 -15
  59. package/docs/puppeteer.md +8 -6
  60. package/docs/quickstart.md +130 -0
  61. package/docs/react.md +4 -2
  62. package/docs/reports.md +6 -4
  63. package/docs/testcafe.md +10 -8
  64. package/docs/translation.md +4 -2
  65. package/docs/ui.md +56 -0
  66. package/docs/videos.md +11 -2
  67. package/docs/visual.md +7 -5
  68. package/docs/vue.md +121 -0
  69. package/docs/webapi/appendField.mustache +1 -1
  70. package/docs/webapi/attachFile.mustache +1 -1
  71. package/docs/webapi/checkOption.mustache +2 -2
  72. package/docs/webapi/clearCookie.mustache +1 -1
  73. package/docs/webapi/click.mustache +2 -2
  74. package/docs/webapi/clickLink.mustache +2 -2
  75. package/docs/webapi/dontSee.mustache +1 -2
  76. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  77. package/docs/webapi/dontSeeElement.mustache +1 -1
  78. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  79. package/docs/webapi/dontSeeInField.mustache +1 -1
  80. package/docs/webapi/doubleClick.mustache +2 -2
  81. package/docs/webapi/downloadFile.mustache +1 -1
  82. package/docs/webapi/dragSlider.mustache +1 -1
  83. package/docs/webapi/executeAsyncScript.mustache +2 -1
  84. package/docs/webapi/executeScript.mustache +2 -1
  85. package/docs/webapi/fillField.mustache +1 -1
  86. package/docs/webapi/grabAttributeFrom.mustache +1 -1
  87. package/docs/webapi/grabBrowserLogs.mustache +1 -1
  88. package/docs/webapi/grabCookie.mustache +2 -2
  89. package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
  90. package/docs/webapi/grabHTMLFrom.mustache +1 -1
  91. package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
  92. package/docs/webapi/grabPageScrollPosition.mustache +1 -1
  93. package/docs/webapi/grabTextFrom.mustache +2 -2
  94. package/docs/webapi/grabValueFrom.mustache +1 -1
  95. package/docs/webapi/moveCursorTo.mustache +3 -3
  96. package/docs/webapi/pressKey.mustache +1 -1
  97. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  98. package/docs/webapi/rightClick.mustache +2 -2
  99. package/docs/webapi/saveScreenshot.mustache +1 -1
  100. package/docs/webapi/scrollIntoView.mustache +10 -0
  101. package/docs/webapi/scrollTo.mustache +3 -3
  102. package/docs/webapi/see.mustache +1 -1
  103. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  104. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  105. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  106. package/docs/webapi/seeElement.mustache +1 -1
  107. package/docs/webapi/seeElementInDOM.mustache +1 -1
  108. package/docs/webapi/seeInField.mustache +1 -1
  109. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  110. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  111. package/docs/webapi/seeTextEquals.mustache +8 -0
  112. package/docs/webapi/selectOption.mustache +2 -2
  113. package/docs/webapi/switchTo.mustache +1 -1
  114. package/docs/webapi/uncheckOption.mustache +2 -2
  115. package/docs/webapi/waitForClickable.mustache +10 -0
  116. package/docs/webapi/waitForDetached.mustache +2 -2
  117. package/docs/webapi/waitForElement.mustache +2 -2
  118. package/docs/webapi/waitForEnabled.mustache +2 -2
  119. package/docs/webapi/waitForFunction.mustache +2 -2
  120. package/docs/webapi/waitForInvisible.mustache +2 -2
  121. package/docs/webapi/waitForText.mustache +2 -2
  122. package/docs/webapi/waitForValue.mustache +1 -1
  123. package/docs/webapi/waitForVisible.mustache +2 -2
  124. package/docs/webapi/waitInUrl.mustache +1 -1
  125. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
  126. package/docs/webapi/waitToHide.mustache +2 -2
  127. package/docs/webapi/waitUntil.mustache +3 -2
  128. package/docs/webapi/waitUrlEquals.mustache +1 -1
  129. package/docs/webdriver.md +20 -18
  130. package/docs/wiki/.git/FETCH_HEAD +1 -0
  131. package/docs/wiki/.git/HEAD +1 -0
  132. package/docs/wiki/.git/ORIG_HEAD +1 -0
  133. package/docs/wiki/.git/config +11 -0
  134. package/docs/wiki/.git/description +1 -0
  135. package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
  136. package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
  137. package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
  138. package/docs/wiki/.git/hooks/post-update.sample +8 -0
  139. package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
  140. package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
  141. package/docs/wiki/.git/hooks/pre-push.sample +53 -0
  142. package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
  143. package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
  144. package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
  145. package/docs/wiki/.git/hooks/update.sample +128 -0
  146. package/docs/wiki/.git/index +0 -0
  147. package/docs/wiki/.git/info/exclude +6 -0
  148. package/docs/wiki/.git/logs/HEAD +4 -0
  149. package/docs/wiki/.git/logs/refs/heads/master +4 -0
  150. package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
  151. package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
  152. package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
  153. package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
  154. package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
  155. package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
  156. package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
  157. package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
  158. package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
  159. package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
  160. package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
  161. package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
  162. package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
  163. package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
  164. package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
  165. package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
  166. package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
  167. package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
  168. package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
  169. package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
  170. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
  171. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
  172. package/docs/wiki/.git/packed-refs +2 -0
  173. package/docs/wiki/.git/refs/heads/master +1 -0
  174. package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
  175. package/docs/wiki/.git/refs/remotes/origin/master +1 -0
  176. package/docs/wiki/Books-&-Posts.md +27 -0
  177. package/docs/wiki/Community-Helpers.md +41 -0
  178. package/docs/wiki/Examples.md +138 -0
  179. package/docs/wiki/Home.md +11 -0
  180. package/docs/wiki/Release-process.md +25 -0
  181. package/docs/wiki/Roadmap.md +23 -0
  182. package/docs/wiki/Videos.md +19 -0
  183. package/lib/actor.js +18 -1
  184. package/lib/assert/error.js +3 -3
  185. package/lib/codecept.js +9 -6
  186. package/lib/command/configMigrate.js +7 -6
  187. package/lib/command/definitions.js +98 -350
  188. package/lib/command/generate.js +22 -17
  189. package/lib/command/gherkin/init.js +2 -1
  190. package/lib/command/gherkin/snippets.js +6 -6
  191. package/lib/command/gherkin/steps.js +0 -1
  192. package/lib/command/info.js +40 -0
  193. package/lib/command/init.js +54 -41
  194. package/lib/command/run-multiple.js +5 -4
  195. package/lib/command/run-rerun.js +39 -0
  196. package/lib/command/run-workers.js +4 -6
  197. package/lib/command/run.js +8 -18
  198. package/lib/command/utils.js +23 -2
  199. package/lib/command/workers/runTests.js +1 -2
  200. package/lib/config.js +10 -4
  201. package/lib/container.js +31 -6
  202. package/lib/data/dataTableArgument.js +31 -0
  203. package/lib/data/table.js +4 -0
  204. package/lib/event.js +65 -1
  205. package/lib/helper/Appium.js +52 -38
  206. package/lib/helper/FileSystem.js +48 -3
  207. package/lib/helper/GraphQL.js +3 -2
  208. package/lib/helper/GraphQLDataFactory.js +1 -0
  209. package/lib/helper/Mochawesome.js +3 -2
  210. package/lib/helper/MockRequest.js +23 -5
  211. package/lib/helper/Nightmare.js +5 -6
  212. package/lib/helper/Protractor.js +7 -8
  213. package/lib/helper/Puppeteer.js +76 -20
  214. package/lib/helper/REST.js +13 -9
  215. package/lib/helper/SeleniumWebdriver.js +0 -17
  216. package/lib/helper/TestCafe.js +84 -36
  217. package/lib/helper/WebDriver.js +113 -59
  218. package/lib/helper/WebDriverIO.js +43 -59
  219. package/lib/helper/clientscripts/nightmare.js +66 -4
  220. package/lib/helper/scripts/isElementClickable.js +24 -0
  221. package/lib/helper.js +34 -10
  222. package/lib/history.js +1 -1
  223. package/lib/hooks.js +2 -1
  224. package/lib/index.js +19 -0
  225. package/lib/interfaces/bdd.js +4 -0
  226. package/lib/interfaces/featureConfig.js +10 -3
  227. package/lib/interfaces/gherkin.js +6 -2
  228. package/lib/interfaces/scenarioConfig.js +17 -6
  229. package/lib/listener/config.js +1 -1
  230. package/lib/listener/exit.js +6 -0
  231. package/lib/listener/steps.js +0 -1
  232. package/lib/listener/trace.js +0 -1
  233. package/lib/locator.js +67 -2
  234. package/lib/output.js +53 -0
  235. package/lib/parser.js +2 -71
  236. package/lib/pause.js +3 -2
  237. package/lib/plugin/allure.js +41 -22
  238. package/lib/plugin/autoLogin.js +4 -1
  239. package/lib/plugin/pauseOnFail.js +38 -0
  240. package/lib/plugin/puppeteerCoverage.js +8 -7
  241. package/lib/plugin/screenshotOnFail.js +13 -8
  242. package/lib/plugin/stepByStepReport.js +7 -6
  243. package/lib/plugin/wdio.js +2 -1
  244. package/lib/recorder.js +85 -7
  245. package/lib/rerun.js +81 -0
  246. package/lib/secret.js +6 -0
  247. package/lib/session.js +9 -2
  248. package/lib/step.js +37 -2
  249. package/lib/store.js +5 -1
  250. package/lib/ui.js +34 -8
  251. package/lib/utils.js +6 -13
  252. package/lib/within.js +5 -0
  253. package/package.json +49 -29
  254. package/typings/Mocha.d.ts +21 -0
  255. package/typings/Protractor.d.ts +16 -0
  256. package/typings/index.d.ts +169 -0
  257. package/typings/jsdoc.conf.js +34 -0
  258. package/typings/jsdoc.namespace.js +29 -0
  259. package/typings/types.d.ts +9827 -0
  260. package/typings/utils.d.ts +7 -0
  261. package/docs/acceptance.md +0 -409
  262. package/docs/api/codecept.md +0 -75
  263. package/docs/api/config.md +0 -49
  264. package/docs/api/container.md +0 -66
  265. package/docs/api/helper.md +0 -116
  266. package/docs/api/output.md +0 -67
  267. package/docs/api/recorder.md +0 -63
  268. package/docs/helpers/SeleniumWebdriver.md +0 -92
  269. package/docs/helpers/WebDriverIO.md +0 -1671
@@ -1,4 +1,7 @@
1
+ const path = require('path');
1
2
  const requireg = require('requireg');
3
+ const urlResolve = require('url').resolve;
4
+
2
5
  const Helper = require('../helper');
3
6
  const stringIncludes = require('../assert/include').includes;
4
7
  const urlEquals = require('../assert/equal').urlEquals;
@@ -6,9 +9,7 @@ const equals = require('../assert/equal').equals;
6
9
  const empty = require('../assert/empty').empty;
7
10
  const truth = require('../assert/truth').truth;
8
11
  const Locator = require('../locator');
9
- const path = require('path');
10
12
  const ElementNotFound = require('./errors/ElementNotFound');
11
- const urlResolve = require('url').resolve;
12
13
  const {
13
14
  xpathLocator,
14
15
  fileExists,
@@ -405,8 +406,7 @@ class Nightmare extends Helper {
405
406
  * ```
406
407
  *
407
408
  * @param {string} url url path or global url.
408
- * {--end--}
409
- * @param headers {object} list of request headers can be passed
409
+ * @param {?object} headers list of request headers can be passed
410
410
  *
411
411
  */
412
412
  async amOnPage(url, headers = null) {
@@ -433,7 +433,6 @@ class Nightmare extends Helper {
433
433
  * ```
434
434
  *
435
435
  * @param {string} text text value to check.
436
- * {--end--}
437
436
  */
438
437
  async seeInTitle(text) {
439
438
  const title = await this.browser.title();
@@ -448,7 +447,6 @@ class Nightmare extends Helper {
448
447
  * ```
449
448
  *
450
449
  * @param {string} text value to check.
451
- * {--end--}
452
450
  */
453
451
  async dontSeeInTitle(text) {
454
452
  const title = await this.browser.title();
@@ -464,7 +462,6 @@ class Nightmare extends Helper {
464
462
  * ```
465
463
  *
466
464
  * @returns {Promise<string>} title
467
- * {--end--}
468
465
  */
469
466
  async grabTitle() {
470
467
  return this.browser.title();
@@ -480,7 +477,6 @@ class Nightmare extends Helper {
480
477
  * ```
481
478
  *
482
479
  * @returns {Promise<string>} current URL
483
- * {--end--}
484
480
  */
485
481
  async grabCurrentUrl() {
486
482
  return this.browser.url();
@@ -494,7 +490,6 @@ class Nightmare extends Helper {
494
490
  * ```
495
491
  *
496
492
  * @param {string} url a fragment to check
497
- * {--end--}
498
493
  */
499
494
  async seeInCurrentUrl(url) {
500
495
  const currentUrl = await this.browser.url();
@@ -505,7 +500,6 @@ class Nightmare extends Helper {
505
500
  * Checks that current url does not contain a provided fragment.
506
501
  *
507
502
  * @param {string} url value to check.
508
- * {--end--}
509
503
  */
510
504
  async dontSeeInCurrentUrl(url) {
511
505
  const currentUrl = await this.browser.url();
@@ -523,7 +517,6 @@ class Nightmare extends Helper {
523
517
  * ```
524
518
  *
525
519
  * @param {string} url value to check.
526
- * {--end--}
527
520
  */
528
521
  async seeCurrentUrlEquals(url) {
529
522
  const currentUrl = await this.browser.url();
@@ -540,7 +533,6 @@ class Nightmare extends Helper {
540
533
  * ```
541
534
  *
542
535
  * @param {string} url value to check.
543
- * {--end--}
544
536
  */
545
537
  async dontSeeCurrentUrlEquals(url) {
546
538
  const currentUrl = await this.browser.url();
@@ -557,8 +549,7 @@ class Nightmare extends Helper {
557
549
  * I.see('Register', {css: 'form.register'}); // use strict locator
558
550
  * ```
559
551
  * @param {string} text expected on page.
560
- * @param {string|object} context (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
561
- * {--end--}
552
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
562
553
  */
563
554
  async see(text, context = null) {
564
555
  return proceedSee.call(this, 'assert', text, context);
@@ -574,9 +565,8 @@ class Nightmare extends Helper {
574
565
  * ```
575
566
  *
576
567
  * @param {string} text which is not present.
577
- * @param {string|object} context (optional) element located by CSS|XPath|strict locator in which to perfrom search.
578
- *
579
- * {--end--}
568
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
569
+ *
580
570
  */
581
571
  dontSee(text, context = null) {
582
572
  return proceedSee.call(this, 'negate', text, context);
@@ -589,8 +579,7 @@ class Nightmare extends Helper {
589
579
  * ```js
590
580
  * I.seeElement('#modal');
591
581
  * ```
592
- * @param {string|object} locator located by CSS|XPath|strict locator.
593
- * {--end--}
582
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
594
583
  */
595
584
  async seeElement(locator) {
596
585
  locator = new Locator(locator, 'css');
@@ -607,8 +596,7 @@ class Nightmare extends Helper {
607
596
  * I.dontSeeElement('.modal'); // modal is not shown
608
597
  * ```
609
598
  *
610
- * @param {string|object} locator located by CSS|XPath|Strict locator.
611
- * {--end--}
599
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
612
600
  */
613
601
  async dontSeeElement(locator) {
614
602
  locator = new Locator(locator, 'css');
@@ -626,8 +614,8 @@ class Nightmare extends Helper {
626
614
  * ```js
627
615
  * I.seeElementInDOM('#modal');
628
616
  * ```
629
- * @param {string|object} locator element located by CSS|XPath|strict locator.
630
- * {--end--}
617
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
618
+ *
631
619
  */
632
620
  async seeElementInDOM(locator) {
633
621
  locator = new Locator(locator, 'css');
@@ -642,8 +630,7 @@ class Nightmare extends Helper {
642
630
  * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
643
631
  * ```
644
632
  *
645
- * @param {string|object} locator located by CSS|XPath|Strict locator.
646
- * {--end--}
633
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
647
634
  */
648
635
  async dontSeeElementInDOM(locator) {
649
636
  locator = new Locator(locator, 'css');
@@ -658,7 +645,6 @@ class Nightmare extends Helper {
658
645
  * I.seeInSource('<h1>Green eggs &amp; ham</h1>');
659
646
  * ```
660
647
  * @param {string} text value to check.
661
- * {--end--}
662
648
  */
663
649
  async seeInSource(text) {
664
650
  const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
@@ -673,7 +659,7 @@ class Nightmare extends Helper {
673
659
  * ```
674
660
  *
675
661
  * @param {string} value to check.
676
- * {--end--}
662
+ *
677
663
  */
678
664
  async dontSeeInSource(text) {
679
665
  const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
@@ -689,9 +675,9 @@ class Nightmare extends Helper {
689
675
  * I.seeNumberOfElements('#submitBtn', 1);
690
676
  * ```
691
677
  *
692
- * @param {string|object} locator element located by CSS|XPath|strict locator.
678
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
693
679
  * @param {number} num number of elements.
694
- * {--end--}
680
+ *
695
681
  */
696
682
  async seeNumberOfElements(locator, num) {
697
683
  const elements = await this._locate(locator);
@@ -706,9 +692,9 @@ class Nightmare extends Helper {
706
692
  * I.seeNumberOfVisibleElements('.buttons', 3);
707
693
  * ```
708
694
  *
709
- * @param {string|object} locator element located by CSS|XPath|strict locator.
695
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
710
696
  * @param {number} num number of elements.
711
- * {--end--}
697
+ *
712
698
  */
713
699
  async seeNumberOfVisibleElements(locator, num) {
714
700
  const res = await this.grabNumberOfVisibleElements(locator);
@@ -722,9 +708,8 @@ class Nightmare extends Helper {
722
708
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
723
709
  * ```
724
710
  *
725
- * @param {string|object} locator located by CSS|XPath|strict locator.
711
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
726
712
  * @returns {Promise<number>} number of visible elements
727
- * {--end--}
728
713
  */
729
714
  async grabNumberOfVisibleElements(locator) {
730
715
  locator = new Locator(locator, 'css');
@@ -760,9 +745,9 @@ class Nightmare extends Helper {
760
745
  * I.click({css: 'nav a.login'});
761
746
  * ```
762
747
  *
763
- * @param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
764
- * @param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
765
- * {--end--}
748
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
749
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
750
+ *
766
751
  */
767
752
  async click(locator, context = null) {
768
753
  const el = await findClickable.call(this, locator, context);
@@ -782,9 +767,9 @@ class Nightmare extends Helper {
782
767
  * I.doubleClick('.btn.edit');
783
768
  * ```
784
769
  *
785
- * @param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
786
- * @param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
787
- * {--end--}
770
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
771
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
772
+ *
788
773
  */
789
774
  async doubleClick(locator, context = null) {
790
775
  const el = await findClickable.call(this, locator, context);
@@ -806,9 +791,9 @@ class Nightmare extends Helper {
806
791
  * I.rightClick('Click me', '.context');
807
792
  * ```
808
793
  *
809
- * @param {string|object} locator clickable element located by CSS|XPath|strict locator.
810
- * @param {string|object} context (optional, `null` by default) element located by CSS|XPath|strict locator.
811
- * {--end--}
794
+ * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
795
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
796
+ *
812
797
  */
813
798
  async rightClick(locator, context = null) {
814
799
  const el = await findClickable.call(this, locator, context);
@@ -827,10 +812,10 @@ class Nightmare extends Helper {
827
812
  * I.moveCursorTo('#submit', 5,5);
828
813
  * ```
829
814
  *
830
- * @param {string|object} locator located by CSS|XPath|strict locator.
831
- * @param {number} offsetX (optional, `0` by default) X-axis offset.
832
- * @param {number} offsetY (optional, `0` by default) Y-axis offset.
833
- * {--end--}
815
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
816
+ * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
817
+ * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
818
+ *
834
819
  */
835
820
  async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
836
821
  locator = new Locator(locator, 'css');
@@ -866,8 +851,9 @@ class Nightmare extends Helper {
866
851
  * ```
867
852
  *
868
853
  * @param {string|function} fn function to be executed in browser context.
869
- * @param ...args args to be passed to function.
870
- * {--end--}
854
+ * @param {...any} args to be passed to function.
855
+ * @return {Promise<any>}
856
+ *
871
857
  *
872
858
  * Wrapper for synchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2)
873
859
  */
@@ -899,8 +885,9 @@ class Nightmare extends Helper {
899
885
  * ```
900
886
  *
901
887
  * @param {string|function} fn function to be executed in browser context.
902
- * @param ...args args to be passed to function.
903
- * {--end--}
888
+ * @param {...any} args to be passed to function.
889
+ * @return {Promise<any>}
890
+ *
904
891
  *
905
892
  * Wrapper for asynchronous [evaluate](https://github.com/segmentio/nightmare#evaluatefn-arg1-arg2).
906
893
  * Unlike NightmareJS implementation calling `done` will return its first argument.
@@ -916,7 +903,6 @@ class Nightmare extends Helper {
916
903
  *
917
904
  * @param {number} width width in pixels or `maximize`.
918
905
  * @param {number} height height in pixels.
919
- * {--end--}
920
906
  */
921
907
  async resizeWindow(width, height) {
922
908
  if (width === 'maximize') {
@@ -936,9 +922,8 @@ class Nightmare extends Helper {
936
922
  * I.checkOption('I Agree to Terms and Conditions');
937
923
  * I.checkOption('agree', '//form');
938
924
  * ```
939
- * @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
940
- * @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
941
- * {--end--}
925
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
926
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
942
927
  */
943
928
  async checkOption(field, context = null) {
944
929
  const els = await findCheckable.call(this, field, context);
@@ -958,9 +943,8 @@ class Nightmare extends Helper {
958
943
  * I.uncheckOption('I Agree to Terms and Conditions');
959
944
  * I.uncheckOption('agree', '//form');
960
945
  * ```
961
- * @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
962
- * @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
963
- * {--end--}
946
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
947
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
964
948
  */
965
949
  async uncheckOption(field, context = null) {
966
950
  const els = await findCheckable.call(this, field, context);
@@ -983,9 +967,9 @@ class Nightmare extends Helper {
983
967
  * // or by strict locator
984
968
  * I.fillField({css: 'form#login input[name=username]'}, 'John');
985
969
  * ```
986
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
970
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
987
971
  * @param {string} value text value to fill.
988
- * {--end--}
972
+ *
989
973
  */
990
974
  async fillField(field, value) {
991
975
  const el = await findField.call(this, field);
@@ -1003,7 +987,6 @@ class Nightmare extends Helper {
1003
987
  * I.clearField('#email');
1004
988
  * ```
1005
989
  * @param {string|object} editable field located by label|name|CSS|XPath|strict locator.
1006
- * {--end--}
1007
990
  */
1008
991
  async clearField(field) {
1009
992
  return this.fillField(field, '');
@@ -1016,9 +999,8 @@ class Nightmare extends Helper {
1016
999
  * ```js
1017
1000
  * I.appendField('#myTextField', 'appended');
1018
1001
  * ```
1019
- * @param {string|object} field located by label|name|CSS|XPath|strict locator
1002
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1020
1003
  * @param {string} value text value to append.
1021
- * {--end--}
1022
1004
  */
1023
1005
  async appendField(field, value) {
1024
1006
  const el = await findField.call(this, field);
@@ -1037,9 +1019,9 @@ class Nightmare extends Helper {
1037
1019
  * I.seeInField('form input[type=hidden]','hidden_value');
1038
1020
  * I.seeInField('#searchform input','Search');
1039
1021
  * ```
1040
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1022
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1041
1023
  * @param {string} value value to check.
1042
- * {--end--}
1024
+ *
1043
1025
  */
1044
1026
  async seeInField(field, value) {
1045
1027
  return proceedSeeInField.call(this, 'assert', field, value);
@@ -1054,9 +1036,8 @@ class Nightmare extends Helper {
1054
1036
  * I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
1055
1037
  * ```
1056
1038
  *
1057
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1039
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1058
1040
  * @param {string} value value to check.
1059
- * {--end--}
1060
1041
  */
1061
1042
  async dontSeeInField(field, value) {
1062
1043
  return proceedSeeInField.call(this, 'negate', field, value);
@@ -1099,8 +1080,8 @@ class Nightmare extends Helper {
1099
1080
  * I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1100
1081
  * ```
1101
1082
  *
1102
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1103
- * {--end--}
1083
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1084
+ *
1104
1085
  */
1105
1086
  async seeCheckboxIsChecked(field) {
1106
1087
  return proceedIsChecked.call(this, 'assert', field);
@@ -1115,8 +1096,8 @@ class Nightmare extends Helper {
1115
1096
  * I.dontSeeCheckboxIsChecked('agree'); // located by name
1116
1097
  * ```
1117
1098
  *
1118
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
1119
- * {--end--}
1099
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1100
+ *
1120
1101
  */
1121
1102
  async dontSeeCheckboxIsChecked(field) {
1122
1103
  return proceedIsChecked.call(this, 'negate', field);
@@ -1132,13 +1113,10 @@ class Nightmare extends Helper {
1132
1113
  * I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
1133
1114
  * ```
1134
1115
  *
1135
- * @param {string|object} locator field located by label|name|CSS|XPath|strict locator.
1116
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1136
1117
  * @param {string} pathToFile local file path relative to codecept.json config file.
1137
- * {--end--}
1138
1118
  *
1139
1119
  * Doesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more](https://github.com/rosshinkley/nightmare-upload#important-note-about-setting-file-upload-inputs))
1140
- *
1141
- * @param locator CSS locator (XPath not allowed)
1142
1120
  */
1143
1121
  async attachFile(locator, pathToFile) {
1144
1122
  const file = path.join(global.codecept_dir, pathToFile);
@@ -1163,9 +1141,8 @@ class Nightmare extends Helper {
1163
1141
  * ```
1164
1142
  * If multiple elements found returns an array of texts.
1165
1143
  *
1166
- * @param locator element located by CSS|XPath|strict locator.
1167
- * @returns {Promise<string>} attribute value
1168
- * {--end--}
1144
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1145
+ * @returns {Promise<string|string[]>} attribute value
1169
1146
  */
1170
1147
  async grabTextFrom(locator) {
1171
1148
  locator = new Locator(locator, 'css');
@@ -1187,9 +1164,8 @@ class Nightmare extends Helper {
1187
1164
  * ```js
1188
1165
  * let email = await I.grabValueFrom('input[name=email]');
1189
1166
  * ```
1190
- * @param {string|object} locator field located by label|name|CSS|XPath|strict locator.
1167
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1191
1168
  * @returns {Promise<string>} attribute value
1192
- * {--end--}
1193
1169
  */
1194
1170
  async grabValueFrom(locator) {
1195
1171
  const el = await findField.call(this, locator);
@@ -1205,10 +1181,9 @@ class Nightmare extends Helper {
1205
1181
  * ```js
1206
1182
  * let hint = await I.grabAttributeFrom('#tooltip', 'title');
1207
1183
  * ```
1208
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1184
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1209
1185
  * @param {string} attr attribute name.
1210
1186
  * @returns {Promise<string>} attribute value
1211
- * {--end--}
1212
1187
  */
1213
1188
  async grabAttributeFrom(locator, attr) {
1214
1189
  locator = new Locator(locator, 'css');
@@ -1233,9 +1208,8 @@ class Nightmare extends Helper {
1233
1208
  * let postHTML = await I.grabHTMLFrom('#post');
1234
1209
  * ```
1235
1210
  *
1236
- * @param locator element located by CSS|XPath|strict locator.
1211
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
1237
1212
  * @returns {Promise<string>} HTML code for an element
1238
- * {--end--}
1239
1213
  */
1240
1214
  async grabHTMLFrom(locator) {
1241
1215
  locator = new Locator(locator, 'css');
@@ -1276,9 +1250,8 @@ class Nightmare extends Helper {
1276
1250
  * ```js
1277
1251
  * I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1278
1252
  * ```
1279
- * @param {string|object} select field located by label|name|CSS|XPath|strict locator.
1280
- * @param {string|array} option visible text or value of option.
1281
- * {--end--}
1253
+ * @param {CodeceptJS.LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
1254
+ * @param {string|Array<*>} option visible text or value of option.
1282
1255
  */
1283
1256
  async selectOption(select, option) {
1284
1257
  const fetchAndCheckOption = function (el, locator) {
@@ -1328,7 +1301,6 @@ class Nightmare extends Helper {
1328
1301
  * ```
1329
1302
  *
1330
1303
  * @param {object} cookie a cookie object.
1331
- * {--end--}
1332
1304
  *
1333
1305
  * Wrapper for `.cookies.set(cookie)`.
1334
1306
  * [See more](https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie)
@@ -1345,7 +1317,7 @@ class Nightmare extends Helper {
1345
1317
  * ```
1346
1318
  *
1347
1319
  * @param {string} name cookie name.
1348
- * {--end--}
1320
+ *
1349
1321
  *
1350
1322
  */
1351
1323
  async seeCookie(name) {
@@ -1361,7 +1333,6 @@ class Nightmare extends Helper {
1361
1333
  * ```
1362
1334
  *
1363
1335
  * @param {string} name cookie name.
1364
- * {--end--}
1365
1336
  */
1366
1337
  async dontSeeCookie(name) {
1367
1338
  const res = await this.browser.cookies.get(name);
@@ -1371,18 +1342,17 @@ class Nightmare extends Helper {
1371
1342
  /**
1372
1343
  * Gets a cookie object by name.
1373
1344
  * If none provided gets all cookies.
1374
- * * Resumes test execution, so **should be used inside async with `await`** operator.
1345
+ * Resumes test execution, so **should be used inside async with `await`** operator.
1375
1346
  *
1376
1347
  * ```js
1377
1348
  * let cookie = await I.grabCookie('auth');
1378
1349
  * assert(cookie.value, '123456');
1379
1350
  * ```
1380
1351
  *
1381
- * @param [name=null] cookie name.
1352
+ * @param {?string} [name=null] cookie name.
1382
1353
  * @returns {Promise<string>} attribute value
1383
- * {--end--}
1384
1354
  *
1385
- * @returns Promise<object> Cookie in JSON format. If name not passed returns all cookies for this domain.
1355
+ * Cookie in JSON format. If name not passed returns all cookies for this domain.
1386
1356
  *
1387
1357
  * 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 }).`
1388
1358
  */
@@ -1399,8 +1369,7 @@ class Nightmare extends Helper {
1399
1369
  * I.clearCookie('test');
1400
1370
  * ```
1401
1371
  *
1402
- * @param {string} cookie (optional, `null` by default) cookie name
1403
- * {--end--}
1372
+ * @param {?string} [cookie=null] (optional, `null` by default) cookie name
1404
1373
  */
1405
1374
  async clearCookie(cookie) {
1406
1375
  if (!cookie) {
@@ -1424,9 +1393,9 @@ class Nightmare extends Helper {
1424
1393
  * ```
1425
1394
  *
1426
1395
  * @param {string|function} fn to be executed in browser context.
1427
- * @param {array|number} argsOrSec (optional, `1` by default) arguments for function or seconds.
1428
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1429
- * {--end--}
1396
+ * @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
1397
+ * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1398
+ *
1430
1399
  */
1431
1400
  async waitForFunction(fn, argsOrSec = null, sec = null) {
1432
1401
  let args = [];
@@ -1449,7 +1418,6 @@ class Nightmare extends Helper {
1449
1418
  * ```
1450
1419
  *
1451
1420
  * @param {number} sec number of second to wait.
1452
- * {--end--}
1453
1421
  */
1454
1422
  async wait(sec) {
1455
1423
  return new Promise(((done) => {
@@ -1468,9 +1436,8 @@ class Nightmare extends Helper {
1468
1436
  * ```
1469
1437
  *
1470
1438
  * @param {string }text to wait for.
1471
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1472
- * @param {string|object} context (optional) element located by CSS|XPath|strict locator.
1473
- * {--end--}
1439
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1440
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
1474
1441
  */
1475
1442
  async waitForText(text, sec, context = null) {
1476
1443
  if (!context) {
@@ -1497,9 +1464,8 @@ class Nightmare extends Helper {
1497
1464
  * I.waitForVisible('#popup');
1498
1465
  * ```
1499
1466
  *
1500
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1501
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1502
- * {--end--}
1467
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1468
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1503
1469
  */
1504
1470
  waitForVisible(locator, sec) {
1505
1471
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1524,9 +1490,8 @@ class Nightmare extends Helper {
1524
1490
  * I.waitToHide('#popup');
1525
1491
  * ```
1526
1492
  *
1527
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1528
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1529
- * {--end--}
1493
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1494
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1530
1495
  */
1531
1496
  async waitToHide(locator, sec = null) {
1532
1497
  return this.waitForInvisible(locator, sec);
@@ -1540,9 +1505,8 @@ class Nightmare extends Helper {
1540
1505
  * I.waitForInvisible('#popup');
1541
1506
  * ```
1542
1507
  *
1543
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1544
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1545
- * {--end--}
1508
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1509
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1546
1510
  */
1547
1511
  waitForInvisible(locator, sec) {
1548
1512
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1568,9 +1532,8 @@ class Nightmare extends Helper {
1568
1532
  * I.waitForElement('.btn.continue', 5); // wait for 5 secs
1569
1533
  * ```
1570
1534
  *
1571
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1572
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1573
- * {--end--}
1535
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1536
+ * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1574
1537
  */
1575
1538
  async waitForElement(locator, sec) {
1576
1539
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1598,9 +1561,8 @@ class Nightmare extends Helper {
1598
1561
  * I.waitForDetached('#popup');
1599
1562
  * ```
1600
1563
  *
1601
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1602
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1603
- * {--end--}
1564
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1565
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1604
1566
  */
1605
1567
  async waitForDetached(locator, sec) {
1606
1568
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1620,7 +1582,7 @@ class Nightmare extends Helper {
1620
1582
  * ```js
1621
1583
  * I.refreshPage();
1622
1584
  * ```
1623
- * {--end--}
1585
+ *
1624
1586
  */
1625
1587
  async refreshPage() {
1626
1588
  return this.browser.refresh();
@@ -1645,8 +1607,7 @@ class Nightmare extends Helper {
1645
1607
  * ```
1646
1608
  *
1647
1609
  * @param {string} fileName file name to save.
1648
- * @param {boolean} fullPage (optional, `false` by default) flag to enable fullscreen screenshot mode.
1649
- * {--end--}
1610
+ * @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
1650
1611
  */
1651
1612
  async saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) {
1652
1613
  const outputFile = screenshotOutputFolder(fileName);
@@ -1677,10 +1638,9 @@ class Nightmare extends Helper {
1677
1638
  * I.scrollTo('#submit', 5, 5);
1678
1639
  * ```
1679
1640
  *
1680
- * @param {string|object} locator located by CSS|XPath|strict locator.
1681
- * @param {number} offsetX (optional, `0` by default) X-axis offset.
1682
- * @param {number} offsetY (optional, `0` by default) Y-axis offset.
1683
- * {--end--}
1641
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1642
+ * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
1643
+ * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
1684
1644
  */
1685
1645
  async scrollTo(locator, offsetX = 0, offsetY = 0) {
1686
1646
  if (typeof locator === 'number' && typeof offsetX === 'number') {
@@ -1707,7 +1667,7 @@ class Nightmare extends Helper {
1707
1667
  * ```js
1708
1668
  * I.scrollPageToTop();
1709
1669
  * ```
1710
- * {--end--}
1670
+ *
1711
1671
  */
1712
1672
  async scrollPageToTop() {
1713
1673
  return this.executeScript(() => window.scrollTo(0, 0));
@@ -1719,7 +1679,7 @@ class Nightmare extends Helper {
1719
1679
  * ```js
1720
1680
  * I.scrollPageToBottom();
1721
1681
  * ```
1722
- * {--end--}
1682
+ *
1723
1683
  */
1724
1684
  async scrollPageToBottom() {
1725
1685
  /* eslint-disable prefer-arrow-callback, comma-dangle */
@@ -1742,8 +1702,7 @@ class Nightmare extends Helper {
1742
1702
  * let { x, y } = await I.grabPageScrollPosition();
1743
1703
  * ```
1744
1704
  *
1745
- * @returns {Promise<object>} scroll position
1746
- * {--end--}
1705
+ * @returns {Promise<Object<string, *>>} scroll position
1747
1706
  */
1748
1707
  async grabPageScrollPosition() {
1749
1708
  /* eslint-disable comma-dangle */