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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ## 3.3.1
2
+
3
+ 🛩️ Features:
4
+
5
+ * Add option to avoid duplicate gherkin step definitions (#3257) - @raywiis
6
+ * Added `step.*` for run-workers #3272. Thanks to @abhimanyupandian
7
+ * Fixed loading tests for `codecept run` using glob patterns. By @jayudey-wf
8
+
9
+ ```
10
+ npx codeceptjs run test-dir/*"
11
+ ```
12
+
13
+ * [Playwright] **Possible breaking change.** By default `timeout` is changed to 5000ms. The value set in 3.3.0 was too low. Please set `timeout` explicitly to not depend on release values.
14
+ * [Playwright] Added for color scheme option by @PeterNgTr
15
+
16
+ ```js
17
+ helpers: {
18
+ Playwright : {
19
+ url: "http://localhost",
20
+ colorScheme: "dark",
21
+ }
22
+ }
23
+ ```
24
+
25
+
26
+ 🐛 Bugfixes:
27
+
28
+ * [Playwright] Fixed `Cannot read property 'video' of undefined`
29
+ * Fixed haveRequestHeaders() and amBearerAuthenticated() of REST helper (#3260) - @mirao
30
+ * Fixed: allure attachment fails if screenshot failed #3298 by @ruudvanderweijde
31
+ * Fixed #3105 using autoLogin() plugin with TypeScript. Fix #3290 by @PeterNgTr
32
+ * [Playwright] Added extra params for click and dragAndDrop to type definitions by @mirao
33
+
34
+
35
+ 📖 Documentation
36
+ * Improving the typings in many places
37
+ * Improving the return type of helpers for TS users (#3245) - @nlespiaucq
38
+
1
39
  ## 3.3.0
2
40
 
3
41
  🛩️ Features:
@@ -46,7 +84,7 @@ await eachElement('click all links in .list', '.list a', (el) => {
46
84
 
47
85
  📖 Documentation
48
86
 
49
- * Added [Testomat.io reporter](/reporters#testomatio)
87
+ * Added [Testomat.io reporter](/reports#testomatio)
50
88
  * Added [api testing](/api) guides
51
89
  * Added [internal api](/internal-api) guides
52
90
  * [Appium] Fixed documentation for `performSwipe`
package/README.md CHANGED
@@ -1,4 +1,30 @@
1
+ > # 🇺🇦 UKRAINE NEEDS YOUR HELP NOW!
2
+ >
3
+ > I'm the creator of this project and I'm Ukrainian.
4
+ >
5
+ > **My country, Ukraine, [is being invaded by the Russian Federation, right now](https://www.bbc.com/news/world-europe-60504334)**. I've fled Kyiv and now I'm safe with my family in the western part of Ukraine. At least for now.
6
+ > Russia is hitting target all over my country by ballistic missiles.
7
+ >
8
+ > **Please, save me and help to save my country!**
9
+ >
10
+ > Ukrainian National Bank opened [an account to Raise Funds for Ukraine’s Armed Forces](https://bank.gov.ua/en/news/all/natsionalniy-bank-vidkriv-spetsrahunok-dlya-zboru-koshtiv-na-potrebi-armiyi):
11
+ >
12
+ > ```
13
+ > SWIFT Code NBU: NBUA UA UX
14
+ > JP MORGAN CHASE BANK, New York
15
+ > SWIFT Code: CHASUS33
16
+ > Account: 400807238
17
+ > 383 Madison Avenue, New York, NY 10179, USA
18
+ > IBAN: UA843000010000000047330992708
19
+ > ```
20
+ >
21
+ > You can also donate to [charity supporting Ukrainian army](https://savelife.in.ua/en/donate/).
22
+ >
23
+ > **THANK YOU!**
24
+
25
+
1
26
  [<img src="https://img.shields.io/badge/slack-@codeceptjs-purple.svg?logo=slack">](https://join.slack.com/t/codeceptjs/shared_invite/enQtMzA5OTM4NDM2MzA4LWE4MThhN2NmYTgxNTU5MTc4YzAyYWMwY2JkMmZlYWI5MWQ2MDM5MmRmYzZmYmNiNmY5NTAzM2EwMGIwOTNhOGQ) [<img src="https://img.shields.io/badge/discourse-codeceptjs-purple">](https://codecept.discourse.group) [![NPM version][npm-image]][npm-url]
27
+ [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) [![RussianWarship](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/RussianWarship.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)
2
28
 
3
29
  Build Status:
4
30
 
package/docs/api.md CHANGED
@@ -300,7 +300,7 @@ To perform arbitrary assertions on a response object use `seeResponseValidByCall
300
300
  It allows you to do any kind of assertions by using `expect` from [`chai`](https://www.chaijs.com) library.
301
301
 
302
302
  ```js
303
- I.seeResponseValidByCallback({ data, status, expect } => {
303
+ I.seeResponseValidByCallback(({ data, status, expect }) => {
304
304
  // we receive data and expect to combine them for good assertion
305
305
  expect(data.users.length).to.be.gte(10);
306
306
  })
package/docs/bdd.md CHANGED
@@ -399,6 +399,7 @@ Tag should be placed before *Scenario:* or before *Feature:* keyword. In the las
399
399
  * `gherkin`
400
400
  * `features` - path to feature files, or an array of feature file paths
401
401
  * `steps` - array of files with step definitions
402
+ * `avoidDuplicateSteps` - attempts to avoid duplicate step definitions by shallow compare
402
403
 
403
404
  ```js
404
405
  "gherkin": {
package/docs/best.md CHANGED
@@ -215,7 +215,7 @@ include: {
215
215
  * When you need to customize access to API and go beyond what ApiDataFactory provides, implement DAO:
216
216
 
217
217
  ```js
218
- const faker = require('faker');
218
+ const faker = require('@faker-js/faker');
219
219
  const { I } = inject();
220
220
  const { output } = require('codeceptjs');
221
221
 
@@ -36,7 +36,7 @@ const REST = require('./REST');
36
36
  * Install [Rosie](https://github.com/rosiejs/rosie) and [Faker](https://www.npmjs.com/package/faker) libraries.
37
37
  *
38
38
  * ```sh
39
- * npm i rosie faker --save-dev
39
+ * npm i rosie @faker-js/faker --save-dev
40
40
  * ```
41
41
  *
42
42
  * Create a factory file for a resource.
@@ -46,8 +46,8 @@ const REST = require('./REST');
46
46
  * ```js
47
47
  * // tests/factories/posts.js
48
48
  *
49
- * var Factory = require('rosie').Factory;
50
- * var faker = require('faker');
49
+ * const Factory = require('rosie').Factory;
50
+ * const faker = require('@faker-js/faker');
51
51
  *
52
52
  * module.exports = new Factory()
53
53
  * // no need to set id, it will be set by REST API
@@ -264,6 +264,7 @@ class ApiDataFactory extends Helper {
264
264
  * @param {*} factory factory to use
265
265
  * @param {*} params predefined parameters
266
266
  * @param {*} options options for programmatically generate the attributes
267
+ * @returns {Promise<*>}
267
268
  */
268
269
  have(factory, params, options) {
269
270
  const item = this._createItem(factory, params, options);
@@ -124,6 +124,7 @@ const webRoot = 'body';
124
124
  class Appium extends Webdriver {
125
125
  /**
126
126
  * Appium Special Methods for Mobile only
127
+ * @augments WebDriver
127
128
  */
128
129
 
129
130
  constructor(config) {
@@ -492,6 +493,7 @@ class Appium extends Webdriver {
492
493
  *
493
494
  * @param {string} appId
494
495
  * @param {string} [bundleId] ID of bundle
496
+ * @return {Promise<any>}
495
497
  */
496
498
  async removeApp(appId, bundleId) {
497
499
  onlyForApps.call(this, 'Android');
@@ -728,7 +730,7 @@ class Appium extends Webdriver {
728
730
  * Switch to the specified context.
729
731
  *
730
732
  * @param {*} context the context to switch to
731
-
733
+ * @return {Promise<any>}
732
734
  */
733
735
  async _switchToContext(context) {
734
736
  return this.browser.switchContext(context);
@@ -774,7 +776,7 @@ class Appium extends Webdriver {
774
776
  * // or set context explicitly
775
777
  * I.switchToNative('SOME_OTHER_CONTEXT');
776
778
  * ```
777
- * @param {*} context
779
+ * @param {*} [context]
778
780
  * @return {Promise<void>}
779
781
  */
780
782
  async switchToNative(context = null) {
@@ -859,6 +861,7 @@ class Appium extends Webdriver {
859
861
  *
860
862
  * @param {'tapOutside' | 'pressKey'} [strategy] Desired strategy to close keyboard (‘tapOutside’ or ‘pressKey’)
861
863
  * @param {string} [key] Optional key
864
+ * @return {Promise<any>}
862
865
  */
863
866
  async hideDeviceKeyboard(strategy, key) {
864
867
  onlyForApps.call(this);
@@ -981,6 +984,7 @@ class Appium extends Webdriver {
981
984
  *
982
985
  * @param {object} from
983
986
  * @param {object} to
987
+ * @return {Promise<any>}
984
988
  *
985
989
  * Appium: support Android and iOS
986
990
  */
@@ -1213,6 +1217,7 @@ class Appium extends Webdriver {
1213
1217
  * Appium: support Android and iOS
1214
1218
  *
1215
1219
  * @param {Array} actions Array of touch actions
1220
+ * @return {Promise<any>}
1216
1221
  */
1217
1222
  async touchPerform(actions) {
1218
1223
  onlyForApps.call(this);
@@ -1337,6 +1342,7 @@ class Appium extends Webdriver {
1337
1342
  * ```
1338
1343
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1339
1344
  * @param {string} value text value to append.
1345
+ * @return {Promise<any>}
1340
1346
  *
1341
1347
  */
1342
1348
  async appendField(field, value) {
@@ -1357,6 +1363,7 @@ class Appium extends Webdriver {
1357
1363
  * ```
1358
1364
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1359
1365
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1366
+ * @return {Promise<any>}
1360
1367
  *
1361
1368
  */
1362
1369
  async checkOption(field) {
@@ -1388,7 +1395,8 @@ class Appium extends Webdriver {
1388
1395
  * ```
1389
1396
  *
1390
1397
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1391
- * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1398
+ * @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1399
+ * @return {Promise<any>}
1392
1400
  *
1393
1401
  *
1394
1402
  */
@@ -1407,7 +1415,7 @@ class Appium extends Webdriver {
1407
1415
  * ```
1408
1416
  *
1409
1417
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1410
- *
1418
+ * @return {Promise<any>}
1411
1419
  *
1412
1420
  */
1413
1421
  async dontSeeCheckboxIsChecked(field) {
@@ -1423,6 +1431,7 @@ class Appium extends Webdriver {
1423
1431
  * ```
1424
1432
  *
1425
1433
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1434
+ * @return {Promise<any>}
1426
1435
  */
1427
1436
  async dontSeeElement(locator) {
1428
1437
  if (this.isWeb) return super.dontSeeElement(locator);
@@ -1440,6 +1449,7 @@ class Appium extends Webdriver {
1440
1449
  *
1441
1450
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1442
1451
  * @param {string} value value to check.
1452
+ * @return {Promise<any>}
1443
1453
  *
1444
1454
  */
1445
1455
  async dontSeeInField(field, value) {
@@ -1458,7 +1468,7 @@ class Appium extends Webdriver {
1458
1468
  *
1459
1469
  * @param {string} text which is not present.
1460
1470
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
1461
- *
1471
+ * @return {Promise<any>}
1462
1472
  */
1463
1473
  async dontSee(text, context = null) {
1464
1474
  if (this.isWeb) return super.dontSee(text, context);
@@ -1481,7 +1491,7 @@ class Appium extends Webdriver {
1481
1491
  * ```
1482
1492
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1483
1493
  * @param {CodeceptJS.StringOrSecret} value text value to fill.
1484
- *
1494
+ * @return {Promise<any>}
1485
1495
  *
1486
1496
  */
1487
1497
  async fillField(field, value) {
@@ -1642,7 +1652,7 @@ class Appium extends Webdriver {
1642
1652
  *
1643
1653
  * @param {LocatorOrString} locator located by CSS|XPath|strict locator.
1644
1654
  * @param {ScrollIntoViewOptions} scrollIntoViewOptions see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.
1645
- *
1655
+ * @return {Promise<any>}
1646
1656
  *
1647
1657
  * Supported only for web testing
1648
1658
  */
@@ -1660,7 +1670,7 @@ class Appium extends Webdriver {
1660
1670
  * ```
1661
1671
  *
1662
1672
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1663
- *
1673
+ * @return {Promise<any>}
1664
1674
  *
1665
1675
  */
1666
1676
  async seeCheckboxIsChecked(field) {
@@ -1676,6 +1686,7 @@ class Appium extends Webdriver {
1676
1686
  * I.seeElement('#modal');
1677
1687
  * ```
1678
1688
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1689
+ * @return {Promise<any>}
1679
1690
  *
1680
1691
  */
1681
1692
  async seeElement(locator) {
@@ -1695,7 +1706,7 @@ class Appium extends Webdriver {
1695
1706
  * ```
1696
1707
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1697
1708
  * @param {string} value value to check.
1698
- *
1709
+ * @return {Promise<any>}
1699
1710
  *
1700
1711
  */
1701
1712
  async seeInField(field, value) {
@@ -1714,6 +1725,7 @@ class Appium extends Webdriver {
1714
1725
  * ```
1715
1726
  * @param {string} text expected on page.
1716
1727
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
1728
+ * @return {Promise<any>}
1717
1729
  *
1718
1730
  */
1719
1731
  async see(text, context) {
@@ -1742,7 +1754,7 @@ class Appium extends Webdriver {
1742
1754
  * ```
1743
1755
  * @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
1744
1756
  * @param {string|Array<*>} option visible text or value of option.
1745
- *
1757
+ * @return {Promise<any>}
1746
1758
  *
1747
1759
  * Supported only for web testing
1748
1760
  */
@@ -1762,6 +1774,7 @@ class Appium extends Webdriver {
1762
1774
  *
1763
1775
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1764
1776
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1777
+ * @return {Promise<any>}
1765
1778
  *
1766
1779
  */
1767
1780
  async waitForElement(locator, sec = null) {
@@ -1779,7 +1792,7 @@ class Appium extends Webdriver {
1779
1792
  *
1780
1793
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1781
1794
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1782
- *
1795
+ * @return {Promise<any>}
1783
1796
  *
1784
1797
  */
1785
1798
  async waitForVisible(locator, sec = null) {
@@ -1797,6 +1810,7 @@ class Appium extends Webdriver {
1797
1810
  *
1798
1811
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1799
1812
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1813
+ * @return {Promise<any>}
1800
1814
  *
1801
1815
  */
1802
1816
  async waitForInvisible(locator, sec = null) {
@@ -1817,6 +1831,7 @@ class Appium extends Webdriver {
1817
1831
  * @param {string }text to wait for.
1818
1832
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1819
1833
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
1834
+ * @return {Promise<any>}
1820
1835
  *
1821
1836
  */
1822
1837
  async waitForText(text, sec = null, context = null) {
@@ -112,15 +112,15 @@ class GraphQL extends Helper {
112
112
  *
113
113
  * @param {object} operation
114
114
  * @param {object} headers
115
+ * @return {object} graphQLRequest
115
116
  */
116
117
  _prepareGraphQLRequest(operation, headers) {
117
- const request = {
118
+ return {
118
119
  baseURL: this.options.endpoint,
119
120
  method: 'POST',
120
121
  data: operation,
121
122
  headers,
122
123
  };
123
- return request;
124
124
  }
125
125
 
126
126
  /**
@@ -142,6 +142,7 @@ class GraphQL extends Helper {
142
142
  * @param {object} variables that may go along with the query
143
143
  * @param {object} options are additional query options
144
144
  * @param {object} headers
145
+ * @return Promise<any>
145
146
  */
146
147
  async sendQuery(query, variables, options = {}, headers = {}) {
147
148
  if (typeof query !== 'string') {
@@ -181,6 +182,7 @@ class GraphQL extends Helper {
181
182
  * @param {object} variables that may go along with the mutation
182
183
  * @param {object} options are additional query options
183
184
  * @param {object} headers
185
+ * @return Promise<any>
184
186
  */
185
187
  async sendMutation(mutation, variables, options = {}, headers = {}) {
186
188
  if (typeof mutation !== 'string') {
@@ -36,7 +36,7 @@ const GraphQL = require('./GraphQL');
36
36
  * Install [Rosie](https://github.com/rosiejs/rosie) and [Faker](https://www.npmjs.com/package/faker) libraries.
37
37
  *
38
38
  * ```sh
39
- * npm i rosie faker --save-dev
39
+ * npm i rosie @faker-js/faker --save-dev
40
40
  * ```
41
41
  *
42
42
  * Create a factory file for a resource.
@@ -46,8 +46,8 @@ const GraphQL = require('./GraphQL');
46
46
  * ```js
47
47
  * // tests/factories/users.js
48
48
  *
49
- * var Factory = require('rosie').Factory;
50
- * var faker = require('faker');
49
+ * const Factory = require('rosie').Factory;
50
+ * const faker = require('@faker-js/faker');
51
51
  *
52
52
  * // Used with a constructor function passed to Factory, so that the final build
53
53
  * // object matches the necessary pattern to be sent as the variables object.
@@ -218,7 +218,7 @@ class JSONResponse extends Helper {
218
218
  * Use it to perform custom checks of response data
219
219
  *
220
220
  * ```js
221
- * I.seeResponseValidByCallback({ data, status, expect } => {
221
+ * I.seeResponseValidByCallback(({ data, status, expect }) => {
222
222
  * expect(status).to.eql(200);
223
223
  * expect(data).keys.to.include(['user', 'company']);
224
224
  * });