codeceptjs 3.4.1 → 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 (281) hide show
  1. package/README.md +31 -30
  2. package/bin/codecept.js +1 -1
  3. package/lib/actor.js +6 -3
  4. package/lib/ai.js +180 -0
  5. package/lib/cli.js +13 -3
  6. package/lib/codecept.js +8 -0
  7. package/lib/colorUtils.js +10 -0
  8. package/lib/command/definitions.js +2 -7
  9. package/lib/command/dryRun.js +11 -2
  10. package/lib/command/generate.js +46 -3
  11. package/lib/command/info.js +24 -0
  12. package/lib/command/init.js +64 -6
  13. package/lib/command/interactive.js +15 -1
  14. package/lib/command/run-multiple/collection.js +17 -5
  15. package/lib/command/run-multiple.js +4 -2
  16. package/lib/command/run-workers.js +68 -5
  17. package/lib/command/run.js +7 -0
  18. package/lib/command/workers/runTests.js +39 -0
  19. package/lib/container.js +13 -3
  20. package/lib/data/context.js +14 -6
  21. package/lib/event.js +4 -0
  22. package/lib/helper/ApiDataFactory.js +2 -1
  23. package/lib/helper/Appium.js +116 -29
  24. package/lib/helper/Expect.js +422 -0
  25. package/lib/helper/FileSystem.js +1 -1
  26. package/lib/helper/GraphQL.js +25 -0
  27. package/lib/helper/JSONResponse.js +4 -4
  28. package/lib/helper/Nightmare.js +10 -5
  29. package/lib/helper/OpenAI.js +126 -0
  30. package/lib/helper/Playwright.js +1298 -229
  31. package/lib/helper/Protractor.js +12 -7
  32. package/lib/helper/Puppeteer.js +204 -64
  33. package/lib/helper/REST.js +15 -5
  34. package/lib/helper/TestCafe.js +45 -10
  35. package/lib/helper/WebDriver.js +252 -83
  36. package/lib/helper/errors/ElementNotFound.js +2 -1
  37. package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
  38. package/lib/helper/scripts/blurElement.js +17 -0
  39. package/lib/helper/scripts/focusElement.js +17 -0
  40. package/lib/helper/scripts/highlightElement.js +20 -0
  41. package/lib/html.js +258 -0
  42. package/lib/interfaces/bdd.js +1 -1
  43. package/lib/interfaces/gherkin.js +37 -3
  44. package/lib/interfaces/scenarioConfig.js +1 -0
  45. package/lib/listener/retry.js +2 -1
  46. package/lib/locator.js +17 -4
  47. package/lib/mochaFactory.js +2 -1
  48. package/lib/output.js +1 -1
  49. package/lib/pause.js +78 -19
  50. package/lib/plugin/autoLogin.js +45 -10
  51. package/lib/plugin/debugErrors.js +67 -0
  52. package/lib/plugin/fakerTransform.js +4 -6
  53. package/lib/plugin/heal.js +209 -0
  54. package/lib/plugin/retryFailedStep.js +10 -1
  55. package/lib/plugin/retryTo.js +2 -4
  56. package/lib/plugin/screenshotOnFail.js +11 -2
  57. package/lib/plugin/selenoid.js +6 -1
  58. package/lib/plugin/standardActingHelpers.js +0 -2
  59. package/lib/plugin/stepByStepReport.js +2 -2
  60. package/lib/plugin/tryTo.js +5 -7
  61. package/lib/plugin/wdio.js +0 -1
  62. package/lib/recorder.js +22 -11
  63. package/lib/secret.js +5 -4
  64. package/lib/session.js +1 -1
  65. package/lib/step.js +36 -12
  66. package/lib/ui.js +5 -3
  67. package/lib/utils.js +22 -1
  68. package/lib/workers.js +83 -10
  69. package/package.json +117 -95
  70. package/translations/de-DE.js +5 -0
  71. package/translations/fr-FR.js +14 -1
  72. package/translations/it-IT.js +1 -0
  73. package/translations/ja-JP.js +14 -9
  74. package/translations/pl-PL.js +5 -0
  75. package/translations/pt-BR.js +1 -0
  76. package/translations/ru-RU.js +1 -0
  77. package/translations/zh-CN.js +5 -0
  78. package/translations/zh-TW.js +5 -0
  79. package/typings/index.d.ts +51 -15
  80. package/typings/promiseBasedTypes.d.ts +864 -802
  81. package/typings/types.d.ts +1339 -744
  82. package/CHANGELOG.md +0 -2427
  83. package/docs/advanced.md +0 -351
  84. package/docs/api.md +0 -323
  85. package/docs/basics.md +0 -980
  86. package/docs/bdd.md +0 -535
  87. package/docs/best.md +0 -237
  88. package/docs/books.md +0 -37
  89. package/docs/bootstrap.md +0 -135
  90. package/docs/build/ApiDataFactory.js +0 -409
  91. package/docs/build/Appium.js +0 -1938
  92. package/docs/build/FileSystem.js +0 -228
  93. package/docs/build/GraphQL.js +0 -204
  94. package/docs/build/GraphQLDataFactory.js +0 -309
  95. package/docs/build/JSONResponse.js +0 -338
  96. package/docs/build/Mochawesome.js +0 -71
  97. package/docs/build/Nightmare.js +0 -2145
  98. package/docs/build/Playwright.js +0 -3986
  99. package/docs/build/Polly.js +0 -42
  100. package/docs/build/Protractor.js +0 -2699
  101. package/docs/build/Puppeteer.js +0 -3710
  102. package/docs/build/REST.js +0 -334
  103. package/docs/build/SeleniumWebdriver.js +0 -76
  104. package/docs/build/TestCafe.js +0 -2057
  105. package/docs/build/WebDriver.js +0 -4017
  106. package/docs/changelog.md +0 -2436
  107. package/docs/commands.md +0 -254
  108. package/docs/community-helpers.md +0 -58
  109. package/docs/configuration.md +0 -157
  110. package/docs/continuous-integration.md +0 -22
  111. package/docs/custom-helpers.md +0 -306
  112. package/docs/data.md +0 -375
  113. package/docs/detox.md +0 -235
  114. package/docs/docker.md +0 -137
  115. package/docs/email.md +0 -183
  116. package/docs/examples.md +0 -149
  117. package/docs/helpers/ApiDataFactory.md +0 -266
  118. package/docs/helpers/Appium.md +0 -1312
  119. package/docs/helpers/Detox.md +0 -586
  120. package/docs/helpers/FileSystem.md +0 -152
  121. package/docs/helpers/GraphQL.md +0 -130
  122. package/docs/helpers/GraphQLDataFactory.md +0 -226
  123. package/docs/helpers/JSONResponse.md +0 -254
  124. package/docs/helpers/Mochawesome.md +0 -8
  125. package/docs/helpers/MockRequest.md +0 -377
  126. package/docs/helpers/Nightmare.md +0 -1256
  127. package/docs/helpers/Playwright.md +0 -2208
  128. package/docs/helpers/Polly.md +0 -44
  129. package/docs/helpers/Puppeteer-firefox.md +0 -86
  130. package/docs/helpers/Puppeteer.md +0 -2141
  131. package/docs/helpers/REST.md +0 -217
  132. package/docs/helpers/TestCafe.md +0 -1222
  133. package/docs/helpers/WebDriver.md +0 -2319
  134. package/docs/hooks.md +0 -340
  135. package/docs/index.md +0 -111
  136. package/docs/installation.md +0 -75
  137. package/docs/internal-api.md +0 -265
  138. package/docs/locators.md +0 -331
  139. package/docs/mobile-react-native-locators.md +0 -67
  140. package/docs/mobile.md +0 -297
  141. package/docs/nightmare.md +0 -223
  142. package/docs/pageobjects.md +0 -291
  143. package/docs/parallel.md +0 -232
  144. package/docs/playwright.md +0 -609
  145. package/docs/plugins.md +0 -1171
  146. package/docs/puppeteer.md +0 -316
  147. package/docs/quickstart.md +0 -163
  148. package/docs/react.md +0 -69
  149. package/docs/reports.md +0 -392
  150. package/docs/secrets.md +0 -30
  151. package/docs/shadow.md +0 -68
  152. package/docs/shared/keys.mustache +0 -31
  153. package/docs/shared/react.mustache +0 -1
  154. package/docs/testcafe.md +0 -174
  155. package/docs/translation.md +0 -247
  156. package/docs/tutorial.md +0 -271
  157. package/docs/typescript.md +0 -180
  158. package/docs/ui.md +0 -59
  159. package/docs/videos.md +0 -28
  160. package/docs/visual.md +0 -202
  161. package/docs/vue.md +0 -121
  162. package/docs/webapi/amOnPage.mustache +0 -11
  163. package/docs/webapi/appendField.mustache +0 -9
  164. package/docs/webapi/attachFile.mustache +0 -12
  165. package/docs/webapi/checkOption.mustache +0 -13
  166. package/docs/webapi/clearCookie.mustache +0 -10
  167. package/docs/webapi/clearField.mustache +0 -9
  168. package/docs/webapi/click.mustache +0 -25
  169. package/docs/webapi/clickLink.mustache +0 -8
  170. package/docs/webapi/closeCurrentTab.mustache +0 -7
  171. package/docs/webapi/closeOtherTabs.mustache +0 -8
  172. package/docs/webapi/dontSee.mustache +0 -11
  173. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +0 -10
  174. package/docs/webapi/dontSeeCookie.mustache +0 -8
  175. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +0 -10
  176. package/docs/webapi/dontSeeElement.mustache +0 -8
  177. package/docs/webapi/dontSeeElementInDOM.mustache +0 -8
  178. package/docs/webapi/dontSeeInCurrentUrl.mustache +0 -4
  179. package/docs/webapi/dontSeeInField.mustache +0 -11
  180. package/docs/webapi/dontSeeInSource.mustache +0 -8
  181. package/docs/webapi/dontSeeInTitle.mustache +0 -8
  182. package/docs/webapi/doubleClick.mustache +0 -13
  183. package/docs/webapi/downloadFile.mustache +0 -12
  184. package/docs/webapi/dragAndDrop.mustache +0 -9
  185. package/docs/webapi/dragSlider.mustache +0 -11
  186. package/docs/webapi/executeAsyncScript.mustache +0 -24
  187. package/docs/webapi/executeScript.mustache +0 -26
  188. package/docs/webapi/fillField.mustache +0 -16
  189. package/docs/webapi/forceClick.mustache +0 -28
  190. package/docs/webapi/forceRightClick.mustache +0 -18
  191. package/docs/webapi/grabAllWindowHandles.mustache +0 -7
  192. package/docs/webapi/grabAttributeFrom.mustache +0 -10
  193. package/docs/webapi/grabAttributeFromAll.mustache +0 -9
  194. package/docs/webapi/grabBrowserLogs.mustache +0 -9
  195. package/docs/webapi/grabCookie.mustache +0 -11
  196. package/docs/webapi/grabCssPropertyFrom.mustache +0 -11
  197. package/docs/webapi/grabCssPropertyFromAll.mustache +0 -10
  198. package/docs/webapi/grabCurrentUrl.mustache +0 -9
  199. package/docs/webapi/grabCurrentWindowHandle.mustache +0 -6
  200. package/docs/webapi/grabDataFromPerformanceTiming.mustache +0 -20
  201. package/docs/webapi/grabElementBoundingRect.mustache +0 -20
  202. package/docs/webapi/grabGeoLocation.mustache +0 -8
  203. package/docs/webapi/grabHTMLFrom.mustache +0 -10
  204. package/docs/webapi/grabHTMLFromAll.mustache +0 -9
  205. package/docs/webapi/grabNumberOfOpenTabs.mustache +0 -8
  206. package/docs/webapi/grabNumberOfVisibleElements.mustache +0 -9
  207. package/docs/webapi/grabPageScrollPosition.mustache +0 -8
  208. package/docs/webapi/grabPopupText.mustache +0 -5
  209. package/docs/webapi/grabSource.mustache +0 -8
  210. package/docs/webapi/grabTextFrom.mustache +0 -10
  211. package/docs/webapi/grabTextFromAll.mustache +0 -9
  212. package/docs/webapi/grabTitle.mustache +0 -8
  213. package/docs/webapi/grabValueFrom.mustache +0 -9
  214. package/docs/webapi/grabValueFromAll.mustache +0 -8
  215. package/docs/webapi/moveCursorTo.mustache +0 -12
  216. package/docs/webapi/openNewTab.mustache +0 -7
  217. package/docs/webapi/pressKey.mustache +0 -12
  218. package/docs/webapi/pressKeyDown.mustache +0 -12
  219. package/docs/webapi/pressKeyUp.mustache +0 -12
  220. package/docs/webapi/pressKeyWithKeyNormalization.mustache +0 -60
  221. package/docs/webapi/refreshPage.mustache +0 -6
  222. package/docs/webapi/resizeWindow.mustache +0 -6
  223. package/docs/webapi/rightClick.mustache +0 -14
  224. package/docs/webapi/saveElementScreenshot.mustache +0 -10
  225. package/docs/webapi/saveScreenshot.mustache +0 -12
  226. package/docs/webapi/say.mustache +0 -10
  227. package/docs/webapi/scrollIntoView.mustache +0 -11
  228. package/docs/webapi/scrollPageToBottom.mustache +0 -6
  229. package/docs/webapi/scrollPageToTop.mustache +0 -6
  230. package/docs/webapi/scrollTo.mustache +0 -12
  231. package/docs/webapi/see.mustache +0 -11
  232. package/docs/webapi/seeAttributesOnElements.mustache +0 -9
  233. package/docs/webapi/seeCheckboxIsChecked.mustache +0 -10
  234. package/docs/webapi/seeCookie.mustache +0 -8
  235. package/docs/webapi/seeCssPropertiesOnElements.mustache +0 -9
  236. package/docs/webapi/seeCurrentUrlEquals.mustache +0 -11
  237. package/docs/webapi/seeElement.mustache +0 -8
  238. package/docs/webapi/seeElementInDOM.mustache +0 -8
  239. package/docs/webapi/seeInCurrentUrl.mustache +0 -8
  240. package/docs/webapi/seeInField.mustache +0 -12
  241. package/docs/webapi/seeInPopup.mustache +0 -8
  242. package/docs/webapi/seeInSource.mustache +0 -7
  243. package/docs/webapi/seeInTitle.mustache +0 -8
  244. package/docs/webapi/seeNumberOfElements.mustache +0 -11
  245. package/docs/webapi/seeNumberOfVisibleElements.mustache +0 -10
  246. package/docs/webapi/seeTextEquals.mustache +0 -9
  247. package/docs/webapi/seeTitleEquals.mustache +0 -8
  248. package/docs/webapi/selectOption.mustache +0 -21
  249. package/docs/webapi/setCookie.mustache +0 -16
  250. package/docs/webapi/setGeoLocation.mustache +0 -12
  251. package/docs/webapi/switchTo.mustache +0 -9
  252. package/docs/webapi/switchToNextTab.mustache +0 -10
  253. package/docs/webapi/switchToPreviousTab.mustache +0 -10
  254. package/docs/webapi/type.mustache +0 -18
  255. package/docs/webapi/uncheckOption.mustache +0 -13
  256. package/docs/webapi/wait.mustache +0 -8
  257. package/docs/webapi/waitForClickable.mustache +0 -11
  258. package/docs/webapi/waitForDetached.mustache +0 -10
  259. package/docs/webapi/waitForElement.mustache +0 -11
  260. package/docs/webapi/waitForEnabled.mustache +0 -6
  261. package/docs/webapi/waitForFunction.mustache +0 -17
  262. package/docs/webapi/waitForInvisible.mustache +0 -10
  263. package/docs/webapi/waitForText.mustache +0 -13
  264. package/docs/webapi/waitForValue.mustache +0 -10
  265. package/docs/webapi/waitForVisible.mustache +0 -10
  266. package/docs/webapi/waitInUrl.mustache +0 -9
  267. package/docs/webapi/waitNumberOfVisibleElements.mustache +0 -10
  268. package/docs/webapi/waitToHide.mustache +0 -10
  269. package/docs/webapi/waitUrlEquals.mustache +0 -10
  270. package/docs/webdriver.md +0 -657
  271. package/docs/wiki/Books-&-Posts.md +0 -27
  272. package/docs/wiki/Community-Helpers-&-Plugins.md +0 -49
  273. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +0 -29
  274. package/docs/wiki/Examples.md +0 -139
  275. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -68
  276. package/docs/wiki/Home.md +0 -16
  277. package/docs/wiki/Release-Process.md +0 -24
  278. package/docs/wiki/Roadmap.md +0 -23
  279. package/docs/wiki/Tests.md +0 -1393
  280. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -153
  281. package/docs/wiki/Videos.md +0 -19
package/docs/plugins.md DELETED
@@ -1,1171 +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
- ## eachElement
483
-
484
- Provides `eachElement` global function to iterate over found elements to perform actions on them.
485
-
486
- `eachElement` takes following args:
487
-
488
- - `purpose` - the goal of an action. A comment text that will be displayed in output.
489
- - `locator` - a CSS/XPath locator to match elements
490
- - `fn(element, index)` - **asynchronous** function which will be executed for each matched element.
491
-
492
- Example of usage:
493
-
494
- ```js
495
- // this example works with Playwright and Puppeteer helper
496
- await eachElement('click all checkboxes', 'form input[type=checkbox]', async (el) => {
497
- await el.click();
498
- });
499
- ```
500
-
501
- Click odd elements:
502
-
503
- ```js
504
- // this example works with Playwright and Puppeteer helper
505
- await eachElement('click odd buttons', '.button-select', async (el, index) => {
506
- if (index % 2) await el.click();
507
- });
508
- ```
509
-
510
- Check all elements for visibility:
511
-
512
- ```js
513
- // this example works with Playwright and Puppeteer helper
514
- const assert = require('assert');
515
- await eachElement('check all items are visible', '.item', async (el) => {
516
- assert(await el.isVisible());
517
- });
518
- ```
519
-
520
- This method works with WebDriver, Playwright, Puppeteer, Appium helpers.
521
-
522
- Function parameter `el` represents a matched element.
523
- Depending on a helper API of `el` can be different. Refer to API of corresponding browser testing engine for a complete API list:
524
-
525
- - [Playwright ElementHandle][2]
526
- - [Puppeteer][3]
527
- - [webdriverio element][4]
528
-
529
- #### Configuration
530
-
531
- - `registerGlobal` - to register `eachElement` function globally, true by default
532
-
533
- If `registerGlobal` is false you can use eachElement from the plugin:
534
-
535
- ```js
536
- const eachElement = codeceptjs.container.plugins('eachElement');
537
- ```
538
-
539
- ### Parameters
540
-
541
- - `purpose` **[string][5]**
542
- - `locator` **CodeceptJS.LocatorOrString**
543
- - `fn` **[Function][6]**
544
-
545
- Returns **([Promise][7]&lt;any> | [undefined][8])**
546
-
547
- ## fakerTransform
548
-
549
- Use the [faker.js][9] package to generate fake data inside examples on your gherkin tests
550
-
551
- ![Faker.js][10]
552
-
553
- #### Usage
554
-
555
- To start please install `faker.js` package
556
-
557
- npm install -D faker
558
-
559
- yarn add -D faker
560
-
561
- Add this plugin to config file:
562
-
563
- ```js
564
- plugins: {
565
- fakerTransform: {
566
- enabled: true
567
- }
568
- }
569
- ```
570
-
571
- Add the faker API using a mustache string format inside examples tables in your gherkin scenario outline
572
-
573
- ```feature
574
- Scenario Outline: ...
575
- Given ...
576
- When ...
577
- Then ...
578
- Examples:
579
- | productName | customer | email | anythingMore |
580
- | {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData |
581
- ```
582
-
583
- ### Parameters
584
-
585
- - `config`
586
-
587
- ## pauseOnFail
588
-
589
- Automatically launches [interactive pause][11] when a test fails.
590
-
591
- Useful for debugging flaky tests on local environment.
592
- Add this plugin to config file:
593
-
594
- ```js
595
- plugins: {
596
- pauseOnFail: {},
597
- }
598
- ```
599
-
600
- Unlike other plugins, `pauseOnFail` is not recommended to be enabled by default.
601
- Enable it manually on each run via `-p` option:
602
-
603
- npx codeceptjs run -p pauseOnFail
604
-
605
- ## retryFailedStep
606
-
607
- Retries each failed step in a test.
608
-
609
- Add this plugin to config file:
610
-
611
- ```js
612
- plugins: {
613
- retryFailedStep: {
614
- enabled: true
615
- }
616
- }
617
- ```
618
-
619
- Run tests with plugin enabled:
620
-
621
- npx codeceptjs run --plugins retryFailedStep
622
-
623
- #### Configuration:
624
-
625
- - `retries` - number of retries (by default 3),
626
- - `when` - function, when to perform a retry (accepts error as parameter)
627
- - `factor` - The exponential factor to use. Default is 1.5.
628
- - `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000.
629
- - `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity.
630
- - `randomize` - Randomizes the timeouts by multiplying with a factor between 1 to 2. Default is false.
631
- - `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes:
632
- - `amOnPage`
633
- - `wait*`
634
- - `send*`
635
- - `execute*`
636
- - `run*`
637
- - `have*`
638
- - `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list.
639
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
640
- To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well.
641
-
642
- #### Example
643
-
644
- ```js
645
- plugins: {
646
- retryFailedStep: {
647
- enabled: true,
648
- ignoredSteps: [
649
- 'scroll*', // ignore all scroll steps
650
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
651
- ]
652
- }
653
- }
654
- ```
655
-
656
- #### Disable Per Test
657
-
658
- This plugin can be disabled per test. In this case you will need to stet `I.retry()` to all flaky steps:
659
-
660
- Use scenario configuration to disable plugin for a test
661
-
662
- ```js
663
- Scenario('scenario tite', () => {
664
- // test goes here
665
- }).config(test => test.disableRetryFailedStep = true)
666
- ```
667
-
668
- ### Parameters
669
-
670
- - `config`
671
-
672
- ## retryTo
673
-
674
- Adds global `retryTo` which retries steps a few times before failing.
675
-
676
- Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
677
-
678
- ```js
679
- plugins: {
680
- retryTo: {
681
- enabled: true
682
- }
683
- }
684
- ```
685
-
686
- Use it in your tests:
687
-
688
- ```js
689
- // retry these steps 5 times before failing
690
- await retryTo((tryNum) => {
691
- I.switchTo('#editor frame');
692
- I.click('Open');
693
- I.see('Opened')
694
- }, 5);
695
- ```
696
-
697
- Set polling interval as 3rd argument (200ms by default):
698
-
699
- ```js
700
- // retry these steps 5 times before failing
701
- await retryTo((tryNum) => {
702
- I.switchTo('#editor frame');
703
- I.click('Open');
704
- I.see('Opened')
705
- }, 5, 100);
706
- ```
707
-
708
- Default polling interval can be changed in a config:
709
-
710
- ```js
711
- plugins: {
712
- retryTo: {
713
- enabled: true,
714
- pollInterval: 500,
715
- }
716
- }
717
- ```
718
-
719
- Disables retryFailedStep plugin for steps inside a block;
720
-
721
- Use this plugin if:
722
-
723
- - you need repeat a set of actions in flaky tests
724
- - iframe was not rendered and you need to retry switching to it
725
-
726
- #### Configuration
727
-
728
- - `pollInterval` - default interval between retries in ms. 200 by default.
729
- - `registerGlobal` - to register `retryTo` function globally, true by default
730
-
731
- If `registerGlobal` is false you can use retryTo from the plugin:
732
-
733
- ```js
734
- const retryTo = codeceptjs.container.plugins('retryTo');
735
- ```
736
-
737
- ### Parameters
738
-
739
- - `config`
740
-
741
- ## screenshotOnFail
742
-
743
- Creates screenshot on failure. Screenshot is saved into `output` directory.
744
-
745
- Initially this functionality was part of corresponding helper but has been moved into plugin since 1.4
746
-
747
- This plugin is **enabled by default**.
748
-
749
- #### Configuration
750
-
751
- Configuration can either be taken from a corresponding helper (deprecated) or a from plugin config (recommended).
752
-
753
- ```js
754
- plugins: {
755
- screenshotOnFail: {
756
- enabled: true
757
- }
758
- }
759
- ```
760
-
761
- Possible config options:
762
-
763
- - `uniqueScreenshotNames`: use unique names for screenshot. Default: false.
764
- - `fullPageScreenshots`: make full page screenshots. Default: false.
765
-
766
- ### Parameters
767
-
768
- - `config`
769
-
770
- ## selenoid
771
-
772
- [Selenoid][12] plugin automatically starts browsers and video recording.
773
- Works with WebDriver helper.
774
-
775
- ### Prerequisite
776
-
777
- This plugin **requires Docker** to be installed.
778
-
779
- > If you have issues starting Selenoid with this plugin consider using the official [Configuration Manager][13] tool from Selenoid
780
-
781
- ### Usage
782
-
783
- Selenoid plugin can be started in two ways:
784
-
785
- 1. **Automatic** - this plugin will create and manage selenoid container for you.
786
- 2. **Manual** - you create the conatainer and configure it with a plugin (recommended).
787
-
788
- #### Automatic
789
-
790
- If you are new to Selenoid and you want plug and play setup use automatic mode.
791
-
792
- Add plugin configuration in `codecept.conf.js`:
793
-
794
- ```js
795
- plugins: {
796
- selenoid: {
797
- enabled: true,
798
- deletePassed: true,
799
- autoCreate: true,
800
- autoStart: true,
801
- sessionTimeout: '30m',
802
- enableVideo: true,
803
- enableLog: true,
804
- },
805
- }
806
- ```
807
-
808
- When `autoCreate` is enabled it will pull the [latest Selenoid from DockerHub][14] and start Selenoid automatically.
809
- It will also create `browsers.json` file required by Selenoid.
810
-
811
- 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.
812
-
813
- > **If you are using Windows machine or if `autoCreate` does not work properly, create container manually**
814
-
815
- #### Manual
816
-
817
- While this plugin can create containers for you for better control it is recommended to create and launch containers manually.
818
- This is especially useful for Continous Integration server as you can configure scaling for Selenoid containers.
819
-
820
- > Use [Selenoid Configuration Manager][13] to create and start containers semi-automatically.
821
-
822
- 1. Create `browsers.json` file in the same directory `codecept.conf.js` is located
823
- [Refer to Selenoid documentation][15] to know more about browsers.json.
824
-
825
- _Sample browsers.json_
826
-
827
- ```js
828
- {
829
- "chrome": {
830
- "default": "latest",
831
- "versions": {
832
- "latest": {
833
- "image": "selenoid/chrome:latest",
834
- "port": "4444",
835
- "path": "/"
836
- }
837
- }
838
- }
839
- }
840
- ```
841
-
842
- > 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.
843
-
844
- **⚠ At first launch selenoid plugin takes extra time to download all Docker images before tests starts**.
845
-
846
- 2. Create Selenoid container
847
-
848
- Run the following command to create a container. To know more [refer here][16]
849
-
850
- ```bash
851
- docker create \
852
- --name selenoid \
853
- -p 4444:4444 \
854
- -v /var/run/docker.sock:/var/run/docker.sock \
855
- -v `pwd`/:/etc/selenoid/:ro \
856
- -v `pwd`/output/video/:/opt/selenoid/video/ \
857
- -e OVERRIDE_VIDEO_OUTPUT_DIR=`pwd`/output/video/ \
858
- aerokube/selenoid:latest-release
859
- ```
860
-
861
- ### Video Recording
862
-
863
- This plugin allows to record and save video per each executed tests.
864
-
865
- When `enableVideo` is `true` this plugin saves video in `output/videos` directory with each test by name
866
- To save space videos for all succesful tests are deleted. This can be changed by `deletePassed` option.
867
-
868
- When `allure` plugin is enabled a video is attached to report automatically.
869
-
870
- ### Options:
871
-
872
- | Param | Description |
873
- | ---------------- | ------------------------------------------------------------------------------ |
874
- | name | Name of the container (default : selenoid) |
875
- | port | Port of selenium server (default : 4444) |
876
- | autoCreate | Will automatically create container (Linux only) (default : true) |
877
- | autoStart | If disabled start the container manually before running tests (default : true) |
878
- | enableVideo | Enable video recording and use `video` folder of output (default: false) |
879
- | enableLog | Enable log recording and use `logs` folder of output (default: false) |
880
- | deletePassed | Delete video and logs of passed tests (default : true) |
881
- | additionalParams | example: `additionalParams: '--env TEST=test'` [Refer here][17] to know more |
882
-
883
- ### Parameters
884
-
885
- - `config`
886
-
887
- ## stepByStepReport
888
-
889
- ![step-by-step-report][18]
890
-
891
- Generates step by step report for a test.
892
- After each step in a test a screenshot is created. After test executed screenshots are combined into slideshow.
893
- By default, reports are generated only for failed tests.
894
-
895
- Run tests with plugin enabled:
896
-
897
- npx codeceptjs run --plugins stepByStepReport
898
-
899
- #### Configuration
900
-
901
- ```js
902
- "plugins": {
903
- "stepByStepReport": {
904
- "enabled": true
905
- }
906
- }
907
- ```
908
-
909
- Possible config options:
910
-
911
- - `deleteSuccessful`: do not save screenshots for successfully executed tests. Default: true.
912
- - `animateSlides`: should animation for slides to be used. Default: true.
913
- - `ignoreSteps`: steps to ignore in report. Array of RegExps is expected. Recommended to skip `grab*` and `wait*` steps.
914
- - `fullPageScreenshots`: should full page screenshots be used. Default: false.
915
- - `output`: a directory where reports should be stored. Default: `output`.
916
- - `screenshotsForAllureReport`: If Allure plugin is enabled this plugin attaches each saved screenshot to allure report. Default: false.
917
- - \`disableScreenshotOnFail : Disables the capturing of screeshots after the failed step. Default: true.
918
-
919
- ### Parameters
920
-
921
- - `config` **any**
922
-
923
- ## stepTimeout
924
-
925
- Set timeout for test steps globally.
926
-
927
- Add this plugin to config file:
928
-
929
- ```js
930
- plugins: {
931
- stepTimeout: {
932
- enabled: true
933
- }
934
- }
935
- ```
936
-
937
- Run tests with plugin enabled:
938
-
939
- npx codeceptjs run --plugins stepTimeout
940
-
941
- #### Configuration:
942
-
943
- - `timeout` - global step timeout, default 150 seconds
944
- - `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false
945
- - `noTimeoutSteps` - an array of steps with no timeout. Default:
946
-
947
- - `amOnPage`
948
- - `wait*`
949
-
950
- you could set your own noTimeoutSteps which would replace the default one.
951
-
952
- - `customTimeoutSteps` - an array of step actions with custom timeout. Use it to override or extend noTimeoutSteps.
953
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
954
-
955
- #### Example
956
-
957
- ```js
958
- plugins: {
959
- stepTimeout: {
960
- enabled: true,
961
- overrideStepLimits: true,
962
- noTimeoutSteps: [
963
- 'scroll*', // ignore all scroll steps
964
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
965
- ],
966
- customTimeoutSteps: [
967
- ['myFlakyStep*', 1],
968
- ['scrollWhichRequiresTimeout', 5],
969
- ]
970
- }
971
- }
972
- ```
973
-
974
- ### Parameters
975
-
976
- - `config`
977
-
978
- ## subtitles
979
-
980
- Automatically captures steps as subtitle, and saves it as an artifact when a video is found for a failed test
981
-
982
- #### Configuration
983
-
984
- ```js
985
- plugins: {
986
- subtitles: {
987
- enabled: true
988
- }
989
- }
990
- ```
991
-
992
- ## tryTo
993
-
994
- Adds global `tryTo` function inside of which all failed steps won't fail a test but will return true/false.
995
-
996
- Enable this plugin in `codecept.conf.js` (enabled by default for new setups):
997
-
998
- ```js
999
- plugins: {
1000
- tryTo: {
1001
- enabled: true
1002
- }
1003
- }
1004
- ```
1005
-
1006
- Use it in your tests:
1007
-
1008
- ```js
1009
- const result = await tryTo(() => I.see('Welcome'));
1010
-
1011
- // if text "Welcome" is on page, result => true
1012
- // if text "Welcome" is not on page, result => false
1013
- ```
1014
-
1015
- Disables retryFailedStep plugin for steps inside a block;
1016
-
1017
- Use this plugin if:
1018
-
1019
- - you need to perform multiple assertions inside a test
1020
- - there is A/B testing on a website you test
1021
- - there is "Accept Cookie" banner which may surprisingly appear on a page.
1022
-
1023
- #### Usage
1024
-
1025
- #### Multiple Conditional Assertions
1026
-
1027
- ````js
1028
- Add assert requires first:
1029
- ```js
1030
- const assert = require('assert');
1031
- ````
1032
-
1033
- Then use the assert:
1034
- const result1 = await tryTo(() => I.see('Hello, user'));
1035
- const result2 = await tryTo(() => I.seeElement('.welcome'));
1036
- assert.ok(result1 && result2, 'Assertions were not succesful');
1037
-
1038
- ##### Optional click
1039
-
1040
- ```js
1041
- I.amOnPage('/');
1042
- tryTo(() => I.click('Agree', '.cookies'));
1043
-
1044
- #### Configuration
1045
-
1046
- - `registerGlobal` - to register `tryTo` function globally, true by default
1047
-
1048
- If `registerGlobal` is false you can use tryTo from the plugin:
1049
-
1050
- ```js
1051
- const tryTo = codeceptjs.container.plugins('tryTo');
1052
- ```
1053
-
1054
- ### Parameters
1055
-
1056
- - `config`
1057
-
1058
- ## wdio
1059
-
1060
- Webdriverio services runner.
1061
-
1062
- This plugin allows to run webdriverio services like:
1063
-
1064
- - selenium-standalone
1065
- - sauce
1066
- - testingbot
1067
- - browserstack
1068
- - appium
1069
-
1070
- A complete list of all available services can be found on [webdriverio website][19].
1071
-
1072
- #### Setup
1073
-
1074
- 1. Install a webdriverio service
1075
- 2. Enable `wdio` plugin in config
1076
- 3. Add service name to `services` array inside wdio plugin config.
1077
-
1078
- See examples below:
1079
-
1080
- #### Selenium Standalone Service
1081
-
1082
- Install `@wdio/selenium-standalone-service` package, as [described here][20].
1083
- It is important to make sure it is compatible with current webdriverio version.
1084
-
1085
- Enable `wdio` plugin in plugins list and add `selenium-standalone` service:
1086
-
1087
- ```js
1088
- plugins: {
1089
- wdio: {
1090
- enabled: true,
1091
- services: ['selenium-standalone']
1092
- // additional config for service can be passed here
1093
- }
1094
- }
1095
- ```
1096
-
1097
- Please note, this service can be used with Protractor helper as well!
1098
-
1099
- #### Sauce Service
1100
-
1101
- Install `@wdio/sauce-service` package, as [described here][21].
1102
- It is important to make sure it is compatible with current webdriverio version.
1103
-
1104
- Enable `wdio` plugin in plugins list and add `sauce` service:
1105
-
1106
- ```js
1107
- plugins: {
1108
- wdio: {
1109
- enabled: true,
1110
- services: ['sauce'],
1111
- user: ... ,// saucelabs username
1112
- key: ... // saucelabs api key
1113
- // additional config, from sauce service
1114
- }
1115
- }
1116
- ```
1117
-
1118
- * * *
1119
-
1120
- In the same manner additional services from webdriverio can be installed, enabled, and configured.
1121
-
1122
- #### Configuration
1123
-
1124
- - `services` - list of enabled services
1125
- - ... - additional configuration passed into services.
1126
-
1127
- ### Parameters
1128
-
1129
- - `config`
1130
-
1131
- [1]: https://codecept.io/locators#custom-locators
1132
-
1133
- [2]: https://playwright.dev/docs/api/class-elementhandle
1134
-
1135
- [3]: https://pptr.dev/#?product=Puppeteer&show=api-class-elementhandle
1136
-
1137
- [4]: https://webdriver.io/docs/api
1138
-
1139
- [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
1140
-
1141
- [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
1142
-
1143
- [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
1144
-
1145
- [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
1146
-
1147
- [9]: https://www.npmjs.com/package/faker
1148
-
1149
- [10]: https://raw.githubusercontent.com/Marak/faker.js/master/logo.png
1150
-
1151
- [11]: /basics/#pause
1152
-
1153
- [12]: https://aerokube.com/selenoid/
1154
-
1155
- [13]: https://aerokube.com/cm/latest/
1156
-
1157
- [14]: https://hub.docker.com/u/selenoid
1158
-
1159
- [15]: https://aerokube.com/selenoid/latest/#_prepare_configuration
1160
-
1161
- [16]: https://aerokube.com/selenoid/latest/#_option_2_start_selenoid_container
1162
-
1163
- [17]: https://docs.docker.com/engine/reference/commandline/create/
1164
-
1165
- [18]: https://codecept.io/img/codeceptjs-slideshow.gif
1166
-
1167
- [19]: https://webdriver.io
1168
-
1169
- [20]: https://webdriver.io/docs/selenium-standalone-service.html
1170
-
1171
- [21]: https://webdriver.io/docs/sauce-service.html