codeceptjs 3.5.12-beta.1 → 3.5.12-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/docs/advanced.md +351 -0
  2. package/docs/ai.md +248 -0
  3. package/docs/api.md +323 -0
  4. package/docs/basics.md +979 -0
  5. package/docs/bdd.md +539 -0
  6. package/docs/best.md +237 -0
  7. package/docs/books.md +37 -0
  8. package/docs/bootstrap.md +135 -0
  9. package/docs/build/ApiDataFactory.js +410 -0
  10. package/docs/build/Appium.js +2027 -0
  11. package/docs/build/Expect.js +422 -0
  12. package/docs/build/FileSystem.js +228 -0
  13. package/docs/build/GraphQL.js +229 -0
  14. package/docs/build/GraphQLDataFactory.js +309 -0
  15. package/docs/build/JSONResponse.js +338 -0
  16. package/docs/build/Mochawesome.js +71 -0
  17. package/docs/build/Nightmare.js +2152 -0
  18. package/docs/build/OpenAI.js +126 -0
  19. package/docs/build/Playwright.js +5110 -0
  20. package/docs/build/Protractor.js +2706 -0
  21. package/docs/build/Puppeteer.js +3905 -0
  22. package/docs/build/REST.js +344 -0
  23. package/docs/build/TestCafe.js +2125 -0
  24. package/docs/build/WebDriver.js +4240 -0
  25. package/docs/changelog.md +2572 -0
  26. package/docs/commands.md +266 -0
  27. package/docs/community-helpers.md +58 -0
  28. package/docs/configuration.md +157 -0
  29. package/docs/continuous-integration.md +22 -0
  30. package/docs/custom-helpers.md +306 -0
  31. package/docs/data.md +379 -0
  32. package/docs/detox.md +235 -0
  33. package/docs/docker.md +136 -0
  34. package/docs/email.md +183 -0
  35. package/docs/examples.md +149 -0
  36. package/docs/helpers/ApiDataFactory.md +266 -0
  37. package/docs/helpers/Appium.md +1374 -0
  38. package/docs/helpers/Detox.md +586 -0
  39. package/docs/helpers/Expect.md +275 -0
  40. package/docs/helpers/FileSystem.md +152 -0
  41. package/docs/helpers/GraphQL.md +151 -0
  42. package/docs/helpers/GraphQLDataFactory.md +226 -0
  43. package/docs/helpers/JSONResponse.md +254 -0
  44. package/docs/helpers/Mochawesome.md +8 -0
  45. package/docs/helpers/MockRequest.md +377 -0
  46. package/docs/helpers/Nightmare.md +1305 -0
  47. package/docs/helpers/OpenAI.md +70 -0
  48. package/docs/helpers/Playwright.md +2759 -0
  49. package/docs/helpers/Polly.md +44 -0
  50. package/docs/helpers/Protractor.md +1769 -0
  51. package/docs/helpers/Puppeteer-firefox.md +86 -0
  52. package/docs/helpers/Puppeteer.md +2317 -0
  53. package/docs/helpers/REST.md +218 -0
  54. package/docs/helpers/TestCafe.md +1321 -0
  55. package/docs/helpers/WebDriver.md +2547 -0
  56. package/docs/hooks.md +340 -0
  57. package/docs/index.md +111 -0
  58. package/docs/installation.md +75 -0
  59. package/docs/internal-api.md +266 -0
  60. package/docs/locators.md +339 -0
  61. package/docs/mobile-react-native-locators.md +67 -0
  62. package/docs/mobile.md +338 -0
  63. package/docs/pageobjects.md +291 -0
  64. package/docs/parallel.md +400 -0
  65. package/docs/playwright.md +632 -0
  66. package/docs/plugins.md +1259 -0
  67. package/docs/puppeteer.md +316 -0
  68. package/docs/quickstart.md +162 -0
  69. package/docs/react.md +70 -0
  70. package/docs/reports.md +392 -0
  71. package/docs/secrets.md +36 -0
  72. package/docs/shadow.md +68 -0
  73. package/docs/shared/keys.mustache +31 -0
  74. package/docs/shared/react.mustache +1 -0
  75. package/docs/testcafe.md +174 -0
  76. package/docs/translation.md +247 -0
  77. package/docs/tutorial.md +271 -0
  78. package/docs/typescript.md +180 -0
  79. package/docs/ui.md +59 -0
  80. package/docs/videos.md +28 -0
  81. package/docs/visual.md +202 -0
  82. package/docs/vue.md +143 -0
  83. package/docs/webapi/amOnPage.mustache +11 -0
  84. package/docs/webapi/appendField.mustache +11 -0
  85. package/docs/webapi/attachFile.mustache +12 -0
  86. package/docs/webapi/blur.mustache +18 -0
  87. package/docs/webapi/checkOption.mustache +13 -0
  88. package/docs/webapi/clearCookie.mustache +9 -0
  89. package/docs/webapi/clearField.mustache +9 -0
  90. package/docs/webapi/click.mustache +25 -0
  91. package/docs/webapi/clickLink.mustache +8 -0
  92. package/docs/webapi/closeCurrentTab.mustache +7 -0
  93. package/docs/webapi/closeOtherTabs.mustache +8 -0
  94. package/docs/webapi/dontSee.mustache +11 -0
  95. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +10 -0
  96. package/docs/webapi/dontSeeCookie.mustache +8 -0
  97. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +10 -0
  98. package/docs/webapi/dontSeeElement.mustache +8 -0
  99. package/docs/webapi/dontSeeElementInDOM.mustache +8 -0
  100. package/docs/webapi/dontSeeInCurrentUrl.mustache +4 -0
  101. package/docs/webapi/dontSeeInField.mustache +11 -0
  102. package/docs/webapi/dontSeeInSource.mustache +8 -0
  103. package/docs/webapi/dontSeeInTitle.mustache +8 -0
  104. package/docs/webapi/doubleClick.mustache +13 -0
  105. package/docs/webapi/downloadFile.mustache +12 -0
  106. package/docs/webapi/dragAndDrop.mustache +9 -0
  107. package/docs/webapi/dragSlider.mustache +11 -0
  108. package/docs/webapi/executeAsyncScript.mustache +24 -0
  109. package/docs/webapi/executeScript.mustache +26 -0
  110. package/docs/webapi/fillField.mustache +16 -0
  111. package/docs/webapi/focus.mustache +13 -0
  112. package/docs/webapi/forceClick.mustache +28 -0
  113. package/docs/webapi/forceRightClick.mustache +18 -0
  114. package/docs/webapi/grabAllWindowHandles.mustache +7 -0
  115. package/docs/webapi/grabAttributeFrom.mustache +10 -0
  116. package/docs/webapi/grabAttributeFromAll.mustache +9 -0
  117. package/docs/webapi/grabBrowserLogs.mustache +9 -0
  118. package/docs/webapi/grabCookie.mustache +11 -0
  119. package/docs/webapi/grabCssPropertyFrom.mustache +11 -0
  120. package/docs/webapi/grabCssPropertyFromAll.mustache +10 -0
  121. package/docs/webapi/grabCurrentUrl.mustache +9 -0
  122. package/docs/webapi/grabCurrentWindowHandle.mustache +6 -0
  123. package/docs/webapi/grabDataFromPerformanceTiming.mustache +20 -0
  124. package/docs/webapi/grabElementBoundingRect.mustache +20 -0
  125. package/docs/webapi/grabGeoLocation.mustache +8 -0
  126. package/docs/webapi/grabHTMLFrom.mustache +10 -0
  127. package/docs/webapi/grabHTMLFromAll.mustache +9 -0
  128. package/docs/webapi/grabNumberOfOpenTabs.mustache +8 -0
  129. package/docs/webapi/grabNumberOfVisibleElements.mustache +9 -0
  130. package/docs/webapi/grabPageScrollPosition.mustache +8 -0
  131. package/docs/webapi/grabPopupText.mustache +5 -0
  132. package/docs/webapi/grabSource.mustache +8 -0
  133. package/docs/webapi/grabTextFrom.mustache +10 -0
  134. package/docs/webapi/grabTextFromAll.mustache +9 -0
  135. package/docs/webapi/grabTitle.mustache +8 -0
  136. package/docs/webapi/grabValueFrom.mustache +9 -0
  137. package/docs/webapi/grabValueFromAll.mustache +8 -0
  138. package/docs/webapi/grabWebElement.mustache +9 -0
  139. package/docs/webapi/grabWebElements.mustache +9 -0
  140. package/docs/webapi/moveCursorTo.mustache +12 -0
  141. package/docs/webapi/openNewTab.mustache +7 -0
  142. package/docs/webapi/pressKey.mustache +12 -0
  143. package/docs/webapi/pressKeyDown.mustache +12 -0
  144. package/docs/webapi/pressKeyUp.mustache +12 -0
  145. package/docs/webapi/pressKeyWithKeyNormalization.mustache +60 -0
  146. package/docs/webapi/refreshPage.mustache +6 -0
  147. package/docs/webapi/resizeWindow.mustache +6 -0
  148. package/docs/webapi/rightClick.mustache +14 -0
  149. package/docs/webapi/saveElementScreenshot.mustache +10 -0
  150. package/docs/webapi/saveScreenshot.mustache +12 -0
  151. package/docs/webapi/say.mustache +10 -0
  152. package/docs/webapi/scrollIntoView.mustache +11 -0
  153. package/docs/webapi/scrollPageToBottom.mustache +6 -0
  154. package/docs/webapi/scrollPageToTop.mustache +6 -0
  155. package/docs/webapi/scrollTo.mustache +12 -0
  156. package/docs/webapi/see.mustache +11 -0
  157. package/docs/webapi/seeAttributesOnElements.mustache +9 -0
  158. package/docs/webapi/seeCheckboxIsChecked.mustache +10 -0
  159. package/docs/webapi/seeCookie.mustache +8 -0
  160. package/docs/webapi/seeCssPropertiesOnElements.mustache +9 -0
  161. package/docs/webapi/seeCurrentUrlEquals.mustache +11 -0
  162. package/docs/webapi/seeElement.mustache +8 -0
  163. package/docs/webapi/seeElementInDOM.mustache +8 -0
  164. package/docs/webapi/seeInCurrentUrl.mustache +8 -0
  165. package/docs/webapi/seeInField.mustache +12 -0
  166. package/docs/webapi/seeInPopup.mustache +8 -0
  167. package/docs/webapi/seeInSource.mustache +7 -0
  168. package/docs/webapi/seeInTitle.mustache +8 -0
  169. package/docs/webapi/seeNumberOfElements.mustache +11 -0
  170. package/docs/webapi/seeNumberOfVisibleElements.mustache +10 -0
  171. package/docs/webapi/seeTextEquals.mustache +9 -0
  172. package/docs/webapi/seeTitleEquals.mustache +8 -0
  173. package/docs/webapi/selectOption.mustache +21 -0
  174. package/docs/webapi/setCookie.mustache +16 -0
  175. package/docs/webapi/setGeoLocation.mustache +12 -0
  176. package/docs/webapi/switchTo.mustache +9 -0
  177. package/docs/webapi/switchToNextTab.mustache +10 -0
  178. package/docs/webapi/switchToPreviousTab.mustache +10 -0
  179. package/docs/webapi/type.mustache +21 -0
  180. package/docs/webapi/uncheckOption.mustache +13 -0
  181. package/docs/webapi/wait.mustache +8 -0
  182. package/docs/webapi/waitForClickable.mustache +11 -0
  183. package/docs/webapi/waitForDetached.mustache +10 -0
  184. package/docs/webapi/waitForElement.mustache +11 -0
  185. package/docs/webapi/waitForEnabled.mustache +6 -0
  186. package/docs/webapi/waitForFunction.mustache +17 -0
  187. package/docs/webapi/waitForInvisible.mustache +10 -0
  188. package/docs/webapi/waitForNumberOfTabs.mustache +9 -0
  189. package/docs/webapi/waitForText.mustache +13 -0
  190. package/docs/webapi/waitForValue.mustache +10 -0
  191. package/docs/webapi/waitForVisible.mustache +10 -0
  192. package/docs/webapi/waitInUrl.mustache +9 -0
  193. package/docs/webapi/waitNumberOfVisibleElements.mustache +10 -0
  194. package/docs/webapi/waitToHide.mustache +10 -0
  195. package/docs/webapi/waitUrlEquals.mustache +10 -0
  196. package/docs/webdriver.md +701 -0
  197. package/docs/wiki/Books-&-Posts.md +27 -0
  198. package/docs/wiki/Community-Helpers-&-Plugins.md +53 -0
  199. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +61 -0
  200. package/docs/wiki/Examples.md +145 -0
  201. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +68 -0
  202. package/docs/wiki/Home.md +16 -0
  203. package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
  204. package/docs/wiki/Release-Process.md +24 -0
  205. package/docs/wiki/Roadmap.md +23 -0
  206. package/docs/wiki/Tests.md +1393 -0
  207. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +153 -0
  208. package/docs/wiki/Videos.md +19 -0
  209. package/lib/css2xpath/js/css_to_xpath.js +20 -0
  210. package/lib/css2xpath/js/expression.js +23 -0
  211. package/lib/css2xpath/js/renderer.js +239 -0
  212. package/lib/locator.js +15 -1
  213. package/package.json +12 -9
@@ -0,0 +1,392 @@
1
+ ---
2
+ permalink: /reports
3
+ title: Reporters
4
+ ---
5
+
6
+ # Reporters
7
+
8
+ ## Cli
9
+
10
+ By default, CodeceptJS provides cli reporter with console output.
11
+ Test names and failures will be printed out on screen.
12
+
13
+ ```sh
14
+ GitHub --
15
+ ✓ search in 2577ms
16
+ ✓ signin in 2170ms
17
+ ✖ register in 1306ms
18
+
19
+ -- FAILURES:
20
+
21
+ 1) GitHub: register:
22
+ Field q not found by name|text|CSS|XPath
23
+
24
+ Scenario Steps:
25
+
26
+ - I.fillField("q", "aaa") at examples/github_test.js:29:7
27
+ - I.fillField("user[password]", "user@user.com") at examples/github_test.js:28:7
28
+ - I.fillField("user[email]", "user@user.com") at examples/github_test.js:27:7
29
+ - I.fillField("user[login]", "User") at examples/github_test.js:26:7
30
+
31
+
32
+
33
+ Run with --verbose flag to see NodeJS stacktrace
34
+
35
+ ```
36
+
37
+ output steps use `--steps` option:
38
+ ```
39
+ npx codeceptjs run --steps
40
+ ```
41
+
42
+ Output:
43
+
44
+ ```sh
45
+ GitHub --
46
+ search
47
+ • I am on page "https://github.com"
48
+ • I am on page "https://github.com/search"
49
+ • I fill field "Search GitHub", "CodeceptJS"
50
+ • I press key "Enter"
51
+ • I see "Codeception/CodeceptJS", "a"
52
+ ✓ OK in 2681ms
53
+
54
+ signin
55
+ • I am on page "https://github.com"
56
+ • I click "Sign in"
57
+ • I see "Sign in to GitHub"
58
+ • I fill field "Username or email address", "something@totest.com"
59
+ • I fill field "Password", "123456"
60
+ • I click "Sign in"
61
+ • I see "Incorrect username or password.", ".flash-error"
62
+ ✓ OK in 2252ms
63
+
64
+ register
65
+ • I am on page "https://github.com"
66
+ Within .js-signup-form:
67
+ • I fill field "user[login]", "User"
68
+ • I fill field "user[email]", "user@user.com"
69
+ • I fill field "user[password]", "user@user.com"
70
+ • I fill field "q", "aaa"
71
+ ✖ FAILED in 1260ms
72
+ ```
73
+
74
+ To get additional information about test execution use `--debug` option.
75
+
76
+
77
+ ```
78
+ npx codeceptjs run --debug
79
+ ```
80
+
81
+
82
+ This will show execution steps
83
+ as well as notices from test runner. To get even more information with more technical details like error stack traces,
84
+ and global promises, or events use `--verbose` mode.
85
+
86
+ ```
87
+ npx codeceptjs run --verbose
88
+ ```
89
+
90
+ ```sh
91
+ GitHub --
92
+ register
93
+ [1] Starting recording promises
94
+ Emitted | test.before
95
+ > WebDriver._before
96
+ [1] Queued | hook WebDriver._before()
97
+ [1] Queued | amOnPage: https://github.com
98
+ Emitted | step.before (I am on page "https://github.com")
99
+ • I am on page "https://github.com"
100
+ Emitted | step.after (I am on page "https://github.com")
101
+ Emitted | test.start ([object Object])
102
+ ...
103
+ ```
104
+
105
+ Please use verbose output when reporting issues to GitHub.
106
+
107
+ ### Dry Run
108
+
109
+ There is a way to list all tests and their steps without actually executing them. Execute tests in `dry-run` mode to see all available tests:
110
+
111
+ ```
112
+ npx codeceptjs dry-run
113
+ ```
114
+
115
+ Output:
116
+
117
+ ```
118
+ Tests from /home/davert/projects/codeceptjs/examples:
119
+
120
+ Business rules --
121
+ ☐ do something
122
+ Google --
123
+ ☐ test @123
124
+ GitHub -- /home/davert/projects/codeceptjs/examples/github_test.js
125
+ ☐ Visit Home Page @retry
126
+ ☐ search @grop
127
+ ☐ signin @normal @important @slow
128
+ ☐ signin2
129
+ ☐ register
130
+
131
+ Total: 3 suites | 7 tests
132
+
133
+ --- DRY MODE: No tests were executed ---
134
+ ```
135
+
136
+ Pass `--steps` or `--debug` option as in `run` command to also get steps and substeps to be printed. In this mode **tests will be executed** but all helpers and plugins disabled, so no real actions will be performed.
137
+
138
+ ```
139
+ npx codecepjs dry-run --debug
140
+ ```
141
+
142
+ > ℹ If you use custom JavaScript code inside tests, or rely on values from `grab*` commands, dry-run may produce error output.
143
+
144
+
145
+ ## Testomat.io
146
+
147
+ [Testomat.io](https://testomat.io) is a modern test management tool focused on CodeceptJS and **created by CodeceptJS team**.
148
+ Testomat.io is commercial SaaS service that can receive run reports from local runs or CI. Out of box Testomat.io supports parallel runs, uploading of screenshots and videos.
149
+
150
+ ![](https://user-images.githubusercontent.com/220264/151728836-b52d2b2b-56e1-4640-8d3a-b39de817b1fd.png)
151
+
152
+ > 😻 **Testomat.io is free** for small teams, so you can use its reporting features with CodeceptJS.
153
+
154
+ To receive run reports you should:
155
+
156
+ * [Sign up](https://app.testomat.io/users/sign_up) at Testomat.io
157
+ * Create a new "Classical" project (select "BDD" project if you use CodeceptJS in BDD mode)
158
+ * Select "Import from Source Code"
159
+ * Select "CodeceptJS" as testing framework and JavaScript or TypeScript as a language. If you use BDD select "Gherkin" as language.
160
+ * Execute provided command in a terminal with your project. This will be "check-tests" or "check-cucmber" command. It scans all your test files and imports them into Testomat.io. This way all your e2e tests will be visible in one UI.
161
+ * After tests are imported, go to Runs tab and select "Setup automated tests".
162
+ * Follow the instructions:
163
+
164
+
165
+ ![image](https://user-images.githubusercontent.com/77803888/151834217-5da44d92-a59a-458d-8856-64ce61bf3a38.png)
166
+
167
+ * You will need to install `@testomatio/reporter` package and enable it as a plugin in codeceptjs config:
168
+
169
+ ```js
170
+ plugins: {
171
+ testomatio: {
172
+ enabled: true,
173
+ require: '@testomatio/reporter/lib/adapter/codecept',
174
+ apiKey: process.env.TESTOMATIO,
175
+ }
176
+ }
177
+ ```
178
+
179
+ * Run tests with `TESTOMATIO=` env variable and API key provided by Testomat.io
180
+ * See the run report is created and updated in realtime.
181
+
182
+
183
+ [Testomat.io](https://testomat.io) reporter works in the cloud, so it doesn't require you to install additional software. It can be integrated with your CI service to rerun only failed tests, launch new runs from UI, and send report notifications by email or in Slack, MS Teams, or create issue in Jira.
184
+
185
+
186
+
187
+ ## ReportPortal
188
+
189
+ For enterprise grade we reporting we recommend using [ReportPortal](https://reportportal.io).
190
+
191
+ ![](https://camo.githubusercontent.com/6550c0365f1d0ce1e29c53f1860b12957d1fc529/68747470733a2f2f692e6962622e636f2f516d353247306e2f53637265656e73686f742d323031392d30342d31312d61742d31352d35372d34302e706e67)
192
+
193
+ [ReportPortal](https://reportportal.io) is open-source self-hosted service for aggregating test execution reports.
194
+ Think of it as Kibana but for test reports.
195
+
196
+ Use official [CodeceptJS Agent for ReportPortal](https://github.com/reportportal/agent-js-codecept/) to start publishing your test results.
197
+
198
+
199
+ ## XML
200
+
201
+ Use default xunit reporter of Mocha to print xml reports. Provide `--reporter xunit` to get the report to screen.
202
+ It is recommended to use more powerful [`mocha-junit-reporter`](https://www.npmjs.com/package/mocha-junit-reporter) package
203
+ to get better support for Jenkins CI.
204
+
205
+ Install it via NPM (locally or globally, depending on CodeceptJS installation type):
206
+
207
+ ```sh
208
+ npm i mocha-junit-reporter
209
+ ```
210
+
211
+ Additional configuration should be added to `codecept.conf.js` to print xml report to `output` directory:
212
+
213
+ ```json
214
+ "mocha": {
215
+ "reporterOptions": {
216
+ "mochaFile": "output/result.xml"
217
+ }
218
+ },
219
+ ```
220
+
221
+ Execute CodeceptJS with JUnit reporter:
222
+
223
+ ```sh
224
+ codeceptjs run --reporter mocha-junit-reporter
225
+ ```
226
+
227
+ Result will be located at `output/result.xml` file.
228
+
229
+ ## Html
230
+
231
+ Best HTML reports could be produced with [mochawesome](https://www.npmjs.com/package/mochawesome) reporter.
232
+
233
+ ![mochawesome](/img/mochawesome.png)
234
+
235
+ Install it via NPM:
236
+
237
+ ```sh
238
+ npm i mochawesome
239
+ ```
240
+
241
+ If you get an error like this
242
+ ```sh
243
+ "mochawesome" reporter not found
244
+
245
+ invalid reporter "mochawesome"
246
+ ```
247
+
248
+ Make sure to have mocha installed or install it:
249
+
250
+ ```sh
251
+ npm i mocha -D
252
+ ```
253
+
254
+ Configure it to use `output` directory to print HTML reports:
255
+
256
+ ```json
257
+ "mocha": {
258
+ "reporterOptions": {
259
+ "reportDir": "output"
260
+ }
261
+ },
262
+ ```
263
+
264
+ Execute CodeceptJS with HTML reporter:
265
+
266
+ ```sh
267
+ codeceptjs run --reporter mochawesome
268
+ ```
269
+
270
+ Result will be located at `output/index.html` file.
271
+
272
+ ### Advanced usage
273
+
274
+ Want to have screenshots for failed tests?
275
+ Then add Mochawesome helper to your config:
276
+
277
+ ```json
278
+ "helpers": {
279
+ "Mochawesome": {
280
+ "uniqueScreenshotNames": "true"
281
+ }
282
+ },
283
+ ```
284
+
285
+ Then tests with failure will have screenshots.
286
+
287
+ ### Configuration
288
+
289
+ This helper should be configured in codecept.conf.ts
290
+
291
+ - `uniqueScreenshotNames` (optional, default: false) - option to prevent screenshot override if you have scenarios with the same name in different suites. This option should be the same as in common helper.
292
+ - `disableScreenshots` (optional, default: false) - don't save screenshot on failure. This option should be the same as in common helper.
293
+
294
+ Also if you will add Mochawesome helper, then you will able to add custom context in report:
295
+
296
+ #### addMochawesomeContext
297
+
298
+ Adds context to executed test in HTML report:
299
+
300
+ ```js
301
+ I.addMochawesomeContext('simple string');
302
+ I.addMochawesomeContext('http://www.url.com/pathname');
303
+ I.addMochawesomeContext('http://www.url.com/screenshot-maybe.jpg');
304
+ I.addMochawesomeContext({title: 'expected output',
305
+ value: {
306
+ a: 1,
307
+ b: '2',
308
+ c: 'd'
309
+ }
310
+ });
311
+ ```
312
+
313
+ ##### Parameters
314
+
315
+ - `context` string, url, path to screenshot, object. See [this](https://www.npmjs.com/package/mochawesome#adding-test-context)
316
+
317
+ ## Multi Reports
318
+
319
+ Want to use several reporters in the same time? Try to use [mocha-multi](https://www.npmjs.com/package/mocha-multi) reporter
320
+
321
+ Install it via NPM:
322
+
323
+ ```sh
324
+ npm i mocha-multi
325
+ ```
326
+
327
+ Configure mocha-multi with reports that you want:
328
+
329
+ ```json
330
+ "mocha": {
331
+ "reporterOptions": {
332
+ "codeceptjs-cli-reporter": {
333
+ "stdout": "-",
334
+ "options": {
335
+ "verbose": true,
336
+ "steps": true,
337
+ }
338
+ },
339
+ "mochawesome": {
340
+ "stdout": "./output/console.log",
341
+ "options": {
342
+ "reportDir": "./output",
343
+ "reportFilename": "report"
344
+ }
345
+ },
346
+ "mocha-junit-reporter": {
347
+ "stdout": "./output/console.log",
348
+ "options": {
349
+ "mochaFile": "./output/result.xml",
350
+ "attachments": true //add screenshot for a failed test
351
+ }
352
+ }
353
+ }
354
+ }
355
+ ```
356
+
357
+ Execute CodeceptJS with mocha-multi reporter:
358
+
359
+ ```sh
360
+ npx codeceptjs run --reporter mocha-multi
361
+ ```
362
+
363
+ This will give you cli with steps in console and HTML report in `output` directory.
364
+
365
+
366
+ ## Testrail
367
+
368
+ Testrail integration with CodeceptJS is now so seamless. The test run is created automatically afterwards. The screenshots of failed tests are also attached to test results.
369
+
370
+ Try to use [codeceptjs-testrail](https://www.npmjs.com/package/codeceptjs-testrail) plugin
371
+
372
+ Install it via NPM:
373
+
374
+ ```sh
375
+ npm i codeceptjs-testrail --save
376
+ ```
377
+
378
+ ![Attachemnt for failed case](http://g.recordit.co/ajaa2QRlnW.gif)
379
+
380
+ Now there is new feature, add the configuration to test run of test plan
381
+ ![Attachemnt for failed case](http://g.recordit.co/uQLvQUq7cT.gif)
382
+
383
+
384
+ ## Tesults
385
+
386
+ Submit test results data from CodeceptJS to [Tesults](https://www.tesults.com) easily with the [codeceptjs-tesults](https://www.npmjs.com/package/codeceptjs-tesults) plugin. Test results data is submitted automatically after a test run completes.
387
+
388
+ ```sh
389
+ npm i codeceptjs-tesults --save
390
+ ```
391
+
392
+ Once installed, follow the [quick and easy integration instructions](https://www.tesults.com/docs/codeceptjs) to get setup in no time.
@@ -0,0 +1,36 @@
1
+ # Secrets
2
+
3
+ It is possible to **mask out sensitive data** when passing it to steps. This is important when filling password fields, or sending secure keys to API endpoint.
4
+
5
+ Wrap data in `secret` function to mask sensitive values in output and logs.
6
+
7
+ For basic string `secret` just wrap a value into a string:
8
+
9
+ ```js
10
+ I.fillField('password', secret('123456'));
11
+ ```
12
+
13
+ When executed it will be printed like this:
14
+
15
+ ```
16
+ I fill field "password" "*****"
17
+ ```
18
+ **Other Examples**
19
+ ```js
20
+ I.fillField('password', secret('123456'));
21
+ I.append('password', secret('123456'));
22
+ I.type('password', secret('123456'));
23
+ ```
24
+
25
+ For an object, which can be a payload to POST request, specify which fields should be masked:
26
+
27
+ ```js
28
+ I.sendPostRequest('/login', secret({
29
+ name: 'davert',
30
+ password: '123456'
31
+ }, 'password'))
32
+ ```
33
+
34
+ The object created from `secret` is as Proxy to the object passed in. When printed password will be replaced with ****.
35
+
36
+ > ⚠️ Only direct properties of the object can be masked via `secret`
package/docs/shadow.md ADDED
@@ -0,0 +1,68 @@
1
+ ---
2
+ permalink: /shadow
3
+ title: Locating Shadow Dom Elements
4
+ ---
5
+
6
+ # Locating Shadow Dom Elements
7
+
8
+ > ℹ Shadow DOM locators is supported only in WebDriver helper
9
+
10
+ Shadow DOM is one of the key browser features that make up web components. Web components are a really great way to build reusable elements, and are able to scale all the way up to complete web applications. Style encapsulation, the feature that gives shadow DOM it's power, has been a bit of a pain when it comes to E2E or UI testing. Things just got a little easier though, as CodeceptJS introduced built-in support for shadow DOM via locators of type `shadow`. Let's dig into what they're all about.
11
+
12
+ Generated HTML code may often look like this (ref: [Salesforce's Lighting Web Components](https://github.com/salesforce/lwc)):
13
+
14
+ ```js
15
+ <body>
16
+ <my-app>
17
+ <recipe-hello>
18
+ <button>Click Me!</button>
19
+ </recipe-hello>
20
+ <recipe-hello-binding>
21
+ <ui-input>
22
+ <input type="text" class="input">
23
+ </ui-input>
24
+ </recipe-hello-binding>
25
+ </my-app>
26
+ </body>
27
+ ```
28
+
29
+ This uses custom elements, `my-app`, `recipe-hello`, `recipe-hello-binding` and `ui-input`. It's quite common that clickable elements are not actual `a` or `button` elements but custom elements. This way `I.click('Click Me!');` won't work, as well as `fillField('.input', 'value)`. Finding a correct locator for such cases turns to be almost impossible until `shadow` element support is added to CodeceptJS.
30
+
31
+ ## Locate Shadow Dom
32
+
33
+ For Web Components or [Salesforce's Lighting Web Components](https://github.com/salesforce/lwc) with Shadow DOM's, a special `shadow` locator is available. It allows to select an element by its shadow dom sequences and sequences are defined as an Array of `elements`. Elements defined in the array of `elements` must be in the ordered the shadow elements appear in the DOM.
34
+
35
+ ```js
36
+ { shadow: ['my-app', 'recipe-hello', 'button'] }
37
+ { shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }
38
+ ```
39
+
40
+ In WebDriver, you can use shadow locators in any method where locator is required.
41
+
42
+ For example, to fill value in `input` field or to click the `Click Me!` button, in above HTML code:
43
+
44
+ ```js
45
+ I.fillField({ shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }, 'value');
46
+ I.click({ shadow: ['my-app', 'recipe-hello', 'button'] });
47
+ ```
48
+
49
+ ## Example
50
+
51
+ ```js
52
+ Feature('Shadow Dom Locators');
53
+
54
+ Scenario('should fill input field within shadow elements', ({I}) => {
55
+
56
+ // navigate to LWC webpage containing shadow dom
57
+ I.amOnPage('https://recipes.lwc.dev/');
58
+
59
+ // click Click Me! button
60
+ I.click({ shadow: ['my-app', 'recipe-hello', 'button'] });
61
+
62
+ // fill the input field
63
+ I.fillField({ shadow: ['my-app', 'recipe-hello-binding', 'ui-input', 'input.input'] }, 'value');
64
+
65
+ });
66
+
67
+
68
+ ```
@@ -0,0 +1,31 @@
1
+ [Valid key names](https://w3c.github.io/webdriver/#keyboard-actions) are:
2
+
3
+ - `'Add'`,
4
+ - `'Alt'`,
5
+ - `'ArrowDown'` or `'Down arrow'`,
6
+ - `'ArrowLeft'` or `'Left arrow'`,
7
+ - `'ArrowRight'` or `'Right arrow'`,
8
+ - `'ArrowUp'` or `'Up arrow'`,
9
+ - `'Backspace'`,
10
+ - `'Command'`,
11
+ - `'Control'`,
12
+ - `'Del'`,
13
+ - `'Divide'`,
14
+ - `'End'`,
15
+ - `'Enter'`,
16
+ - `'Equals'`,
17
+ - `'Escape'`,
18
+ - `'F1 to F12'`,
19
+ - `'Home'`,
20
+ - `'Insert'`,
21
+ - `'Meta'`,
22
+ - `'Multiply'`,
23
+ - `'Numpad 0'` to `'Numpad 9'`,
24
+ - `'Pagedown'` or `'PageDown'`,
25
+ - `'Pageup'` or `'PageUp'`,
26
+ - `'Pause'`,
27
+ - `'Semicolon'`,
28
+ - `'Shift'`,
29
+ - `'Space'`,
30
+ - `'Subtract'`,
31
+ - `'Tab'`.
@@ -0,0 +1 @@
1
+ This action supports [React locators](https://codecept.io/react#locators)