codeceptjs 3.3.0-beta.4 → 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 (137) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/README.md +26 -0
  3. package/docs/api.md +45 -30
  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 +58 -43
  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 +99 -70
  12. package/docs/build/Playwright.js +187 -109
  13. package/docs/build/Protractor.js +70 -32
  14. package/docs/build/Puppeteer.js +141 -98
  15. package/docs/build/REST.js +4 -1
  16. package/docs/build/TestCafe.js +96 -65
  17. package/docs/build/WebDriver.js +183 -133
  18. package/docs/changelog.md +92 -0
  19. package/docs/custom-helpers.md +1 -1
  20. package/docs/data.md +2 -2
  21. package/docs/email.md +5 -0
  22. package/docs/helpers/ApiDataFactory.md +7 -3
  23. package/docs/helpers/Appium.md +113 -15
  24. package/docs/helpers/GraphQL.md +6 -0
  25. package/docs/helpers/GraphQLDataFactory.md +3 -3
  26. package/docs/helpers/JSONResponse.md +1 -1
  27. package/docs/helpers/MockRequest.md +8 -6
  28. package/docs/helpers/Nightmare.md +131 -29
  29. package/docs/helpers/Playwright.md +424 -215
  30. package/docs/helpers/Puppeteer.md +229 -92
  31. package/docs/helpers/REST.md +1 -1
  32. package/docs/helpers/TestCafe.md +166 -62
  33. package/docs/helpers/WebDriver.md +254 -103
  34. package/docs/index.md +1 -1
  35. package/docs/locators.md +1 -1
  36. package/docs/videos.md +2 -2
  37. package/docs/webapi/amOnPage.mustache +2 -1
  38. package/docs/webapi/appendField.mustache +2 -1
  39. package/docs/webapi/attachFile.mustache +2 -1
  40. package/docs/webapi/checkOption.mustache +2 -1
  41. package/docs/webapi/clearCookie.mustache +2 -1
  42. package/docs/webapi/clearField.mustache +1 -0
  43. package/docs/webapi/click.mustache +2 -1
  44. package/docs/webapi/clickLink.mustache +2 -1
  45. package/docs/webapi/closeCurrentTab.mustache +6 -4
  46. package/docs/webapi/closeOtherTabs.mustache +6 -4
  47. package/docs/webapi/dontSee.mustache +1 -0
  48. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
  49. package/docs/webapi/dontSeeCookie.mustache +2 -1
  50. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
  51. package/docs/webapi/dontSeeElement.mustache +2 -1
  52. package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
  53. package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
  54. package/docs/webapi/dontSeeInField.mustache +2 -1
  55. package/docs/webapi/dontSeeInSource.mustache +1 -0
  56. package/docs/webapi/dontSeeInTitle.mustache +2 -1
  57. package/docs/webapi/doubleClick.mustache +1 -0
  58. package/docs/webapi/downloadFile.mustache +2 -1
  59. package/docs/webapi/dragAndDrop.mustache +1 -0
  60. package/docs/webapi/dragSlider.mustache +2 -1
  61. package/docs/webapi/fillField.mustache +1 -0
  62. package/docs/webapi/forceClick.mustache +1 -0
  63. package/docs/webapi/forceRightClick.mustache +1 -0
  64. package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
  65. package/docs/webapi/moveCursorTo.mustache +1 -0
  66. package/docs/webapi/openNewTab.mustache +6 -4
  67. package/docs/webapi/pressKey.mustache +2 -1
  68. package/docs/webapi/pressKeyDown.mustache +1 -0
  69. package/docs/webapi/pressKeyUp.mustache +1 -0
  70. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
  71. package/docs/webapi/refreshPage.mustache +1 -0
  72. package/docs/webapi/resizeWindow.mustache +2 -1
  73. package/docs/webapi/rightClick.mustache +1 -0
  74. package/docs/webapi/saveElementScreenshot.mustache +1 -0
  75. package/docs/webapi/saveScreenshot.mustache +2 -1
  76. package/docs/webapi/say.mustache +2 -1
  77. package/docs/webapi/scrollIntoView.mustache +1 -0
  78. package/docs/webapi/scrollPageToBottom.mustache +1 -0
  79. package/docs/webapi/scrollPageToTop.mustache +1 -0
  80. package/docs/webapi/scrollTo.mustache +2 -1
  81. package/docs/webapi/see.mustache +2 -1
  82. package/docs/webapi/seeAttributesOnElements.mustache +2 -1
  83. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
  84. package/docs/webapi/seeCookie.mustache +1 -0
  85. package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
  86. package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
  87. package/docs/webapi/seeElement.mustache +2 -1
  88. package/docs/webapi/seeElementInDOM.mustache +1 -0
  89. package/docs/webapi/seeInCurrentUrl.mustache +2 -1
  90. package/docs/webapi/seeInField.mustache +1 -0
  91. package/docs/webapi/seeInPopup.mustache +1 -0
  92. package/docs/webapi/seeInSource.mustache +2 -1
  93. package/docs/webapi/seeInTitle.mustache +2 -1
  94. package/docs/webapi/seeNumberOfElements.mustache +1 -0
  95. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
  96. package/docs/webapi/seeTextEquals.mustache +2 -1
  97. package/docs/webapi/seeTitleEquals.mustache +6 -5
  98. package/docs/webapi/selectOption.mustache +1 -0
  99. package/docs/webapi/setCookie.mustache +1 -0
  100. package/docs/webapi/setGeoLocation.mustache +1 -0
  101. package/docs/webapi/switchTo.mustache +2 -1
  102. package/docs/webapi/switchToNextTab.mustache +8 -7
  103. package/docs/webapi/switchToPreviousTab.mustache +8 -7
  104. package/docs/webapi/type.mustache +1 -0
  105. package/docs/webapi/uncheckOption.mustache +2 -1
  106. package/docs/webapi/wait.mustache +2 -1
  107. package/docs/webapi/waitForClickable.mustache +2 -1
  108. package/docs/webapi/waitForDetached.mustache +2 -1
  109. package/docs/webapi/waitForElement.mustache +2 -1
  110. package/docs/webapi/waitForEnabled.mustache +2 -1
  111. package/docs/webapi/waitForFunction.mustache +1 -0
  112. package/docs/webapi/waitForInvisible.mustache +2 -1
  113. package/docs/webapi/waitForText.mustache +2 -1
  114. package/docs/webapi/waitForValue.mustache +1 -0
  115. package/docs/webapi/waitForVisible.mustache +1 -0
  116. package/docs/webapi/waitInUrl.mustache +2 -1
  117. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
  118. package/docs/webapi/waitToHide.mustache +2 -1
  119. package/docs/webapi/waitUrlEquals.mustache +2 -1
  120. package/lib/command/definitions.js +9 -0
  121. package/lib/command/run.js +2 -2
  122. package/lib/command/workers/runTests.js +40 -0
  123. package/lib/helper/ApiDataFactory.js +4 -3
  124. package/lib/helper/Appium.js +7 -2
  125. package/lib/helper/GraphQL.js +4 -2
  126. package/lib/helper/GraphQLDataFactory.js +3 -3
  127. package/lib/helper/JSONResponse.js +1 -1
  128. package/lib/helper/Playwright.js +49 -13
  129. package/lib/helper/REST.js +4 -1
  130. package/lib/helper/WebDriver.js +6 -0
  131. package/lib/interfaces/bdd.js +5 -0
  132. package/lib/listener/steps.js +1 -0
  133. package/lib/plugin/fakerTransform.js +1 -1
  134. package/lib/plugin/stepByStepReport.js +8 -6
  135. package/lib/workers.js +12 -0
  136. package/package.json +4 -3
  137. package/typings/types.d.ts +598 -600
@@ -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();
@@ -549,7 +556,8 @@ class Nightmare extends Helper {
549
556
  * I.see('Register', {css: 'form.register'}); // use strict locator
550
557
  * ```
551
558
  * @param {string} text expected on page.
552
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
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);
@@ -565,8 +573,8 @@ class Nightmare extends Helper {
565
573
  * ```
566
574
  *
567
575
  * @param {string} text which is not present.
568
- * @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
569
- *
576
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
577
+ * @return {Promise<any>}
570
578
  */
571
579
  dontSee(text, context = null) {
572
580
  return proceedSee.call(this, 'negate', text, context);
@@ -579,7 +587,8 @@ class Nightmare extends Helper {
579
587
  * ```js
580
588
  * I.seeElement('#modal');
581
589
  * ```
582
- * @param {string | object} locator located by CSS|XPath|strict locator.
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');
@@ -596,7 +605,8 @@ class Nightmare extends Helper {
596
605
  * I.dontSeeElement('.modal'); // modal is not shown
597
606
  * ```
598
607
  *
599
- * @param {string | object} locator located by CSS|XPath|Strict locator.
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');
@@ -614,8 +624,8 @@ class Nightmare extends Helper {
614
624
  * ```js
615
625
  * I.seeElementInDOM('#modal');
616
626
  * ```
617
- * @param {string | object} locator element located by CSS|XPath|strict locator.
618
- *
627
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
628
+ * @return {Promise<any>}
619
629
  */
620
630
  async seeElementInDOM(locator) {
621
631
  locator = new Locator(locator, 'css');
@@ -630,7 +640,8 @@ class Nightmare extends Helper {
630
640
  * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
631
641
  * ```
632
642
  *
633
- * @param {string | object} locator located by CSS|XPath|Strict locator.
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);
@@ -675,9 +687,9 @@ class Nightmare extends Helper {
675
687
  * I.seeNumberOfElements('#submitBtn', 1);
676
688
  * ```
677
689
  *
678
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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);
@@ -692,9 +704,9 @@ class Nightmare extends Helper {
692
704
  * I.seeNumberOfVisibleElements('.buttons', 3);
693
705
  * ```
694
706
  *
695
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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);
@@ -709,7 +721,7 @@ class Nightmare extends Helper {
709
721
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
710
722
  * ```
711
723
  *
712
- * @param {string | object} locator located by CSS|XPath|strict locator.
724
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
713
725
  * @returns {Promise<number>} number of visible elements
714
726
  */
715
727
  async grabNumberOfVisibleElements(locator) {
@@ -746,8 +758,9 @@ class Nightmare extends Helper {
746
758
  * I.click({css: 'nav a.login'});
747
759
  * ```
748
760
  *
749
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
750
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
761
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by 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) {
@@ -768,9 +781,9 @@ class Nightmare extends Helper {
768
781
  * I.doubleClick('.btn.edit');
769
782
  * ```
770
783
  *
771
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
772
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
773
- *
784
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
785
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
786
+ * @return {Promise<any>}
774
787
  */
775
788
  async doubleClick(locator, context = null) {
776
789
  const el = await findClickable.call(this, locator, context);
@@ -791,9 +804,9 @@ class Nightmare extends Helper {
791
804
  * I.rightClick('Click me', '.context');
792
805
  * ```
793
806
  *
794
- * @param {string | object} locator clickable element located by CSS|XPath|strict locator.
795
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
796
- *
807
+ * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
808
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
809
+ * @return {Promise<any>}
797
810
  */
798
811
  async rightClick(locator, context = null) {
799
812
  const el = await findClickable.call(this, locator, context);
@@ -811,10 +824,10 @@ class Nightmare extends Helper {
811
824
  * I.moveCursorTo('#submit', 5,5);
812
825
  * ```
813
826
  *
814
- * @param {string | object} locator located by CSS|XPath|strict locator.
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') {
@@ -920,8 +934,9 @@ class Nightmare extends Helper {
920
934
  * I.checkOption('I Agree to Terms and Conditions');
921
935
  * I.checkOption('agree', '//form');
922
936
  * ```
923
- * @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
924
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
937
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
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);
@@ -941,8 +956,9 @@ class Nightmare extends Helper {
941
956
  * I.uncheckOption('I Agree to Terms and Conditions');
942
957
  * I.uncheckOption('agree', '//form');
943
958
  * ```
944
- * @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
945
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
959
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
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);
@@ -965,9 +981,9 @@ class Nightmare extends Helper {
965
981
  * // or by strict locator
966
982
  * I.fillField({css: 'form#login input[name=username]'}, 'John');
967
983
  * ```
968
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
969
- * @param {string | object} value text value to fill.
970
- *
984
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
985
+ * @param {CodeceptJS.StringOrSecret} value text value to fill.
986
+ * @return {Promise<any>}
971
987
  */
972
988
  async fillField(field, value) {
973
989
  const el = await findField.call(this, field);
@@ -984,8 +1000,8 @@ class Nightmare extends Helper {
984
1000
  * I.clearField('user[email]');
985
1001
  * I.clearField('#email');
986
1002
  * ```
987
- * @param {string | object} editable field located by label|name|CSS|XPath|strict locator.
988
- *
1003
+ * @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
1004
+ * @return {Promise<any>}
989
1005
  */
990
1006
  async clearField(field) {
991
1007
  return this.fillField(field, '');
@@ -998,8 +1014,9 @@ class Nightmare extends Helper {
998
1014
  * ```js
999
1015
  * I.appendField('#myTextField', 'appended');
1000
1016
  * ```
1001
- * @param {string | object} field located by label|name|CSS|XPath|strict locator
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);
@@ -1018,9 +1035,9 @@ class Nightmare extends Helper {
1018
1035
  * I.seeInField('form input[type=hidden]','hidden_value');
1019
1036
  * I.seeInField('#searchform input','Search');
1020
1037
  * ```
1021
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
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);
@@ -1035,8 +1052,9 @@ class Nightmare extends Helper {
1035
1052
  * I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
1036
1053
  * ```
1037
1054
  *
1038
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
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);
@@ -1079,8 +1097,8 @@ class Nightmare extends Helper {
1079
1097
  * I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1080
1098
  * ```
1081
1099
  *
1082
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1083
- *
1100
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1101
+ * @return {Promise<any>}
1084
1102
  */
1085
1103
  async seeCheckboxIsChecked(field) {
1086
1104
  return proceedIsChecked.call(this, 'assert', field);
@@ -1095,8 +1113,8 @@ class Nightmare extends Helper {
1095
1113
  * I.dontSeeCheckboxIsChecked('agree'); // located by name
1096
1114
  * ```
1097
1115
  *
1098
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1099
- *
1116
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1117
+ * @return {Promise<any>}
1100
1118
  */
1101
1119
  async dontSeeCheckboxIsChecked(field) {
1102
1120
  return proceedIsChecked.call(this, 'negate', field);
@@ -1112,8 +1130,9 @@ class Nightmare extends Helper {
1112
1130
  * I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
1113
1131
  * ```
1114
1132
  *
1115
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
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
  */
@@ -1139,7 +1158,7 @@ class Nightmare extends Helper {
1139
1158
  * let pins = await I.grabTextFromAll('#pin li');
1140
1159
  * ```
1141
1160
  *
1142
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1161
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1143
1162
  * @returns {Promise<string[]>} attribute value
1144
1163
  *
1145
1164
  */
@@ -1163,7 +1182,7 @@ class Nightmare extends Helper {
1163
1182
  * ```
1164
1183
  * If multiple elements found returns first element.
1165
1184
  *
1166
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1185
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1167
1186
  * @returns {Promise<string>} attribute value
1168
1187
  *
1169
1188
  */
@@ -1186,7 +1205,7 @@ class Nightmare extends Helper {
1186
1205
  * ```js
1187
1206
  * let inputs = await I.grabValueFromAll('//form/input');
1188
1207
  * ```
1189
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
1208
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1190
1209
  * @returns {Promise<string[]>} attribute value
1191
1210
  *
1192
1211
  */
@@ -1210,7 +1229,7 @@ class Nightmare extends Helper {
1210
1229
  * ```js
1211
1230
  * let email = await I.grabValueFrom('input[name=email]');
1212
1231
  * ```
1213
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
1232
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1214
1233
  * @returns {Promise<string>} attribute value
1215
1234
  *
1216
1235
  */
@@ -1232,7 +1251,7 @@ class Nightmare extends Helper {
1232
1251
  * ```js
1233
1252
  * let hints = await I.grabAttributeFromAll('.tooltip', 'title');
1234
1253
  * ```
1235
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1254
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1236
1255
  * @param {string} attr attribute name.
1237
1256
  * @returns {Promise<string[]>} attribute value
1238
1257
  *
@@ -1258,7 +1277,7 @@ class Nightmare extends Helper {
1258
1277
  * ```js
1259
1278
  * let hint = await I.grabAttributeFrom('#tooltip', 'title');
1260
1279
  * ```
1261
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1280
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1262
1281
  * @param {string} attr attribute name.
1263
1282
  * @returns {Promise<string>} attribute value
1264
1283
  *
@@ -1284,7 +1303,7 @@ class Nightmare extends Helper {
1284
1303
  * let postHTMLs = await I.grabHTMLFromAll('.post');
1285
1304
  * ```
1286
1305
  *
1287
- * @param {string | object} element located by CSS|XPath|strict locator.
1306
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
1288
1307
  * @returns {Promise<string[]>} HTML code for an element
1289
1308
  *
1290
1309
  */
@@ -1311,7 +1330,7 @@ class Nightmare extends Helper {
1311
1330
  * let postHTML = await I.grabHTMLFrom('#post');
1312
1331
  * ```
1313
1332
  *
1314
- * @param {string | object} element located by CSS|XPath|strict locator.
1333
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
1315
1334
  * @returns {Promise<string>} HTML code for an element
1316
1335
  *
1317
1336
  */
@@ -1336,7 +1355,7 @@ class Nightmare extends Helper {
1336
1355
  * const value = await I.grabCssPropertyFrom('h3', 'font-weight');
1337
1356
  * ```
1338
1357
  *
1339
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1358
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1340
1359
  * @param {string} cssProperty CSS property name.
1341
1360
  * @returns {Promise<string>} CSS value
1342
1361
  *
@@ -1385,9 +1404,9 @@ class Nightmare extends Helper {
1385
1404
  * ```js
1386
1405
  * I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1387
1406
  * ```
1388
- * @param {string | object} select field located by label|name|CSS|XPath|strict locator.
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) => {
@@ -1582,7 +1604,8 @@ class Nightmare extends Helper {
1582
1604
  *
1583
1605
  * @param {string }text to wait for.
1584
1606
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1585
- * @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
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) {
@@ -1609,9 +1632,9 @@ class Nightmare extends Helper {
1609
1632
  * I.waitForVisible('#popup');
1610
1633
  * ```
1611
1634
  *
1612
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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;
@@ -1636,8 +1659,9 @@ class Nightmare extends Helper {
1636
1659
  * I.waitToHide('#popup');
1637
1660
  * ```
1638
1661
  *
1639
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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);
@@ -1651,8 +1675,9 @@ class Nightmare extends Helper {
1651
1675
  * I.waitForInvisible('#popup');
1652
1676
  * ```
1653
1677
  *
1654
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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;
@@ -1678,8 +1703,9 @@ class Nightmare extends Helper {
1678
1703
  * I.waitForElement('.btn.continue', 5); // wait for 5 secs
1679
1704
  * ```
1680
1705
  *
1681
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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;
@@ -1707,8 +1733,9 @@ class Nightmare extends Helper {
1707
1733
  * I.waitForDetached('#popup');
1708
1734
  * ```
1709
1735
  *
1710
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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();
@@ -1750,9 +1777,9 @@ class Nightmare extends Helper {
1750
1777
  * I.saveElementScreenshot(`#submit`,'debug.png');
1751
1778
  * ```
1752
1779
  *
1753
- * @param {string | object} locator element located by CSS|XPath|strict locator.
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) {
@@ -1790,7 +1817,7 @@ class Nightmare extends Helper {
1790
1817
  * const width = await I.grabElementBoundingRect('h3', 'width');
1791
1818
  * // width == 527
1792
1819
  * ```
1793
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1820
+ * @param {LocatorOrString} locator element located by CSS|XPath|strict locator.
1794
1821
  * @param {string=} elementSize x, y, width or height of the given element.
1795
1822
  * @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
1796
1823
  *
@@ -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);
@@ -1861,9 +1889,10 @@ class Nightmare extends Helper {
1861
1889
  * I.scrollTo('#submit', 5, 5);
1862
1890
  * ```
1863
1891
  *
1864
- * @param {string | object} locator located by CSS|XPath|strict locator.
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 */