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
package/docs/changelog.md CHANGED
@@ -1,8 +1,64 @@
1
1
  ---
2
- id: changelog
2
+ permalink: /changelog
3
3
  title: Releases
4
+ sidebar: false
5
+ layout: Section
4
6
  ---
5
7
 
8
+ # Releases
9
+
10
+ ## 2.4.1
11
+
12
+ * **[Hotfix]** - Add missing lib that prevents codeceptjs from initializing.
13
+
14
+ ## 2.4.0
15
+
16
+ * Improved setup wizard with `npx codecept init`:
17
+ * **enabled [retryFailedStep](/plugins/#retryfailedstep) plugin for new setups**.
18
+ * enabled [@codeceptjs/configure](/configuration/#common-configuration-patterns) to toggle headless/window mode via env variable
19
+ * creates a new test on init
20
+ * removed question on "steps file", create it by default.
21
+ * Added [pauseOnFail plugin](/plugins/#pauseonfail). *Sponsored by Paul Vincent Beigang and his book "[Practical End 2 End Testing with CodeceptJS](https://leanpub.com/codeceptjs/)"*.
22
+ * Added [`run-rerun` command](/commands/#run-rerun) to run tests multiple times to detect and fix flaky tests. By **[Ilrilan](https://github.com/Ilrilan)** and **[Vorobeyko](https://github.com/Vorobeyko)**.
23
+ * Added [`Scenario.todo()` to declare tests as pending](/basics#todotest). See [#2100](https://github.com/Codeception/CodeceptJS/issues/2100) by **[Vorobeyko](https://github.com/Vorobeyko)**
24
+ * Added support for absolute path for `output` dir. See [#2049](https://github.com/Codeception/CodeceptJS/issues/2049) by **[elukoyanov](https://github.com/elukoyanov)**
25
+ * Fixed error in `npx codecept init` caused by calling `console.print`. See [#2071](https://github.com/Codeception/CodeceptJS/issues/2071) by **[Atinux](https://github.com/Atinux)**.
26
+ * **[Filesystem]** Methods added by **[aefluke](https://github.com/aefluke)**:
27
+ * `seeFileNameMatching`
28
+ * `grabFileNames`
29
+ * **[Puppeteer]** Fixed grabbing attributes with hyphen by **[Holorium](https://github.com/Holorium)**
30
+ * **[TestCafe]** Fixed `grabAttributeFrom` method by **[elukoyanov](https://github.com/elukoyanov)**
31
+ * **[MockRequest]** Added support for [Polly config options](https://netflix.github.io/pollyjs/#/configuration?id=configuration) by **[ecrmnn](https://github.com/ecrmnn)**
32
+ * **[TestCafe]** Fixes exiting with zero code on failure. Fixed [#2090](https://github.com/Codeception/CodeceptJS/issues/2090) with [#2106](https://github.com/Codeception/CodeceptJS/issues/2106) by **[koushikmohan1996](https://github.com/koushikmohan1996)**
33
+ * [WebDriver][Puppeteer] Added basicAuth support via config. Example: `basicAuth: {username: 'username', password: 'password'}`. See [#1962](https://github.com/Codeception/CodeceptJS/issues/1962) by **[PeterNgTr](https://github.com/PeterNgTr)**
34
+ * [WebDriver][Appium] Added `scrollIntoView` by **[pablopaul](https://github.com/pablopaul)**
35
+ * Fixed [#2118](https://github.com/Codeception/CodeceptJS/issues/2118): No error stack trace for syntax error by **[senthillkumar](https://github.com/senthillkumar)**
36
+ * Added `parse()` method to data table inside Cucumber tests. Use it to obtain rows and hashes for test data. See [#2082](https://github.com/Codeception/CodeceptJS/issues/2082) by **[Sraime](https://github.com/Sraime)**
37
+
38
+ ## 2.3.6
39
+
40
+ * Create better Typescript definition file through JSDoc. By **[lemnis](https://github.com/lemnis)**
41
+ * `run-workers` now can use glob pattern. By **[Ilrilan](https://github.com/Ilrilan)**
42
+ ```js
43
+ // Example:
44
+ exports.config = {
45
+ tests: '{./workers/base_test.workers.js,./workers/test_grep.workers.js}',
46
+ }
47
+ ```
48
+ * Added new command `npx codeceptjs info` which print information about your environment and CodeceptJS configs. By **[jamesgeorge007](https://github.com/jamesgeorge007)**
49
+ * Fixed some typos in documantation. By **[pablopaul](https://github.com/pablopaul)** **[atomicpages](https://github.com/atomicpages)** **[EricTendian](https://github.com/EricTendian)**
50
+ * Added PULL_REQUEST template.
51
+ * [Puppeteer][WebDriver] Added `waitForClickable` for waiting clickable element on page.
52
+ * **[TestCafe]** Added support for remote connection. By **[jvdieten](https://github.com/jvdieten)**
53
+ * **[Puppeteer]** Fixed `waitForText` XPath context now works correctly. By **[Heavik](https://github.com/Heavik)**
54
+ * **[TestCafe]** Fixed `clearField` clear field now awaits TestCafe's promise. By **[orihomie](https://github.com/orihomie)**
55
+ * **[Puppeteer]** Fixed fails when executing localStorage on services pages. See [#2026](https://github.com/Codeception/CodeceptJS/issues/2026)
56
+ * Fixed empty tags in test name. See [#2038](https://github.com/Codeception/CodeceptJS/issues/2038)
57
+
58
+ ## 2.3.5
59
+
60
+ * Set "parse-function" dependency to "5.2.11" to avoid further installation errors.
61
+
6
62
  ## 2.3.4
7
63
 
8
64
  * Fixed installation error "Cannot find module '@babel/runtime/helpers/interopRequireDefault'". The issue came from `parse-function` package. Fixed by **[pablopaul](https://github.com/pablopaul)**.
package/docs/commands.md CHANGED
@@ -1,8 +1,9 @@
1
1
  ---
2
- id: commands
2
+ permalink: /commands
3
3
  title: Commands
4
4
  ---
5
5
 
6
+ # Commands
6
7
 
7
8
  ## Run
8
9
 
@@ -87,6 +88,36 @@ Run tests in parallel threads.
87
88
  npx codeceptjs run-workers 3
88
89
  ```
89
90
 
91
+ ## Run Rerun <Badge text="Since 2.4" type="warning"/>
92
+
93
+ Run tests multiple times to detect and fix flaky tests.
94
+
95
+ ```
96
+ npx codeceptjs run-rerun
97
+ ```
98
+
99
+ For this command configuration is required:
100
+
101
+ ```js
102
+ {
103
+ // inside codecept.conf.js
104
+ rerun: {
105
+ // how many times all tests should pass
106
+ minSuccess: 2,
107
+
108
+ // how many times to try to rerun all tests
109
+ maxReruns: 4,
110
+ }
111
+ }
112
+ ```
113
+
114
+ Use Cases:
115
+
116
+ * `minSuccess: 1, maxReruns: 5` - run all tests no more than 5 times, until first successful run.
117
+ * `minSuccess: 3, maxReruns: 5` - run all tests no more than 5 times, until reaching 3 successfull runs.
118
+ * `minSuccess: 10, maxReruns: 10` - run all tests exactly 10 times, to check their stability.
119
+
120
+
90
121
  ## Dry Run
91
122
 
92
123
  Prints test scenarios without executing them
@@ -116,7 +147,7 @@ npx codeceptjs dry-run --steps --bootstrap
116
147
  ## Run Multiple
117
148
 
118
149
  Run multiple suites. Unlike `run-workers` spawns processes to execute tests.
119
- [Requires additional configuration](https://codecept.io/advanced#multiple-browsers-execution) and can be used to execute tests in multiple browsers.
150
+ [Requires additional configuration](/advanced#multiple-browsers-execution) and can be used to execute tests in multiple browsers.
120
151
 
121
152
  ```sh
122
153
  npx codeceptjs run-multiple smoke:chrome regression:firefox
@@ -197,3 +228,11 @@ Prints all available methods of `I` to console
197
228
  ```sh
198
229
  npx codeceptjs list
199
230
  ```
231
+
232
+ ## Local Environment Information
233
+
234
+ Prints debugging information concerning the local environment
235
+
236
+ ```sh
237
+ npx codeceptjs info
238
+ ```
@@ -1,8 +1,10 @@
1
1
  ---
2
- id: community-helpers
2
+ permalink: /community-helpers
3
3
  title: Community Helpers
4
+ editLink: false
4
5
  ---
5
6
 
7
+ # Community Helpers
6
8
  > Share your helpers at our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Community-Helpers)
7
9
 
8
10
  Here is the list of helpers created by our community.
@@ -35,5 +37,14 @@ Please **add your own** by editing this page.
35
37
 
36
38
  ## Page Object Code Generator
37
39
  * [codeceptjs-CodeGenerator](https://github.com/senthillkumar/CodeCeptJS-PageObject) is a CodeceptJS custom wrapper which can create page class with action methods from the page object file(JSON) and project setup(Folder Structure).
40
+
41
+ ## Browser request control
42
+ * [codeceptjs-resources-check](https://github.com/luarmr/codeceptjs-resources-check) Load a URL with Puppeteer and listen to the requests while the page is loading. Enabling count the number or check the sizes of the requests.
43
+
44
+ ## Assertion & Validations
45
+ * [codeceptjs-chai](https://www.npmjs.com/package/codeceptjs-chai) is a CodeceptJS helper which wraps
46
+ [chai](https://www.chaijs.com/) library to complete chai assertion steps with CodeceptJS logging.
47
+
38
48
  ## Other
39
49
 
50
+ * [eslint-plugin-codeceptjs](https://www.npmjs.com/package/eslint-plugin-codeceptjs) Eslint rules for CodeceptJS.
@@ -1,8 +1,9 @@
1
1
  ---
2
- id: configuration
2
+ permalink: /configuration
3
3
  title: Configuration
4
4
  ---
5
5
 
6
+ # Configuration
6
7
 
7
8
  CodeceptJS configuration is set in `codecept.conf.js` file.
8
9
 
@@ -10,7 +11,7 @@ After running `codeceptjs init` it should be saved in test root.
10
11
 
11
12
  Here is an overview of available options with their defaults:
12
13
 
13
- * **tests**: `"./*_test.js"` - pattern to locate tests
14
+ * **tests**: `"./*_test.js"` - pattern to locate tests. Allows to enter [glob pattern](https://github.com/isaacs/node-glob).
14
15
  * **grep**: - pattern to filter tests by name
15
16
  * **include**: `{}` - actors and page objects to be registered in DI container and included in tests. Accepts objects and module `require` paths
16
17
  * **timeout**: `10000` - default tests timeout
@@ -98,6 +99,8 @@ codeceptjs run --config=./path/to/my/config.js
98
99
 
99
100
  ## Common Configuration Patterns
100
101
 
102
+ > 📺 [Watch this material](https://www.youtube.com/watch?v=onBnfo_rJa4&t=4s) on YouTube
103
+
101
104
  [`@codeceptjs/configure` package](https://github.com/codecept-js/configure) contains shared recipes for common configuration patterns. This allows to set meta-configuration, independent from a current helper enabled.
102
105
 
103
106
  Install it and enable to easily switch to headless/window mode, change window size, etc.
@@ -0,0 +1,22 @@
1
+ ---
2
+ permalink: /continuous-integration
3
+ title: Continuous Integration
4
+ ---
5
+
6
+ <!-- this file is auto generated from CI category https://codecept.discourse.group/c/CodeceptJS-issues-in-general/ci/9 -->
7
+
8
+ # Continuous Integration
9
+
10
+ > Help us improve this article. [Write how did you set up CodeceptJS for CI](https://codecept.discourse.group/c/CodeceptJS-issues-in-general/ci/9) and see your post listed here!
11
+
12
+ Continuous Integration services allows you to delegate the control of running tests to external system.
13
+ CodeceptJS plays well with all types of CI even when there is no documentation on this topic, it is still easy to set up with any kind of hosted or cloud CI.
14
+ Our community prepared some valuable recipes for setting up CI systems with CodeceptJS.
15
+
16
+ ## Recipes
17
+
18
+ * ### [CodeceptJS - Codefresh Integration](https://codecept.discourse.group/t/codeceptjs-codefresh-integration/)
19
+ * ### [CodeceptJS GitLab Integration](https://codecept.discourse.group/t/codeceptjs-gitlab-integration/)
20
+ * ### [CodeceptJS - Jenkins Integration](https://codecept.discourse.group/t/codeceptjs-jenkins-integration/)
21
+ * ### [CodeceptJS Integration with TeamCity](https://codecept.discourse.group/t/codeceptjs-integration-with-teamcity/)
22
+
@@ -1,14 +1,16 @@
1
1
  ---
2
- id: helpers
2
+ permalink: /helpers
3
3
  title: Custom Helpers
4
4
  ---
5
5
 
6
6
 
7
- Helpers is a core concept of CodeceptJS. Helper is a wrapper around various libraries providing unified interface around them.
8
- Methods of Helper class will be available in tests in `I` object. This abstracts test scenarios from the implementation and allows easy switching between backends.
7
+ Helpers is a core concept of CodeceptJS. Helper is a wrapper on top of various libraries providing unified interface around them.
8
+
9
+ Methods of Helper class will be available in tests in `I` object. This abstracts test scenarios from the implementation and allows easily switching between backends.
10
+
9
11
  Functionality of CodeceptJS should be extended by writing a custom helpers.
10
12
 
11
- Helpers can also be installed as Node packages and required by corresponding Node modules
13
+ Helpers can also be installed as Node packages and required by corresponding Node modules.
12
14
 
13
15
  You can either access core Helpers (and underlying libraries) or create a new from scratch.
14
16
 
@@ -17,7 +19,7 @@ You can either access core Helpers (and underlying libraries) or create a new fr
17
19
  Helpers can be created by running a generator command:
18
20
 
19
21
  ```bash
20
- codeceptjs gh
22
+ npx codeceptjs gh
21
23
  ```
22
24
 
23
25
  *(or `generate helper`)*
@@ -65,7 +67,7 @@ Every method should return a value in order to be appended into promise chain.
65
67
  After writing your own custom helpers here you can always update CodeceptJS TypeScript Type Definitions running:
66
68
 
67
69
  ```sh
68
- codeceptjs def .
70
+ npx codeceptjs def .
69
71
  ```
70
72
 
71
73
  This way, if your tests are written with TypeScript, your IDE will be able to leverage features like autocomplete and so on.
@@ -110,7 +112,7 @@ module.exports = MyHelper;
110
112
 
111
113
  ## Puppeteer Example
112
114
 
113
- Puppteer has [nice and elegant API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) which you can use inside helpers. Access `page` instance via `this.helpers.Puppeteer.page` from inside a helper.
115
+ Puppeteer has [nice and elegant API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) which you can use inside helpers. Access `page` instance via `this.helpers.Puppeteer.page` from inside a helper.
114
116
 
115
117
  Let's see how we can use [emulate](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageemulateoptions) function to emulate iPhone browser in a test.
116
118
 
@@ -209,6 +211,7 @@ Implement corresponding methods to them.
209
211
  * `_init` - before all tests
210
212
  * `_finishTest` - after all tests
211
213
  * `_before` - before a test
214
+ * `_after` - after a test
212
215
  * `_beforeStep` - before each step
213
216
  * `_afterStep` - after each step
214
217
  * `_beforeSuite` - before each suite
@@ -220,7 +223,7 @@ Each implemented method should return a value as they will be added to global pr
220
223
 
221
224
  ### Hook Usage Examples
222
225
 
223
- 1) Failing if JS error occur in WebDriver:
226
+ 1) Failing if JS error occurs in WebDriver:
224
227
 
225
228
  ```js
226
229
  class JSFailure extends codecept_helper {
@@ -231,7 +234,7 @@ class JSFailure extends codecept_helper {
231
234
  }
232
235
 
233
236
  _afterStep() {
234
- if (this.err) throw new Error('Browser JS error '+this.err);
237
+ if (this.err) throw new Error(`Browser JS error ${this.err}`);
235
238
  }
236
239
  }
237
240
 
@@ -259,7 +262,7 @@ module.exports = JSWait;
259
262
  It is possible to execute global conditional retries to handle unforseen errors.
260
263
  Lost connections and network issues are good candidates to be retried whenever they appear.
261
264
 
262
- This can be done inside a helper using the global [promise recorder](https://codecept.io/hooks/#api):
265
+ This can be done inside a helper using the global [promise recorder](/hooks/#api):
263
266
 
264
267
  Example: Retrying rendering errors in Puppeteer.
265
268
 
@@ -277,3 +280,6 @@ _before() {
277
280
 
278
281
  Retry rules are available in array `recorder.retries`. The last retry rule can be disabled by running `recorder.retries.pop()`;
279
282
 
283
+ ## Using Typescript
284
+
285
+ When using typescript, replace `module.exports` with `export` for autocompletion.
package/docs/data.md CHANGED
@@ -1,8 +1,9 @@
1
1
  ---
2
- id: data
2
+ permalink: /data
3
3
  title: Data Management
4
4
  ---
5
5
 
6
+ # Data Management
6
7
 
7
8
  > This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](http://codecept.io/advanced/#data-drivern-tests) section*
8
9
 
@@ -153,8 +154,8 @@ Scenario('check post page', async (I) => {
153
154
  // cleanup created data
154
155
  After((I) => {
155
156
  I.sendMutation(
156
- 'mutation deletePost($id: ID!) { deletePost(id: $id) }',
157
- { id: postData.id},
157
+ 'mutation deletePost($permalink: /ID!) { deletePost(permalink: /$id) }',
158
+ { permalink: /postData.id},
158
159
  );
159
160
  });
160
161
  ```
@@ -195,7 +196,7 @@ The way for setting data for a test is as simple as writing:
195
196
  ```js
196
197
  // inside async function
197
198
  let post = await I.have('post');
198
- I.haveMultiple('comment', 5, { postId: post.id});
199
+ I.haveMultiple('comment', 5, { postpermalink: /post.id});
199
200
  ```
200
201
 
201
202
  After completing the preparations under 'Data Generation with Factories', create a factory module which will export a factory.
@@ -247,7 +248,7 @@ This way for setting data for a test is as simple as writing:
247
248
  ```js
248
249
  // inside async function
249
250
  let post = await I.mutateData('createPost');
250
- I.mutateMultiple('createComment', 5, { postId: post.id});
251
+ I.mutateMultiple('createComment', 5, { postpermalink: /post.id});
251
252
  ```
252
253
 
253
254
 
@@ -287,7 +288,7 @@ GraphQLDataFactory: {
287
288
  query: 'mutation createUser($input: UserInput!) { createUser(input: $input) { id name }}',
288
289
  factory: './factories/users',
289
290
  revert: (data) => ({
290
- query: 'mutation deleteUser($id: ID!) { deleteUser(id: $id) }',
291
+ query: 'mutation deleteUser($permalink: /ID!) { deleteUser(permalink: /$id) }',
291
292
  variables: { id : data.id},
292
293
  }),
293
294
  },
package/docs/detox.md CHANGED
@@ -1,11 +1,11 @@
1
1
  ---
2
- id: detox
2
+ permalink: /detox
3
3
  title: Testing React Native with Detox
4
4
  ---
5
5
 
6
6
  > Warning! Detox support in CodeceptJS is experimental. Please try it and help us to test it and improve it. [See Detox helper repository](https://github.com/Codeception/detox-helper).
7
7
 
8
- Automated mobile testing can be slow, hard, and ineffective. The price of it goes high, if we take into account fragility of applications, slowness of emulators, and the complexity of debug. [Appium](https://codecept.io/mobile) helps writing mobile tests but not all apps can be tested effectively with it. That's why you should consider using an alternative approach.
8
+ Automated mobile testing can be slow, hard, and ineffective. The price of it goes high, if we take into account fragility of applications, slowness of emulators, and the complexity of debug. [Appium](/mobile) helps writing mobile tests but not all apps can be tested effectively with it. That's why you should consider using an alternative approach.
9
9
 
10
10
  Meet [Detox](https://github.com/wix/Detox) - grey-box testing solution for mobile testing by Wix.
11
11
 
@@ -30,8 +30,8 @@ CodeceptJS allows you to try different options and choose the one which works be
30
30
  CodeceptJS provides next features over standard Detox:
31
31
 
32
32
  * **Unified API**. The same test can be executed in Appium or Detox. Unified API helps different teams to use the same syntax and easy port tests from one engine to another.
33
- * [Interactive pause](https://codecept.io/basics#pause). When starting/stopping an application takes a long time, debugging and writing tests can be hard. CodeceptJS solves this by pausing an execution and letting you try different commands and locators. With this feature a test can be writtern during one running session.
34
- * [Auto-retries](https://codecept.io/basics#retries) using `retryFailedStepPlugin` and `I.retry()`
33
+ * [Interactive pause](/basics#pause). When starting/stopping an application takes a long time, debugging and writing tests can be hard. CodeceptJS solves this by pausing an execution and letting you try different commands and locators. With this feature a test can be writtern during one running session.
34
+ * [Auto-retries](/basics#retries) using `retryFailedStepPlugin` and `I.retry()`
35
35
  * **Cross-Platform testing** - one test can be executed on different engines. When needed, platform-specific actions and locators can be easily applied.
36
36
 
37
37
  ## A Test
@@ -179,7 +179,7 @@ If element differs on on iOS and Android you can use **cross platform locators**
179
179
  ```js
180
180
  // locate element by text on Android
181
181
  // locate element by accessibility id on iOS
182
- I.click({ android: 'Start', ios: '~start' });
182
+ I.click({ andropermalink: /'Start', ios: '~start' });
183
183
  ```
184
184
 
185
185
  When application behavior differs on Android and iOS use platform-specific actions:
@@ -207,7 +207,7 @@ Scenario('save in application', (I) => {
207
207
  I.fillField('#text', 'a new text');
208
208
  I.see('a new text', '#textValue');
209
209
  I.dontSeeElement('#createdAndVisibleText');
210
- I.click({ ios: '#GoButton', android: 'Button' });
210
+ I.click({ ios: '#GoButton', andropermalink: /'Button' });
211
211
  I.waitForElement('#createdAndVisibleText', 20);
212
212
  I.seeElement('#createdAndVisibleText');
213
213
  I.runOnAndroid(() => {
package/docs/email.md CHANGED
@@ -1,8 +1,10 @@
1
1
  ---
2
- id: email
2
+ permalink: /email
3
3
  title: Email Testing
4
4
  ---
5
5
 
6
+ # Email Testing
7
+
6
8
  In End 2 End testing we need to interact with emails.
7
9
  Email delivery can't tested locally or mocked while testing.
8
10
  That's why for an end to end test you need to use a real emails to be sent and real email address to receive that emails.
@@ -53,7 +55,7 @@ mailbox object contains:
53
55
  * `id` - which is used in next commands
54
56
  * `emailAddress` - randomly generated address of a created mailbox.
55
57
 
56
- > See [Mailslsurp Guide](https://www.mailslurp.com/developers/guides/#create-email-addresses) for details.
58
+ > See [MailSlurp's guide](https://www.mailslurp.com/guides/getting-started/#create-email-addresses) for details.
57
59
 
58
60
  Mailbox is opened on creation. If you need more than one mailboxes and you want to switch between them use `openMailbox` method:
59
61
 
package/docs/examples.md CHANGED
@@ -1,9 +1,28 @@
1
1
  ---
2
- id: examples
2
+ permalink: /examples
3
+ layout: Section
4
+ sidebar: false
3
5
  title: Examples
6
+ editLink: false
4
7
  ---
5
8
 
9
+ # Examples
6
10
  > Add your own examples to our [Wiki Page](https://github.com/Codeception/CodeceptJS/wiki/Examples)
11
+ ## [TodoMVC Examples](https://github.com/codecept-js/examples)
12
+
13
+ ![](https://github.com/codecept-js/examples/raw/master/todo.png)
14
+
15
+ Playground repository where you can run tests in different helpers on a basic single-page website.
16
+
17
+ Tests repository demonstrate usage of
18
+
19
+ * Puppeteer helper
20
+ * WebDriver helper
21
+ * TestCafe plugin
22
+ * Toggle headless mode with env variables
23
+ * PageObjects
24
+ * Cucumber syntax
25
+
7
26
  ## [Basic Examples](https://github.com/Codeception/CodeceptJS/tree/master/examples)
8
27
 
9
28
  CodeceptJS repo contains basic tests (both failing and passing) just to show how it works.
@@ -14,9 +33,9 @@ Our team uses it to test new features and run simple scenarios.
14
33
 
15
34
  ![](https://user-images.githubusercontent.com/220264/56353972-56975080-61db-11e9-8b23-06e8b4620995.png)
16
35
 
17
- End 2 end tests for [Bugira Bugtracker](https://bugira.com) app built with Rails & EmberJS. Bugira is a SaaS application which helps to collect user feedback and transform it into professional bugreports.
36
+ End 2 end tests for [Bugira Bugtracker](https://bugira.com) app built with Rails & EmberJS. Bugira is a SaaS application that helps collecting users' feedbacks and transforming them into professional bug reports.
18
37
 
19
- Tests repository deomstrate usage of
38
+ Tests repository demonstrate usage of
20
39
 
21
40
  * Puppeteer helper
22
41
  * ApiDataFactory helper
@@ -1,5 +1,7 @@
1
1
  ---
2
- id: ApiDataFactory
2
+ permalink: /helpers/ApiDataFactory
3
+ editLink: false
4
+ sidebar: auto
3
5
  title: ApiDataFactory
4
6
  ---
5
7
 
@@ -7,7 +9,7 @@ title: ApiDataFactory
7
9
 
8
10
  ## ApiDataFactory
9
11
 
10
- Extends Helper
12
+ **Extends Helper**
11
13
 
12
14
  Helper for managing remote data using REST API.
13
15
  Uses data generators like [rosie][1] or factory girl to create new record.
@@ -189,25 +191,25 @@ By default `id` property of response is taken. This behavior can be changed by s
189
191
 
190
192
  - `config`
191
193
 
192
- ### \_requestCreate
194
+ ### _requestCreate
193
195
 
194
196
  Executes request to create a record in API.
195
197
  Can be replaced from a in custom helper.
196
198
 
197
199
  #### Parameters
198
200
 
199
- - `factory` any
200
- - `data` any
201
+ - `factory` **any**
202
+ - `data` **any**
201
203
 
202
- ### \_requestDelete
204
+ ### _requestDelete
203
205
 
204
206
  Executes request to delete a record in API
205
207
  Can be replaced from a custom helper.
206
208
 
207
209
  #### Parameters
208
210
 
209
- - `factory` any
210
- - `id` any
211
+ - `factory` **any**
212
+ - `id` **any**
211
213
 
212
214
  ### have
213
215
 
@@ -223,8 +225,8 @@ const user = await I.have('user', { email: 'user@user.com'});
223
225
 
224
226
  #### Parameters
225
227
 
226
- - `factory` any factory to use
227
- - `params` any predefined parameters
228
+ - `factory` **any** factory to use
229
+ - `params` **any** predefined parameters
228
230
 
229
231
  ### haveMultiple
230
232
 
@@ -240,9 +242,9 @@ I.haveMultiple('post', 3, { author: 'davert' });
240
242
 
241
243
  #### Parameters
242
244
 
243
- - `factory` any
244
- - `times` any
245
- - `params` any
245
+ - `factory` **any**
246
+ - `times` **any**
247
+ - `params` **any**
246
248
 
247
249
  [1]: https://github.com/rosiejs/rosie
248
250