codeceptjs 4.0.0-beta.3 → 4.0.0-beta.5

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 (155) hide show
  1. package/README.md +134 -119
  2. package/bin/codecept.js +12 -2
  3. package/bin/test-server.js +53 -0
  4. package/docs/webapi/clearCookie.mustache +1 -1
  5. package/lib/actor.js +66 -102
  6. package/lib/ai.js +130 -121
  7. package/lib/assert/empty.js +3 -5
  8. package/lib/assert/equal.js +4 -7
  9. package/lib/assert/include.js +4 -6
  10. package/lib/assert/throws.js +2 -4
  11. package/lib/assert/truth.js +2 -2
  12. package/lib/codecept.js +141 -86
  13. package/lib/command/check.js +201 -0
  14. package/lib/command/configMigrate.js +2 -4
  15. package/lib/command/definitions.js +8 -26
  16. package/lib/command/dryRun.js +30 -35
  17. package/lib/command/generate.js +10 -14
  18. package/lib/command/gherkin/snippets.js +75 -73
  19. package/lib/command/gherkin/steps.js +1 -1
  20. package/lib/command/info.js +42 -8
  21. package/lib/command/init.js +13 -12
  22. package/lib/command/interactive.js +10 -2
  23. package/lib/command/list.js +1 -1
  24. package/lib/command/run-multiple/chunk.js +48 -45
  25. package/lib/command/run-multiple.js +12 -35
  26. package/lib/command/run-workers.js +21 -58
  27. package/lib/command/utils.js +5 -6
  28. package/lib/command/workers/runTests.js +263 -222
  29. package/lib/container.js +386 -238
  30. package/lib/data/context.js +10 -13
  31. package/lib/data/dataScenarioConfig.js +8 -8
  32. package/lib/data/dataTableArgument.js +6 -6
  33. package/lib/data/table.js +5 -11
  34. package/lib/effects.js +223 -0
  35. package/lib/element/WebElement.js +327 -0
  36. package/lib/els.js +158 -0
  37. package/lib/event.js +21 -17
  38. package/lib/heal.js +88 -80
  39. package/lib/helper/AI.js +2 -1
  40. package/lib/helper/ApiDataFactory.js +4 -7
  41. package/lib/helper/Appium.js +50 -57
  42. package/lib/helper/FileSystem.js +3 -3
  43. package/lib/helper/GraphQLDataFactory.js +4 -4
  44. package/lib/helper/JSONResponse.js +75 -37
  45. package/lib/helper/Mochawesome.js +31 -9
  46. package/lib/helper/Nightmare.js +37 -58
  47. package/lib/helper/Playwright.js +267 -272
  48. package/lib/helper/Protractor.js +56 -87
  49. package/lib/helper/Puppeteer.js +247 -264
  50. package/lib/helper/REST.js +29 -17
  51. package/lib/helper/TestCafe.js +22 -47
  52. package/lib/helper/WebDriver.js +157 -368
  53. package/lib/helper/extras/PlaywrightPropEngine.js +2 -2
  54. package/lib/helper/extras/Popup.js +22 -22
  55. package/lib/helper/network/utils.js +1 -1
  56. package/lib/helper/testcafe/testcafe-utils.js +27 -28
  57. package/lib/listener/emptyRun.js +55 -0
  58. package/lib/listener/exit.js +7 -10
  59. package/lib/listener/{retry.js → globalRetry.js} +5 -5
  60. package/lib/listener/globalTimeout.js +165 -0
  61. package/lib/listener/helpers.js +15 -15
  62. package/lib/listener/mocha.js +1 -1
  63. package/lib/listener/result.js +12 -0
  64. package/lib/listener/retryEnhancer.js +85 -0
  65. package/lib/listener/steps.js +32 -18
  66. package/lib/listener/store.js +20 -0
  67. package/lib/locator.js +1 -1
  68. package/lib/mocha/asyncWrapper.js +231 -0
  69. package/lib/{interfaces → mocha}/bdd.js +3 -3
  70. package/lib/mocha/cli.js +308 -0
  71. package/lib/mocha/factory.js +104 -0
  72. package/lib/{interfaces → mocha}/featureConfig.js +32 -12
  73. package/lib/{interfaces → mocha}/gherkin.js +26 -28
  74. package/lib/mocha/hooks.js +112 -0
  75. package/lib/mocha/index.js +12 -0
  76. package/lib/mocha/inject.js +29 -0
  77. package/lib/{interfaces → mocha}/scenarioConfig.js +31 -7
  78. package/lib/mocha/suite.js +82 -0
  79. package/lib/mocha/test.js +181 -0
  80. package/lib/mocha/types.d.ts +42 -0
  81. package/lib/mocha/ui.js +232 -0
  82. package/lib/output.js +93 -65
  83. package/lib/pause.js +160 -138
  84. package/lib/plugin/analyze.js +396 -0
  85. package/lib/plugin/auth.js +435 -0
  86. package/lib/plugin/autoDelay.js +8 -8
  87. package/lib/plugin/autoLogin.js +3 -338
  88. package/lib/plugin/commentStep.js +6 -1
  89. package/lib/plugin/coverage.js +10 -22
  90. package/lib/plugin/customLocator.js +3 -3
  91. package/lib/plugin/customReporter.js +52 -0
  92. package/lib/plugin/eachElement.js +1 -1
  93. package/lib/plugin/fakerTransform.js +1 -1
  94. package/lib/plugin/heal.js +36 -9
  95. package/lib/plugin/htmlReporter.js +1947 -0
  96. package/lib/plugin/pageInfo.js +140 -0
  97. package/lib/plugin/retryFailedStep.js +17 -18
  98. package/lib/plugin/retryTo.js +2 -113
  99. package/lib/plugin/screenshotOnFail.js +17 -58
  100. package/lib/plugin/selenoid.js +15 -35
  101. package/lib/plugin/standardActingHelpers.js +4 -1
  102. package/lib/plugin/stepByStepReport.js +56 -17
  103. package/lib/plugin/stepTimeout.js +5 -12
  104. package/lib/plugin/subtitles.js +4 -4
  105. package/lib/plugin/tryTo.js +3 -102
  106. package/lib/plugin/wdio.js +8 -10
  107. package/lib/recorder.js +155 -124
  108. package/lib/rerun.js +43 -42
  109. package/lib/result.js +161 -0
  110. package/lib/secret.js +1 -2
  111. package/lib/step/base.js +239 -0
  112. package/lib/step/comment.js +10 -0
  113. package/lib/step/config.js +50 -0
  114. package/lib/step/func.js +46 -0
  115. package/lib/step/helper.js +50 -0
  116. package/lib/step/meta.js +99 -0
  117. package/lib/step/record.js +74 -0
  118. package/lib/step/retry.js +11 -0
  119. package/lib/step/section.js +55 -0
  120. package/lib/step.js +21 -332
  121. package/lib/steps.js +50 -0
  122. package/lib/store.js +37 -5
  123. package/lib/template/heal.js +2 -11
  124. package/lib/test-server.js +323 -0
  125. package/lib/timeout.js +66 -0
  126. package/lib/utils.js +351 -218
  127. package/lib/within.js +75 -55
  128. package/lib/workerStorage.js +2 -1
  129. package/lib/workers.js +386 -277
  130. package/package.json +81 -75
  131. package/translations/de-DE.js +5 -3
  132. package/translations/fr-FR.js +5 -4
  133. package/translations/index.js +1 -0
  134. package/translations/it-IT.js +4 -3
  135. package/translations/ja-JP.js +4 -3
  136. package/translations/nl-NL.js +76 -0
  137. package/translations/pl-PL.js +4 -3
  138. package/translations/pt-BR.js +4 -3
  139. package/translations/ru-RU.js +4 -3
  140. package/translations/utils.js +9 -0
  141. package/translations/zh-CN.js +4 -3
  142. package/translations/zh-TW.js +4 -3
  143. package/typings/index.d.ts +197 -187
  144. package/typings/promiseBasedTypes.d.ts +53 -903
  145. package/typings/types.d.ts +372 -1042
  146. package/lib/cli.js +0 -257
  147. package/lib/helper/ExpectHelper.js +0 -391
  148. package/lib/helper/MockServer.js +0 -221
  149. package/lib/helper/SoftExpectHelper.js +0 -381
  150. package/lib/listener/artifacts.js +0 -19
  151. package/lib/listener/timeout.js +0 -109
  152. package/lib/mochaFactory.js +0 -113
  153. package/lib/plugin/debugErrors.js +0 -67
  154. package/lib/scenario.js +0 -224
  155. package/lib/ui.js +0 -236
@@ -0,0 +1,435 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+ const { fileExists } = require('../utils')
4
+ const CommentStep = require('../step/comment')
5
+ const Section = require('../step/section')
6
+ const container = require('../container')
7
+ const store = require('../store')
8
+ const event = require('../event')
9
+ const recorder = require('../recorder')
10
+ const { debug } = require('../output')
11
+ const { isAsyncFunction } = require('../utils')
12
+
13
+ const defaultUser = {
14
+ fetch: I => I.grabCookie(),
15
+ check: () => {},
16
+ restore: (I, cookies) => {
17
+ I.amOnPage('/') // open a page
18
+ I.setCookie(cookies)
19
+ },
20
+ }
21
+
22
+ const defaultConfig = {
23
+ saveToFile: false,
24
+ inject: 'login',
25
+ }
26
+
27
+ /**
28
+ * Logs user in for the first test and reuses session for next tests.
29
+ * Works by saving cookies into memory or file.
30
+ * If a session expires automatically logs in again.
31
+ *
32
+ * > For better development experience cookies can be saved into file, so a session can be reused while writing tests.
33
+ *
34
+ * #### Usage
35
+ *
36
+ * 1. Enable this plugin and configure as described below
37
+ * 2. Define user session names (example: `user`, `editor`, `admin`, etc).
38
+ * 3. Define how users are logged in and how to check that user is logged in
39
+ * 4. Use `login` object inside your tests to log in:
40
+ *
41
+ * ```js
42
+ * // inside a test file
43
+ * // use login to inject auto-login function
44
+ * Feature('Login');
45
+ *
46
+ * Before(({ login }) => {
47
+ * login('user'); // login using user session
48
+ * });
49
+ *
50
+ * // Alternatively log in for one scenario.
51
+ * Scenario('log me in', ( { I, login } ) => {
52
+ * login('admin');
53
+ * I.see('I am logged in');
54
+ * });
55
+ * ```
56
+ *
57
+ * #### Configuration
58
+ *
59
+ * * `saveToFile` (default: false) - save cookies to file. Allows to reuse session between execution.
60
+ * * `inject` (default: `login`) - name of the login function to use
61
+ * * `users` - an array containing different session names and functions to:
62
+ * * `login` - sign in into the system
63
+ * * `check` - check that user is logged in
64
+ * * `fetch` - to get current cookies (by default `I.grabCookie()`)
65
+ * * `restore` - to set cookies (by default `I.amOnPage('/'); I.setCookie(cookie)`)
66
+ *
67
+ * #### How It Works
68
+ *
69
+ * 1. `restore` method is executed. It should open a page and set credentials.
70
+ * 2. `check` method is executed. It should reload a page (so cookies are applied) and check that this page belongs to logged-in user. When you pass the second args `session`, you could perform the validation using passed session.
71
+ * 3. If `restore` and `check` were not successful, `login` is executed
72
+ * 4. `login` should fill in login form
73
+ * 5. After successful login, `fetch` is executed to save cookies into memory or file.
74
+ *
75
+ * #### Example: Simple login
76
+ *
77
+ * ```js
78
+ * auth: {
79
+ * enabled: true,
80
+ * saveToFile: true,
81
+ * inject: 'login',
82
+ * users: {
83
+ * admin: {
84
+ * // loginAdmin function is defined in `steps_file.js`
85
+ * login: (I) => I.loginAdmin(),
86
+ * // if we see `Admin` on page, we assume we are logged in
87
+ * check: (I) => {
88
+ * I.amOnPage('/');
89
+ * I.see('Admin');
90
+ * }
91
+ * }
92
+ * }
93
+ * }
94
+ * ```
95
+ *
96
+ * #### Example: Multiple users
97
+ *
98
+ * ```js
99
+ * auth: {
100
+ * enabled: true,
101
+ * saveToFile: true,
102
+ * inject: 'loginAs', // use `loginAs` instead of login
103
+ * users: {
104
+ * user: {
105
+ * login: (I) => {
106
+ * I.amOnPage('/login');
107
+ * I.fillField('email', 'user@site.com');
108
+ * I.fillField('password', '123456');
109
+ * I.click('Login');
110
+ * },
111
+ * check: (I) => {
112
+ * I.amOnPage('/');
113
+ * I.see('User', '.navbar');
114
+ * },
115
+ * },
116
+ * admin: {
117
+ * login: (I) => {
118
+ * I.amOnPage('/login');
119
+ * I.fillField('email', 'admin@site.com');
120
+ * I.fillField('password', '123456');
121
+ * I.click('Login');
122
+ * },
123
+ * check: (I) => {
124
+ * I.amOnPage('/');
125
+ * I.see('Admin', '.navbar');
126
+ * },
127
+ * },
128
+ * }
129
+ * }
130
+ * ```
131
+ *
132
+ * #### Example: Keep cookies between tests
133
+ *
134
+ * If you decide to keep cookies between tests you don't need to save/retrieve cookies between tests.
135
+ * But you need to login once work until session expires.
136
+ * For this case, disable `fetch` and `restore` methods.
137
+ *
138
+ * ```js
139
+ * helpers: {
140
+ * WebDriver: {
141
+ * // config goes here
142
+ * keepCookies: true; // keep cookies for all tests
143
+ * }
144
+ * },
145
+ * plugins: {
146
+ * auth: {
147
+ * users: {
148
+ * admin: {
149
+ * login: (I) => {
150
+ * I.amOnPage('/login');
151
+ * I.fillField('email', 'admin@site.com');
152
+ * I.fillField('password', '123456');
153
+ * I.click('Login');
154
+ * },
155
+ * check: (I) => {
156
+ * I.amOnPage('/dashboard');
157
+ * I.see('Admin', '.navbar');
158
+ * },
159
+ * fetch: () => {}, // empty function
160
+ * restore: () => {}, // empty funciton
161
+ * }
162
+ * }
163
+ * }
164
+ * }
165
+ * ```
166
+ *
167
+ * #### Example: Getting sessions from local storage
168
+ *
169
+ * If your session is stored in local storage instead of cookies you still can obtain sessions.
170
+ *
171
+ * ```js
172
+ * plugins: {
173
+ * auth: {
174
+ * admin: {
175
+ * login: (I) => I.loginAsAdmin(),
176
+ * check: (I) => I.see('Admin', '.navbar'),
177
+ * fetch: (I) => {
178
+ * return I.executeScript(() => localStorage.getItem('session_id'));
179
+ * },
180
+ * restore: (I, session) => {
181
+ * I.amOnPage('/');
182
+ * I.executeScript((session) => localStorage.setItem('session_id', session), session);
183
+ * },
184
+ * }
185
+ * }
186
+ * }
187
+ * ```
188
+ *
189
+ * #### Tips: Using async function in the auth
190
+ *
191
+ * If you use async functions in the auth plugin, login function should be used with `await` keyword.
192
+ *
193
+ * ```js
194
+ * auth: {
195
+ * enabled: true,
196
+ * saveToFile: true,
197
+ * inject: 'login',
198
+ * users: {
199
+ * admin: {
200
+ * login: async (I) => { // If you use async function in the auth plugin
201
+ * const phrase = await I.grabTextFrom('#phrase')
202
+ * I.fillField('username', 'admin'),
203
+ * I.fillField('password', 'password')
204
+ * I.fillField('phrase', phrase)
205
+ * },
206
+ * check: (I) => {
207
+ * I.amOnPage('/');
208
+ * I.see('Admin');
209
+ * },
210
+ * }
211
+ * }
212
+ * }
213
+ * ```
214
+ *
215
+ * ```js
216
+ * Scenario('login', async ( {I, login} ) => {
217
+ * await login('admin') // you should use `await`
218
+ * })
219
+ * ```
220
+ *
221
+ * #### Tips: Using session to validate user
222
+ *
223
+ * Instead of asserting on page elements for the current user in `check`, you can use the `session` you saved in `fetch`
224
+ *
225
+ * ```js
226
+ * auth: {
227
+ * enabled: true,
228
+ * saveToFile: true,
229
+ * inject: 'login',
230
+ * users: {
231
+ * admin: {
232
+ * login: async (I) => { // If you use async function in the auth plugin
233
+ * const phrase = await I.grabTextFrom('#phrase')
234
+ * I.fillField('username', 'admin'),
235
+ * I.fillField('password', 'password')
236
+ * I.fillField('phrase', phrase)
237
+ * },
238
+ * check: (I, session) => {
239
+ * // Throwing an error in `check` will make CodeceptJS perform the login step for the user
240
+ * if (session.profile.email !== the.email.you.expect@some-mail.com) {
241
+ * throw new Error ('Wrong user signed in');
242
+ * }
243
+ * },
244
+ * }
245
+ * }
246
+ * }
247
+ * ```
248
+ *
249
+ * ```js
250
+ * Scenario('login', async ( {I, login} ) => {
251
+ * await login('admin') // you should use `await`
252
+ * })
253
+ *
254
+ *
255
+ */
256
+ module.exports = function (config) {
257
+ config = Object.assign(defaultConfig, config)
258
+ Object.keys(config.users).map(
259
+ u =>
260
+ (config.users[u] = {
261
+ ...defaultUser,
262
+ ...config.users[u],
263
+ }),
264
+ )
265
+
266
+ if (config.saveToFile) {
267
+ // loading from file
268
+ loadCookiesFromFile(config)
269
+ }
270
+
271
+ const loginFunction = async name => {
272
+ const I = container.support('I')
273
+ const userSession = config.users[name]
274
+
275
+ if (!userSession) {
276
+ throw new Error(`User '${name}' was not configured for authorization in auth plugin. Add it to the plugin config`)
277
+ }
278
+
279
+ const test = store.currentTest
280
+
281
+ // we are in BeforeSuite hook
282
+ if (!test) {
283
+ enableAuthBeforeEachTest(name)
284
+ return
285
+ }
286
+
287
+ const section = new Section(`I am logged in as ${name}`)
288
+
289
+ if (config.saveToFile && !store[`${name}_session`]) {
290
+ loadCookiesFromFile(config)
291
+ }
292
+
293
+ if (isPlaywrightSession() && test?.opts?.cookies) {
294
+ if (test.opts.user == name) {
295
+ debug(`Cookies already loaded for ${name}`)
296
+
297
+ alreadyLoggedIn(name)
298
+ return
299
+ } else {
300
+ debug(`Cookies already loaded for ${test.opts.user}, but not for ${name}`)
301
+ await I.deleteCookie()
302
+ }
303
+ }
304
+
305
+ section.start()
306
+
307
+ const cookies = store[`${name}_session`]
308
+ const shouldAwait = isAsyncFunction(userSession.login) || isAsyncFunction(userSession.restore) || isAsyncFunction(userSession.check)
309
+
310
+ const loginAndSave = async () => {
311
+ if (shouldAwait) {
312
+ await userSession.login(I)
313
+ } else {
314
+ userSession.login(I)
315
+ }
316
+
317
+ section.end()
318
+ const cookies = await userSession.fetch(I)
319
+ if (!cookies) {
320
+ debug("Cannot save user session with empty cookies from auto login's fetch method")
321
+ return
322
+ }
323
+ if (config.saveToFile) {
324
+ debug(`Saved user session into file for ${name}`)
325
+ fs.writeFileSync(path.join(global.output_dir, `${name}_session.json`), JSON.stringify(cookies))
326
+ }
327
+ store[`${name}_session`] = cookies
328
+ }
329
+
330
+ if (!cookies) return loginAndSave()
331
+
332
+ recorder.session.start('check login')
333
+ if (shouldAwait) {
334
+ await userSession.restore(I, cookies)
335
+ await userSession.check(I, cookies)
336
+ } else {
337
+ userSession.restore(I, cookies)
338
+ userSession.check(I, cookies)
339
+ }
340
+ section.end()
341
+ recorder.session.catch(err => {
342
+ debug(`Failed auto login for ${name} due to ${err}`)
343
+ debug('Logging in again')
344
+ recorder.session.start('auto login')
345
+ return loginAndSave()
346
+ .then(() => {
347
+ recorder.add(() => recorder.session.restore('auto login'))
348
+ recorder.catch(() => debug('continue'))
349
+ })
350
+ .catch(err => {
351
+ recorder.session.restore('auto login')
352
+ recorder.session.restore('check login')
353
+ section.end()
354
+ recorder.throw(err)
355
+ })
356
+ })
357
+ recorder.add(() => {
358
+ recorder.session.restore('check login')
359
+ })
360
+
361
+ return recorder.promise()
362
+ }
363
+
364
+ function enableAuthBeforeEachTest(name) {
365
+ const suite = store.currentSuite
366
+ if (!suite) return
367
+
368
+ debug(`enabling auth as ${name} for each test of suite ${suite.title}`)
369
+
370
+ // we are setting test opts so they can be picked up by Playwright if it starts browser for this test
371
+ suite.eachTest(test => {
372
+ // preload from store
373
+ if (store[`${name}_session`]) {
374
+ test.opts.cookies = store[`${name}_session`]
375
+ test.opts.user = name
376
+ return
377
+ }
378
+
379
+ if (!config.saveToFile) return
380
+ const cookieFile = path.join(global.output_dir, `${name}_session.json`)
381
+
382
+ if (!fileExists(cookieFile)) {
383
+ return
384
+ }
385
+
386
+ const context = fs.readFileSync(cookieFile).toString()
387
+ test.opts.cookies = JSON.parse(context)
388
+ test.opts.user = name
389
+ })
390
+
391
+ function runLoginFunctionForTest(test) {
392
+ if (!suite.tests.includes(test)) return
393
+ // let's call this function to ensure that authorization happened
394
+ // if no cookies, it will login and save them
395
+ loginFunction(name)
396
+ }
397
+
398
+ // we are in BeforeSuite hook
399
+ event.dispatcher.on(event.test.started, runLoginFunctionForTest)
400
+ event.dispatcher.on(event.suite.after, () => {
401
+ event.dispatcher.off(event.test.started, runLoginFunctionForTest)
402
+ })
403
+ }
404
+
405
+ // adding this to DI container
406
+ const support = {}
407
+ support[config.inject] = loginFunction
408
+ container.append({ support })
409
+
410
+ return loginFunction
411
+ }
412
+
413
+ function loadCookiesFromFile(config) {
414
+ for (const name in config.users) {
415
+ const fileName = path.join(global.output_dir, `${name}_session.json`)
416
+ if (!fileExists(fileName)) continue
417
+ const data = fs.readFileSync(fileName).toString()
418
+ try {
419
+ store[`${name}_session`] = JSON.parse(data)
420
+ } catch (err) {
421
+ throw new Error(`Could not load session from ${fileName}\n${err}`)
422
+ }
423
+ debug(`Loaded user session for ${name}`)
424
+ }
425
+ }
426
+
427
+ function isPlaywrightSession() {
428
+ return !!container.helpers('Playwright')
429
+ }
430
+
431
+ function alreadyLoggedIn(name) {
432
+ const step = new CommentStep('am logged in as')
433
+ step.actor = 'I'
434
+ return step.addToRecorder([name])
435
+ }
@@ -2,8 +2,8 @@ const Container = require('../container')
2
2
  const store = require('../store')
3
3
  const recorder = require('../recorder')
4
4
  const event = require('../event')
5
- const log = require('../output').log
6
- const supportedHelpers = require('./standardActingHelpers').slice()
5
+ const { log } = require('../output')
6
+ const standardActingHelpers = Container.STANDARD_ACTING_HELPERS
7
7
 
8
8
  const methodsToDelay = ['click', 'fillField', 'checkOption', 'pressKey', 'doubleClick', 'rightClick']
9
9
 
@@ -52,13 +52,13 @@ const defaultConfig = {
52
52
  *
53
53
  */
54
54
  module.exports = function (config) {
55
- supportedHelpers.push('REST')
55
+ const affectedHelpers = [...standardActingHelpers, 'REST']
56
56
  const helpers = Container.helpers()
57
57
  let helper
58
58
 
59
59
  config = Object.assign(defaultConfig, config)
60
60
 
61
- for (const helperName of supportedHelpers) {
61
+ for (const helperName of affectedHelpers) {
62
62
  if (Object.keys(helpers).indexOf(helperName) > -1) {
63
63
  helper = helpers[helperName]
64
64
  }
@@ -66,25 +66,25 @@ module.exports = function (config) {
66
66
 
67
67
  if (!helper) return // no helpers for auto-delay
68
68
 
69
- event.dispatcher.on(event.step.before, (step) => {
69
+ event.dispatcher.on(event.step.before, step => {
70
70
  if (config.methods.indexOf(step.helperMethod) < 0) return // skip non-actions
71
71
 
72
72
  recorder.add('auto-delay', async () => {
73
73
  if (store.debugMode) return // no need to delay in debug
74
74
  log(`Delaying for ${config.delayBefore}ms`)
75
- return new Promise((resolve) => {
75
+ return new Promise(resolve => {
76
76
  setTimeout(resolve, config.delayBefore)
77
77
  })
78
78
  })
79
79
  })
80
80
 
81
- event.dispatcher.on(event.step.after, (step) => {
81
+ event.dispatcher.on(event.step.after, step => {
82
82
  if (config.methods.indexOf(step.helperMethod) < 0) return // skip non-actions
83
83
 
84
84
  recorder.add('auto-delay', async () => {
85
85
  if (store.debugMode) return // no need to delay in debug
86
86
  log(`Delaying for ${config.delayAfter}ms`)
87
- return new Promise((resolve) => {
87
+ return new Promise(resolve => {
88
88
  setTimeout(resolve, config.delayAfter)
89
89
  })
90
90
  })