codeceptjs 2.3.4 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +28 -6
  3. package/bin/codecept.js +42 -0
  4. package/docs/advanced.md +45 -1
  5. package/docs/angular.md +3 -3
  6. package/docs/basics.md +162 -118
  7. package/docs/bdd.md +30 -5
  8. package/docs/best.md +8 -6
  9. package/docs/books.md +6 -1
  10. package/docs/build/Appium.js +95 -85
  11. package/docs/build/FileSystem.js +48 -3
  12. package/docs/build/GraphQL.js +3 -2
  13. package/docs/build/GraphQLDataFactory.js +1 -0
  14. package/docs/build/Mochawesome.js +3 -2
  15. package/docs/build/MockRequest.js +23 -5
  16. package/docs/build/Nightmare.js +87 -128
  17. package/docs/build/Protractor.js +107 -155
  18. package/docs/build/Puppeteer.js +190 -174
  19. package/docs/build/REST.js +13 -9
  20. package/docs/build/SeleniumWebdriver.js +0 -17
  21. package/docs/build/TestCafe.js +164 -158
  22. package/docs/build/WebDriver.js +236 -211
  23. package/docs/build/WebDriverIO.js +218 -187
  24. package/docs/changelog.md +57 -1
  25. package/docs/commands.md +41 -2
  26. package/docs/community-helpers.md +12 -1
  27. package/docs/configuration.md +5 -2
  28. package/docs/continuous-integration.md +22 -0
  29. package/docs/{helpers.md → custom-helpers.md} +16 -10
  30. package/docs/data.md +7 -6
  31. package/docs/detox.md +6 -6
  32. package/docs/email.md +4 -2
  33. package/docs/examples.md +22 -3
  34. package/docs/helpers/ApiDataFactory.md +15 -13
  35. package/docs/helpers/Appium.md +1011 -468
  36. package/docs/helpers/Detox.md +33 -26
  37. package/docs/helpers/FileSystem.md +43 -13
  38. package/docs/helpers/GraphQL.md +17 -15
  39. package/docs/helpers/GraphQLDataFactory.md +15 -13
  40. package/docs/helpers/Mochawesome.md +3 -1
  41. package/docs/helpers/MockRequest.md +37 -19
  42. package/docs/helpers/Nightmare.md +129 -240
  43. package/docs/helpers/Polly.md +1 -1
  44. package/docs/helpers/Protractor.md +157 -298
  45. package/docs/helpers/Puppeteer.md +216 -335
  46. package/docs/helpers/REST.md +29 -24
  47. package/docs/helpers/TestCafe.md +137 -235
  48. package/docs/helpers/WebDriver.md +250 -347
  49. package/docs/hooks.md +14 -10
  50. package/docs/index.md +112 -0
  51. package/docs/installation.md +3 -1
  52. package/docs/locators.md +19 -8
  53. package/docs/mobile-react-native-locators.md +2 -2
  54. package/docs/mobile.md +5 -3
  55. package/docs/nightmare.md +2 -1
  56. package/docs/pageobjects.md +4 -2
  57. package/docs/parallel.md +4 -2
  58. package/docs/plugins.md +41 -15
  59. package/docs/puppeteer.md +8 -6
  60. package/docs/quickstart.md +130 -0
  61. package/docs/react.md +4 -2
  62. package/docs/reports.md +6 -4
  63. package/docs/testcafe.md +10 -8
  64. package/docs/translation.md +4 -2
  65. package/docs/ui.md +56 -0
  66. package/docs/videos.md +11 -2
  67. package/docs/visual.md +7 -5
  68. package/docs/vue.md +121 -0
  69. package/docs/webapi/appendField.mustache +1 -1
  70. package/docs/webapi/attachFile.mustache +1 -1
  71. package/docs/webapi/checkOption.mustache +2 -2
  72. package/docs/webapi/clearCookie.mustache +1 -1
  73. package/docs/webapi/click.mustache +2 -2
  74. package/docs/webapi/clickLink.mustache +2 -2
  75. package/docs/webapi/dontSee.mustache +1 -2
  76. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  77. package/docs/webapi/dontSeeElement.mustache +1 -1
  78. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  79. package/docs/webapi/dontSeeInField.mustache +1 -1
  80. package/docs/webapi/doubleClick.mustache +2 -2
  81. package/docs/webapi/downloadFile.mustache +1 -1
  82. package/docs/webapi/dragSlider.mustache +1 -1
  83. package/docs/webapi/executeAsyncScript.mustache +2 -1
  84. package/docs/webapi/executeScript.mustache +2 -1
  85. package/docs/webapi/fillField.mustache +1 -1
  86. package/docs/webapi/grabAttributeFrom.mustache +1 -1
  87. package/docs/webapi/grabBrowserLogs.mustache +1 -1
  88. package/docs/webapi/grabCookie.mustache +2 -2
  89. package/docs/webapi/grabCssPropertyFrom.mustache +1 -1
  90. package/docs/webapi/grabHTMLFrom.mustache +1 -1
  91. package/docs/webapi/grabNumberOfVisibleElements.mustache +1 -1
  92. package/docs/webapi/grabPageScrollPosition.mustache +1 -1
  93. package/docs/webapi/grabTextFrom.mustache +2 -2
  94. package/docs/webapi/grabValueFrom.mustache +1 -1
  95. package/docs/webapi/moveCursorTo.mustache +3 -3
  96. package/docs/webapi/pressKey.mustache +1 -1
  97. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  98. package/docs/webapi/rightClick.mustache +2 -2
  99. package/docs/webapi/saveScreenshot.mustache +1 -1
  100. package/docs/webapi/scrollIntoView.mustache +10 -0
  101. package/docs/webapi/scrollTo.mustache +3 -3
  102. package/docs/webapi/see.mustache +1 -1
  103. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  104. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  105. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  106. package/docs/webapi/seeElement.mustache +1 -1
  107. package/docs/webapi/seeElementInDOM.mustache +1 -1
  108. package/docs/webapi/seeInField.mustache +1 -1
  109. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  110. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  111. package/docs/webapi/seeTextEquals.mustache +8 -0
  112. package/docs/webapi/selectOption.mustache +2 -2
  113. package/docs/webapi/switchTo.mustache +1 -1
  114. package/docs/webapi/uncheckOption.mustache +2 -2
  115. package/docs/webapi/waitForClickable.mustache +10 -0
  116. package/docs/webapi/waitForDetached.mustache +2 -2
  117. package/docs/webapi/waitForElement.mustache +2 -2
  118. package/docs/webapi/waitForEnabled.mustache +2 -2
  119. package/docs/webapi/waitForFunction.mustache +2 -2
  120. package/docs/webapi/waitForInvisible.mustache +2 -2
  121. package/docs/webapi/waitForText.mustache +2 -2
  122. package/docs/webapi/waitForValue.mustache +1 -1
  123. package/docs/webapi/waitForVisible.mustache +2 -2
  124. package/docs/webapi/waitInUrl.mustache +1 -1
  125. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -2
  126. package/docs/webapi/waitToHide.mustache +2 -2
  127. package/docs/webapi/waitUntil.mustache +3 -2
  128. package/docs/webapi/waitUrlEquals.mustache +1 -1
  129. package/docs/webdriver.md +20 -18
  130. package/docs/wiki/.git/FETCH_HEAD +1 -0
  131. package/docs/wiki/.git/HEAD +1 -0
  132. package/docs/wiki/.git/ORIG_HEAD +1 -0
  133. package/docs/wiki/.git/config +11 -0
  134. package/docs/wiki/.git/description +1 -0
  135. package/docs/wiki/.git/hooks/applypatch-msg.sample +15 -0
  136. package/docs/wiki/.git/hooks/commit-msg.sample +24 -0
  137. package/docs/wiki/.git/hooks/fsmonitor-watchman.sample +114 -0
  138. package/docs/wiki/.git/hooks/post-update.sample +8 -0
  139. package/docs/wiki/.git/hooks/pre-applypatch.sample +14 -0
  140. package/docs/wiki/.git/hooks/pre-commit.sample +49 -0
  141. package/docs/wiki/.git/hooks/pre-push.sample +53 -0
  142. package/docs/wiki/.git/hooks/pre-rebase.sample +169 -0
  143. package/docs/wiki/.git/hooks/pre-receive.sample +24 -0
  144. package/docs/wiki/.git/hooks/prepare-commit-msg.sample +42 -0
  145. package/docs/wiki/.git/hooks/update.sample +128 -0
  146. package/docs/wiki/.git/index +0 -0
  147. package/docs/wiki/.git/info/exclude +6 -0
  148. package/docs/wiki/.git/logs/HEAD +4 -0
  149. package/docs/wiki/.git/logs/refs/heads/master +4 -0
  150. package/docs/wiki/.git/logs/refs/remotes/origin/HEAD +1 -0
  151. package/docs/wiki/.git/logs/refs/remotes/origin/master +3 -0
  152. package/docs/wiki/.git/objects/00/d216b0774d15db2d0a2a0d4ce249b5251acc55 +3 -0
  153. package/docs/wiki/.git/objects/09/01d87c5241905fdfe3493cfe8f04df4a2685ea +0 -0
  154. package/docs/wiki/.git/objects/0d/bdd0c20c4deb6a8cc81dbbf32ecf8c09238983 +2 -0
  155. package/docs/wiki/.git/objects/1a/c29e4fa82422c52392f22f0f2b8d1a759535bf +0 -0
  156. package/docs/wiki/.git/objects/27/12f92898d3e8f68e229b6cda76570d6c66d781 +0 -0
  157. package/docs/wiki/.git/objects/2d/dbe22c257166b648928eeb9460ecfb71ba702d +0 -0
  158. package/docs/wiki/.git/objects/2f/c942ec3773efd2678d9ff98035c61fcded81a1 +0 -0
  159. package/docs/wiki/.git/objects/40/a2856342c67796b48911a256b764fb06888b94 +5 -0
  160. package/docs/wiki/.git/objects/47/53181844fc4dc563cf3aa5e80462243cb58d38 +0 -0
  161. package/docs/wiki/.git/objects/4e/24a95fb2e4f8ffef51f19b694451a205c06f10 +3 -0
  162. package/docs/wiki/.git/objects/73/31ebd96f3c7e08a9f63f05a25f939afa0d4de1 +0 -0
  163. package/docs/wiki/.git/objects/86/19cbb2289caa502e33fccf0ed14eecf6ba2ba0 +0 -0
  164. package/docs/wiki/.git/objects/a4/72f797d9d74b87c9f71a2b1539d75bb07d1e35 +0 -0
  165. package/docs/wiki/.git/objects/c9/9f3e4bd227d6b050b2e416f9876df49583dbf6 +0 -0
  166. package/docs/wiki/.git/objects/ca/e609b4ef3e0ef85fcbe0d68d1a58246584b915 +0 -0
  167. package/docs/wiki/.git/objects/d5/8386ca72f6d550548f3d71d74e3ac73d5ad488 +0 -0
  168. package/docs/wiki/.git/objects/d9/c6874a6de524bdafeb563a20d847f4fdd59a86 +0 -0
  169. package/docs/wiki/.git/objects/f1/c944675bb38b40ae553b0be36c14674c79af54 +0 -0
  170. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.idx +0 -0
  171. package/docs/wiki/.git/objects/pack/pack-28da0fc7e6c08d4c5350717bfbb7b1c53e8198ad.pack +0 -0
  172. package/docs/wiki/.git/packed-refs +2 -0
  173. package/docs/wiki/.git/refs/heads/master +1 -0
  174. package/docs/wiki/.git/refs/remotes/origin/HEAD +1 -0
  175. package/docs/wiki/.git/refs/remotes/origin/master +1 -0
  176. package/docs/wiki/Books-&-Posts.md +27 -0
  177. package/docs/wiki/Community-Helpers.md +41 -0
  178. package/docs/wiki/Examples.md +138 -0
  179. package/docs/wiki/Home.md +11 -0
  180. package/docs/wiki/Release-process.md +25 -0
  181. package/docs/wiki/Roadmap.md +23 -0
  182. package/docs/wiki/Videos.md +19 -0
  183. package/lib/actor.js +18 -1
  184. package/lib/assert/error.js +3 -3
  185. package/lib/codecept.js +9 -6
  186. package/lib/command/configMigrate.js +7 -6
  187. package/lib/command/definitions.js +98 -350
  188. package/lib/command/generate.js +22 -17
  189. package/lib/command/gherkin/init.js +2 -1
  190. package/lib/command/gherkin/snippets.js +6 -6
  191. package/lib/command/gherkin/steps.js +0 -1
  192. package/lib/command/info.js +40 -0
  193. package/lib/command/init.js +54 -41
  194. package/lib/command/run-multiple.js +5 -4
  195. package/lib/command/run-rerun.js +39 -0
  196. package/lib/command/run-workers.js +4 -6
  197. package/lib/command/run.js +8 -18
  198. package/lib/command/utils.js +23 -2
  199. package/lib/command/workers/runTests.js +1 -2
  200. package/lib/config.js +10 -4
  201. package/lib/container.js +31 -6
  202. package/lib/data/dataTableArgument.js +31 -0
  203. package/lib/data/table.js +4 -0
  204. package/lib/event.js +65 -1
  205. package/lib/helper/Appium.js +52 -38
  206. package/lib/helper/FileSystem.js +48 -3
  207. package/lib/helper/GraphQL.js +3 -2
  208. package/lib/helper/GraphQLDataFactory.js +1 -0
  209. package/lib/helper/Mochawesome.js +3 -2
  210. package/lib/helper/MockRequest.js +23 -5
  211. package/lib/helper/Nightmare.js +5 -6
  212. package/lib/helper/Protractor.js +7 -8
  213. package/lib/helper/Puppeteer.js +76 -20
  214. package/lib/helper/REST.js +13 -9
  215. package/lib/helper/SeleniumWebdriver.js +0 -17
  216. package/lib/helper/TestCafe.js +84 -36
  217. package/lib/helper/WebDriver.js +113 -59
  218. package/lib/helper/WebDriverIO.js +43 -59
  219. package/lib/helper/clientscripts/nightmare.js +66 -4
  220. package/lib/helper/scripts/isElementClickable.js +24 -0
  221. package/lib/helper.js +34 -10
  222. package/lib/history.js +1 -1
  223. package/lib/hooks.js +2 -1
  224. package/lib/index.js +19 -0
  225. package/lib/interfaces/bdd.js +4 -0
  226. package/lib/interfaces/featureConfig.js +10 -3
  227. package/lib/interfaces/gherkin.js +6 -2
  228. package/lib/interfaces/scenarioConfig.js +17 -6
  229. package/lib/listener/config.js +1 -1
  230. package/lib/listener/exit.js +6 -0
  231. package/lib/listener/steps.js +0 -1
  232. package/lib/listener/trace.js +0 -1
  233. package/lib/locator.js +67 -2
  234. package/lib/output.js +53 -0
  235. package/lib/parser.js +2 -71
  236. package/lib/pause.js +3 -2
  237. package/lib/plugin/allure.js +41 -22
  238. package/lib/plugin/autoLogin.js +4 -1
  239. package/lib/plugin/pauseOnFail.js +38 -0
  240. package/lib/plugin/puppeteerCoverage.js +8 -7
  241. package/lib/plugin/screenshotOnFail.js +13 -8
  242. package/lib/plugin/stepByStepReport.js +7 -6
  243. package/lib/plugin/wdio.js +2 -1
  244. package/lib/recorder.js +85 -7
  245. package/lib/rerun.js +81 -0
  246. package/lib/secret.js +6 -0
  247. package/lib/session.js +9 -2
  248. package/lib/step.js +37 -2
  249. package/lib/store.js +5 -1
  250. package/lib/ui.js +34 -8
  251. package/lib/utils.js +6 -13
  252. package/lib/within.js +5 -0
  253. package/package.json +49 -29
  254. package/typings/Mocha.d.ts +21 -0
  255. package/typings/Protractor.d.ts +16 -0
  256. package/typings/index.d.ts +169 -0
  257. package/typings/jsdoc.conf.js +34 -0
  258. package/typings/jsdoc.namespace.js +29 -0
  259. package/typings/types.d.ts +9827 -0
  260. package/typings/utils.d.ts +7 -0
  261. package/docs/acceptance.md +0 -409
  262. package/docs/api/codecept.md +0 -75
  263. package/docs/api/config.md +0 -49
  264. package/docs/api/container.md +0 -66
  265. package/docs/api/helper.md +0 -116
  266. package/docs/api/output.md +0 -67
  267. package/docs/api/recorder.md +0 -63
  268. package/docs/helpers/SeleniumWebdriver.md +0 -92
  269. package/docs/helpers/WebDriverIO.md +0 -1671
@@ -4,7 +4,9 @@ let Button;
4
4
  let ProtractorBy;
5
5
  let ProtractorExpectedConditions;
6
6
 
7
+ const path = require('path');
7
8
  const requireg = require('requireg');
9
+
8
10
  const Helper = require('../helper');
9
11
  const stringIncludes = require('../assert/include').includes;
10
12
  const { urlEquals, equals } = require('../assert/equal');
@@ -23,7 +25,6 @@ const {
23
25
  const ElementNotFound = require('./errors/ElementNotFound');
24
26
  const ConnectionRefused = require('./errors/ConnectionRefused');
25
27
  const Locator = require('../locator');
26
- const path = require('path');
27
28
 
28
29
  let withinStore = {};
29
30
  let Runner;
@@ -99,7 +100,7 @@ let Runner;
99
100
  * "browser": "chrome",
100
101
  * "capabilities": {
101
102
  * "chromeOptions": {
102
- * "args": [ "--headless", "--disable-gpu", "--window-size=800,600" ]
103
+ * "args": [ "--headless", "--disable-gpu", "--no-sandbox" ]
103
104
  * }
104
105
  * }
105
106
  * }
@@ -436,7 +437,6 @@ class Protractor extends Helper {
436
437
  * ```
437
438
  *
438
439
  * @param {string} url url path or global url.
439
- * {--end--}
440
440
  */
441
441
  async amOnPage(url) {
442
442
  if (!(/^\w+\:\/\//.test(url))) {
@@ -470,9 +470,9 @@ class Protractor extends Helper {
470
470
  * I.click({css: 'nav a.login'});
471
471
  * ```
472
472
  *
473
- * @param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
474
- * @param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
475
- * {--end--}
473
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
474
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
475
+ *
476
476
  */
477
477
  async click(locator, context = null) {
478
478
  let matcher = this.browser;
@@ -496,9 +496,9 @@ class Protractor extends Helper {
496
496
  * I.doubleClick('.btn.edit');
497
497
  * ```
498
498
  *
499
- * @param {string|object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
500
- * @param {string|object} context (optional, `null` by default) element to search in CSS|XPath|Strict locator.
501
- * {--end--}
499
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
500
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
501
+ *
502
502
  */
503
503
  async doubleClick(locator, context = null) {
504
504
  let matcher = this.browser;
@@ -523,9 +523,9 @@ class Protractor extends Helper {
523
523
  * I.rightClick('Click me', '.context');
524
524
  * ```
525
525
  *
526
- * @param {string|object} locator clickable element located by CSS|XPath|strict locator.
527
- * @param {string|object} context (optional, `null` by default) element located by CSS|XPath|strict locator.
528
- * {--end--}
526
+ * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
527
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
528
+ *
529
529
  */
530
530
  async rightClick(locator, context = null) {
531
531
  /**
@@ -555,10 +555,10 @@ class Protractor extends Helper {
555
555
  * I.moveCursorTo('#submit', 5,5);
556
556
  * ```
557
557
  *
558
- * @param {string|object} locator located by CSS|XPath|strict locator.
559
- * @param {number} offsetX (optional, `0` by default) X-axis offset.
560
- * @param {number} offsetY (optional, `0` by default) Y-axis offset.
561
- * {--end--}
558
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
559
+ * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
560
+ * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
561
+ *
562
562
  */
563
563
  async moveCursorTo(locator, offsetX = null, offsetY = null) {
564
564
  let offset = null;
@@ -580,8 +580,7 @@ class Protractor extends Helper {
580
580
  * I.see('Register', {css: 'form.register'}); // use strict locator
581
581
  * ```
582
582
  * @param {string} text expected on page.
583
- * @param {string|object} context (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
584
- * {--end--}
583
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
585
584
  */
586
585
  async see(text, context = null) {
587
586
  return proceedSee.call(this, 'assert', text, context);
@@ -589,10 +588,13 @@ class Protractor extends Helper {
589
588
 
590
589
  /**
591
590
  * Checks that text is equal to provided one.
592
- *
591
+ *
593
592
  * ```js
594
593
  * I.seeTextEquals('text', 'h1');
595
594
  * ```
595
+ *
596
+ * @param {string} text element value to check.
597
+ * @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
596
598
  */
597
599
  async seeTextEquals(text, context = null) {
598
600
  return proceedSee.call(this, 'assert', text, context, true);
@@ -608,9 +610,8 @@ class Protractor extends Helper {
608
610
  * ```
609
611
  *
610
612
  * @param {string} text which is not present.
611
- * @param {string|object} context (optional) element located by CSS|XPath|strict locator in which to perfrom search.
612
- *
613
- * {--end--}
613
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
614
+ *
614
615
  */
615
616
  dontSee(text, context = null) {
616
617
  return proceedSee.call(this, 'negate', text, context);
@@ -625,8 +626,7 @@ class Protractor extends Helper {
625
626
  * console.log(JSON.stringify(logs))
626
627
  * ```
627
628
  *
628
- * @returns {Promise<Array>} all browser logs
629
- * {--end--}
629
+ * @returns {Promise<Array<*>>} all browser logs
630
630
  */
631
631
  async grabBrowserLogs() {
632
632
  return this.browser.manage().logs().get('browser');
@@ -642,7 +642,6 @@ class Protractor extends Helper {
642
642
  * ```
643
643
  *
644
644
  * @returns {Promise<string>} current URL
645
- * {--end--}
646
645
  */
647
646
  async grabCurrentUrl() {
648
647
  return this.browser.getCurrentUrl();
@@ -667,9 +666,8 @@ class Protractor extends Helper {
667
666
  * ```js
668
667
  * I.selectOption('Which OS do you use?', ['Android', 'iOS']);
669
668
  * ```
670
- * @param {string|object} select field located by label|name|CSS|XPath|strict locator.
671
- * @param {string|array} option visible text or value of option.
672
- * {--end--}
669
+ * @param {CodeceptJS.LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
670
+ * @param {string|Array<*>} option visible text or value of option.
673
671
  */
674
672
  async selectOption(select, option) {
675
673
  const fields = await findFields(this.browser, select);
@@ -705,9 +703,9 @@ class Protractor extends Helper {
705
703
  * // or by strict locator
706
704
  * I.fillField({css: 'form#login input[name=username]'}, 'John');
707
705
  * ```
708
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
706
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
709
707
  * @param {string} value text value to fill.
710
- * {--end--}
708
+ *
711
709
  */
712
710
  async fillField(field, value) {
713
711
  const els = await findFields(this.browser, field);
@@ -726,8 +724,7 @@ class Protractor extends Helper {
726
724
  * I.pressKey(['Control','a']);
727
725
  * ```
728
726
  *
729
- * @param {string|array} key key or array of keys to press.
730
- * {--end--}
727
+ * @param {string|string[]} key key or array of keys to press.
731
728
  * {{ keys }}
732
729
  */
733
730
  async pressKey(key) {
@@ -759,9 +756,8 @@ class Protractor extends Helper {
759
756
  * I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
760
757
  * ```
761
758
  *
762
- * @param {string|object} locator field located by label|name|CSS|XPath|strict locator.
759
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
763
760
  * @param {string} pathToFile local file path relative to codecept.json config file.
764
- * {--end--}
765
761
  */
766
762
  async attachFile(locator, pathToFile) {
767
763
  const file = path.join(global.codecept_dir, pathToFile);
@@ -787,9 +783,9 @@ class Protractor extends Helper {
787
783
  * I.seeInField('form input[type=hidden]','hidden_value');
788
784
  * I.seeInField('#searchform input','Search');
789
785
  * ```
790
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
786
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
791
787
  * @param {string} value value to check.
792
- * {--end--}
788
+ *
793
789
  */
794
790
  async seeInField(field, value) {
795
791
  return proceedSeeInField.call(this, 'assert', field, value);
@@ -804,9 +800,8 @@ class Protractor extends Helper {
804
800
  * I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
805
801
  * ```
806
802
  *
807
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
803
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
808
804
  * @param {string} value value to check.
809
- * {--end--}
810
805
  */
811
806
  async dontSeeInField(field, value) {
812
807
  return proceedSeeInField.call(this, 'negate', field, value);
@@ -819,9 +814,8 @@ class Protractor extends Helper {
819
814
  * ```js
820
815
  * I.appendField('#myTextField', 'appended');
821
816
  * ```
822
- * @param {string|object} field located by label|name|CSS|XPath|strict locator
817
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
823
818
  * @param {string} value text value to append.
824
- * {--end--}
825
819
  */
826
820
  async appendField(field, value) {
827
821
  const els = await findFields(this.browser, field);
@@ -838,7 +832,6 @@ class Protractor extends Helper {
838
832
  * I.clearField('#email');
839
833
  * ```
840
834
  * @param {string|object} editable field located by label|name|CSS|XPath|strict locator.
841
- * {--end--}
842
835
  */
843
836
  async clearField(field) {
844
837
  const els = await findFields(this.browser, field);
@@ -857,9 +850,8 @@ class Protractor extends Helper {
857
850
  * I.checkOption('I Agree to Terms and Conditions');
858
851
  * I.checkOption('agree', '//form');
859
852
  * ```
860
- * @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
861
- * @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
862
- * {--end--}
853
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
854
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
863
855
  */
864
856
  async checkOption(field, context = null) {
865
857
  let matcher = this.browser;
@@ -885,9 +877,8 @@ class Protractor extends Helper {
885
877
  * I.uncheckOption('I Agree to Terms and Conditions');
886
878
  * I.uncheckOption('agree', '//form');
887
879
  * ```
888
- * @param {string|object} field checkbox located by label | name | CSS | XPath | strict locator.
889
- * @param {string} context (optional, `null` by default) element located by CSS | XPath | strict locator.
890
- * {--end--}
880
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
881
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
891
882
  */
892
883
  async uncheckOption(field, context = null) {
893
884
  let matcher = this.browser;
@@ -911,8 +902,8 @@ class Protractor extends Helper {
911
902
  * I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
912
903
  * ```
913
904
  *
914
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
915
- * {--end--}
905
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
906
+ *
916
907
  */
917
908
  async seeCheckboxIsChecked(field) {
918
909
  return proceedIsChecked.call(this, 'assert', field);
@@ -927,8 +918,8 @@ class Protractor extends Helper {
927
918
  * I.dontSeeCheckboxIsChecked('agree'); // located by name
928
919
  * ```
929
920
  *
930
- * @param {string|object} field located by label|name|CSS|XPath|strict locator.
931
- * {--end--}
921
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
922
+ *
932
923
  */
933
924
  async dontSeeCheckboxIsChecked(field) {
934
925
  return proceedIsChecked.call(this, 'negate', field);
@@ -943,9 +934,8 @@ class Protractor extends Helper {
943
934
  * ```
944
935
  * If multiple elements found returns an array of texts.
945
936
  *
946
- * @param locator element located by CSS|XPath|strict locator.
947
- * @returns {Promise<string>} attribute value
948
- * {--end--}
937
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
938
+ * @returns {Promise<string|string[]>} attribute value
949
939
  */
950
940
  async grabTextFrom(locator) {
951
941
  const els = await this._locate(locator);
@@ -967,9 +957,8 @@ class Protractor extends Helper {
967
957
  * let postHTML = await I.grabHTMLFrom('#post');
968
958
  * ```
969
959
  *
970
- * @param locator element located by CSS|XPath|strict locator.
960
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
971
961
  * @returns {Promise<string>} HTML code for an element
972
- * {--end--}
973
962
  */
974
963
  async grabHTMLFrom(locator) {
975
964
  const els = await this._locate(locator);
@@ -992,9 +981,8 @@ class Protractor extends Helper {
992
981
  * ```js
993
982
  * let email = await I.grabValueFrom('input[name=email]');
994
983
  * ```
995
- * @param {string|object} locator field located by label|name|CSS|XPath|strict locator.
984
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
996
985
  * @returns {Promise<string>} attribute value
997
- * {--end--}
998
986
  */
999
987
  async grabValueFrom(locator) {
1000
988
  const els = await findFields(this.browser, locator);
@@ -1010,10 +998,9 @@ class Protractor extends Helper {
1010
998
  * const value = await I.grabCssPropertyFrom('h3', 'font-weight');
1011
999
  * ```
1012
1000
  *
1013
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1001
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1014
1002
  * @param {string} cssProperty CSS property name.
1015
1003
  * @returns {Promise<string>} CSS value
1016
- * {--end--}
1017
1004
  */
1018
1005
  async grabCssPropertyFrom(locator, cssProperty) {
1019
1006
  const els = await this._locate(locator, true);
@@ -1034,10 +1021,9 @@ class Protractor extends Helper {
1034
1021
  * ```js
1035
1022
  * let hint = await I.grabAttributeFrom('#tooltip', 'title');
1036
1023
  * ```
1037
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1024
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1038
1025
  * @param {string} attr attribute name.
1039
1026
  * @returns {Promise<string>} attribute value
1040
- * {--end--}
1041
1027
  */
1042
1028
  async grabAttributeFrom(locator, attr) {
1043
1029
  const els = await this._locate(locator);
@@ -1050,6 +1036,7 @@ class Protractor extends Helper {
1050
1036
  }
1051
1037
  return array.length === 1 ? array[0] : array;
1052
1038
  }
1039
+
1053
1040
  /**
1054
1041
  * Checks that title contains text.
1055
1042
  *
@@ -1058,7 +1045,6 @@ class Protractor extends Helper {
1058
1045
  * ```
1059
1046
  *
1060
1047
  * @param {string} text text value to check.
1061
- * {--end--}
1062
1048
  */
1063
1049
  async seeInTitle(text) {
1064
1050
  return this.browser.getTitle().then(title => stringIncludes('web page title').assert(text, title));
@@ -1084,7 +1070,6 @@ class Protractor extends Helper {
1084
1070
  * ```
1085
1071
  *
1086
1072
  * @param {string} text value to check.
1087
- * {--end--}
1088
1073
  */
1089
1074
  async dontSeeInTitle(text) {
1090
1075
  return this.browser.getTitle().then(title => stringIncludes('web page title').negate(text, title));
@@ -1099,7 +1084,6 @@ class Protractor extends Helper {
1099
1084
  * ```
1100
1085
  *
1101
1086
  * @returns {Promise<string>} title
1102
- * {--end--}
1103
1087
  */
1104
1088
  async grabTitle() {
1105
1089
  return this.browser.getTitle().then((title) => {
@@ -1115,8 +1099,7 @@ class Protractor extends Helper {
1115
1099
  * ```js
1116
1100
  * I.seeElement('#modal');
1117
1101
  * ```
1118
- * @param {string|object} locator located by CSS|XPath|strict locator.
1119
- * {--end--}
1102
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1120
1103
  */
1121
1104
  async seeElement(locator) {
1122
1105
  let els = await this._locate(locator, true);
@@ -1131,8 +1114,7 @@ class Protractor extends Helper {
1131
1114
  * I.dontSeeElement('.modal'); // modal is not shown
1132
1115
  * ```
1133
1116
  *
1134
- * @param {string|object} locator located by CSS|XPath|Strict locator.
1135
- * {--end--}
1117
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1136
1118
  */
1137
1119
  async dontSeeElement(locator) {
1138
1120
  let els = await this._locate(locator, false);
@@ -1147,8 +1129,8 @@ class Protractor extends Helper {
1147
1129
  * ```js
1148
1130
  * I.seeElementInDOM('#modal');
1149
1131
  * ```
1150
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1151
- * {--end--}
1132
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1133
+ *
1152
1134
  */
1153
1135
  async seeElementInDOM(locator) {
1154
1136
  return this.browser.findElements(guessLocator(locator) || global.by.css(locator)).then(els => empty('elements').negate(els.fill('ELEMENT')));
@@ -1161,8 +1143,7 @@ class Protractor extends Helper {
1161
1143
  * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
1162
1144
  * ```
1163
1145
  *
1164
- * @param {string|object} locator located by CSS|XPath|Strict locator.
1165
- * {--end--}
1146
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1166
1147
  */
1167
1148
  async dontSeeElementInDOM(locator) {
1168
1149
  return this.browser.findElements(guessLocator(locator) || global.by.css(locator)).then(els => empty('elements').assert(els.fill('ELEMENT')));
@@ -1175,7 +1156,6 @@ class Protractor extends Helper {
1175
1156
  * I.seeInSource('<h1>Green eggs &amp; ham</h1>');
1176
1157
  * ```
1177
1158
  * @param {string} text value to check.
1178
- * {--end--}
1179
1159
  */
1180
1160
  async seeInSource(text) {
1181
1161
  return this.browser.getPageSource().then(source => stringIncludes('HTML source of a page').assert(text, source));
@@ -1190,7 +1170,6 @@ class Protractor extends Helper {
1190
1170
  * ```
1191
1171
  *
1192
1172
  * @returns {Promise<string>} source code
1193
- * {--end--}
1194
1173
  */
1195
1174
  async grabSource() {
1196
1175
  return this.browser.getPageSource();
@@ -1204,7 +1183,7 @@ class Protractor extends Helper {
1204
1183
  * ```
1205
1184
  *
1206
1185
  * @param {string} value to check.
1207
- * {--end--}
1186
+ *
1208
1187
  */
1209
1188
  async dontSeeInSource(text) {
1210
1189
  return this.browser.getPageSource().then(source => stringIncludes('HTML source of a page').negate(text, source));
@@ -1219,9 +1198,9 @@ class Protractor extends Helper {
1219
1198
  * I.seeNumberOfElements('#submitBtn', 1);
1220
1199
  * ```
1221
1200
  *
1222
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1201
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1223
1202
  * @param {number} num number of elements.
1224
- * {--end--}
1203
+ *
1225
1204
  */
1226
1205
  async seeNumberOfElements(locator, num) {
1227
1206
  const elements = await this._locate(locator);
@@ -1236,9 +1215,9 @@ class Protractor extends Helper {
1236
1215
  * I.seeNumberOfVisibleElements('.buttons', 3);
1237
1216
  * ```
1238
1217
  *
1239
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1218
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1240
1219
  * @param {number} num number of elements.
1241
- * {--end--}
1220
+ *
1242
1221
  */
1243
1222
  async seeNumberOfVisibleElements(locator, num) {
1244
1223
  const res = await this.grabNumberOfVisibleElements(locator);
@@ -1252,9 +1231,8 @@ class Protractor extends Helper {
1252
1231
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
1253
1232
  * ```
1254
1233
  *
1255
- * @param {string|object} locator located by CSS|XPath|strict locator.
1234
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1256
1235
  * @returns {Promise<number>} number of visible elements
1257
- * {--end--}
1258
1236
  */
1259
1237
  async grabNumberOfVisibleElements(locator) {
1260
1238
  let els = await this._locate(locator);
@@ -1269,9 +1247,8 @@ class Protractor extends Helper {
1269
1247
  * I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
1270
1248
  * ```
1271
1249
  *
1272
- * @param {string|object} locator located by CSS|XPath|strict locator.
1250
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1273
1251
  * @param {object} cssProperties object with CSS properties and their values to check.
1274
- * {--end--}
1275
1252
  */
1276
1253
  async seeCssPropertiesOnElements(locator, cssProperties) {
1277
1254
  const els = await this._locate(locator);
@@ -1308,9 +1285,8 @@ class Protractor extends Helper {
1308
1285
  * I.seeAttributesOnElements('//form', { method: "post"});
1309
1286
  * ```
1310
1287
  *
1311
- * @param {string|object} locator located by CSS|XPath|strict locator.
1288
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1312
1289
  * @param {object} attributes attributes and their values to check.
1313
- * {--end--}
1314
1290
  */
1315
1291
  async seeAttributesOnElements(locator, attributes) {
1316
1292
  const els = await this._locate(locator);
@@ -1361,8 +1337,9 @@ class Protractor extends Helper {
1361
1337
  * ```
1362
1338
  *
1363
1339
  * @param {string|function} fn function to be executed in browser context.
1364
- * @param ...args args to be passed to function.
1365
- * {--end--}
1340
+ * @param {...any} args to be passed to function.
1341
+ * @return {Promise<any>}
1342
+ *
1366
1343
  */
1367
1344
  async executeScript(fn) {
1368
1345
  return this.browser.executeScript.apply(this.browser, arguments);
@@ -1391,8 +1368,9 @@ class Protractor extends Helper {
1391
1368
  * ```
1392
1369
  *
1393
1370
  * @param {string|function} fn function to be executed in browser context.
1394
- * @param ...args args to be passed to function.
1395
- * {--end--}
1371
+ * @param {...any} args to be passed to function.
1372
+ * @return {Promise<any>}
1373
+ *
1396
1374
  */
1397
1375
  async executeAsyncScript(fn) {
1398
1376
  this.browser.manage().timeouts().setScriptTimeout(this.options.scriptTimeout);
@@ -1407,7 +1385,6 @@ class Protractor extends Helper {
1407
1385
  * ```
1408
1386
  *
1409
1387
  * @param {string} url a fragment to check
1410
- * {--end--}
1411
1388
  */
1412
1389
  async seeInCurrentUrl(url) {
1413
1390
  return this.browser.getCurrentUrl().then(currentUrl => stringIncludes('url').assert(url, currentUrl));
@@ -1417,7 +1394,6 @@ class Protractor extends Helper {
1417
1394
  * Checks that current url does not contain a provided fragment.
1418
1395
  *
1419
1396
  * @param {string} url value to check.
1420
- * {--end--}
1421
1397
  */
1422
1398
  async dontSeeInCurrentUrl(url) {
1423
1399
  return this.browser.getCurrentUrl().then(currentUrl => stringIncludes('url').negate(url, currentUrl));
@@ -1434,7 +1410,6 @@ class Protractor extends Helper {
1434
1410
  * ```
1435
1411
  *
1436
1412
  * @param {string} url value to check.
1437
- * {--end--}
1438
1413
  */
1439
1414
  async seeCurrentUrlEquals(url) {
1440
1415
  return this.browser.getCurrentUrl().then(currentUrl => urlEquals(this.options.url).assert(url, currentUrl));
@@ -1450,7 +1425,6 @@ class Protractor extends Helper {
1450
1425
  * ```
1451
1426
  *
1452
1427
  * @param {string} url value to check.
1453
- * {--end--}
1454
1428
  */
1455
1429
  async dontSeeCurrentUrlEquals(url) {
1456
1430
  return this.browser.getCurrentUrl().then(currentUrl => urlEquals(this.options.url).negate(url, currentUrl));
@@ -1467,8 +1441,7 @@ class Protractor extends Helper {
1467
1441
  * ```
1468
1442
  *
1469
1443
  * @param {string} fileName file name to save.
1470
- * @param {boolean} fullPage (optional, `false` by default) flag to enable fullscreen screenshot mode.
1471
- * {--end--}
1444
+ * @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
1472
1445
  */
1473
1446
  async saveScreenshot(fileName, fullPage = false) {
1474
1447
  const outputFile = screenshotOutputFolder(fileName);
@@ -1509,8 +1482,7 @@ class Protractor extends Helper {
1509
1482
  * I.clearCookie('test');
1510
1483
  * ```
1511
1484
  *
1512
- * @param {string} cookie (optional, `null` by default) cookie name
1513
- * {--end--}
1485
+ * @param {?string} [cookie=null] (optional, `null` by default) cookie name
1514
1486
  */
1515
1487
  async clearCookie(cookie = null) {
1516
1488
  if (!cookie) {
@@ -1527,7 +1499,7 @@ class Protractor extends Helper {
1527
1499
  * ```
1528
1500
  *
1529
1501
  * @param {string} name cookie name.
1530
- * {--end--}
1502
+ *
1531
1503
  */
1532
1504
  async seeCookie(name) {
1533
1505
  return this.browser.manage().getCookie(name).then(res => truth(`cookie ${name}`, 'to be set').assert(res));
@@ -1541,7 +1513,6 @@ class Protractor extends Helper {
1541
1513
  * ```
1542
1514
  *
1543
1515
  * @param {string} name cookie name.
1544
- * {--end--}
1545
1516
  */
1546
1517
  async dontSeeCookie(name) {
1547
1518
  return this.browser.manage().getCookie(name).then(res => truth(`cookie ${name}`, 'to be set').negate(res));
@@ -1550,16 +1521,15 @@ class Protractor extends Helper {
1550
1521
  /**
1551
1522
  * Gets a cookie object by name.
1552
1523
  * If none provided gets all cookies.
1553
- * * Resumes test execution, so **should be used inside async with `await`** operator.
1524
+ * Resumes test execution, so **should be used inside async with `await`** operator.
1554
1525
  *
1555
1526
  * ```js
1556
1527
  * let cookie = await I.grabCookie('auth');
1557
1528
  * assert(cookie.value, '123456');
1558
1529
  * ```
1559
1530
  *
1560
- * @param [name=null] cookie name.
1531
+ * @param {?string} [name=null] cookie name.
1561
1532
  * @returns {Promise<string>} attribute value
1562
- * {--end--}
1563
1533
  *
1564
1534
  * Returns cookie in JSON [format](https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object).
1565
1535
  */
@@ -1626,7 +1596,6 @@ class Protractor extends Helper {
1626
1596
  *
1627
1597
  * @param {number} width width in pixels or `maximize`.
1628
1598
  * @param {number} height height in pixels.
1629
- * {--end--}
1630
1599
  */
1631
1600
  async resizeWindow(width, height) {
1632
1601
  if (width === 'maximize') {
@@ -1645,7 +1614,6 @@ class Protractor extends Helper {
1645
1614
  *
1646
1615
  * @param {string|object} srcElement located by CSS|XPath|strict locator.
1647
1616
  * @param {string|object} destElement located by CSS|XPath|strict locator.
1648
- * {--end--}
1649
1617
  */
1650
1618
  async dragAndDrop(srcElement, destElement) {
1651
1619
  const srcEl = await this._locate(srcElement, true);
@@ -1771,7 +1739,6 @@ class Protractor extends Helper {
1771
1739
  * ```
1772
1740
  *
1773
1741
  * @returns {Promise<number>} number of open tabs
1774
- * {--end--}
1775
1742
  */
1776
1743
  async grabNumberOfOpenTabs() {
1777
1744
  const pages = await this.browser.getAllWindowHandles();
@@ -1786,13 +1753,13 @@ class Protractor extends Helper {
1786
1753
  * I.switchTo(); // switch back to main page
1787
1754
  * ```
1788
1755
  *
1789
- * @param {string|object} locator (optional, `null` by default) element located by CSS|XPath|strict locator.
1790
- * {--end--}
1756
+ * @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
1791
1757
  */
1792
1758
  async switchTo(locator) {
1793
1759
  if (Number.isInteger(locator)) {
1794
1760
  return this.browser.switchTo().frame(locator);
1795
- } else if (!locator) {
1761
+ }
1762
+ if (!locator) {
1796
1763
  return this.browser.switchTo().frame(null);
1797
1764
  }
1798
1765
 
@@ -1809,7 +1776,6 @@ class Protractor extends Helper {
1809
1776
  * ```
1810
1777
  *
1811
1778
  * @param {number} sec number of second to wait.
1812
- * {--end--}
1813
1779
  */
1814
1780
  wait(sec) {
1815
1781
  return this.browser.sleep(sec * 1000);
@@ -1825,9 +1791,8 @@ class Protractor extends Helper {
1825
1791
  * I.waitForElement('.btn.continue', 5); // wait for 5 secs
1826
1792
  * ```
1827
1793
  *
1828
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1829
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1830
- * {--end--}
1794
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1795
+ * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1831
1796
  */
1832
1797
  async waitForElement(locator, sec = null) {
1833
1798
  const aSec = sec || this.options.waitForTimeout;
@@ -1850,9 +1815,8 @@ class Protractor extends Helper {
1850
1815
  * I.waitForDetached('#popup');
1851
1816
  * ```
1852
1817
  *
1853
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1854
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1855
- * {--end--}
1818
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1819
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1856
1820
  */
1857
1821
  async waitForDetached(locator, sec = null) {
1858
1822
  const aSec = sec || this.options.waitForTimeout;
@@ -1885,9 +1849,8 @@ class Protractor extends Helper {
1885
1849
  * I.waitForVisible('#popup');
1886
1850
  * ```
1887
1851
  *
1888
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1889
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1890
- * {--end--}
1852
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1853
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1891
1854
  */
1892
1855
  async waitForVisible(locator, sec = null) {
1893
1856
  const aSec = sec || this.options.waitForTimeout;
@@ -1903,9 +1866,8 @@ class Protractor extends Helper {
1903
1866
  * I.waitToHide('#popup');
1904
1867
  * ```
1905
1868
  *
1906
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1907
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1908
- * {--end--}
1869
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1870
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1909
1871
  */
1910
1872
  async waitToHide(locator, sec = null) {
1911
1873
  return this.waitForInvisible(locator, sec);
@@ -1919,9 +1881,8 @@ class Protractor extends Helper {
1919
1881
  * I.waitForInvisible('#popup');
1920
1882
  * ```
1921
1883
  *
1922
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1923
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1924
- * {--end--}
1884
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1885
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1925
1886
  */
1926
1887
  async waitForInvisible(locator, sec = null) {
1927
1888
  const aSec = sec || this.options.waitForTimeout;
@@ -1943,10 +1904,9 @@ class Protractor extends Helper {
1943
1904
  * I.waitNumberOfVisibleElements('a', 3);
1944
1905
  * ```
1945
1906
  *
1946
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1907
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1947
1908
  * @param {number} num number of elements.
1948
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1949
- * {--end--}
1909
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1950
1910
  */
1951
1911
  async waitNumberOfVisibleElements(locator, num, sec = null) {
1952
1912
  function visibilityCountOf(loc, expectedCount) {
@@ -1971,9 +1931,8 @@ class Protractor extends Helper {
1971
1931
  * Waits for element to become enabled (by default waits for 1sec).
1972
1932
  * Element can be located by CSS or XPath.
1973
1933
  *
1974
- * @param {string|object} locator element located by CSS|XPath|strict locator.
1975
- * @param sec (optional) time in seconds to wait, 1 by default.
1976
- * {--end--}
1934
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1935
+ * @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
1977
1936
  */
1978
1937
  async waitForEnabled(locator, sec = null) {
1979
1938
  const aSec = sec || this.options.waitForTimeout;
@@ -1994,8 +1953,7 @@ class Protractor extends Helper {
1994
1953
  *
1995
1954
  * @param {string|object} field input field.
1996
1955
  * @param {string }value expected value.
1997
- * @param {number} sec (optional, `1` by default) time in seconds to wait
1998
- * {--end--}
1956
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
1999
1957
  */
2000
1958
  async waitForValue(field, value, sec = null) {
2001
1959
  const aSec = sec || this.options.waitForTimeout;
@@ -2033,9 +1991,9 @@ class Protractor extends Helper {
2033
1991
  * ```
2034
1992
  *
2035
1993
  * @param {string|function} fn to be executed in browser context.
2036
- * @param {array|number} argsOrSec (optional, `1` by default) arguments for function or seconds.
2037
- * @param {number} sec (optional, `1` by default) time in seconds to wait
2038
- * {--end--}
1994
+ * @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
1995
+ * @param {number} [sec] (optional, `1` by default) time in seconds to wait
1996
+ *
2039
1997
  */
2040
1998
  async waitForFunction(fn, argsOrSec = null, sec = null) {
2041
1999
  let args = [];
@@ -2060,9 +2018,9 @@ class Protractor extends Helper {
2060
2018
  * ```
2061
2019
  *
2062
2020
  * @param {function|string} fn function which is executed in browser context.
2063
- * @param {number} sec (optional, `1` by default) time in seconds to wait
2021
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2064
2022
  * @param {string} [timeoutMsg=''] message to show in case of timeout fail.
2065
- * {--end--}
2023
+ * @param {?number} [interval=null]
2066
2024
  */
2067
2025
  async waitUntil(fn, sec = null, timeoutMsg = null) {
2068
2026
  const aSec = sec || this.options.waitForTimeout;
@@ -2077,8 +2035,7 @@ class Protractor extends Helper {
2077
2035
  * ```
2078
2036
  *
2079
2037
  * @param {string} urlPart value to check.
2080
- * @param {number} sec (optional, `1` by default) time in seconds to wait
2081
- * {--end--}
2038
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2082
2039
  */
2083
2040
  async waitInUrl(urlPart, sec = null) {
2084
2041
  const aSec = sec || this.options.waitForTimeout;
@@ -2104,8 +2061,7 @@ class Protractor extends Helper {
2104
2061
  * ```
2105
2062
  *
2106
2063
  * @param {string} urlPart value to check.
2107
- * @param {number} sec (optional, `1` by default) time in seconds to wait
2108
- * {--end--}
2064
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2109
2065
  */
2110
2066
  async waitUrlEquals(urlPart, sec = null) {
2111
2067
  const aSec = sec || this.options.waitForTimeout;
@@ -2137,9 +2093,8 @@ class Protractor extends Helper {
2137
2093
  * ```
2138
2094
  *
2139
2095
  * @param {string }text to wait for.
2140
- * @param {number} sec (optional, `1` by default) time in seconds to wait
2141
- * @param {string|object} context (optional) element located by CSS|XPath|strict locator.
2142
- * {--end--}
2096
+ * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2097
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
2143
2098
  */
2144
2099
  async waitForText(text, sec = null, context = null) {
2145
2100
  if (!context) {
@@ -2166,7 +2121,7 @@ class Protractor extends Helper {
2166
2121
  * ```js
2167
2122
  * I.refreshPage();
2168
2123
  * ```
2169
- * {--end--}
2124
+ *
2170
2125
  */
2171
2126
  refreshPage() {
2172
2127
  return this.browser.refresh();
@@ -2189,10 +2144,9 @@ class Protractor extends Helper {
2189
2144
  * I.scrollTo('#submit', 5, 5);
2190
2145
  * ```
2191
2146
  *
2192
- * @param {string|object} locator located by CSS|XPath|strict locator.
2193
- * @param {number} offsetX (optional, `0` by default) X-axis offset.
2194
- * @param {number} offsetY (optional, `0` by default) Y-axis offset.
2195
- * {--end--}
2147
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2148
+ * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
2149
+ * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
2196
2150
  */
2197
2151
  async scrollTo(locator, offsetX = 0, offsetY = 0) {
2198
2152
  if (typeof locator === 'number' && typeof offsetX === 'number') {
@@ -2224,7 +2178,7 @@ class Protractor extends Helper {
2224
2178
  * ```js
2225
2179
  * I.scrollPageToTop();
2226
2180
  * ```
2227
- * {--end--}
2181
+ *
2228
2182
  */
2229
2183
  async scrollPageToTop() {
2230
2184
  return this.executeScript('window.scrollTo(0, 0);');
@@ -2236,7 +2190,7 @@ class Protractor extends Helper {
2236
2190
  * ```js
2237
2191
  * I.scrollPageToBottom();
2238
2192
  * ```
2239
- * {--end--}
2193
+ *
2240
2194
  */
2241
2195
  async scrollPageToBottom() {
2242
2196
  /* eslint-disable prefer-arrow-callback, comma-dangle */
@@ -2259,8 +2213,7 @@ class Protractor extends Helper {
2259
2213
  * let { x, y } = await I.grabPageScrollPosition();
2260
2214
  * ```
2261
2215
  *
2262
- * @returns {Promise<object>} scroll position
2263
- * {--end--}
2216
+ * @returns {Promise<Object<string, *>>} scroll position
2264
2217
  */
2265
2218
  async grabPageScrollPosition() {
2266
2219
  /* eslint-disable comma-dangle */
@@ -2310,7 +2263,6 @@ class Protractor extends Helper {
2310
2263
  * ```
2311
2264
  *
2312
2265
  * @param {object} cookie a cookie object.
2313
- * {--end--}
2314
2266
  */
2315
2267
  setCookie(cookie) {
2316
2268
  return this.browser.manage().addCookie(cookie);