codeceptjs 3.3.0 → 3.3.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 (134) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +26 -0
  3. package/docs/api.md +1 -1
  4. package/docs/bdd.md +1 -0
  5. package/docs/best.md +1 -1
  6. package/docs/build/ApiDataFactory.js +4 -3
  7. package/docs/build/Appium.js +26 -11
  8. package/docs/build/GraphQL.js +4 -2
  9. package/docs/build/GraphQLDataFactory.js +3 -3
  10. package/docs/build/JSONResponse.js +1 -1
  11. package/docs/build/Nightmare.js +52 -23
  12. package/docs/build/Playwright.js +126 -48
  13. package/docs/build/Protractor.js +70 -32
  14. package/docs/build/Puppeteer.js +78 -35
  15. package/docs/build/REST.js +4 -1
  16. package/docs/build/TestCafe.js +53 -22
  17. package/docs/build/WebDriver.js +115 -65
  18. package/docs/changelog.md +39 -1
  19. package/docs/custom-helpers.md +1 -1
  20. package/docs/data.md +2 -2
  21. package/docs/helpers/ApiDataFactory.md +7 -3
  22. package/docs/helpers/Appium.md +113 -15
  23. package/docs/helpers/GraphQL.md +6 -0
  24. package/docs/helpers/GraphQLDataFactory.md +3 -3
  25. package/docs/helpers/JSONResponse.md +1 -1
  26. package/docs/helpers/Nightmare.md +131 -29
  27. package/docs/helpers/Playwright.md +424 -215
  28. package/docs/helpers/Puppeteer.md +229 -92
  29. package/docs/helpers/REST.md +1 -1
  30. package/docs/helpers/TestCafe.md +166 -62
  31. package/docs/helpers/WebDriver.md +254 -103
  32. package/docs/index.md +1 -1
  33. package/docs/locators.md +1 -1
  34. package/docs/webapi/amOnPage.mustache +2 -1
  35. package/docs/webapi/appendField.mustache +2 -1
  36. package/docs/webapi/attachFile.mustache +2 -1
  37. package/docs/webapi/checkOption.mustache +2 -1
  38. package/docs/webapi/clearCookie.mustache +2 -1
  39. package/docs/webapi/clearField.mustache +1 -0
  40. package/docs/webapi/click.mustache +2 -1
  41. package/docs/webapi/clickLink.mustache +2 -1
  42. package/docs/webapi/closeCurrentTab.mustache +6 -4
  43. package/docs/webapi/closeOtherTabs.mustache +6 -4
  44. package/docs/webapi/dontSee.mustache +1 -0
  45. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
  46. package/docs/webapi/dontSeeCookie.mustache +2 -1
  47. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
  48. package/docs/webapi/dontSeeElement.mustache +2 -1
  49. package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
  50. package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
  51. package/docs/webapi/dontSeeInField.mustache +2 -1
  52. package/docs/webapi/dontSeeInSource.mustache +1 -0
  53. package/docs/webapi/dontSeeInTitle.mustache +2 -1
  54. package/docs/webapi/doubleClick.mustache +1 -0
  55. package/docs/webapi/downloadFile.mustache +2 -1
  56. package/docs/webapi/dragAndDrop.mustache +1 -0
  57. package/docs/webapi/dragSlider.mustache +2 -1
  58. package/docs/webapi/fillField.mustache +1 -0
  59. package/docs/webapi/forceClick.mustache +1 -0
  60. package/docs/webapi/forceRightClick.mustache +1 -0
  61. package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
  62. package/docs/webapi/moveCursorTo.mustache +1 -0
  63. package/docs/webapi/openNewTab.mustache +6 -4
  64. package/docs/webapi/pressKey.mustache +2 -1
  65. package/docs/webapi/pressKeyDown.mustache +1 -0
  66. package/docs/webapi/pressKeyUp.mustache +1 -0
  67. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
  68. package/docs/webapi/refreshPage.mustache +1 -0
  69. package/docs/webapi/resizeWindow.mustache +2 -1
  70. package/docs/webapi/rightClick.mustache +1 -0
  71. package/docs/webapi/saveElementScreenshot.mustache +1 -0
  72. package/docs/webapi/saveScreenshot.mustache +2 -1
  73. package/docs/webapi/say.mustache +2 -1
  74. package/docs/webapi/scrollIntoView.mustache +1 -0
  75. package/docs/webapi/scrollPageToBottom.mustache +1 -0
  76. package/docs/webapi/scrollPageToTop.mustache +1 -0
  77. package/docs/webapi/scrollTo.mustache +2 -1
  78. package/docs/webapi/see.mustache +2 -1
  79. package/docs/webapi/seeAttributesOnElements.mustache +2 -1
  80. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
  81. package/docs/webapi/seeCookie.mustache +1 -0
  82. package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
  83. package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
  84. package/docs/webapi/seeElement.mustache +2 -1
  85. package/docs/webapi/seeElementInDOM.mustache +1 -0
  86. package/docs/webapi/seeInCurrentUrl.mustache +2 -1
  87. package/docs/webapi/seeInField.mustache +1 -0
  88. package/docs/webapi/seeInPopup.mustache +1 -0
  89. package/docs/webapi/seeInSource.mustache +2 -1
  90. package/docs/webapi/seeInTitle.mustache +2 -1
  91. package/docs/webapi/seeNumberOfElements.mustache +1 -0
  92. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
  93. package/docs/webapi/seeTextEquals.mustache +2 -1
  94. package/docs/webapi/seeTitleEquals.mustache +6 -5
  95. package/docs/webapi/selectOption.mustache +1 -0
  96. package/docs/webapi/setCookie.mustache +1 -0
  97. package/docs/webapi/setGeoLocation.mustache +1 -0
  98. package/docs/webapi/switchTo.mustache +2 -1
  99. package/docs/webapi/switchToNextTab.mustache +8 -7
  100. package/docs/webapi/switchToPreviousTab.mustache +8 -7
  101. package/docs/webapi/type.mustache +1 -0
  102. package/docs/webapi/uncheckOption.mustache +2 -1
  103. package/docs/webapi/wait.mustache +2 -1
  104. package/docs/webapi/waitForClickable.mustache +2 -1
  105. package/docs/webapi/waitForDetached.mustache +2 -1
  106. package/docs/webapi/waitForElement.mustache +2 -1
  107. package/docs/webapi/waitForEnabled.mustache +2 -1
  108. package/docs/webapi/waitForFunction.mustache +1 -0
  109. package/docs/webapi/waitForInvisible.mustache +2 -1
  110. package/docs/webapi/waitForText.mustache +2 -1
  111. package/docs/webapi/waitForValue.mustache +1 -0
  112. package/docs/webapi/waitForVisible.mustache +1 -0
  113. package/docs/webapi/waitInUrl.mustache +2 -1
  114. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
  115. package/docs/webapi/waitToHide.mustache +2 -1
  116. package/docs/webapi/waitUrlEquals.mustache +2 -1
  117. package/lib/command/definitions.js +9 -0
  118. package/lib/command/run.js +2 -2
  119. package/lib/command/workers/runTests.js +40 -0
  120. package/lib/helper/ApiDataFactory.js +4 -3
  121. package/lib/helper/Appium.js +7 -2
  122. package/lib/helper/GraphQL.js +4 -2
  123. package/lib/helper/GraphQLDataFactory.js +3 -3
  124. package/lib/helper/JSONResponse.js +1 -1
  125. package/lib/helper/Playwright.js +49 -13
  126. package/lib/helper/REST.js +4 -1
  127. package/lib/helper/WebDriver.js +6 -0
  128. package/lib/interfaces/bdd.js +5 -0
  129. package/lib/listener/steps.js +1 -0
  130. package/lib/plugin/fakerTransform.js +1 -1
  131. package/lib/plugin/stepByStepReport.js +8 -6
  132. package/lib/workers.js +12 -0
  133. package/package.json +3 -3
  134. package/typings/types.d.ts +558 -607
@@ -406,6 +406,7 @@ class Nightmare extends Helper {
406
406
  * ```
407
407
  *
408
408
  * @param {string} url url path or global url.
409
+ * @return {Promise<any>}
409
410
  * @param {?object} headers list of request headers can be passed
410
411
  *
411
412
  */
@@ -433,6 +434,7 @@ class Nightmare extends Helper {
433
434
  * ```
434
435
  *
435
436
  * @param {string} text text value to check.
437
+ * @return {Promise<any>}
436
438
  */
437
439
  async seeInTitle(text) {
438
440
  const title = await this.browser.title();
@@ -447,6 +449,7 @@ class Nightmare extends Helper {
447
449
  * ```
448
450
  *
449
451
  * @param {string} text value to check.
452
+ * @return {Promise<any>}
450
453
  */
451
454
  async dontSeeInTitle(text) {
452
455
  const title = await this.browser.title();
@@ -490,6 +493,7 @@ class Nightmare extends Helper {
490
493
  * ```
491
494
  *
492
495
  * @param {string} url a fragment to check
496
+ * @return {Promise<any>}
493
497
  */
494
498
  async seeInCurrentUrl(url) {
495
499
  const currentUrl = await this.browser.url();
@@ -500,6 +504,7 @@ class Nightmare extends Helper {
500
504
  * Checks that current url does not contain a provided fragment.
501
505
  *
502
506
  * @param {string} url value to check.
507
+ * @return {Promise<any>}
503
508
  */
504
509
  async dontSeeInCurrentUrl(url) {
505
510
  const currentUrl = await this.browser.url();
@@ -517,6 +522,7 @@ class Nightmare extends Helper {
517
522
  * ```
518
523
  *
519
524
  * @param {string} url value to check.
525
+ * @return {Promise<any>}
520
526
  */
521
527
  async seeCurrentUrlEquals(url) {
522
528
  const currentUrl = await this.browser.url();
@@ -533,6 +539,7 @@ class Nightmare extends Helper {
533
539
  * ```
534
540
  *
535
541
  * @param {string} url value to check.
542
+ * @return {Promise<any>}
536
543
  */
537
544
  async dontSeeCurrentUrlEquals(url) {
538
545
  const currentUrl = await this.browser.url();
@@ -550,6 +557,7 @@ class Nightmare extends Helper {
550
557
  * ```
551
558
  * @param {string} text expected on page.
552
559
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
560
+ * @return {Promise<any>}
553
561
  */
554
562
  async see(text, context = null) {
555
563
  return proceedSee.call(this, 'assert', text, context);
@@ -566,7 +574,7 @@ class Nightmare extends Helper {
566
574
  *
567
575
  * @param {string} text which is not present.
568
576
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
569
- *
577
+ * @return {Promise<any>}
570
578
  */
571
579
  dontSee(text, context = null) {
572
580
  return proceedSee.call(this, 'negate', text, context);
@@ -580,6 +588,7 @@ class Nightmare extends Helper {
580
588
  * I.seeElement('#modal');
581
589
  * ```
582
590
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
591
+ * @return {Promise<any>}
583
592
  */
584
593
  async seeElement(locator) {
585
594
  locator = new Locator(locator, 'css');
@@ -597,6 +606,7 @@ class Nightmare extends Helper {
597
606
  * ```
598
607
  *
599
608
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
609
+ * @return {Promise<any>}
600
610
  */
601
611
  async dontSeeElement(locator) {
602
612
  locator = new Locator(locator, 'css');
@@ -615,7 +625,7 @@ class Nightmare extends Helper {
615
625
  * I.seeElementInDOM('#modal');
616
626
  * ```
617
627
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
618
- *
628
+ * @return {Promise<any>}
619
629
  */
620
630
  async seeElementInDOM(locator) {
621
631
  locator = new Locator(locator, 'css');
@@ -631,6 +641,7 @@ class Nightmare extends Helper {
631
641
  * ```
632
642
  *
633
643
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
644
+ * @return {Promise<any>}
634
645
  */
635
646
  async dontSeeElementInDOM(locator) {
636
647
  locator = new Locator(locator, 'css');
@@ -645,6 +656,7 @@ class Nightmare extends Helper {
645
656
  * I.seeInSource('<h1>Green eggs &amp; ham</h1>');
646
657
  * ```
647
658
  * @param {string} text value to check.
659
+ * @return {Promise<any>}
648
660
  */
649
661
  async seeInSource(text) {
650
662
  const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
@@ -659,7 +671,7 @@ class Nightmare extends Helper {
659
671
  * ```
660
672
  *
661
673
  * @param {string} value to check.
662
- *
674
+ * @return {Promise<any>}
663
675
  */
664
676
  async dontSeeInSource(text) {
665
677
  const source = await this.browser.evaluate(() => document.documentElement.outerHTML);
@@ -677,7 +689,7 @@ class Nightmare extends Helper {
677
689
  *
678
690
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
679
691
  * @param {number} num number of elements.
680
- *
692
+ * @return {Promise<any>}
681
693
  */
682
694
  async seeNumberOfElements(locator, num) {
683
695
  const elements = await this._locate(locator);
@@ -694,7 +706,7 @@ class Nightmare extends Helper {
694
706
  *
695
707
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
696
708
  * @param {number} num number of elements.
697
- *
709
+ * @return {Promise<any>}
698
710
  */
699
711
  async seeNumberOfVisibleElements(locator, num) {
700
712
  const res = await this.grabNumberOfVisibleElements(locator);
@@ -747,7 +759,8 @@ class Nightmare extends Helper {
747
759
  * ```
748
760
  *
749
761
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
750
- * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
762
+ * @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
763
+ * @return {Promise<any>}
751
764
  *
752
765
  */
753
766
  async click(locator, context = null) {
@@ -770,7 +783,7 @@ class Nightmare extends Helper {
770
783
  *
771
784
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
772
785
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
773
- *
786
+ * @return {Promise<any>}
774
787
  */
775
788
  async doubleClick(locator, context = null) {
776
789
  const el = await findClickable.call(this, locator, context);
@@ -793,7 +806,7 @@ class Nightmare extends Helper {
793
806
  *
794
807
  * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
795
808
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
796
- *
809
+ * @return {Promise<any>}
797
810
  */
798
811
  async rightClick(locator, context = null) {
799
812
  const el = await findClickable.call(this, locator, context);
@@ -814,7 +827,7 @@ class Nightmare extends Helper {
814
827
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
815
828
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
816
829
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
817
- *
830
+ * @return {Promise<any>}
818
831
  */
819
832
  async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
820
833
  locator = new Locator(locator, 'css');
@@ -901,6 +914,7 @@ class Nightmare extends Helper {
901
914
  *
902
915
  * @param {number} width width in pixels or `maximize`.
903
916
  * @param {number} height height in pixels.
917
+ * @return {Promise<any>}
904
918
  */
905
919
  async resizeWindow(width, height) {
906
920
  if (width === 'maximize') {
@@ -922,6 +936,7 @@ class Nightmare extends Helper {
922
936
  * ```
923
937
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
924
938
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
939
+ * @return {Promise<any>}
925
940
  */
926
941
  async checkOption(field, context = null) {
927
942
  const els = await findCheckable.call(this, field, context);
@@ -943,6 +958,7 @@ class Nightmare extends Helper {
943
958
  * ```
944
959
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
945
960
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
961
+ * @return {Promise<any>}
946
962
  */
947
963
  async uncheckOption(field, context = null) {
948
964
  const els = await findCheckable.call(this, field, context);
@@ -967,7 +983,7 @@ class Nightmare extends Helper {
967
983
  * ```
968
984
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
969
985
  * @param {CodeceptJS.StringOrSecret} value text value to fill.
970
- *
986
+ * @return {Promise<any>}
971
987
  */
972
988
  async fillField(field, value) {
973
989
  const el = await findField.call(this, field);
@@ -985,7 +1001,7 @@ class Nightmare extends Helper {
985
1001
  * I.clearField('#email');
986
1002
  * ```
987
1003
  * @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
988
- *
1004
+ * @return {Promise<any>}
989
1005
  */
990
1006
  async clearField(field) {
991
1007
  return this.fillField(field, '');
@@ -1000,6 +1016,7 @@ class Nightmare extends Helper {
1000
1016
  * ```
1001
1017
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1002
1018
  * @param {string} value text value to append.
1019
+ * @return {Promise<any>}
1003
1020
  */
1004
1021
  async appendField(field, value) {
1005
1022
  const el = await findField.call(this, field);
@@ -1020,7 +1037,7 @@ class Nightmare extends Helper {
1020
1037
  * ```
1021
1038
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1022
1039
  * @param {string} value value to check.
1023
- *
1040
+ * @return {Promise<any>}
1024
1041
  */
1025
1042
  async seeInField(field, value) {
1026
1043
  return proceedSeeInField.call(this, 'assert', field, value);
@@ -1037,6 +1054,7 @@ class Nightmare extends Helper {
1037
1054
  *
1038
1055
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1039
1056
  * @param {string} value value to check.
1057
+ * @return {Promise<any>}
1040
1058
  */
1041
1059
  async dontSeeInField(field, value) {
1042
1060
  return proceedSeeInField.call(this, 'negate', field, value);
@@ -1080,7 +1098,7 @@ class Nightmare extends Helper {
1080
1098
  * ```
1081
1099
  *
1082
1100
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1083
- *
1101
+ * @return {Promise<any>}
1084
1102
  */
1085
1103
  async seeCheckboxIsChecked(field) {
1086
1104
  return proceedIsChecked.call(this, 'assert', field);
@@ -1096,7 +1114,7 @@ class Nightmare extends Helper {
1096
1114
  * ```
1097
1115
  *
1098
1116
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1099
- *
1117
+ * @return {Promise<any>}
1100
1118
  */
1101
1119
  async dontSeeCheckboxIsChecked(field) {
1102
1120
  return proceedIsChecked.call(this, 'negate', field);
@@ -1114,6 +1132,7 @@ class Nightmare extends Helper {
1114
1132
  *
1115
1133
  * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1116
1134
  * @param {string} pathToFile local file path relative to codecept.json config file.
1135
+ * @return {Promise<any>}
1117
1136
  *
1118
1137
  * 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))
1119
1138
  */
@@ -1387,7 +1406,7 @@ class Nightmare extends Helper {
1387
1406
  * ```
1388
1407
  * @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
1389
1408
  * @param {string|Array<*>} option visible text or value of option.
1390
- *
1409
+ * @return {Promise<any>}
1391
1410
  */
1392
1411
  async selectOption(select, option) {
1393
1412
  const fetchAndCheckOption = function (el, locator) {
@@ -1444,7 +1463,7 @@ class Nightmare extends Helper {
1444
1463
  * ```
1445
1464
  *
1446
1465
  * @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
1447
- *
1466
+ * @return {Promise<any>}
1448
1467
  *
1449
1468
  * Wrapper for `.cookies.set(cookie)`.
1450
1469
  * [See more](https://github.com/segmentio/nightmare/blob/master/Readme.md#cookiessetcookie)
@@ -1461,7 +1480,7 @@ class Nightmare extends Helper {
1461
1480
  * ```
1462
1481
  *
1463
1482
  * @param {string} name cookie name.
1464
- *
1483
+ * @return {Promise<any>}
1465
1484
  *
1466
1485
  */
1467
1486
  async seeCookie(name) {
@@ -1477,6 +1496,7 @@ class Nightmare extends Helper {
1477
1496
  * ```
1478
1497
  *
1479
1498
  * @param {string} name cookie name.
1499
+ * @return {Promise<any>}
1480
1500
  */
1481
1501
  async dontSeeCookie(name) {
1482
1502
  const res = await this.browser.cookies.get(name);
@@ -1515,6 +1535,7 @@ class Nightmare extends Helper {
1515
1535
  * ```
1516
1536
  *
1517
1537
  * @param {?string} [cookie=null] (optional, `null` by default) cookie name
1538
+ * @return {Promise<any>}
1518
1539
  */
1519
1540
  async clearCookie(cookie) {
1520
1541
  if (!cookie) {
@@ -1540,7 +1561,7 @@ class Nightmare extends Helper {
1540
1561
  * @param {string|function} fn to be executed in browser context.
1541
1562
  * @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
1542
1563
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1543
- *
1564
+ * @return {Promise<any>}
1544
1565
  */
1545
1566
  async waitForFunction(fn, argsOrSec = null, sec = null) {
1546
1567
  let args = [];
@@ -1563,6 +1584,7 @@ class Nightmare extends Helper {
1563
1584
  * ```
1564
1585
  *
1565
1586
  * @param {number} sec number of second to wait.
1587
+ * @return {Promise<any>}
1566
1588
  */
1567
1589
  async wait(sec) {
1568
1590
  return new Promise(((done) => {
@@ -1583,6 +1605,7 @@ class Nightmare extends Helper {
1583
1605
  * @param {string }text to wait for.
1584
1606
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1585
1607
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
1608
+ * @return {Promise<any>}
1586
1609
  */
1587
1610
  async waitForText(text, sec, context = null) {
1588
1611
  if (!context) {
@@ -1611,7 +1634,7 @@ class Nightmare extends Helper {
1611
1634
  *
1612
1635
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1613
1636
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1614
- *
1637
+ * @return {Promise<any>}
1615
1638
  */
1616
1639
  waitForVisible(locator, sec) {
1617
1640
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1638,6 +1661,7 @@ class Nightmare extends Helper {
1638
1661
  *
1639
1662
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1640
1663
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1664
+ * @return {Promise<any>}
1641
1665
  */
1642
1666
  async waitToHide(locator, sec = null) {
1643
1667
  return this.waitForInvisible(locator, sec);
@@ -1653,6 +1677,7 @@ class Nightmare extends Helper {
1653
1677
  *
1654
1678
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1655
1679
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1680
+ * @return {Promise<any>}
1656
1681
  */
1657
1682
  waitForInvisible(locator, sec) {
1658
1683
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1680,6 +1705,7 @@ class Nightmare extends Helper {
1680
1705
  *
1681
1706
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1682
1707
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1708
+ * @return {Promise<any>}
1683
1709
  */
1684
1710
  async waitForElement(locator, sec) {
1685
1711
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1709,6 +1735,7 @@ class Nightmare extends Helper {
1709
1735
  *
1710
1736
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1711
1737
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1738
+ * @return {Promise<any>}
1712
1739
  */
1713
1740
  async waitForDetached(locator, sec) {
1714
1741
  this.browser.options.waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -1728,7 +1755,7 @@ class Nightmare extends Helper {
1728
1755
  * ```js
1729
1756
  * I.refreshPage();
1730
1757
  * ```
1731
- *
1758
+ * @return {Promise<any>}
1732
1759
  */
1733
1760
  async refreshPage() {
1734
1761
  return this.browser.refresh();
@@ -1752,7 +1779,7 @@ class Nightmare extends Helper {
1752
1779
  *
1753
1780
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1754
1781
  * @param {string} fileName file name to save.
1755
- *
1782
+ * @return {Promise<any>}
1756
1783
  *
1757
1784
  */
1758
1785
  async saveElementScreenshot(locator, fileName) {
@@ -1832,6 +1859,7 @@ class Nightmare extends Helper {
1832
1859
  *
1833
1860
  * @param {string} fileName file name to save.
1834
1861
  * @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
1862
+ * @return {Promise<any>}
1835
1863
  */
1836
1864
  async saveScreenshot(fileName, fullPage = this.options.fullPageScreenshots) {
1837
1865
  const outputFile = screenshotOutputFolder(fileName);
@@ -1864,6 +1892,7 @@ class Nightmare extends Helper {
1864
1892
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1865
1893
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
1866
1894
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
1895
+ * @return {Promise<any>}
1867
1896
  */
1868
1897
  async scrollTo(locator, offsetX = 0, offsetY = 0) {
1869
1898
  if (typeof locator === 'number' && typeof offsetX === 'number') {
@@ -1890,7 +1919,7 @@ class Nightmare extends Helper {
1890
1919
  * ```js
1891
1920
  * I.scrollPageToTop();
1892
1921
  * ```
1893
- *
1922
+ * @return {Promise<any>}
1894
1923
  */
1895
1924
  async scrollPageToTop() {
1896
1925
  return this.executeScript(() => window.scrollTo(0, 0));
@@ -1902,7 +1931,7 @@ class Nightmare extends Helper {
1902
1931
  * ```js
1903
1932
  * I.scrollPageToBottom();
1904
1933
  * ```
1905
- *
1934
+ * @return {Promise<any>}
1906
1935
  */
1907
1936
  async scrollPageToBottom() {
1908
1937
  /* eslint-disable prefer-arrow-callback, comma-dangle */