codeceptjs 3.3.1 → 3.3.2

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 (108) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +4 -25
  3. package/docs/build/Appium.js +18 -28
  4. package/docs/build/Nightmare.js +53 -53
  5. package/docs/build/Playwright.js +74 -99
  6. package/docs/build/Protractor.js +66 -66
  7. package/docs/build/Puppeteer.js +74 -74
  8. package/docs/build/REST.js +2 -2
  9. package/docs/build/TestCafe.js +53 -53
  10. package/docs/build/WebDriver.js +79 -81
  11. package/docs/changelog.md +7 -0
  12. package/docs/helpers/Appium.md +212 -268
  13. package/docs/helpers/Nightmare.md +92 -141
  14. package/docs/helpers/Playwright.md +266 -383
  15. package/docs/helpers/Puppeteer.md +171 -231
  16. package/docs/helpers/TestCafe.md +125 -174
  17. package/docs/helpers/WebDriver.md +184 -247
  18. package/docs/webapi/amOnPage.mustache +1 -1
  19. package/docs/webapi/appendField.mustache +1 -1
  20. package/docs/webapi/attachFile.mustache +1 -1
  21. package/docs/webapi/checkOption.mustache +1 -1
  22. package/docs/webapi/clearCookie.mustache +1 -1
  23. package/docs/webapi/clearField.mustache +1 -1
  24. package/docs/webapi/click.mustache +1 -1
  25. package/docs/webapi/clickLink.mustache +1 -1
  26. package/docs/webapi/closeCurrentTab.mustache +1 -1
  27. package/docs/webapi/closeOtherTabs.mustache +1 -1
  28. package/docs/webapi/dontSee.mustache +1 -1
  29. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  30. package/docs/webapi/dontSeeCookie.mustache +1 -1
  31. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
  32. package/docs/webapi/dontSeeElement.mustache +1 -1
  33. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  34. package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
  35. package/docs/webapi/dontSeeInField.mustache +1 -1
  36. package/docs/webapi/dontSeeInSource.mustache +1 -1
  37. package/docs/webapi/dontSeeInTitle.mustache +1 -1
  38. package/docs/webapi/doubleClick.mustache +1 -1
  39. package/docs/webapi/downloadFile.mustache +1 -1
  40. package/docs/webapi/dragAndDrop.mustache +1 -1
  41. package/docs/webapi/dragSlider.mustache +1 -1
  42. package/docs/webapi/executeAsyncScript.mustache +1 -1
  43. package/docs/webapi/executeScript.mustache +1 -1
  44. package/docs/webapi/fillField.mustache +1 -1
  45. package/docs/webapi/forceClick.mustache +1 -1
  46. package/docs/webapi/forceRightClick.mustache +1 -1
  47. package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
  48. package/docs/webapi/moveCursorTo.mustache +1 -1
  49. package/docs/webapi/openNewTab.mustache +1 -1
  50. package/docs/webapi/pressKey.mustache +1 -1
  51. package/docs/webapi/pressKeyDown.mustache +1 -1
  52. package/docs/webapi/pressKeyUp.mustache +1 -1
  53. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  54. package/docs/webapi/refreshPage.mustache +1 -1
  55. package/docs/webapi/resizeWindow.mustache +1 -1
  56. package/docs/webapi/rightClick.mustache +1 -1
  57. package/docs/webapi/saveElementScreenshot.mustache +1 -1
  58. package/docs/webapi/saveScreenshot.mustache +1 -1
  59. package/docs/webapi/say.mustache +1 -1
  60. package/docs/webapi/scrollIntoView.mustache +1 -1
  61. package/docs/webapi/scrollPageToBottom.mustache +1 -1
  62. package/docs/webapi/scrollPageToTop.mustache +1 -1
  63. package/docs/webapi/scrollTo.mustache +1 -1
  64. package/docs/webapi/see.mustache +1 -1
  65. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  66. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  67. package/docs/webapi/seeCookie.mustache +1 -1
  68. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  69. package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
  70. package/docs/webapi/seeElement.mustache +1 -1
  71. package/docs/webapi/seeElementInDOM.mustache +1 -1
  72. package/docs/webapi/seeInCurrentUrl.mustache +1 -1
  73. package/docs/webapi/seeInField.mustache +1 -1
  74. package/docs/webapi/seeInPopup.mustache +1 -1
  75. package/docs/webapi/seeInSource.mustache +1 -1
  76. package/docs/webapi/seeInTitle.mustache +1 -1
  77. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  78. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  79. package/docs/webapi/seeTextEquals.mustache +1 -1
  80. package/docs/webapi/seeTitleEquals.mustache +1 -1
  81. package/docs/webapi/selectOption.mustache +1 -1
  82. package/docs/webapi/setCookie.mustache +1 -1
  83. package/docs/webapi/setGeoLocation.mustache +1 -1
  84. package/docs/webapi/switchTo.mustache +1 -1
  85. package/docs/webapi/switchToNextTab.mustache +1 -1
  86. package/docs/webapi/switchToPreviousTab.mustache +1 -1
  87. package/docs/webapi/type.mustache +1 -1
  88. package/docs/webapi/uncheckOption.mustache +1 -1
  89. package/docs/webapi/wait.mustache +1 -1
  90. package/docs/webapi/waitForClickable.mustache +1 -1
  91. package/docs/webapi/waitForDetached.mustache +1 -1
  92. package/docs/webapi/waitForElement.mustache +1 -1
  93. package/docs/webapi/waitForEnabled.mustache +1 -1
  94. package/docs/webapi/waitForFunction.mustache +1 -1
  95. package/docs/webapi/waitForInvisible.mustache +1 -1
  96. package/docs/webapi/waitForText.mustache +1 -1
  97. package/docs/webapi/waitForValue.mustache +1 -1
  98. package/docs/webapi/waitForVisible.mustache +1 -1
  99. package/docs/webapi/waitInUrl.mustache +1 -1
  100. package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
  101. package/docs/webapi/waitToHide.mustache +1 -1
  102. package/docs/webapi/waitUrlEquals.mustache +1 -1
  103. package/lib/helper/Appium.js +0 -10
  104. package/lib/helper/Playwright.js +3 -28
  105. package/lib/helper/REST.js +2 -2
  106. package/lib/helper/WebDriver.js +0 -2
  107. package/package.json +1 -1
  108. package/typings/types.d.ts +988 -517
@@ -7,4 +7,4 @@ I.waitNumberOfVisibleElements('a', 3);
7
7
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
8
8
  @param {number} num number of elements.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- @return {Promise<any>}
10
+ [!] returns a _promise_ which is synchronized internally by recorder
@@ -7,4 +7,4 @@ I.waitToHide('#popup');
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- @return {Promise<any>}
10
+ [!] returns a _promise_ which is synchronized internally by recorder
@@ -7,4 +7,4 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
7
7
 
8
8
  @param {string} urlPart value to check.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- @return {Promise<any>}
10
+ [!] returns a _promise_ which is synchronized internally by recorder
@@ -332,7 +332,6 @@ class Appium extends Webdriver {
332
332
  *
333
333
  * @param {*} caps
334
334
  * @param {*} fn
335
- * @return {Promise<any>}
336
335
  */
337
336
  async runOnIOS(caps, fn) {
338
337
  if (this.platform !== 'ios') return;
@@ -375,7 +374,6 @@ class Appium extends Webdriver {
375
374
  *
376
375
  * @param {*} caps
377
376
  * @param {*} fn
378
- * @return {Promise<any>}
379
377
  */
380
378
  async runOnAndroid(caps, fn) {
381
379
  if (this.platform !== 'android') return;
@@ -396,7 +394,6 @@ class Appium extends Webdriver {
396
394
  * ```
397
395
  *
398
396
  * @param {*} fn
399
- * @return {Promise<any>}
400
397
  */
401
398
  /* eslint-disable */
402
399
  async runInWeb(fn) {
@@ -493,7 +490,6 @@ class Appium extends Webdriver {
493
490
  *
494
491
  * @param {string} appId
495
492
  * @param {string} [bundleId] ID of bundle
496
- * @return {Promise<any>}
497
493
  */
498
494
  async removeApp(appId, bundleId) {
499
495
  onlyForApps.call(this, 'Android');
@@ -601,7 +597,6 @@ class Appium extends Webdriver {
601
597
  * ```
602
598
  *
603
599
  * @param {'LANDSCAPE'|'PORTRAIT'} orientation LANDSCAPE or PORTRAIT
604
- * @return {Promise<any>}
605
600
  *
606
601
  * Appium: support Android and iOS
607
602
  */
@@ -730,7 +725,6 @@ class Appium extends Webdriver {
730
725
  * Switch to the specified context.
731
726
  *
732
727
  * @param {*} context the context to switch to
733
- * @return {Promise<any>}
734
728
  */
735
729
  async _switchToContext(context) {
736
730
  return this.browser.switchContext(context);
@@ -836,7 +830,6 @@ class Appium extends Webdriver {
836
830
  * ```
837
831
  *
838
832
  * @param {object} settings object
839
- * @return {Promise<any>}
840
833
  *
841
834
  * Appium: support Android and iOS
842
835
  */
@@ -861,7 +854,6 @@ class Appium extends Webdriver {
861
854
  *
862
855
  * @param {'tapOutside' | 'pressKey'} [strategy] Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
863
856
  * @param {string} [key] Optional key
864
- * @return {Promise<any>}
865
857
  */
866
858
  async hideDeviceKeyboard(strategy, key) {
867
859
  onlyForApps.call(this);
@@ -984,7 +976,6 @@ class Appium extends Webdriver {
984
976
  *
985
977
  * @param {object} from
986
978
  * @param {object} to
987
- * @return {Promise<any>}
988
979
  *
989
980
  * Appium: support Android and iOS
990
981
  */
@@ -1217,7 +1208,6 @@ class Appium extends Webdriver {
1217
1208
  * Appium: support Android and iOS
1218
1209
  *
1219
1210
  * @param {Array} actions Array of touch actions
1220
- * @return {Promise<any>}
1221
1211
  */
1222
1212
  async touchPerform(actions) {
1223
1213
  onlyForApps.call(this);
@@ -553,8 +553,7 @@ class Playwright extends Helper {
553
553
  * ```
554
554
  *
555
555
  * @param {string} description used to show in logs.
556
- * @param {function} fn async function that executed with Playwright helper as argument
557
- * @return {Promise<any>}
556
+ * @param {function} fn async function that executed with Playwright helper as argumen
558
557
  */
559
558
  usePlaywrightTo(description, fn) {
560
559
  return this._useTo(...arguments);
@@ -569,7 +568,6 @@ class Playwright extends Helper {
569
568
  * I.click('#triggerPopup');
570
569
  * I.acceptPopup();
571
570
  * ```
572
- * @return {Promise<any>}
573
571
  */
574
572
  amAcceptingPopups() {
575
573
  popupStore.actionType = 'accept';
@@ -579,7 +577,6 @@ class Playwright extends Helper {
579
577
  * Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
580
578
  * Don't confuse popups with modal windows, as created by [various
581
579
  * libraries](http://jster.net/category/windows-modals-popups).
582
- * @return {Promise<any>}
583
580
  */
584
581
  acceptPopup() {
585
582
  popupStore.assertPopupActionType('accept');
@@ -594,7 +591,6 @@ class Playwright extends Helper {
594
591
  * I.click('#triggerPopup');
595
592
  * I.cancelPopup();
596
593
  * ```
597
- * @return {Promise<any>}
598
594
  */
599
595
  amCancellingPopups() {
600
596
  popupStore.actionType = 'cancel';
@@ -602,7 +598,6 @@ class Playwright extends Helper {
602
598
 
603
599
  /**
604
600
  * Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
605
- * @return {Promise<any>}
606
601
  */
607
602
  cancelPopup() {
608
603
  popupStore.assertPopupActionType('cancel');
@@ -620,7 +615,6 @@ class Playwright extends Helper {
620
615
  /**
621
616
  * Set current page
622
617
  * @param {object} page page to set
623
- * @return {Promise<any>}
624
618
  */
625
619
  async _setPage(page) {
626
620
  page = await page;
@@ -645,7 +639,6 @@ class Playwright extends Helper {
645
639
  /**
646
640
  * Add the 'dialog' event listener to a page
647
641
  * @page {playwright.Page}
648
- * @return {Promise<any>}
649
642
  *
650
643
  * The popup listener handles the dialog with the predefined action when it appears on the page.
651
644
  * It also saves a reference to the object which is used in seeInPopup.
@@ -676,7 +669,6 @@ class Playwright extends Helper {
676
669
 
677
670
  /**
678
671
  * Gets page URL including hash.
679
- * @return {Promise<any>}
680
672
  */
681
673
  async _getPageUrl() {
682
674
  return this.executeScript(() => window.location.href);
@@ -849,7 +841,6 @@ class Playwright extends Helper {
849
841
  * ```
850
842
  *
851
843
  * @param {object} customHeaders headers to set
852
- * @return {Promise<any>}
853
844
  */
854
845
  async haveRequestHeaders(customHeaders) {
855
846
  if (!customHeaders) {
@@ -996,7 +987,6 @@ class Playwright extends Helper {
996
987
  * ```js
997
988
  * const elements = await this.helpers['Playwright']._locate({name: 'password'});
998
989
  * ```
999
- * @return {Promise<any>}
1000
990
  */
1001
991
  async _locate(locator) {
1002
992
  const context = await this.context || await this._getContext();
@@ -1010,7 +1000,6 @@ class Playwright extends Helper {
1010
1000
  * ```js
1011
1001
  * this.helpers['Playwright']._locateCheckable('I agree with terms and conditions').then // ...
1012
1002
  * ```
1013
- * @return {Promise<any>}
1014
1003
  */
1015
1004
  async _locateCheckable(locator, providedContext = null) {
1016
1005
  const context = providedContext || await this._getContext();
@@ -1025,7 +1014,6 @@ class Playwright extends Helper {
1025
1014
  * ```js
1026
1015
  * this.helpers['Playwright']._locateClickable('Next page').then // ...
1027
1016
  * ```
1028
- * @return {Promise<any>}
1029
1017
  */
1030
1018
  async _locateClickable(locator) {
1031
1019
  const context = await this._getContext();
@@ -1038,7 +1026,6 @@ class Playwright extends Helper {
1038
1026
  * ```js
1039
1027
  * this.helpers['Playwright']._locateFields('Your email').then // ...
1040
1028
  * ```
1041
- * @return {Promise<any>}
1042
1029
  */
1043
1030
  async _locateFields(locator) {
1044
1031
  return findFields.call(this, locator);
@@ -1053,7 +1040,6 @@ class Playwright extends Helper {
1053
1040
  * ```
1054
1041
  *
1055
1042
  * @param {number} [num=1]
1056
- * @return {Promise<any>}
1057
1043
  */
1058
1044
  async switchToNextTab(num = 1) {
1059
1045
  if (this.isElectron) {
@@ -1080,7 +1066,6 @@ class Playwright extends Helper {
1080
1066
  * I.switchToPreviousTab(2);
1081
1067
  * ```
1082
1068
  * @param {number} [num=1]
1083
- * @return {Promise<any>}
1084
1069
  */
1085
1070
  async switchToPreviousTab(num = 1) {
1086
1071
  if (this.isElectron) {
@@ -1105,7 +1090,6 @@ class Playwright extends Helper {
1105
1090
  * ```js
1106
1091
  * I.closeCurrentTab();
1107
1092
  * ```
1108
- * @return {Promise<any>}
1109
1093
  */
1110
1094
  async closeCurrentTab() {
1111
1095
  if (this.isElectron) {
@@ -1123,7 +1107,6 @@ class Playwright extends Helper {
1123
1107
  * ```js
1124
1108
  * I.closeOtherTabs();
1125
1109
  * ```
1126
- * @return {Promise<any>}
1127
1110
  */
1128
1111
  async closeOtherTabs() {
1129
1112
  const pages = await this.browserContext.pages();
@@ -1148,7 +1131,6 @@ class Playwright extends Helper {
1148
1131
  * // enable mobile
1149
1132
  * I.openNewTab({ isMobile: true });
1150
1133
  * ```
1151
- * @return {Promise<any>}
1152
1134
  */
1153
1135
  async openNewTab(options) {
1154
1136
  if (this.isElectron) {
@@ -1255,7 +1237,6 @@ class Playwright extends Helper {
1255
1237
 
1256
1238
  /**
1257
1239
  * Clicks link and waits for navigation (deprecated)
1258
- * @return {Promise<any>}
1259
1240
  */
1260
1241
  async clickLink(locator, context = null) {
1261
1242
  console.log('clickLink deprecated: Playwright automatically waits for navigation to happen.');
@@ -1702,7 +1683,6 @@ class Playwright extends Helper {
1702
1683
  *
1703
1684
  * @param {string|function} fn function to be executed in browser context.
1704
1685
  * @param {any} [arg] optional argument to pass to the function
1705
- * @return {Promise<any>}
1706
1686
  */
1707
1687
  async executeScript(fn, arg) {
1708
1688
  let context = this.page;
@@ -2303,7 +2283,6 @@ class Playwright extends Helper {
2303
2283
  *
2304
2284
  * @param {string|function} urlOrPredicate
2305
2285
  * @param {?number} [sec=null] seconds to wait
2306
- * @return {Promise<any>}
2307
2286
  */
2308
2287
  async waitForRequest(urlOrPredicate, sec = null) {
2309
2288
  const timeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2320,7 +2299,6 @@ class Playwright extends Helper {
2320
2299
  *
2321
2300
  * @param {string|function} urlOrPredicate
2322
2301
  * @param {?number} [sec=null] number of seconds to wait
2323
- * @return {Promise<any>}
2324
2302
  */
2325
2303
  async waitForResponse(urlOrPredicate, sec = null) {
2326
2304
  const timeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2392,7 +2370,6 @@ class Playwright extends Helper {
2392
2370
  * See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
2393
2371
  *
2394
2372
  * @param {*} opts
2395
- * @return {Promise<any>}
2396
2373
  */
2397
2374
  async waitForNavigation(opts = {}) {
2398
2375
  opts = {
@@ -2464,8 +2441,7 @@ class Playwright extends Helper {
2464
2441
  * This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
2465
2442
  *
2466
2443
  * @param {string|RegExp} [url] URL, regex or pattern for to match URL
2467
- * @param {function} [handler] a function to process request
2468
- * @return {Promise<any>}
2444
+ * @param {function} [handler] a function to process reques
2469
2445
  */
2470
2446
  async mockRoute(url, handler) {
2471
2447
  return this.browserContext.route(...arguments);
@@ -2481,8 +2457,7 @@ class Playwright extends Helper {
2481
2457
  * If no handler is passed, all mock requests for the rote are disabled.
2482
2458
  *
2483
2459
  * @param {string|RegExp} [url] URL, regex or pattern for to match URL
2484
- * @param {function} [handler] a function to process request
2485
- * @return {Promise<any>}
2460
+ * @param {function} [handler] a function to process reques
2486
2461
  */
2487
2462
  async stopMockingRoute(url, handler) {
2488
2463
  return this.browserContext.unroute(...arguments);
@@ -87,7 +87,7 @@ class REST extends Helper {
87
87
  * @param {object} headers headers list
88
88
  */
89
89
  haveRequestHeaders(headers) {
90
- this.headers = { ...headers, ...this.headers };
90
+ this.headers = { ...this.headers, ...headers };
91
91
  }
92
92
 
93
93
  /**
@@ -113,7 +113,7 @@ class REST extends Helper {
113
113
  */
114
114
  async _executeRequest(request) {
115
115
  // Add custom headers. They can be set by amBearerAuthenticated() or haveRequestHeaders()
116
- request.headers = { ...request.headers, ...this.headers };
116
+ request.headers = { ...this.headers, ...request.headers };
117
117
 
118
118
  const _debugRequest = { ...request };
119
119
  this.axios.defaults.timeout = request.timeout || this.options.timeout;
@@ -2553,7 +2553,6 @@ class WebDriver extends Helper {
2553
2553
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
2554
2554
  * @param {*} caps
2555
2555
  * @param {*} fn
2556
- * @return {Promise<any>}
2557
2556
  */
2558
2557
  /* eslint-disable */
2559
2558
  runOnIOS(caps, fn) {
@@ -2563,7 +2562,6 @@ class WebDriver extends Helper {
2563
2562
  * Placeholder for ~ locator only test case write once run on both Appium and WebDriver.
2564
2563
  * @param {*} caps
2565
2564
  * @param {*} fn
2566
- * @return {Promise<any>}
2567
2565
  */
2568
2566
  runOnAndroid(caps, fn) {
2569
2567
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",