codeceptjs 3.5.0 → 3.5.1-2.beta.7

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 (273) hide show
  1. package/README.md +24 -25
  2. package/lib/actor.js +6 -3
  3. package/lib/ai.js +12 -3
  4. package/lib/cli.js +12 -2
  5. package/lib/codecept.js +4 -0
  6. package/lib/colorUtils.js +10 -0
  7. package/lib/command/definitions.js +2 -7
  8. package/lib/command/dryRun.js +2 -1
  9. package/lib/command/info.js +24 -0
  10. package/lib/command/init.js +51 -5
  11. package/lib/command/run-multiple/collection.js +17 -5
  12. package/lib/command/run-multiple.js +4 -2
  13. package/lib/command/run-workers.js +66 -4
  14. package/lib/command/run.js +7 -0
  15. package/lib/command/workers/runTests.js +39 -0
  16. package/lib/data/context.js +14 -6
  17. package/lib/event.js +4 -0
  18. package/lib/helper/ApiDataFactory.js +2 -1
  19. package/lib/helper/Appium.js +73 -24
  20. package/lib/helper/Expect.js +422 -0
  21. package/lib/helper/FileSystem.js +1 -1
  22. package/lib/helper/GraphQL.js +25 -0
  23. package/lib/helper/Nightmare.js +9 -4
  24. package/lib/helper/OpenAI.js +14 -10
  25. package/lib/helper/Playwright.js +1205 -288
  26. package/lib/helper/Protractor.js +11 -6
  27. package/lib/helper/Puppeteer.js +173 -61
  28. package/lib/helper/TestCafe.js +44 -9
  29. package/lib/helper/WebDriver.js +231 -82
  30. package/lib/helper/errors/ElementNotFound.js +2 -1
  31. package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
  32. package/lib/helper/scripts/blurElement.js +17 -0
  33. package/lib/helper/scripts/focusElement.js +17 -0
  34. package/lib/helper/scripts/highlightElement.js +2 -2
  35. package/lib/html.js +3 -3
  36. package/lib/interfaces/bdd.js +1 -1
  37. package/lib/interfaces/gherkin.js +37 -3
  38. package/lib/interfaces/scenarioConfig.js +1 -0
  39. package/lib/locator.js +17 -4
  40. package/lib/mochaFactory.js +2 -1
  41. package/lib/output.js +1 -1
  42. package/lib/pause.js +12 -9
  43. package/lib/plugin/autoLogin.js +45 -10
  44. package/lib/plugin/heal.js +47 -17
  45. package/lib/plugin/retryFailedStep.js +10 -1
  46. package/lib/plugin/retryTo.js +2 -4
  47. package/lib/plugin/selenoid.js +6 -1
  48. package/lib/plugin/standardActingHelpers.js +0 -2
  49. package/lib/plugin/stepByStepReport.js +2 -2
  50. package/lib/plugin/tryTo.js +5 -7
  51. package/lib/plugin/wdio.js +0 -1
  52. package/lib/recorder.js +20 -9
  53. package/lib/session.js +1 -1
  54. package/lib/step.js +30 -11
  55. package/lib/ui.js +1 -0
  56. package/lib/utils.js +18 -1
  57. package/lib/workers.js +28 -3
  58. package/package.json +108 -98
  59. package/translations/de-DE.js +5 -0
  60. package/translations/fr-FR.js +14 -1
  61. package/translations/it-IT.js +1 -0
  62. package/translations/ja-JP.js +5 -0
  63. package/translations/pl-PL.js +5 -0
  64. package/translations/pt-BR.js +1 -0
  65. package/translations/ru-RU.js +1 -0
  66. package/translations/zh-CN.js +5 -0
  67. package/translations/zh-TW.js +5 -0
  68. package/typings/index.d.ts +8 -6
  69. package/typings/promiseBasedTypes.d.ts +784 -822
  70. package/typings/types.d.ts +1214 -727
  71. package/CHANGELOG.md +0 -2492
  72. package/docs/advanced.md +0 -351
  73. package/docs/ai.md +0 -246
  74. package/docs/api.md +0 -323
  75. package/docs/basics.md +0 -980
  76. package/docs/bdd.md +0 -535
  77. package/docs/best.md +0 -237
  78. package/docs/books.md +0 -37
  79. package/docs/bootstrap.md +0 -135
  80. package/docs/build/ApiDataFactory.js +0 -409
  81. package/docs/build/Appium.js +0 -1978
  82. package/docs/build/FileSystem.js +0 -228
  83. package/docs/build/GraphQL.js +0 -204
  84. package/docs/build/GraphQLDataFactory.js +0 -309
  85. package/docs/build/JSONResponse.js +0 -338
  86. package/docs/build/Mochawesome.js +0 -71
  87. package/docs/build/Nightmare.js +0 -2147
  88. package/docs/build/OpenAI.js +0 -122
  89. package/docs/build/Playwright.js +0 -4134
  90. package/docs/build/Polly.js +0 -42
  91. package/docs/build/Protractor.js +0 -2701
  92. package/docs/build/Puppeteer.js +0 -3743
  93. package/docs/build/REST.js +0 -344
  94. package/docs/build/SeleniumWebdriver.js +0 -76
  95. package/docs/build/TestCafe.js +0 -2059
  96. package/docs/build/WebDriver.js +0 -4042
  97. package/docs/changelog.md +0 -2501
  98. package/docs/commands.md +0 -254
  99. package/docs/community-helpers.md +0 -58
  100. package/docs/configuration.md +0 -157
  101. package/docs/continuous-integration.md +0 -22
  102. package/docs/custom-helpers.md +0 -306
  103. package/docs/data.md +0 -375
  104. package/docs/detox.md +0 -235
  105. package/docs/docker.md +0 -137
  106. package/docs/email.md +0 -183
  107. package/docs/examples.md +0 -149
  108. package/docs/helpers/ApiDataFactory.md +0 -266
  109. package/docs/helpers/Appium.md +0 -1317
  110. package/docs/helpers/Detox.md +0 -586
  111. package/docs/helpers/FileSystem.md +0 -152
  112. package/docs/helpers/GraphQL.md +0 -130
  113. package/docs/helpers/GraphQLDataFactory.md +0 -226
  114. package/docs/helpers/JSONResponse.md +0 -254
  115. package/docs/helpers/Mochawesome.md +0 -8
  116. package/docs/helpers/MockRequest.md +0 -377
  117. package/docs/helpers/Nightmare.md +0 -1258
  118. package/docs/helpers/OpenAI.md +0 -70
  119. package/docs/helpers/Playwright.md +0 -2250
  120. package/docs/helpers/Polly.md +0 -44
  121. package/docs/helpers/Puppeteer-firefox.md +0 -86
  122. package/docs/helpers/Puppeteer.md +0 -2147
  123. package/docs/helpers/REST.md +0 -218
  124. package/docs/helpers/TestCafe.md +0 -1224
  125. package/docs/helpers/WebDriver.md +0 -2325
  126. package/docs/hooks.md +0 -340
  127. package/docs/index.md +0 -111
  128. package/docs/installation.md +0 -75
  129. package/docs/internal-api.md +0 -265
  130. package/docs/locators.md +0 -331
  131. package/docs/mobile-react-native-locators.md +0 -67
  132. package/docs/mobile.md +0 -344
  133. package/docs/nightmare.md +0 -223
  134. package/docs/pageobjects.md +0 -291
  135. package/docs/parallel.md +0 -288
  136. package/docs/playwright.md +0 -609
  137. package/docs/plugins.md +0 -1225
  138. package/docs/puppeteer.md +0 -316
  139. package/docs/quickstart.md +0 -163
  140. package/docs/react.md +0 -69
  141. package/docs/reports.md +0 -392
  142. package/docs/secrets.md +0 -36
  143. package/docs/shadow.md +0 -68
  144. package/docs/shared/keys.mustache +0 -31
  145. package/docs/shared/react.mustache +0 -1
  146. package/docs/testcafe.md +0 -174
  147. package/docs/translation.md +0 -247
  148. package/docs/tutorial.md +0 -271
  149. package/docs/typescript.md +0 -180
  150. package/docs/ui.md +0 -59
  151. package/docs/videos.md +0 -28
  152. package/docs/visual.md +0 -202
  153. package/docs/vue.md +0 -121
  154. package/docs/webapi/amOnPage.mustache +0 -11
  155. package/docs/webapi/appendField.mustache +0 -11
  156. package/docs/webapi/attachFile.mustache +0 -12
  157. package/docs/webapi/checkOption.mustache +0 -13
  158. package/docs/webapi/clearCookie.mustache +0 -10
  159. package/docs/webapi/clearField.mustache +0 -9
  160. package/docs/webapi/click.mustache +0 -25
  161. package/docs/webapi/clickLink.mustache +0 -8
  162. package/docs/webapi/closeCurrentTab.mustache +0 -7
  163. package/docs/webapi/closeOtherTabs.mustache +0 -8
  164. package/docs/webapi/dontSee.mustache +0 -11
  165. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +0 -10
  166. package/docs/webapi/dontSeeCookie.mustache +0 -8
  167. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +0 -10
  168. package/docs/webapi/dontSeeElement.mustache +0 -8
  169. package/docs/webapi/dontSeeElementInDOM.mustache +0 -8
  170. package/docs/webapi/dontSeeInCurrentUrl.mustache +0 -4
  171. package/docs/webapi/dontSeeInField.mustache +0 -11
  172. package/docs/webapi/dontSeeInSource.mustache +0 -8
  173. package/docs/webapi/dontSeeInTitle.mustache +0 -8
  174. package/docs/webapi/doubleClick.mustache +0 -13
  175. package/docs/webapi/downloadFile.mustache +0 -12
  176. package/docs/webapi/dragAndDrop.mustache +0 -9
  177. package/docs/webapi/dragSlider.mustache +0 -11
  178. package/docs/webapi/executeAsyncScript.mustache +0 -24
  179. package/docs/webapi/executeScript.mustache +0 -26
  180. package/docs/webapi/fillField.mustache +0 -16
  181. package/docs/webapi/forceClick.mustache +0 -28
  182. package/docs/webapi/forceRightClick.mustache +0 -18
  183. package/docs/webapi/grabAllWindowHandles.mustache +0 -7
  184. package/docs/webapi/grabAttributeFrom.mustache +0 -10
  185. package/docs/webapi/grabAttributeFromAll.mustache +0 -9
  186. package/docs/webapi/grabBrowserLogs.mustache +0 -9
  187. package/docs/webapi/grabCookie.mustache +0 -11
  188. package/docs/webapi/grabCssPropertyFrom.mustache +0 -11
  189. package/docs/webapi/grabCssPropertyFromAll.mustache +0 -10
  190. package/docs/webapi/grabCurrentUrl.mustache +0 -9
  191. package/docs/webapi/grabCurrentWindowHandle.mustache +0 -6
  192. package/docs/webapi/grabDataFromPerformanceTiming.mustache +0 -20
  193. package/docs/webapi/grabElementBoundingRect.mustache +0 -20
  194. package/docs/webapi/grabGeoLocation.mustache +0 -8
  195. package/docs/webapi/grabHTMLFrom.mustache +0 -10
  196. package/docs/webapi/grabHTMLFromAll.mustache +0 -9
  197. package/docs/webapi/grabNumberOfOpenTabs.mustache +0 -8
  198. package/docs/webapi/grabNumberOfVisibleElements.mustache +0 -9
  199. package/docs/webapi/grabPageScrollPosition.mustache +0 -8
  200. package/docs/webapi/grabPopupText.mustache +0 -5
  201. package/docs/webapi/grabSource.mustache +0 -8
  202. package/docs/webapi/grabTextFrom.mustache +0 -10
  203. package/docs/webapi/grabTextFromAll.mustache +0 -9
  204. package/docs/webapi/grabTitle.mustache +0 -8
  205. package/docs/webapi/grabValueFrom.mustache +0 -9
  206. package/docs/webapi/grabValueFromAll.mustache +0 -8
  207. package/docs/webapi/moveCursorTo.mustache +0 -12
  208. package/docs/webapi/openNewTab.mustache +0 -7
  209. package/docs/webapi/pressKey.mustache +0 -12
  210. package/docs/webapi/pressKeyDown.mustache +0 -12
  211. package/docs/webapi/pressKeyUp.mustache +0 -12
  212. package/docs/webapi/pressKeyWithKeyNormalization.mustache +0 -60
  213. package/docs/webapi/refreshPage.mustache +0 -6
  214. package/docs/webapi/resizeWindow.mustache +0 -6
  215. package/docs/webapi/rightClick.mustache +0 -14
  216. package/docs/webapi/saveElementScreenshot.mustache +0 -10
  217. package/docs/webapi/saveScreenshot.mustache +0 -12
  218. package/docs/webapi/say.mustache +0 -10
  219. package/docs/webapi/scrollIntoView.mustache +0 -11
  220. package/docs/webapi/scrollPageToBottom.mustache +0 -6
  221. package/docs/webapi/scrollPageToTop.mustache +0 -6
  222. package/docs/webapi/scrollTo.mustache +0 -12
  223. package/docs/webapi/see.mustache +0 -11
  224. package/docs/webapi/seeAttributesOnElements.mustache +0 -9
  225. package/docs/webapi/seeCheckboxIsChecked.mustache +0 -10
  226. package/docs/webapi/seeCookie.mustache +0 -8
  227. package/docs/webapi/seeCssPropertiesOnElements.mustache +0 -9
  228. package/docs/webapi/seeCurrentUrlEquals.mustache +0 -11
  229. package/docs/webapi/seeElement.mustache +0 -8
  230. package/docs/webapi/seeElementInDOM.mustache +0 -8
  231. package/docs/webapi/seeInCurrentUrl.mustache +0 -8
  232. package/docs/webapi/seeInField.mustache +0 -12
  233. package/docs/webapi/seeInPopup.mustache +0 -8
  234. package/docs/webapi/seeInSource.mustache +0 -7
  235. package/docs/webapi/seeInTitle.mustache +0 -8
  236. package/docs/webapi/seeNumberOfElements.mustache +0 -11
  237. package/docs/webapi/seeNumberOfVisibleElements.mustache +0 -10
  238. package/docs/webapi/seeTextEquals.mustache +0 -9
  239. package/docs/webapi/seeTitleEquals.mustache +0 -8
  240. package/docs/webapi/selectOption.mustache +0 -21
  241. package/docs/webapi/setCookie.mustache +0 -16
  242. package/docs/webapi/setGeoLocation.mustache +0 -12
  243. package/docs/webapi/switchTo.mustache +0 -9
  244. package/docs/webapi/switchToNextTab.mustache +0 -10
  245. package/docs/webapi/switchToPreviousTab.mustache +0 -10
  246. package/docs/webapi/type.mustache +0 -21
  247. package/docs/webapi/uncheckOption.mustache +0 -13
  248. package/docs/webapi/wait.mustache +0 -8
  249. package/docs/webapi/waitForClickable.mustache +0 -11
  250. package/docs/webapi/waitForDetached.mustache +0 -10
  251. package/docs/webapi/waitForElement.mustache +0 -11
  252. package/docs/webapi/waitForEnabled.mustache +0 -6
  253. package/docs/webapi/waitForFunction.mustache +0 -17
  254. package/docs/webapi/waitForInvisible.mustache +0 -10
  255. package/docs/webapi/waitForText.mustache +0 -13
  256. package/docs/webapi/waitForValue.mustache +0 -10
  257. package/docs/webapi/waitForVisible.mustache +0 -10
  258. package/docs/webapi/waitInUrl.mustache +0 -9
  259. package/docs/webapi/waitNumberOfVisibleElements.mustache +0 -10
  260. package/docs/webapi/waitToHide.mustache +0 -10
  261. package/docs/webapi/waitUrlEquals.mustache +0 -10
  262. package/docs/webdriver.md +0 -657
  263. package/docs/wiki/Books-&-Posts.md +0 -27
  264. package/docs/wiki/Community-Helpers-&-Plugins.md +0 -49
  265. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -29
  266. package/docs/wiki/Examples.md +0 -139
  267. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
  268. package/docs/wiki/Home.md +0 -16
  269. package/docs/wiki/Release-Process.md +0 -24
  270. package/docs/wiki/Roadmap.md +0 -23
  271. package/docs/wiki/Tests.md +0 -1393
  272. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
  273. package/docs/wiki/Videos.md +0 -19
package/docs/plugins.md DELETED
@@ -1,1225 +0,0 @@
1
- ---
2
- permalink: plugins
3
- sidebarDepth:
4
- sidebar: auto
5
- title: Plugins
6
- ---
7
-
8
- <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
9
-
10
- ## autoDelay
11
-
12
- Sometimes it takes some time for a page to respond to user's actions.
13
- Depending on app's performance this can be either slow or fast.
14
-
15
- For instance, if you click a button and nothing happens - probably JS event is not attached to this button yet
16
- Also, if you fill field and input validation doesn't accept your input - maybe because you typed value too fast.
17
-
18
- This plugin allows to slow down tests execution when a test running too fast.
19
- It puts a tiny delay for before and after action commands.
20
-
21
- Commands affected (by default):
22
-
23
- - `click`
24
- - `fillField`
25
- - `checkOption`
26
- - `pressKey`
27
- - `doubleClick`
28
- - `rightClick`
29
-
30
- #### Configuration
31
-
32
- ```js
33
- plugins: {
34
- autoDelay: {
35
- enabled: true
36
- }
37
- }
38
- ```
39
-
40
- Possible config options:
41
-
42
- - `methods`: list of affected commands. Can be overridden
43
- - `delayBefore`: put a delay before a command. 100ms by default
44
- - `delayAfter`: put a delay after a command. 200ms by default
45
-
46
- ### Parameters
47
-
48
- - `config`
49
-
50
- ## autoLogin
51
-
52
- Logs user in for the first test and reuses session for next tests.
53
- Works by saving cookies into memory or file.
54
- If a session expires automatically logs in again.
55
-
56
- > For better development experience cookies can be saved into file, so a session can be reused while writing tests.
57
-
58
- #### Usage
59
-
60
- 1. Enable this plugin and configure as described below
61
- 2. Define user session names (example: `user`, `editor`, `admin`, etc).
62
- 3. Define how users are logged in and how to check that user is logged in
63
- 4. Use `login` object inside your tests to log in:
64
-
65
- ```js
66
- // inside a test file
67
- // use login to inject auto-login function
68
- Before(({ login }) => {
69
- login('user'); // login using user session
70
- });
71
-
72
- // Alternatively log in for one scenario
73
- Scenario('log me in', ( {I, login} ) => {
74
- login('admin');
75
- I.see('I am logged in');
76
- });
77
- ```
78
-
79
- #### Configuration
80
-
81
- - `saveToFile` (default: false) - save cookies to file. Allows to reuse session between execution.
82
- - `inject` (default: `login`) - name of the login function to use
83
- - `users` - an array containing different session names and functions to:
84
- - `login` - sign in into the system
85
- - `check` - check that user is logged in
86
- - `fetch` - to get current cookies (by default `I.grabCookie()`)
87
- - `restore` - to set cookies (by default `I.amOnPage('/'); I.setCookie(cookie)`)
88
-
89
- #### How It Works
90
-
91
- 1. `restore` method is executed. It should open a page and set credentials.
92
- 2. `check` method is executed. It should reload a page (so cookies are applied) and check that this page belongs to logged in user.
93
- 3. If `restore` and `check` were not successful, `login` is executed
94
- 4. `login` should fill in login form
95
- 5. After successful login, `fetch` is executed to save cookies into memory or file.
96
-
97
- #### Example: Simple login
98
-
99
- ```js
100
- autoLogin: {
101
- enabled: true,
102
- saveToFile: true,
103
- inject: 'login',
104
- users: {
105
- admin: {
106
- // loginAdmin function is defined in `steps_file.js`
107
- login: (I) => I.loginAdmin(),
108
- // if we see `Admin` on page, we assume we are logged in
109
- check: (I) => {
110
- I.amOnPage('/');
111
- I.see('Admin');
112
- }
113
- }
114
- }
115
- }
116
- ```
117
-
118
- #### Example: Multiple users
119
-
120
- ```js
121
- autoLogin: {
122
- enabled: true,
123
- saveToFile: true,
124
- inject: 'loginAs', // use `loginAs` instead of login
125
- users: {
126
- user: {
127
- login: (I) => {
128
- I.amOnPage('/login');
129
- I.fillField('email', 'user@site.com');
130
- I.fillField('password', '123456');
131
- I.click('Login');
132
- },
133
- check: (I) => {
134
- I.amOnPage('/');
135
- I.see('User', '.navbar');
136
- },
137
- },
138
- admin: {
139
- login: (I) => {
140
- I.amOnPage('/login');
141
- I.fillField('email', 'admin@site.com');
142
- I.fillField('password', '123456');
143
- I.click('Login');
144
- },
145
- check: (I) => {
146
- I.amOnPage('/');
147
- I.see('Admin', '.navbar');
148
- },
149
- },
150
- }
151
- }
152
- ```
153
-
154
- #### Example: Keep cookies between tests
155
-
156
- If you decide to keep cookies between tests you don't need to save/retrieve cookies between tests.
157
- But you need to login once work until session expires.
158
- For this case, disable `fetch` and `restore` methods.
159
-
160
- ```js
161
- helpers: {
162
- WebDriver: {
163
- // config goes here
164
- keepCookies: true; // keep cookies for all tests
165
- }
166
- },
167
- plugins: {
168
- autoLogin: {
169
- users: {
170
- admin: {
171
- login: (I) => {
172
- I.amOnPage('/login');
173
- I.fillField('email', 'admin@site.com');
174
- I.fillField('password', '123456');
175
- I.click('Login');
176
- },
177
- check: (I) => {
178
- I.amOnPage('/dashboard');
179
- I.see('Admin', '.navbar');
180
- },
181
- fetch: () => {}, // empty function
182
- restore: () => {}, // empty funciton
183
- }
184
- }
185
- }
186
- }
187
- ```
188
-
189
- #### Example: Getting sessions from local storage
190
-
191
- If your session is stored in local storage instead of cookies you still can obtain sessions.
192
-
193
- ```js
194
- plugins: {
195
- autoLogin: {
196
- admin: {
197
- login: (I) => I.loginAsAdmin(),
198
- check: (I) => I.see('Admin', '.navbar'),
199
- fetch: (I) => {
200
- return I.executeScript(() => localStorage.getItem('session_id'));
201
- },
202
- restore: (I, session) => {
203
- I.amOnPage('/');
204
- I.executeScript((session) => localStorage.setItem('session_id', session), session);
205
- },
206
- }
207
- }
208
- }
209
- ```
210
-
211
- #### Tips: Using async function in the autoLogin
212
-
213
- If you use async functions in the autoLogin plugin, login function should be used with `await` keyword.
214
-
215
- ```js
216
- autoLogin: {
217
- enabled: true,
218
- saveToFile: true,
219
- inject: 'login',
220
- users: {
221
- admin: {
222
- login: async (I) => { // If you use async function in the autoLogin plugin
223
- const phrase = await I.grabTextFrom('#phrase')
224
- I.fillField('username', 'admin'),
225
- I.fillField('password', 'password')
226
- I.fillField('phrase', phrase)
227
- },
228
- check: (I) => {
229
- I.amOnPage('/');
230
- I.see('Admin');
231
- },
232
- }
233
- }
234
- }
235
- ```
236
-
237
- ```js
238
- Scenario('login', async ( {I, login} ) => {
239
- await login('admin') // you should use `await`
240
- })
241
- ```
242
-
243
- ### Parameters
244
-
245
- - `config`
246
-
247
- ## commentStep
248
-
249
- Add descriptive nested steps for your tests:
250
-
251
- ```js
252
- Scenario('project update test', async (I) => {
253
- __`Given`;
254
- const projectId = await I.have('project');
255
-
256
- __`When`;
257
- projectPage.update(projectId, { title: 'new title' });
258
-
259
- __`Then`;
260
- projectPage.open(projectId);
261
- I.see('new title', 'h1');
262
- })
263
- ```
264
-
265
- Steps prefixed with `__` will be printed as nested steps in `--steps` output:
266
-
267
- Given
268
- I have "project"
269
- When
270
- projectPage update
271
- Then
272
- projectPage open
273
- I see "new title", "h1"
274
-
275
- Also those steps will be exported to allure reports.
276
-
277
- This plugin can be used
278
-
279
- ### Config
280
-
281
- - `enabled` - (default: false) enable a plugin
282
- - `registerGlobal` - (default: false) register `__` template literal function globally. You can override function global name by providing a name as a value.
283
-
284
- ### Examples
285
-
286
- Registering `__` globally:
287
-
288
- ```js
289
- plugins: {
290
- commentStep: {
291
- enabled: true,
292
- registerGlobal: true
293
- }
294
- }
295
- ```
296
-
297
- Registering `Step` globally:
298
-
299
- ```js
300
- plugins: {
301
- commentStep: {
302
- enabled: true,
303
- registerGlobal: 'Step'
304
- }
305
- }
306
- ```
307
-
308
- Using only local function names:
309
-
310
- ```js
311
- plugins: {
312
- commentStep: {
313
- enabled: true
314
- }
315
- }
316
- ```
317
-
318
- Then inside a test import a comment function from a plugin.
319
- For instance, you can prepare Given/When/Then functions to use them inside tests:
320
-
321
- ```js
322
- // inside a test
323
- const step = codeceptjs.container.plugins('commentStep');
324
-
325
- const Given = () => step`Given`;
326
- const When = () => step`When`;
327
- const Then = () => step`Then`;
328
- ```
329
-
330
- Scenario('project update test', async (I) => {
331
- Given();
332
- const projectId = await I.have('project');
333
-
334
- When();
335
- projectPage.update(projectId, { title: 'new title' });
336
-
337
- Then();
338
- projectPage.open(projectId);
339
- I.see('new title', 'h1');
340
- });
341
-
342
- ```
343
-
344
- ```
345
-
346
- ### Parameters
347
-
348
- - `config`
349
-
350
- ## coverage
351
-
352
- Dumps code coverage from Playwright/Puppeteer after every test.
353
-
354
- #### Configuration
355
-
356
- ```js
357
- plugins: {
358
- coverage: {
359
- enabled: true
360
- }
361
- }
362
- ```
363
-
364
- Possible config options:
365
-
366
- - `coverageDir`: directory to dump coverage files
367
- - `uniqueFileName`: generate a unique filename by adding uuid
368
-
369
- ### Parameters
370
-
371
- - `config`
372
-
373
- ## customLocator
374
-
375
- Creates a [custom locator][1] by using special attributes in HTML.
376
-
377
- If you have a convention to use `data-test-id` or `data-qa` attributes to mark active elements for e2e tests,
378
- you can enable this plugin to simplify matching elements with these attributes:
379
-
380
- ```js
381
- // replace this:
382
- I.click({ css: '[data-test-id=register_button]');
383
- // with this:
384
- I.click('$register_button');
385
- ```
386
-
387
- This plugin will create a valid XPath locator for you.
388
-
389
- #### Configuration
390
-
391
- - `enabled` (default: `false`) should a locator be enabled
392
- - `prefix` (default: `$`) sets a prefix for a custom locator.
393
- - `attribute` (default: `data-test-id`) to set an attribute to be matched.
394
- - `strategy` (default: `xpath`) actual locator strategy to use in query (`css` or `xpath`).
395
- - `showActual` (default: false) show in the output actually produced XPath or CSS locator. By default shows custom locator value.
396
-
397
- #### Examples:
398
-
399
- Using `data-test` attribute with `$` prefix:
400
-
401
- ```js
402
- // in codecept.conf.js
403
- plugins: {
404
- customLocator: {
405
- enabled: true,
406
- attribute: 'data-test'
407
- }
408
- }
409
- ```
410
-
411
- In a test:
412
-
413
- ```js
414
- I.seeElement('$user'); // matches => [data-test=user]
415
- I.click('$sign-up'); // matches => [data-test=sign-up]
416
- ```
417
-
418
- Using `data-qa` attribute with `=` prefix:
419
-
420
- ```js
421
- // in codecept.conf.js
422
- plugins: {
423
- customLocator: {
424
- enabled: true,
425
- prefix: '=',
426
- attribute: 'data-qa'
427
- }
428
- }
429
- ```
430
-
431
- In a test:
432
-
433
- ```js
434
- I.seeElement('=user'); // matches => [data-qa=user]
435
- I.click('=sign-up'); // matches => [data-qa=sign-up]
436
- ```
437
-
438
- Using `data-qa` OR `data-test` attribute with `=` prefix:
439
-
440
- ```js
441
- // in codecept.conf.js
442
- plugins: {
443
- customLocator: {
444
- enabled: true,
445
- prefix: '=',
446
- attribute: ['data-qa', 'data-test'],
447
- strategy: 'xpath'
448
- }
449
- }
450
- ```
451
-
452
- In a test:
453
-
454
- ```js
455
- I.seeElement('=user'); // matches => //*[@data-qa=user or @data-test=user]
456
- I.click('=sign-up'); // matches => //*[data-qa=sign-up or @data-test=sign-up]
457
- ```
458
-
459
- ```js
460
- // in codecept.conf.js
461
- plugins: {
462
- customLocator: {
463
- enabled: true,
464
- prefix: '=',
465
- attribute: ['data-qa', 'data-test'],
466
- strategy: 'css'
467
- }
468
- }
469
- ```
470
-
471
- In a test:
472
-
473
- ```js
474
- I.seeElement('=user'); // matches => [data-qa=user],[data-test=user]
475
- I.click('=sign-up'); // matches => [data-qa=sign-up],[data-test=sign-up]
476
- ```
477
-
478
- ### Parameters
479
-
480
- - `config`
481
-
482
- ## debugErrors
483
-
484
- Prints errors found in HTML code after each failed test.
485
-
486
- It scans HTML and searches for elements with error classes.
487
- If an element found prints a text from it to console and adds as artifact to the test.
488
-
489
- Enable this plugin in config:
490
-
491
- ```js
492
- plugins: {
493
- debugErrors: {
494
- enabled: true,
495
- }
496
- ```
497
-
498
- Additional config options:
499
-
500
- - `errorClasses` - list of classes to search for errors (default: `['error', 'warning', 'alert', 'danger']`)
501
-
502
- ### Parameters
503
-
504
- - `config` (optional, default `{}`)
505
-
506
- ## eachElement
507
-
508
- Provides `eachElement` global function to iterate over found elements to perform actions on them.
509
-
510
- `eachElement` takes following args:
511
-
512
- - `purpose` - the goal of an action. A comment text that will be displayed in output.
513
- - `locator` - a CSS/XPath locator to match elements
514
- - `fn(element, index)` - **asynchronous** function which will be executed for each matched element.
515
-
516
- Example of usage:
517
-
518
- ```js
519
- // this example works with Playwright and Puppeteer helper
520
- await eachElement('click all checkboxes', 'form input[type=checkbox]', async (el) => {
521
- await el.click();
522
- });
523
- ```
524
-
525
- Click odd elements:
526
-
527
- ```js
528
- // this example works with Playwright and Puppeteer helper
529
- await eachElement('click odd buttons', '.button-select', async (el, index) => {
530
- if (index % 2) await el.click();
531
- });
532
- ```
533
-
534
- Check all elements for visibility:
535
-
536
- ```js
537
- // this example works with Playwright and Puppeteer helper
538
- const assert = require('assert');
539
- await eachElement('check all items are visible', '.item', async (el) => {
540
- assert(await el.isVisible());
541
- });
542
- ```
543
-
544
- This method works with WebDriver, Playwright, Puppeteer, Appium helpers.
545
-
546
- Function parameter `el` represents a matched element.
547
- Depending on a helper API of `el` can be different. Refer to API of corresponding browser testing engine for a complete API list:
548
-
549
- - [Playwright ElementHandle][2]
550
- - [Puppeteer][3]
551
- - [webdriverio element][4]
552
-
553
- #### Configuration
554
-
555
- - `registerGlobal` - to register `eachElement` function globally, true by default
556
-
557
- If `registerGlobal` is false you can use eachElement from the plugin:
558
-
559
- ```js
560
- const eachElement = codeceptjs.container.plugins('eachElement');
561
- ```
562
-
563
- ### Parameters
564
-
565
- - `purpose` **[string][5]**
566
- - `locator` **CodeceptJS.LocatorOrString**
567
- - `fn` **[Function][6]**
568
-
569
- Returns **([Promise][7]&lt;any> | [undefined][8])**
570
-
571
- ## fakerTransform
572
-
573
- Use the `@faker-js/faker` package to generate fake data inside examples on your gherkin tests
574
-
575
- #### Usage
576
-
577
- To start please install `@faker-js/faker` package
578
-
579
- npm install -D @faker-js/faker
580
-
581
- yarn add -D @faker-js/faker
582
-
583
- Add this plugin to config file:
584
-
585
- ```js
586
- plugins: {
587
- fakerTransform: {
588
- enabled: true
589
- }
590
- }
591
- ```
592
-
593
- Add the faker API using a mustache string format inside examples tables in your gherkin scenario outline
594
-
595
- ```feature
596
- Scenario Outline: ...
597
- Given ...
598
- When ...
599
- Then ...
600
- Examples:
601
- | productName | customer | email | anythingMore |
602
- | {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData |
603
- ```
604
-
605
- ### Parameters
606
-
607
- - `config`
608
-
609
- ## heal
610
-
611
- Self-healing tests with OpenAI.
612
-
613
- This plugin is experimental and requires OpenAI API key.
614
-
615
- To use it you need to set OPENAI_API_KEY env variable and enable plugin inside condig.
616
-
617
- ```js
618
- plugins: {
619
- heal: {
620
- enabled: true,
621
- }
622
- }
623
- ```
624
-
625
- More config options are available:
626
-
627
- - `healLimit` - how many steps can be healed in a single test (default: 2)
628
- - `healSteps` - which steps can be healed (default: all steps that interact with UI, see list below)
629
-
630
- Steps to heal:
631
-
632
- - `click`
633
- - `fillField`
634
- - `appendField`
635
- - `selectOption`
636
- - `attachFile`
637
- - `checkOption`
638
- - `uncheckOption`
639
- - `doubleClick`
640
-
641
- ### Parameters
642
-
643
- - `config` (optional, default `{}`)
644
-
645
- ## pauseOnFail
646
-
647
- Automatically launches [interactive pause][9] when a test fails.
648
-
649
- Useful for debugging flaky tests on local environment.
650
- Add this plugin to config file:
651
-
652
- ```js
653
- plugins: {
654
- pauseOnFail: {},
655
- }
656
- ```
657
-
658
- Unlike other plugins, `pauseOnFail` is not recommended to be enabled by default.
659
- Enable it manually on each run via `-p` option:
660
-
661
- npx codeceptjs run -p pauseOnFail
662
-
663
- ## retryFailedStep
664
-
665
- Retries each failed step in a test.
666
-
667
- Add this plugin to config file:
668
-
669
- ```js
670
- plugins: {
671
- retryFailedStep: {
672
- enabled: true
673
- }
674
- }
675
- ```
676
-
677
- Run tests with plugin enabled:
678
-
679
- npx codeceptjs run --plugins retryFailedStep
680
-
681
- #### Configuration:
682
-
683
- - `retries` - number of retries (by default 3),
684
- - `when` - function, when to perform a retry (accepts error as parameter)
685
- - `factor` - The exponential factor to use. Default is 1.5.
686
- - `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000.
687
- - `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity.
688
- - `randomize` - Randomizes the timeouts by multiplying with a factor between 1 to 2. Default is false.
689
- - `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes:
690
- - `amOnPage`
691
- - `wait*`
692
- - `send*`
693
- - `execute*`
694
- - `run*`
695
- - `have*`
696
- - `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list.
697
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
698
- To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well.
699
-
700
- #### Example
701
-
702
- ```js
703
- plugins: {
704
- retryFailedStep: {
705
- enabled: true,
706
- ignoredSteps: [
707
- 'scroll*', // ignore all scroll steps
708
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
709
- ]
710
- }
711
- }
712
- ```
713
-
714
- #### Disable Per Test
715
-
716
- This plugin can be disabled per test. In this case you will need to stet `I.retry()` to all flaky steps:
717
-
718
- Use scenario configuration to disable plugin for a test
719
-
720
- ```js
721
- Scenario('scenario tite', () => {
722
- // test goes here
723
- }).config(test => test.disableRetryFailedStep = true)
724
- ```
725
-
726
- ### Parameters
727
-
728
- - `config`
729
-
730
- ## retryTo
731
-
732
- Adds global `retryTo` which retries steps a few times before failing.
733
-
734
- Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
735
-
736
- ```js
737
- plugins: {
738
- retryTo: {
739
- enabled: true
740
- }
741
- }
742
- ```
743
-
744
- Use it in your tests:
745
-
746
- ```js
747
- // retry these steps 5 times before failing
748
- await retryTo((tryNum) => {
749
- I.switchTo('#editor frame');
750
- I.click('Open');
751
- I.see('Opened')
752
- }, 5);
753
- ```
754
-
755
- Set polling interval as 3rd argument (200ms by default):
756
-
757
- ```js
758
- // retry these steps 5 times before failing
759
- await retryTo((tryNum) => {
760
- I.switchTo('#editor frame');
761
- I.click('Open');
762
- I.see('Opened')
763
- }, 5, 100);
764
- ```
765
-
766
- Default polling interval can be changed in a config:
767
-
768
- ```js
769
- plugins: {
770
- retryTo: {
771
- enabled: true,
772
- pollInterval: 500,
773
- }
774
- }
775
- ```
776
-
777
- Disables retryFailedStep plugin for steps inside a block;
778
-
779
- Use this plugin if:
780
-
781
- - you need repeat a set of actions in flaky tests
782
- - iframe was not rendered and you need to retry switching to it
783
-
784
- #### Configuration
785
-
786
- - `pollInterval` - default interval between retries in ms. 200 by default.
787
- - `registerGlobal` - to register `retryTo` function globally, true by default
788
-
789
- If `registerGlobal` is false you can use retryTo from the plugin:
790
-
791
- ```js
792
- const retryTo = codeceptjs.container.plugins('retryTo');
793
- ```
794
-
795
- ### Parameters
796
-
797
- - `config`
798
-
799
- ## screenshotOnFail
800
-
801
- Creates screenshot on failure. Screenshot is saved into `output` directory.
802
-
803
- Initially this functionality was part of corresponding helper but has been moved into plugin since 1.4
804
-
805
- This plugin is **enabled by default**.
806
-
807
- #### Configuration
808
-
809
- Configuration can either be taken from a corresponding helper (deprecated) or a from plugin config (recommended).
810
-
811
- ```js
812
- plugins: {
813
- screenshotOnFail: {
814
- enabled: true
815
- }
816
- }
817
- ```
818
-
819
- Possible config options:
820
-
821
- - `uniqueScreenshotNames`: use unique names for screenshot. Default: false.
822
- - `fullPageScreenshots`: make full page screenshots. Default: false.
823
-
824
- ### Parameters
825
-
826
- - `config`
827
-
828
- ## selenoid
829
-
830
- [Selenoid][10] plugin automatically starts browsers and video recording.
831
- Works with WebDriver helper.
832
-
833
- ### Prerequisite
834
-
835
- This plugin **requires Docker** to be installed.
836
-
837
- > If you have issues starting Selenoid with this plugin consider using the official [Configuration Manager][11] tool from Selenoid
838
-
839
- ### Usage
840
-
841
- Selenoid plugin can be started in two ways:
842
-
843
- 1. **Automatic** - this plugin will create and manage selenoid container for you.
844
- 2. **Manual** - you create the conatainer and configure it with a plugin (recommended).
845
-
846
- #### Automatic
847
-
848
- If you are new to Selenoid and you want plug and play setup use automatic mode.
849
-
850
- Add plugin configuration in `codecept.conf.js`:
851
-
852
- ```js
853
- plugins: {
854
- selenoid: {
855
- enabled: true,
856
- deletePassed: true,
857
- autoCreate: true,
858
- autoStart: true,
859
- sessionTimeout: '30m',
860
- enableVideo: true,
861
- enableLog: true,
862
- },
863
- }
864
- ```
865
-
866
- When `autoCreate` is enabled it will pull the [latest Selenoid from DockerHub][12] and start Selenoid automatically.
867
- It will also create `browsers.json` file required by Selenoid.
868
-
869
- In automatic mode the latest version of browser will be used for tests. It is recommended to specify exact version of each browser inside `browsers.json` file.
870
-
871
- > **If you are using Windows machine or if `autoCreate` does not work properly, create container manually**
872
-
873
- #### Manual
874
-
875
- While this plugin can create containers for you for better control it is recommended to create and launch containers manually.
876
- This is especially useful for Continous Integration server as you can configure scaling for Selenoid containers.
877
-
878
- > Use [Selenoid Configuration Manager][11] to create and start containers semi-automatically.
879
-
880
- 1. Create `browsers.json` file in the same directory `codecept.conf.js` is located
881
- [Refer to Selenoid documentation][13] to know more about browsers.json.
882
-
883
- _Sample browsers.json_
884
-
885
- ```js
886
- {
887
- "chrome": {
888
- "default": "latest",
889
- "versions": {
890
- "latest": {
891
- "image": "selenoid/chrome:latest",
892
- "port": "4444",
893
- "path": "/"
894
- }
895
- }
896
- }
897
- }
898
- ```
899
-
900
- > It is recommended to use specific versions of browsers in `browsers.json` instead of latest. This will prevent tests fail when browsers will be updated.
901
-
902
- **⚠ At first launch selenoid plugin takes extra time to download all Docker images before tests starts**.
903
-
904
- 2. Create Selenoid container
905
-
906
- Run the following command to create a container. To know more [refer here][14]
907
-
908
- ```bash
909
- docker create \
910
- --name selenoid \
911
- -p 4444:4444 \
912
- -v /var/run/docker.sock:/var/run/docker.sock \
913
- -v `pwd`/:/etc/selenoid/:ro \
914
- -v `pwd`/output/video/:/opt/selenoid/video/ \
915
- -e OVERRIDE_VIDEO_OUTPUT_DIR=`pwd`/output/video/ \
916
- aerokube/selenoid:latest-release
917
- ```
918
-
919
- ### Video Recording
920
-
921
- This plugin allows to record and save video per each executed tests.
922
-
923
- When `enableVideo` is `true` this plugin saves video in `output/videos` directory with each test by name
924
- To save space videos for all succesful tests are deleted. This can be changed by `deletePassed` option.
925
-
926
- When `allure` plugin is enabled a video is attached to report automatically.
927
-
928
- ### Options:
929
-
930
- | Param | Description |
931
- | ---------------- | ------------------------------------------------------------------------------ |
932
- | name | Name of the container (default : selenoid) |
933
- | port | Port of selenium server (default : 4444) |
934
- | autoCreate | Will automatically create container (Linux only) (default : true) |
935
- | autoStart | If disabled start the container manually before running tests (default : true) |
936
- | enableVideo | Enable video recording and use `video` folder of output (default: false) |
937
- | enableLog | Enable log recording and use `logs` folder of output (default: false) |
938
- | deletePassed | Delete video and logs of passed tests (default : true) |
939
- | additionalParams | example: `additionalParams: '--env TEST=test'` [Refer here][15] to know more |
940
-
941
- ### Parameters
942
-
943
- - `config`
944
-
945
- ## stepByStepReport
946
-
947
- ![step-by-step-report][16]
948
-
949
- Generates step by step report for a test.
950
- After each step in a test a screenshot is created. After test executed screenshots are combined into slideshow.
951
- By default, reports are generated only for failed tests.
952
-
953
- Run tests with plugin enabled:
954
-
955
- npx codeceptjs run --plugins stepByStepReport
956
-
957
- #### Configuration
958
-
959
- ```js
960
- "plugins": {
961
- "stepByStepReport": {
962
- "enabled": true
963
- }
964
- }
965
- ```
966
-
967
- Possible config options:
968
-
969
- - `deleteSuccessful`: do not save screenshots for successfully executed tests. Default: true.
970
- - `animateSlides`: should animation for slides to be used. Default: true.
971
- - `ignoreSteps`: steps to ignore in report. Array of RegExps is expected. Recommended to skip `grab*` and `wait*` steps.
972
- - `fullPageScreenshots`: should full page screenshots be used. Default: false.
973
- - `output`: a directory where reports should be stored. Default: `output`.
974
- - `screenshotsForAllureReport`: If Allure plugin is enabled this plugin attaches each saved screenshot to allure report. Default: false.
975
- - \`disableScreenshotOnFail : Disables the capturing of screeshots after the failed step. Default: true.
976
-
977
- ### Parameters
978
-
979
- - `config` **any**
980
-
981
- ## stepTimeout
982
-
983
- Set timeout for test steps globally.
984
-
985
- Add this plugin to config file:
986
-
987
- ```js
988
- plugins: {
989
- stepTimeout: {
990
- enabled: true
991
- }
992
- }
993
- ```
994
-
995
- Run tests with plugin enabled:
996
-
997
- npx codeceptjs run --plugins stepTimeout
998
-
999
- #### Configuration:
1000
-
1001
- - `timeout` - global step timeout, default 150 seconds
1002
- - `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false
1003
- - `noTimeoutSteps` - an array of steps with no timeout. Default:
1004
-
1005
- - `amOnPage`
1006
- - `wait*`
1007
-
1008
- you could set your own noTimeoutSteps which would replace the default one.
1009
-
1010
- - `customTimeoutSteps` - an array of step actions with custom timeout. Use it to override or extend noTimeoutSteps.
1011
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
1012
-
1013
- #### Example
1014
-
1015
- ```js
1016
- plugins: {
1017
- stepTimeout: {
1018
- enabled: true,
1019
- overrideStepLimits: true,
1020
- noTimeoutSteps: [
1021
- 'scroll*', // ignore all scroll steps
1022
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
1023
- ],
1024
- customTimeoutSteps: [
1025
- ['myFlakyStep*', 1],
1026
- ['scrollWhichRequiresTimeout', 5],
1027
- ]
1028
- }
1029
- }
1030
- ```
1031
-
1032
- ### Parameters
1033
-
1034
- - `config`
1035
-
1036
- ## subtitles
1037
-
1038
- Automatically captures steps as subtitle, and saves it as an artifact when a video is found for a failed test
1039
-
1040
- #### Configuration
1041
-
1042
- ```js
1043
- plugins: {
1044
- subtitles: {
1045
- enabled: true
1046
- }
1047
- }
1048
- ```
1049
-
1050
- ## tryTo
1051
-
1052
- Adds global `tryTo` function inside of which all failed steps won't fail a test but will return true/false.
1053
-
1054
- Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
1055
-
1056
- ```js
1057
- plugins: {
1058
- tryTo: {
1059
- enabled: true
1060
- }
1061
- }
1062
- ```
1063
-
1064
- Use it in your tests:
1065
-
1066
- ```js
1067
- const result = await tryTo(() => I.see('Welcome'));
1068
-
1069
- // if text "Welcome" is on page, result => true
1070
- // if text "Welcome" is not on page, result => false
1071
- ```
1072
-
1073
- Disables retryFailedStep plugin for steps inside a block;
1074
-
1075
- Use this plugin if:
1076
-
1077
- - you need to perform multiple assertions inside a test
1078
- - there is A/B testing on a website you test
1079
- - there is "Accept Cookie" banner which may surprisingly appear on a page.
1080
-
1081
- #### Usage
1082
-
1083
- #### Multiple Conditional Assertions
1084
-
1085
- ````js
1086
- Add assert requires first:
1087
- ```js
1088
- const assert = require('assert');
1089
- ````
1090
-
1091
- Then use the assert:
1092
- const result1 = await tryTo(() => I.see('Hello, user'));
1093
- const result2 = await tryTo(() => I.seeElement('.welcome'));
1094
- assert.ok(result1 && result2, 'Assertions were not succesful');
1095
-
1096
- ##### Optional click
1097
-
1098
- ```js
1099
- I.amOnPage('/');
1100
- tryTo(() => I.click('Agree', '.cookies'));
1101
-
1102
- #### Configuration
1103
-
1104
- - `registerGlobal` - to register `tryTo` function globally, true by default
1105
-
1106
- If `registerGlobal` is false you can use tryTo from the plugin:
1107
-
1108
- ```js
1109
- const tryTo = codeceptjs.container.plugins('tryTo');
1110
- ```
1111
-
1112
- ### Parameters
1113
-
1114
- - `config`
1115
-
1116
- ## wdio
1117
-
1118
- Webdriverio services runner.
1119
-
1120
- This plugin allows to run webdriverio services like:
1121
-
1122
- - selenium-standalone
1123
- - sauce
1124
- - testingbot
1125
- - browserstack
1126
- - appium
1127
-
1128
- A complete list of all available services can be found on [webdriverio website][17].
1129
-
1130
- #### Setup
1131
-
1132
- 1. Install a webdriverio service
1133
- 2. Enable `wdio` plugin in config
1134
- 3. Add service name to `services` array inside wdio plugin config.
1135
-
1136
- See examples below:
1137
-
1138
- #### Selenium Standalone Service
1139
-
1140
- Install `@wdio/selenium-standalone-service` package, as [described here][18].
1141
- It is important to make sure it is compatible with current webdriverio version.
1142
-
1143
- Enable `wdio` plugin in plugins list and add `selenium-standalone` service:
1144
-
1145
- ```js
1146
- plugins: {
1147
- wdio: {
1148
- enabled: true,
1149
- services: ['selenium-standalone']
1150
- // additional config for service can be passed here
1151
- }
1152
- }
1153
- ```
1154
-
1155
- Please note, this service can be used with Protractor helper as well!
1156
-
1157
- #### Sauce Service
1158
-
1159
- Install `@wdio/sauce-service` package, as [described here][19].
1160
- It is important to make sure it is compatible with current webdriverio version.
1161
-
1162
- Enable `wdio` plugin in plugins list and add `sauce` service:
1163
-
1164
- ```js
1165
- plugins: {
1166
- wdio: {
1167
- enabled: true,
1168
- services: ['sauce'],
1169
- user: ... ,// saucelabs username
1170
- key: ... // saucelabs api key
1171
- // additional config, from sauce service
1172
- }
1173
- }
1174
- ```
1175
-
1176
- * * *
1177
-
1178
- In the same manner additional services from webdriverio can be installed, enabled, and configured.
1179
-
1180
- #### Configuration
1181
-
1182
- - `services` - list of enabled services
1183
- - ... - additional configuration passed into services.
1184
-
1185
- ### Parameters
1186
-
1187
- - `config`
1188
-
1189
- [1]: https://codecept.io/locators#custom-locators
1190
-
1191
- [2]: https://playwright.dev/docs/api/class-elementhandle
1192
-
1193
- [3]: https://pptr.dev/#?product=Puppeteer&show=api-class-elementhandle
1194
-
1195
- [4]: https://webdriver.io/docs/api
1196
-
1197
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1198
-
1199
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1200
-
1201
- [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1202
-
1203
- [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
1204
-
1205
- [9]: /basics/#pause
1206
-
1207
- [10]: https://aerokube.com/selenoid/
1208
-
1209
- [11]: https://aerokube.com/cm/latest/
1210
-
1211
- [12]: https://hub.docker.com/u/selenoid
1212
-
1213
- [13]: https://aerokube.com/selenoid/latest/#_prepare_configuration
1214
-
1215
- [14]: https://aerokube.com/selenoid/latest/#_option_2_start_selenoid_container
1216
-
1217
- [15]: https://docs.docker.com/engine/reference/commandline/create/
1218
-
1219
- [16]: https://codecept.io/img/codeceptjs-slideshow.gif
1220
-
1221
- [17]: https://webdriver.io
1222
-
1223
- [18]: https://webdriver.io/docs/selenium-standalone-service.html
1224
-
1225
- [19]: https://webdriver.io/docs/sauce-service.html