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/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "2.3.4",
4
- "description": "Modern Era Acceptance Testing Framework for NodeJS",
3
+ "version": "2.4.1",
4
+ "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
7
7
  "end2end",
8
+ "end 2 end",
9
+ "puppeteer",
10
+ "webdriver",
11
+ "testcafe",
12
+ "protractor",
8
13
  "bdd",
9
14
  "tdd",
10
15
  "testing"
@@ -20,7 +25,8 @@
20
25
  "bin",
21
26
  "docs",
22
27
  "lib",
23
- "translations"
28
+ "translations",
29
+ "typings"
24
30
  ],
25
31
  "main": "lib/index.js",
26
32
  "typings": "typings/index.d.ts",
@@ -32,19 +38,27 @@
32
38
  "build": "tsc -p ./",
33
39
  "json-server": "./node_modules/json-server/bin/index.js test/data/rest/db.json -p 8010 --watch -m test/data/rest/headers.js",
34
40
  "json-server:graphql": "node test/data/graphql/index.js",
35
- "lint": "eslint bin/ examples/ lib/ test/ translations/ gulpfile.js",
36
- "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ gulpfile.js --fix",
37
- "docs": "gulp docs",
38
- "test": "mocha test/unit --recursive && mocha test/runner --recursive",
39
- "dev:graphql": "nodemon test/data/graphql/index.js"
41
+ "lint": "eslint bin/ examples/ lib/ test/ translations/ runio.js",
42
+ "lint-fix": "eslint bin/ examples/ lib/ test/ translations/ runio.js --fix",
43
+ "docs": "./runio.js docs",
44
+ "test:unit": "mocha test/unit --recursive",
45
+ "test:runner": "mocha test/runner --recursive",
46
+ "test": "npm run test:unit && npm run test:runner",
47
+ "def": "./runio.js def",
48
+ "dev:graphql": "nodemon test/data/graphql/index.js",
49
+ "publish:site": "./runio.js publish:site"
40
50
  },
41
51
  "dependencies": {
52
+ "@codeceptjs/configure": "^0.4.0",
53
+ "@types/mocha": "^5.2.7",
42
54
  "allure-js-commons": "^1.3.2",
43
- "axios": "^0.19.0",
55
+ "arrify": "^2.0.1",
56
+ "axios": "^0.19.1",
44
57
  "chalk": "^1.1.3",
45
- "commander": "^2.20.0",
58
+ "commander": "^2.20.3",
46
59
  "css-to-xpath": "^0.1.0",
47
60
  "cucumber-expressions": "^6.6.2",
61
+ "envinfo": "^7.3.1",
48
62
  "escape-string-regexp": "^1.0.3",
49
63
  "figures": "^2.0.0",
50
64
  "fn-args": "^4.0.0",
@@ -56,51 +70,57 @@
56
70
  "lodash.clonedeep": "^4.5.0",
57
71
  "lodash.merge": "^4.6.2",
58
72
  "mkdirp": "^0.5.1",
59
- "mocha": "^6.2.0",
73
+ "mocha": "^6.2.2",
60
74
  "mocha-junit-reporter": "^1.23.1",
61
75
  "ms": "^2.1.2",
62
- "parse-function": "^5.2.11",
76
+ "parse-function": "^5.5.0",
63
77
  "promise-retry": "^1.1.1",
64
78
  "requireg": "^0.1.8",
65
- "resq": "^1.6.0",
79
+ "resq": "^1.7.0",
66
80
  "semver": "^6.2.0",
67
81
  "sprintf-js": "^1.1.1"
68
82
  },
69
83
  "devDependencies": {
70
- "@codeceptjs/detox-helper": "^1.0.1",
71
- "@pollyjs/adapter-puppeteer": "^2.6.2",
72
- "@pollyjs/core": "^2.6.2",
84
+ "@codeceptjs/detox-helper": "^1.0.2",
85
+ "@pollyjs/adapter-puppeteer": "^2.6.3",
86
+ "@pollyjs/core": "^2.6.3",
73
87
  "@types/inquirer": "^0.0.35",
74
- "@types/mocha": "^5.2.7",
75
88
  "@types/node": "^8.10.54",
76
- "@wdio/sauce-service": "^5.13.2",
77
- "@wdio/selenium-standalone-service": "^5.13.2",
78
- "@wdio/utils": "^5.13.2",
79
- "apollo-server-express": "^2.9.4",
89
+ "@wdio/sauce-service": "^5.16.10",
90
+ "@wdio/selenium-standalone-service": "^5.16.10",
91
+ "@wdio/utils": "^5.16.15",
92
+ "apollo-server-express": "^2.9.16",
80
93
  "chai": "^3.4.1",
81
94
  "chai-as-promised": "^5.2.0",
95
+ "chai-subset": "^1.6.0",
82
96
  "documentation": "^8.1.2",
83
- "eslint": "^4.17.0",
84
- "eslint-config-airbnb-base": "^12.1.0",
85
- "eslint-plugin-import": "^2.18.2",
86
- "eslint-plugin-mocha": "^5.3.0",
97
+ "eslint": "^6.8.0",
98
+ "eslint-config-airbnb-base": "^14.0.0",
99
+ "eslint-plugin-import": "^2.19.1",
100
+ "eslint-plugin-mocha": "^6.2.2",
87
101
  "express": "^4.17.1",
88
102
  "faker": "^4.1.0",
89
103
  "graphql": "^14.5.8",
90
104
  "husky": "^1.2.1",
105
+ "jsdoc": "^3.6.2",
106
+ "jsdoc-typeof-plugin": "^1.0.0",
91
107
  "json-server": "^0.10.1",
92
108
  "nightmare": "^3.0.2",
93
- "nodemon": "^1.19.2",
109
+ "nodemon": "^1.19.4",
94
110
  "protractor": "^5.4.1",
95
111
  "puppeteer": "^1.20.0",
112
+ "qrcode-terminal": "^0.12.0",
96
113
  "rosie": "^1.6.0",
114
+ "runio.js": "^1.0.19",
97
115
  "sinon": "^1.17.2",
98
116
  "sinon-chai": "^2.14.0",
99
- "testcafe": "^1.5.0",
117
+ "testcafe": "^1.7.1",
118
+ "ts-morph": "^3.1.3",
119
+ "tsd-jsdoc": "^2.3.0",
100
120
  "typescript": "^2.9.2",
101
121
  "wdio-docker-service": "^1.5.0",
102
- "webdriverio": "^5.13.2",
103
- "xmldom": "^0.1.27",
122
+ "webdriverio": "^5.18.4",
123
+ "xmldom": "^0.1.31",
104
124
  "xpath": "0.0.27"
105
125
  },
106
126
  "engines": {
@@ -0,0 +1,21 @@
1
+ /// <reference types="Mocha" />
2
+
3
+ declare module "mocha/lib/reporters/base" {
4
+ export = Mocha.reporters.Base;
5
+ }
6
+
7
+ declare module "mocha/lib/suite" {
8
+ export = Mocha.Suite;
9
+ }
10
+
11
+ declare module "mocha/lib/context" {
12
+ export = Mocha.Context;
13
+ }
14
+
15
+ declare module "mocha/lib/test" {
16
+ export = Mocha.Test;
17
+ }
18
+
19
+ declare module "mocha/lib/mocha" {
20
+ export = Mocha;
21
+ }
@@ -0,0 +1,16 @@
1
+ import * as Protractor from "protractor";
2
+
3
+ declare global {
4
+ namespace NodeJS {
5
+ interface Global {
6
+ // Used by Protractor helper
7
+ by: Protractor.ProtractorBy;
8
+ By: Protractor.ProtractorBy;
9
+ ExpectedConditions: Protractor.ProtractorExpectedConditions;
10
+ element: typeof Protractor.element;
11
+ $: typeof Protractor.$;
12
+ $$: typeof Protractor.$$;
13
+ browser: Protractor.ProtractorBrowser;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,169 @@
1
+ // Type definitions for CodeceptJS
2
+ // Project: https://github.com/codeception/codeceptjs/
3
+ /// <reference path="./types.d.ts" />
4
+ /// <reference types="webdriverio" />
5
+ /// <reference types="Mocha" />
6
+
7
+ declare namespace CodeceptJS {
8
+ type WithTranslation<T> = T &
9
+ import("./utils").Translate<T, CodeceptJS.Translation.Actions>;
10
+
11
+ // Could get extended by user generated typings
12
+ interface Methods extends ActorStatic {}
13
+ interface I {}
14
+ interface IHook {}
15
+ interface IScenario {}
16
+ interface CallbackOrder extends Array<any> {}
17
+ interface SupportObject {
18
+ I: CodeceptJS.I;
19
+ }
20
+ namespace Translation {
21
+ interface Actions {}
22
+ }
23
+
24
+ // Extending JSDoc generated typings
25
+ interface Step {
26
+ isMetaStep(): this is MetaStep;
27
+ }
28
+
29
+ // Types who are not be defined by JSDoc
30
+ type actor = <T extends { [action: string]: Function }>(
31
+ customSteps?: T & ThisType<WithTranslation<Methods & T>>
32
+ ) => WithTranslation<Methods & T>;
33
+
34
+ type ILocator =
35
+ | { id: string }
36
+ | { xpath: string }
37
+ | { css: string }
38
+ | { name: string }
39
+ | { frame: string }
40
+ | { android: string }
41
+ | { ios: string }
42
+ | { android: string, ios: string }
43
+ | { react: string };
44
+
45
+ type LocatorOrString = string | ILocator | Locator;
46
+
47
+ interface HookCallback<U extends any[]> { (...args: U): void; }
48
+ interface Scenario extends IScenario { only: IScenario, skip: IScenario }
49
+ interface IData { Scenario: IScenario, only: { Scenario: IScenario } }
50
+
51
+ interface IScenario {
52
+ <T extends any[] = CallbackOrder>(
53
+ title: string,
54
+ callback: HookCallback<T>
55
+ ): ScenarioConfig;
56
+ <T extends any[] = CallbackOrder>(
57
+ title: string,
58
+ opts: { [key: string]: any },
59
+ callback: HookCallback<T>
60
+ ): ScenarioConfig;
61
+ }
62
+ interface IHook {
63
+ <T extends any[] = CallbackOrder>(callback: HookCallback<T>): void;
64
+ }
65
+
66
+ interface Globals {
67
+ codeceptjs: typeof codeceptjs;
68
+ }
69
+ }
70
+
71
+ // Globals
72
+ declare const codecept_dir: string;
73
+ declare const output_dir: string;
74
+
75
+ declare const actor: CodeceptJS.actor;
76
+ declare const codecept_actor: CodeceptJS.actor;
77
+ declare const Helper: typeof CodeceptJS.Helper;
78
+ declare const codecept_helper: typeof CodeceptJS.Helper;
79
+ declare const pause: typeof CodeceptJS.pause;
80
+ declare const within: typeof CodeceptJS.within;
81
+ declare const session: typeof CodeceptJS.session;
82
+ declare const DataTable: typeof CodeceptJS.DataTable;
83
+ declare const codeceptjs: typeof CodeceptJS.index;
84
+ declare const locate: typeof CodeceptJS.Locator.build;
85
+ declare function inject(): CodeceptJS.SupportObject;
86
+ declare function inject<T extends keyof CodeceptJS.SupportObject>(
87
+ name: T
88
+ ): CodeceptJS.SupportObject[T];
89
+ declare const secret: typeof CodeceptJS.Secret.secret;
90
+
91
+ // BDD
92
+ declare const Given: typeof CodeceptJS.addStep;
93
+ declare const When: typeof CodeceptJS.addStep;
94
+ declare const Then: typeof CodeceptJS.addStep;
95
+
96
+ declare const Feature: typeof CodeceptJS.Feature;
97
+ declare const Scenario: CodeceptJS.Scenario;
98
+ declare const xScenario: CodeceptJS.IScenario;
99
+ declare function Data(data: any): CodeceptJS.IData;
100
+ declare function xData(data: any): CodeceptJS.IData;
101
+
102
+ // Hooks
103
+ declare const BeforeSuite: CodeceptJS.IHook;
104
+ declare const AfterSuite: CodeceptJS.IHook;
105
+ declare const Background: CodeceptJS.IHook;
106
+ declare const Before: CodeceptJS.IHook;
107
+ declare const After: CodeceptJS.IHook;
108
+
109
+ interface Window {
110
+ codeceptjs: typeof CodeceptJS.browserCodecept;
111
+ resq: any;
112
+ }
113
+
114
+ declare namespace NodeJS {
115
+ interface Process {
116
+ profile: string;
117
+ }
118
+
119
+ interface Global extends CodeceptJS.Globals {
120
+ codecept_dir: typeof codecept_dir;
121
+ output_dir: typeof output_dir;
122
+
123
+ actor: typeof actor;
124
+ codecept_actor: typeof codecept_actor;
125
+ Helper: typeof Helper;
126
+ codecept_helper: typeof codecept_helper;
127
+ pause: typeof pause;
128
+ within: typeof within;
129
+ session: typeof session;
130
+ DataTable: typeof DataTable;
131
+ locate: typeof locate;
132
+ inject: typeof inject;
133
+ secret: typeof secret;
134
+
135
+ // BDD
136
+ Given: typeof Given;
137
+ When: typeof When;
138
+ Then: typeof Then;
139
+ }
140
+ }
141
+
142
+ declare namespace Mocha {
143
+ interface MochaGlobals {
144
+ Feature: typeof Feature;
145
+ Scenario: typeof Scenario;
146
+ xScenario: typeof xScenario;
147
+ Data: typeof Data;
148
+ xData: typeof xData;
149
+ BeforeSuite: typeof BeforeSuite;
150
+ AfterSuite: typeof AfterSuite;
151
+ Background: typeof Background;
152
+ Before: typeof Before;
153
+ After: typeof After;
154
+ }
155
+
156
+ interface Suite {
157
+ tags: any[]
158
+ comment: string
159
+ feature: any
160
+ }
161
+
162
+ interface Test {
163
+ tags: any[]
164
+ }
165
+ }
166
+
167
+ declare module "codeceptjs" {
168
+ export = codeceptjs;
169
+ }
@@ -0,0 +1,34 @@
1
+ module.exports = {
2
+ source: {
3
+ include: [
4
+ './docs/build',
5
+ './lib/actor.js',
6
+ './lib/codecept.js',
7
+ './lib/config.js',
8
+ './lib/container.js',
9
+ './lib/data/table.js',
10
+ './lib/event.js',
11
+ './lib/helper.js',
12
+ './lib/helper/clientscripts/nightmare.js',
13
+ './lib/index.js',
14
+ './lib/interfaces',
15
+ './lib/locator.js',
16
+ './lib/output.js',
17
+ './lib/pause.js',
18
+ './lib/recorder.js',
19
+ './lib/secret.js',
20
+ './lib/session.js',
21
+ './lib/step.js',
22
+ './lib/store.js',
23
+ './lib/ui.js',
24
+ './lib/within.js',
25
+ require.resolve('@codeceptjs/detox-helper'),
26
+ ],
27
+ },
28
+ opts: {
29
+ template: 'node_modules/tsd-jsdoc/dist',
30
+ recurse: true,
31
+ destination: './typings/',
32
+ },
33
+ plugins: ['jsdoc.namespace.js', 'jsdoc-typeof-plugin'],
34
+ };
@@ -0,0 +1,29 @@
1
+ // Helps tsd-jsdoc to exports all typings into the CodeceptJS namespace,
2
+ // instead of the global.
3
+
4
+ let namespaceAdded = false;
5
+ const kinds = ['class', 'constant', 'function', 'typedef', 'interface', 'namespace'];
6
+ const namespace = 'CodeceptJS';
7
+
8
+ module.exports = {
9
+ handlers: {
10
+ beforeParse(event) {
11
+ if (!namespaceAdded) {
12
+ event.source += `/** @namespace ${namespace} */`;
13
+ namespaceAdded = true;
14
+ }
15
+ },
16
+ newDoclet: ({ doclet }) => {
17
+ if (doclet.undocumented
18
+ || doclet.memberof
19
+ || !kinds.includes(doclet.kind)
20
+ || (doclet.kind === 'namespace' && doclet.longname === 'CodeceptJS')
21
+ ) {
22
+ return;
23
+ }
24
+ doclet.memberof = namespace;
25
+ doclet.longname = `${doclet.memberof}.${doclet.longname}`;
26
+ if (doclet.scope === 'global') doclet.scope = 'static';
27
+ },
28
+ },
29
+ };