codeceptjs 4.0.0-rc.23 → 4.0.0-rc.24

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 (73) hide show
  1. package/README.md +9 -10
  2. package/docs/ai.md +3 -51
  3. package/docs/architecture.md +16 -0
  4. package/docs/bootstrap.md +1 -1
  5. package/docs/continuous-integration.md +16 -44
  6. package/docs/custom-helpers.md +1 -1
  7. package/docs/detox.md +1 -1
  8. package/docs/docker.md +1 -30
  9. package/docs/examples.md +0 -1
  10. package/docs/helpers/Appium.md +16 -2
  11. package/docs/helpers/Playwright.md +161 -160
  12. package/docs/helpers/Puppeteer.md +143 -250
  13. package/docs/helpers/WebDriver.md +134 -177
  14. package/docs/hooks.md +11 -1
  15. package/docs/index.md +1 -1
  16. package/docs/installation.md +2 -19
  17. package/docs/locators.md +1 -1
  18. package/docs/migrate-from-cypress.md +98 -0
  19. package/docs/migrate-from-java.md +108 -0
  20. package/docs/migrate-from-protractor.md +101 -0
  21. package/docs/migrate-from-testcafe.md +99 -0
  22. package/docs/migration-4.md +195 -8
  23. package/docs/plugins/aiTrace.md +49 -0
  24. package/docs/plugins/analyze.md +66 -0
  25. package/docs/plugins/auth.md +241 -0
  26. package/docs/plugins/autoDelay.md +48 -0
  27. package/docs/plugins/browser.md +41 -0
  28. package/docs/plugins/coverage.md +39 -0
  29. package/docs/plugins/customLocator.md +119 -0
  30. package/docs/plugins/customReporter.md +16 -0
  31. package/docs/plugins/expose.md +75 -0
  32. package/docs/plugins/heal.md +44 -0
  33. package/docs/plugins/junitReporter.md +51 -0
  34. package/docs/plugins/pageInfo.md +34 -0
  35. package/docs/plugins/pause.md +43 -0
  36. package/docs/plugins/pauseOnFail.md +18 -0
  37. package/docs/plugins/retryFailedStep.md +75 -0
  38. package/docs/plugins/screencast.md +55 -0
  39. package/docs/plugins/screenshot.md +58 -0
  40. package/docs/plugins/screenshotOnFail.md +18 -0
  41. package/docs/plugins/stepTimeout.md +65 -0
  42. package/docs/plugins.md +40 -862
  43. package/docs/reports.md +18 -4
  44. package/docs/retry.md +48 -18
  45. package/docs/store.md +94 -0
  46. package/docs/timeouts.md +1 -1
  47. package/docs/tutorial.md +207 -155
  48. package/docs/webdriver.md +6 -73
  49. package/lib/actor.js +0 -35
  50. package/lib/command/run-multiple.js +1 -2
  51. package/lib/helper/Playwright.js +1 -15
  52. package/lib/helper/Puppeteer.js +0 -103
  53. package/lib/helper/WebDriver.js +1 -28
  54. package/lib/helper/extras/PlaywrightLocator.js +10 -0
  55. package/lib/locator.js +0 -13
  56. package/lib/plugin/analyze.js +3 -4
  57. package/lib/plugin/pauseOnFail.js +3 -1
  58. package/lib/plugin/retryFailedStep.js +7 -7
  59. package/lib/plugin/screenshot.js +0 -5
  60. package/lib/plugin/screenshotOnFail.js +3 -1
  61. package/lib/plugin/stepTimeout.js +1 -1
  62. package/lib/recorder.js +1 -1
  63. package/lib/workers.js +0 -4
  64. package/package.json +3 -4
  65. package/docs/helpers/Mochawesome.md +0 -8
  66. package/docs/helpers/MockServer.md +0 -212
  67. package/docs/helpers/Polly.md +0 -44
  68. package/docs/helpers/Protractor.md +0 -1769
  69. package/docs/helpers/SoftExpectHelper.md +0 -352
  70. package/docs/react.md +0 -70
  71. package/lib/helper/Mochawesome.js +0 -96
  72. package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -61
  73. package/lib/helper/extras/React.js +0 -65
package/docs/plugins.md CHANGED
@@ -1,909 +1,87 @@
1
1
  ---
2
- permalink: plugins
3
- sidebarDepth:
2
+ permalink: /plugins
3
+ editLink: false
4
4
  sidebar: auto
5
5
  title: Plugins
6
6
  ---
7
7
 
8
- <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
8
+ # Plugins
9
9
 
10
- ## aiTrace
10
+ CodeceptJS bundles the following plugins. Each plugin has its own page with full configuration reference.
11
11
 
12
- Generates AI-friendly trace files for debugging with AI agents.
13
- This plugin creates a markdown file with test execution logs and links to all artifacts
14
- (screenshots, HTML, ARIA snapshots, browser logs, HTTP requests) for each step.
12
+ ## [pause](/plugins/pause)
15
13
 
16
- #### Configuration
14
+ Pauses test execution interactively. Replaces the legacy `pauseOnFail` plugin. The default `on=fail` matches the old `pauseOnFail` behavior.
17
15
 
18
- ```js
19
- "plugins": {
20
- "aiTrace": {
21
- "enabled": true
22
- }
23
- }
24
- ```
16
+ ## [pageInfo](/plugins/pageInfo)
25
17
 
26
- Possible config options:
18
+ Collects information from web page after each failed test and adds it to the test as an artifact. It is suggested to enable this plugin if you run tests on CI and you need to debug failed tests. This plugin can be paired with `analyze` plugin to provide more context.
27
19
 
28
- * `deleteSuccessful`: delete traces for successfully executed tests. Default: false.
29
- * `fullPageScreenshots`: should full page screenshots be used. Default: false.
30
- * `output`: a directory where traces should be stored. Default: `output`.
31
- * `captureHTML`: capture HTML for each step. Default: true.
32
- * `captureARIA`: capture ARIA snapshot for each step. Default: true.
33
- * `captureBrowserLogs`: capture browser console logs. Default: true.
34
- * `captureHTTP`: capture HTTP requests (requires `trace` or `recordHar` enabled in helper config). Default: true.
35
- * `captureDebugOutput`: capture CodeceptJS debug output. Default: true.
36
- * `ignoreSteps`: steps to ignore in trace. Array of RegExps is expected.
20
+ ## [expose](/plugins/expose)
37
21
 
38
- ### Parameters
22
+ Exposes properties from helper instances as injectable test arguments. Use it to access the underlying Playwright/Puppeteer `page`, the wdio `browser` client, or any other helper internal directly from a Scenario:
39
23
 
40
- * `config` **any**&#x20;
41
-
42
- ## analyze
43
-
44
- Uses AI to analyze test failures and provide insights
45
-
46
- This plugin analyzes failed tests using AI to provide detailed explanations and group similar failures.
47
- When enabled with --ai flag, it generates reports after test execution.
48
-
49
- #### Usage
50
-
51
- ```js
52
- // in codecept.conf.js
53
- exports.config = {
54
- plugins: {
55
- analyze: {
56
- enabled: true,
57
- clusterize: 5,
58
- analyze: 2,
59
- vision: false
60
- }
61
- }
62
- }
63
- ```
64
-
65
- #### Configuration
66
-
67
- * `clusterize` (number) - minimum number of failures to trigger clustering analysis. Default: 5
68
- * `analyze` (number) - maximum number of individual test failures to analyze in detail. Default: 2
69
- * `vision` (boolean) - enables visual analysis of test screenshots. Default: false
70
- * `categories` (array) - list of failure categories for classification. Defaults to:
71
- * Browser connection error / browser crash
72
- * Network errors (server error, timeout, etc)
73
- * HTML / page elements (not found, not visible, etc)
74
- * Navigation errors (404, etc)
75
- * Code errors (syntax error, JS errors, etc)
76
- * Library & framework errors
77
- * Data errors (password incorrect, invalid format, etc)
78
- * Assertion failures
79
- * Other errors
80
- * `prompts` (object) - customize AI prompts for analysis
81
- * `clusterize` - prompt for clustering analysis
82
- * `analyze` - prompt for individual test analysis
83
-
84
- #### Features
85
-
86
- * Groups similar failures when number of failures >= clusterize value
87
- * Provides detailed analysis of individual failures
88
- * Analyzes screenshots if vision=true and screenshots are available
89
- * Classifies failures into predefined categories
90
- * Suggests possible causes and solutions
91
-
92
- ### Parameters
93
-
94
- * `config` **[Object][1]** Plugin configuration (optional, default `{}`)
95
-
96
- Returns **void**&#x20;
97
-
98
- ## auth
99
-
100
- Logs user in for the first test and reuses session for next tests.
101
- Works by saving cookies into memory or file.
102
- If a session expires automatically logs in again.
103
-
104
- > For better development experience cookies can be saved into file, so a session can be reused while writing tests.
105
-
106
- #### Usage
107
-
108
- 1. Enable this plugin and configure as described below
109
- 2. Define user session names (example: `user`, `editor`, `admin`, etc).
110
- 3. Define how users are logged in and how to check that user is logged in
111
- 4. Use `login` object inside your tests to log in:
112
-
113
- ```js
114
- // inside a test file
115
- // use login to inject auto-login function
116
- Feature('Login');
117
-
118
- Before(({ login }) => {
119
- login('user'); // login using user session
120
- });
121
-
122
- // Alternatively log in for one scenario.
123
- Scenario('log me in', ( { I, login } ) => {
124
- login('admin');
125
- I.see('I am logged in');
126
- });
127
- ```
128
-
129
- #### Configuration
130
-
131
- * `saveToFile` (default: false) - save cookies to file. Allows to reuse session between execution.
132
- * `inject` (default: `login`) - name of the login function to use
133
- * `users` - an array containing different session names and functions to:
134
- * `login` - sign in into the system
135
- * `check` - check that user is logged in
136
- * `fetch` - to get current cookies (by default `I.grabCookie()`)
137
- * `restore` - to set cookies (by default `I.amOnPage('/'); I.setCookie(cookie)`)
138
-
139
- #### How It Works
140
-
141
- 1. `restore` method is executed. It should open a page and set credentials.
142
- 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.
143
- 3. If `restore` and `check` were not successful, `login` is executed
144
- 4. `login` should fill in login form
145
- 5. After successful login, `fetch` is executed to save cookies into memory or file.
146
-
147
- #### Example: Simple login
148
-
149
- ```js
150
- auth: {
151
- enabled: true,
152
- saveToFile: true,
153
- inject: 'login',
154
- users: {
155
- admin: {
156
- // loginAdmin function is defined in `steps_file.js`
157
- login: (I) => I.loginAdmin(),
158
- // if we see `Admin` on page, we assume we are logged in
159
- check: (I) => {
160
- I.amOnPage('/');
161
- I.see('Admin');
162
- }
163
- }
164
- }
165
- }
166
- ```
167
-
168
- #### Example: Multiple users
169
-
170
- ```js
171
- auth: {
172
- enabled: true,
173
- saveToFile: true,
174
- inject: 'loginAs', // use `loginAs` instead of login
175
- users: {
176
- user: {
177
- login: (I) => {
178
- I.amOnPage('/login');
179
- I.fillField('email', 'user@site.com');
180
- I.fillField('password', '123456');
181
- I.click('Login');
182
- },
183
- check: (I) => {
184
- I.amOnPage('/');
185
- I.see('User', '.navbar');
186
- },
187
- },
188
- admin: {
189
- login: (I) => {
190
- I.amOnPage('/login');
191
- I.fillField('email', 'admin@site.com');
192
- I.fillField('password', '123456');
193
- I.click('Login');
194
- },
195
- check: (I) => {
196
- I.amOnPage('/');
197
- I.see('Admin', '.navbar');
198
- },
199
- },
200
- }
201
- }
202
- ```
203
-
204
- #### Example: Keep cookies between tests
205
-
206
- If you decide to keep cookies between tests you don't need to save/retrieve cookies between tests.
207
- But you need to login once work until session expires.
208
- For this case, disable `fetch` and `restore` methods.
209
-
210
- ```js
211
- helpers: {
212
- WebDriver: {
213
- // config goes here
214
- keepCookies: true; // keep cookies for all tests
215
- }
216
- },
217
- plugins: {
218
- auth: {
219
- users: {
220
- admin: {
221
- login: (I) => {
222
- I.amOnPage('/login');
223
- I.fillField('email', 'admin@site.com');
224
- I.fillField('password', '123456');
225
- I.click('Login');
226
- },
227
- check: (I) => {
228
- I.amOnPage('/dashboard');
229
- I.see('Admin', '.navbar');
230
- },
231
- fetch: () => {}, // empty function
232
- restore: () => {}, // empty funciton
233
- }
234
- }
235
- }
236
- }
237
- ```
238
-
239
- #### Example: Getting sessions from local storage
240
-
241
- If your session is stored in local storage instead of cookies you still can obtain sessions.
242
-
243
- ```js
244
- plugins: {
245
- auth: {
246
- admin: {
247
- login: (I) => I.loginAsAdmin(),
248
- check: (I) => I.see('Admin', '.navbar'),
249
- fetch: (I) => {
250
- return I.executeScript(() => localStorage.getItem('session_id'));
251
- },
252
- restore: (I, session) => {
253
- I.amOnPage('/');
254
- I.executeScript((session) => localStorage.setItem('session_id', session), session);
255
- },
256
- }
257
- }
258
- }
259
- ```
260
-
261
- #### Tips: Using async function in the auth
262
-
263
- If you use async functions in the auth plugin, login function should be used with `await` keyword.
264
-
265
- ```js
266
- auth: {
267
- enabled: true,
268
- saveToFile: true,
269
- inject: 'login',
270
- users: {
271
- admin: {
272
- login: async (I) => { // If you use async function in the auth plugin
273
- const phrase = await I.grabTextFrom('#phrase')
274
- I.fillField('username', 'admin'),
275
- I.fillField('password', 'password')
276
- I.fillField('phrase', phrase)
277
- },
278
- check: (I) => {
279
- I.amOnPage('/');
280
- I.see('Admin');
281
- },
282
- }
283
- }
284
- }
285
- ```
286
-
287
- ```js
288
- Scenario('login', async ( {I, login} ) => {
289
- await login('admin') // you should use `await`
290
- })
291
- ```
292
-
293
- #### Tips: Using session to validate user
294
-
295
- Instead of asserting on page elements for the current user in `check`, you can use the `session` you saved in `fetch`
296
-
297
- ```js
298
- auth: {
299
- enabled: true,
300
- saveToFile: true,
301
- inject: 'login',
302
- users: {
303
- admin: {
304
- login: async (I) => { // If you use async function in the auth plugin
305
- const phrase = await I.grabTextFrom('#phrase')
306
- I.fillField('username', 'admin'),
307
- I.fillField('password', 'password')
308
- I.fillField('phrase', phrase)
309
- },
310
- check: (I, session) => {
311
- // Throwing an error in `check` will make CodeceptJS perform the login step for the user
312
- if (session.profile.email !== the.email.you.expect@some-mail.com) {
313
- throw new Error ('Wrong user signed in');
314
- }
315
- },
316
- }
317
- }
318
- }
319
- ```
320
-
321
- ```js
322
- Scenario('login', async ( {I, login} ) => {
323
- await login('admin') // you should use `await`
324
- })
325
- ```
326
-
327
- ### Parameters
328
-
329
- * `config` &#x20;
330
-
331
- ## autoDelay
332
-
333
- Sometimes it takes some time for a page to respond to user's actions.
334
- Depending on app's performance this can be either slow or fast.
335
-
336
- For instance, if you click a button and nothing happens - probably JS event is not attached to this button yet
337
- Also, if you fill field and input validation doesn't accept your input - maybe because you typed value too fast.
338
-
339
- This plugin allows to slow down tests execution when a test running too fast.
340
- It puts a tiny delay for before and after action commands.
341
-
342
- Commands affected (by default):
343
-
344
- * `click`
345
- * `fillField`
346
- * `checkOption`
347
- * `pressKey`
348
- * `doubleClick`
349
- * `rightClick`
350
-
351
- #### Configuration
352
-
353
- ```js
354
- plugins: {
355
- autoDelay: {
356
- enabled: true
357
- }
358
- }
359
- ```
360
-
361
- Possible config options:
362
-
363
- * `methods`: list of affected commands. Can be overridden
364
- * `delayBefore`: put a delay before a command. 100ms by default
365
- * `delayAfter`: put a delay after a command. 200ms by default
366
-
367
- ### Parameters
368
-
369
- * `config` &#x20;
370
-
371
- ## browser
372
-
373
- Overrides browser helper config from the command line. Works for all browser helpers
374
- (Playwright, Puppeteer, WebDriver, Appium) without touching `codecept.conf`.
375
-
376
- Enable it via `-p` option with one or more colon-chained args:
377
-
378
- npx codeceptjs run -p browser:show
379
- npx codeceptjs run -p browser:hide
380
- npx codeceptjs run -p browser:browser=firefox
381
- npx codeceptjs run -p browser:windowSize=1024x768:video=false
382
- npx codeceptjs run -p browser:hide:browser=webkit:windowSize=800x600
383
-
384
- #### Args
385
-
386
- * **show** — force visible browser
387
- * **hide** — force headless (also injects `--headless` into WebDriver chrome/firefox capability args)
388
- * **`<key>=<value>`** — set `helpers.<eachBrowserHelper>.<key> = <value>`. Three keys
389
- get per-helper translation via `setBrowserConfig`:
390
- * `browser=<name>` — Puppeteer receives `product`, Playwright receives `browser`
391
- * `windowSize=WxH` — also adds `--window-size=W,H` chromium/chrome args
392
- * `show=true|false` — toggles `show` on Playwright/Puppeteer; injects/strips
393
- `--headless` in WebDriver chrome/firefox capability args
394
-
395
- Values stay as strings. `true` / `false` are coerced to booleans.
396
-
397
- Requires `@codeceptjs/configure` to be installed; if missing, the plugin
398
- logs a hint and skips the override.
399
-
400
- ### Parameters
401
-
402
- * `config` (optional, default `{}`)
403
-
404
- ## coverage
405
-
406
- Dumps code coverage from Playwright/Puppeteer after every test.
407
-
408
- #### Configuration
409
-
410
- ```js
411
- plugins: {
412
- coverage: {
413
- enabled: true,
414
- debug: true,
415
- name: 'CodeceptJS Coverage Report',
416
- outputDir: 'output/coverage'
417
- }
418
- }
419
- ```
420
-
421
- Possible config options, More could be found at [monocart-coverage-reports][2]
422
-
423
- * `debug`: debug info. By default, false.
424
- * `name`: coverage report name.
425
- * `outputDir`: path to coverage report.
426
- * `sourceFilter`: filter the source files.
427
- * `sourcePath`: option to resolve a custom path.
428
-
429
- ### Parameters
430
-
431
- * `config` &#x20;
432
-
433
- ## customLocator
434
-
435
- Creates a [custom locator][3] by using special attributes in HTML.
436
-
437
- If you have a convention to use `data-test-id` or `data-qa` attributes to mark active elements for e2e tests,
438
- you can enable this plugin to simplify matching elements with these attributes:
439
-
440
- ```js
441
- // replace this:
442
- I.click({ css: '[data-test-id=register_button]');
443
- // with this:
444
- I.click('$register_button');
445
- ```
446
-
447
- This plugin will create a valid XPath locator for you.
448
-
449
- #### Configuration
450
-
451
- * `enabled` (default: `false`) should a locator be enabled
452
- * `prefix` (default: `$`) sets a prefix for a custom locator.
453
- * `attribute` (default: `data-test-id`) to set an attribute to be matched.
454
- * `strategy` (default: `xpath`) actual locator strategy to use in query (`css` or `xpath`).
455
- * `showActual` (default: false) show in the output actually produced XPath or CSS locator. By default shows custom locator value.
456
-
457
- #### Examples:
458
-
459
- Using `data-test` attribute with `$` prefix:
460
-
461
- ```js
462
- // in codecept.conf.js
463
- plugins: {
464
- customLocator: {
465
- enabled: true,
466
- attribute: 'data-test'
467
- }
468
- }
469
- ```
470
-
471
- In a test:
472
-
473
- ```js
474
- I.seeElement('$user'); // matches => [data-test=user]
475
- I.click('$sign-up'); // matches => [data-test=sign-up]
476
- ```
477
-
478
- Using `data-qa` attribute with `=` prefix:
479
-
480
- ```js
481
- // in codecept.conf.js
482
- plugins: {
483
- customLocator: {
484
- enabled: true,
485
- prefix: '=',
486
- attribute: 'data-qa'
487
- }
488
- }
489
- ```
490
-
491
- In a test:
492
-
493
- ```js
494
- I.seeElement('=user'); // matches => [data-qa=user]
495
- I.click('=sign-up'); // matches => [data-qa=sign-up]
496
- ```
497
-
498
- Using `data-qa` OR `data-test` attribute with `=` prefix:
499
-
500
- ```js
501
- // in codecept.conf.js
502
- plugins: {
503
- customLocator: {
504
- enabled: true,
505
- prefix: '=',
506
- attribute: ['data-qa', 'data-test'],
507
- strategy: 'xpath'
508
- }
509
- }
510
- ```
511
-
512
- In a test:
513
-
514
- ```js
515
- I.seeElement('=user'); // matches => //*[@data-qa=user or @data-test=user]
516
- I.click('=sign-up'); // matches => //*[data-qa=sign-up or @data-test=sign-up]
517
- ```
518
-
519
- ```js
520
- // in codecept.conf.js
521
- plugins: {
522
- customLocator: {
523
- enabled: true,
524
- prefix: '=',
525
- attribute: ['data-qa', 'data-test'],
526
- strategy: 'css'
527
- }
528
- }
529
- ```
530
-
531
- In a test:
532
-
533
- ```js
534
- I.seeElement('=user'); // matches => [data-qa=user],[data-test=user]
535
- I.click('=sign-up'); // matches => [data-qa=sign-up],[data-test=sign-up]
536
- ```
537
-
538
- ### Parameters
539
-
540
- * `config` &#x20;
541
-
542
- ## customReporter
543
-
544
- Sample custom reporter for CodeceptJS.
545
-
546
- ### Parameters
547
-
548
- * `config` &#x20;
549
-
550
- ## heal
551
-
552
- Self-healing tests with AI.
553
-
554
- Read more about heaking in [Self-Healing Tests][4]
555
-
556
- ```js
557
- plugins: {
558
- heal: {
559
- enabled: true,
560
- }
561
- }
562
- ```
563
-
564
- More config options are available:
565
-
566
- * `healLimit` - how many steps can be healed in a single test (default: 2)
567
-
568
- ### Parameters
569
-
570
- * `config` (optional, default `{}`)
571
-
572
- ## junitReporter
24
+ ## [junitReporter](/plugins/junitReporter)
573
25
 
574
26
  Generates a JUnit-compatible XML report after a test run.
575
27
 
576
- Unlike Mocha's `mocha-junit-reporter`, this plugin understands CodeceptJS steps and substeps.
577
- For every `<testcase>` it includes:
578
-
579
- * `<properties>` — the test's meta information: every `meta` key from `Scenario('...', { meta })`, plus its `tags` and `retries`
580
- * `<system-out>` — an indented step/substep log (substeps are nested under their meta step); only failed steps are marked
581
- * `<failure>` — for failed tests: the error message, type, stack trace and (optionally) the step trace
582
-
583
- The produced file is consumable by Jenkins, GitLab CI, CircleCI, GitHub Actions test reporters, etc.
584
-
585
- #### Configuration
586
-
587
- ```js
588
- "plugins": {
589
- "junitReporter": {
590
- "enabled": true
591
- }
592
- }
593
- ```
594
-
595
- Possible config options:
596
-
597
- * `outputName`: file name for the report. Default: `report.xml`.
598
- * `output`: directory where the report is stored, relative to the project root. Default: the `output` directory.
599
- * `testGroupName`: value of the `name` attribute on the root `<testsuites>` element. Default: `CodeceptJS`.
600
- * `attachMeta`: add the test's meta information (`meta` keys, `tags`, `retries`) as `<properties>`. Default: true.
601
- * `attachSteps`: add the step/substep log as `<system-out>`. Default: true.
602
- * `stepsInFailure`: append the step trace to the `<failure>` body. Default: true.
603
-
604
- CLI examples:
605
-
606
- npx codeceptjs run -p junitReporter
607
- npx codeceptjs run -p junitReporter:outputName=junit.xml
608
-
609
- > ℹ When running with `run-workers`, steps are serialized between processes and substep nesting is flattened.
610
-
611
- ### Parameters
612
-
613
- * `config` **any** (optional, default `{}`)
614
-
615
- ## pageInfo
616
-
617
- Collects information from web page after each failed test and adds it to the test as an artifact.
618
- It is suggested to enable this plugin if you run tests on CI and you need to debug failed tests.
619
- This plugin can be paired with `analyze` plugin to provide more context.
620
-
621
- It collects URL, HTML errors (by classes), and browser logs.
622
-
623
- Enable this plugin in config:
624
-
625
- ```js
626
- plugins: {
627
- pageInfo: {
628
- enabled: true,
629
- }
630
- ```
631
-
632
- Additional config options:
633
-
634
- * `errorClasses` - list of classes to search for errors (default: `['error', 'warning', 'alert', 'danger']`)
635
- * `browserLogs` - list of types of errors to search for in browser logs (default: `['error']`)
636
-
637
- ### Parameters
638
-
639
- * `config` (optional, default `{}`)
640
-
641
- ## pause
28
+ ## [coverage](/plugins/coverage)
642
29
 
643
- Pauses test execution interactively. Replaces the legacy `pauseOnFail` plugin.
644
- Default `on=fail` matches the old `pauseOnFail` behavior.
645
-
646
- ```js
647
- plugins: {
648
- pause: {
649
- enabled: false,
650
- on: 'fail',
651
- }
652
- }
653
- ```
654
-
655
- #### `on=` modes
656
-
657
- * **fail** — pause when a step fails (default)
658
- * **test** — pause after each test
659
- * **step** — pause before the first step (interactive walk-through)
660
- * **file** — pause when execution reaches `path=...[;line=...]`
661
- * **url** — pause when the current URL matches `pattern=...`
662
-
663
- CLI examples:
664
-
665
- npx codeceptjs run -p pause
666
- npx codeceptjs run -p pause:on=step
667
- npx codeceptjs run -p pause:on=file:path=tests/login_test.js
668
- npx codeceptjs run -p pause:on=file:path=tests/login_test.js;line=43
669
- npx codeceptjs run -p pause:on=url:pattern=/users/*
670
-
671
- > The legacy `pauseOnFail` plugin remains as a deprecated alias that emits a
672
- > deprecation warning and forwards to `pause` with `on=fail`.
673
-
674
- ### Parameters
675
-
676
- * `config` (optional, default `{}`)
677
-
678
- ## retryFailedStep
679
-
680
- Retries each failed step in a test.
681
-
682
- Add this plugin to config file:
683
-
684
- ```js
685
- plugins: {
686
- retryFailedStep: {
687
- enabled: true
688
- }
689
- }
690
- ```
691
-
692
- Run tests with plugin enabled:
693
-
694
- npx codeceptjs run --plugins retryFailedStep
695
-
696
- #### Configuration:
697
-
698
- * `retries` - number of retries (by default 3),
699
- * `when` - function, when to perform a retry (accepts error as parameter)
700
- * `factor` - The exponential factor to use. Default is 1.5.
701
- * `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000.
702
- * `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity.
703
- * `randomize` - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false.
704
- * `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes:
705
- * `amOnPage`
706
- * `wait*`
707
- * `send*`
708
- * `execute*`
709
- * `run*`
710
- * `have*`
711
- * `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list.
712
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
713
- To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well.
714
- * `deferToScenarioRetries` - when enabled (default), step retries are automatically disabled if scenario retries are configured to avoid excessive total retries.
715
-
716
- #### Example
717
-
718
- ```js
719
- plugins: {
720
- retryFailedStep: {
721
- enabled: true,
722
- ignoredSteps: [
723
- 'scroll*', // ignore all scroll steps
724
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
725
- ]
726
- }
727
- }
728
- ```
729
-
730
- #### Disable Per Test
731
-
732
- This plugin can be disabled per test. In this case you will need to stet `I.retry()` to all flaky steps:
733
-
734
- Use scenario configuration to disable plugin for a test
735
-
736
- ```js
737
- Scenario('scenario tite', { disableRetryFailedStep: true }, () => {
738
- // test goes here
739
- })
740
- ```
741
-
742
- ### Parameters
743
-
744
- * `config` &#x20;
745
-
746
- ## screencast
747
-
748
- Records WebM video of tests using Playwright's screencast API (Playwright >= 1.59).
749
- When `captions` is enabled, action annotations are burned into the video; when
750
- `subtitles` is enabled, a standalone `.srt` file is also produced.
751
-
752
- ```js
753
- plugins: {
754
- screencast: {
755
- enabled: true,
756
- on: 'fail',
757
- }
758
- }
759
- ```
760
-
761
- #### `on=` modes
762
-
763
- * **fail** — record while running; delete on pass, keep on fail (default)
764
- * **test** — record and keep every test's video
765
-
766
- CLI examples:
767
-
768
- npx codeceptjs run -p screencast
769
- npx codeceptjs run -p screencast:on=test
770
- npx codeceptjs run -p screencast:on=test;captions=false;subtitles=true
771
-
772
- Possible config options:
773
-
774
- * `captions`: burn-in action overlays via `page.screencast.showActions()`. Default: true.
775
- * `subtitles`: also write a standalone `.srt` file alongside the video. Default: false.
776
- * `video`: record a video. With `video=false, subtitles=true`, only the `.srt` is produced (next to `test.artifacts.video` if a helper recorded one). Default: true.
777
- * `size`: pass-through `{ width, height }` for `screencast.start`.
778
- * `quality`: pass-through 0–100 for `screencast.start`.
779
-
780
- > Enabling Playwright's helper-level `video: true` and this plugin together
781
- > produces two independent recordings. Pick one.
782
-
783
- ### Parameters
30
+ Dumps code coverage from Playwright/Puppeteer after every test.
784
31
 
785
- * `config` &#x20;
32
+ ## [screenshot](/plugins/screenshot)
786
33
 
787
- ## screenshot
34
+ Saves screenshots from the browser at points triggered by `on=`.
788
35
 
789
- Saves screenshots from the browser at points triggered by `on=`. Replaces the
790
- legacy `screenshotOnFail` plugin. Default `on=fail` preserves the old behavior.
36
+ ## [screencast](/plugins/screencast)
791
37
 
792
- This plugin is **enabled by default**.
38
+ Records WebM video of tests using Playwright's screencast API.
793
39
 
794
- ```js
795
- plugins: {
796
- screenshot: {
797
- enabled: true,
798
- on: 'fail',
799
- }
800
- }
801
- ```
40
+ ## [customLocator](/plugins/customLocator)
802
41
 
803
- #### `on=` modes
42
+ Creates a [custom locator][1] by using special attributes in HTML.
804
43
 
805
- * **fail** — screenshot when a test fails (default)
806
- * **test** — screenshot at the end of every test
807
- * **step** — screenshot after every step
808
- * **file** — screenshot for steps in `path=...[;line=...]`
809
- * **url** — screenshot when the current URL matches `pattern=...`
44
+ ## [aiTrace](/plugins/aiTrace)
810
45
 
811
- CLI examples:
46
+ Generates AI-friendly trace files for debugging with AI agents. This plugin creates a markdown file with test execution logs and links to all artifacts (screenshots, HTML, ARIA snapshots, browser logs, HTTP requests) for each step.
812
47
 
813
- npx codeceptjs run -p screenshot
814
- npx codeceptjs run -p screenshot:on=step
815
- npx codeceptjs run -p screenshot:on=step;slides=true
816
- npx codeceptjs run -p screenshot:on=file:path=tests/login_test.js
817
- npx codeceptjs run -p screenshot:on=url:pattern=/users/*
48
+ ## [auth](/plugins/auth)
818
49
 
819
- Possible config options:
50
+ Logs user in for the first test and reuses session for next tests. Works by saving cookies into memory or file. If a session expires automatically logs in again.
820
51
 
821
- * `uniqueScreenshotNames`: use unique names for screenshot. Default: false.
822
- * `fullPageScreenshots`: make full page screenshots. Default: false.
823
- * `slides`: generate a step-by-step slideshow report (works with `on=step|file|url`). Replaces the legacy `stepByStepReport` plugin. Default: false.
824
- * `deleteSuccessful`: when `slides=true`, drop slideshow folders for passing tests. Default: true.
825
- * `animateSlides`: when `slides=true`, animate transitions between slides. Default: true.
826
- * `ignoreSteps`: when `slides=true`, RegExps of step names to skip in the slideshow.
52
+ ## [pauseOnFail](/plugins/pauseOnFail)
827
53
 
828
- #### Step-by-step slideshow
54
+ Starts an interactive pause when a test fails.
829
55
 
830
- `screenshot:on=step;slides=true` writes a per-test `record_<hash>/index.html`
831
- slideshow and a top-level `records.html` index. The output is a self-contained
832
- HTML page with keyboard / dot navigation — no external assets, no JavaScript
833
- frameworks.
56
+ ## [analyze](/plugins/analyze)
834
57
 
835
- > The legacy `screenshotOnFail` plugin remains as a deprecated alias. The legacy
836
- > `stepByStepReport` plugin has been replaced by `screenshot:slides=true`.
58
+ Uses AI to analyze test failures and provide insights
837
59
 
838
- ### Parameters
60
+ ## [autoDelay](/plugins/autoDelay)
839
61
 
840
- * `config` &#x20;
62
+ Sometimes it takes some time for a page to respond to user's actions. Depending on app's performance this can be either slow or fast.
841
63
 
842
- ## stepTimeout
64
+ ## [stepTimeout](/plugins/stepTimeout)
843
65
 
844
66
  Set timeout for test steps globally.
845
67
 
846
- Add this plugin to config file:
847
-
848
- ```js
849
- plugins: {
850
- stepTimeout: {
851
- enabled: true
852
- }
853
- }
854
- ```
68
+ ## [heal](/plugins/heal)
855
69
 
856
- Run tests with plugin enabled:
857
-
858
- npx codeceptjs run --plugins stepTimeout
859
-
860
- #### Configuration:
861
-
862
- * `timeout` - global step timeout, default 150 seconds
863
-
864
- * `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false
865
-
866
- * `noTimeoutSteps` - an array of steps with no timeout. Default:
867
-
868
- * `amOnPage`
869
- * `wait*`
870
-
871
- you could set your own noTimeoutSteps which would replace the default one.
872
-
873
- * `customTimeoutSteps` - an array of step actions with custom timeout. Use it to override or extend noTimeoutSteps.
874
- You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
875
-
876
- #### Example
70
+ Self-healing tests with AI.
877
71
 
878
- ```js
879
- plugins: {
880
- stepTimeout: {
881
- enabled: true,
882
- overrideStepLimits: true,
883
- noTimeoutSteps: [
884
- 'scroll*', // ignore all scroll steps
885
- /Cookie/, // ignore all steps with a Cookie in it (by regexp)
886
- ],
887
- customTimeoutSteps: [
888
- ['myFlakyStep*', 1],
889
- ['scrollWhichRequiresTimeout', 5],
890
- ]
891
- }
892
- }
893
- ```
72
+ ## [customReporter](/plugins/customReporter)
894
73
 
895
- ### Parameters
74
+ Sample custom reporter for CodeceptJS.
896
75
 
897
- * `config` &#x20;
76
+ ## [screenshotOnFail](/plugins/screenshotOnFail)
898
77
 
899
- [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
78
+ Saves a screenshot when a test fails.
900
79
 
901
- [2]: https://github.com/cenfun/monocart-coverage-reports?tab=readme-ov-file#default-options
80
+ ## [retryFailedStep](/plugins/retryFailedStep)
902
81
 
903
- [3]: https://codecept.io/locators#custom-locators
82
+ Retries each failed step in a test.
904
83
 
905
- [4]: https://codecept.io/heal/
84
+ ## [browser](/plugins/browser)
906
85
 
907
- [5]: /basics/#pause
86
+ Overrides browser helper config from the command line. Works for all browser helpers (Playwright, Puppeteer, WebDriver, Appium) without touching `codecept.conf`.
908
87
 
909
- [6]: https://codecept.io/img/codeceptjs-slideshow.gif