codeceptjs 4.0.0-rc.22 → 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.
- package/README.md +9 -10
- package/docs/ai.md +3 -51
- package/docs/architecture.md +16 -0
- package/docs/bootstrap.md +1 -1
- package/docs/continuous-integration.md +16 -44
- package/docs/custom-helpers.md +1 -1
- package/docs/detox.md +1 -1
- package/docs/docker.md +1 -30
- package/docs/examples.md +0 -1
- package/docs/helpers/Appium.md +16 -2
- package/docs/helpers/Playwright.md +161 -160
- package/docs/helpers/Puppeteer.md +143 -250
- package/docs/helpers/WebDriver.md +134 -177
- package/docs/hooks.md +11 -1
- package/docs/index.md +1 -1
- package/docs/installation.md +2 -19
- package/docs/locators.md +1 -1
- package/docs/migrate-from-cypress.md +98 -0
- package/docs/migrate-from-java.md +108 -0
- package/docs/migrate-from-protractor.md +101 -0
- package/docs/migrate-from-testcafe.md +99 -0
- package/docs/migration-4.md +195 -8
- package/docs/plugins/aiTrace.md +49 -0
- package/docs/plugins/analyze.md +66 -0
- package/docs/plugins/auth.md +241 -0
- package/docs/plugins/autoDelay.md +48 -0
- package/docs/plugins/browser.md +41 -0
- package/docs/plugins/coverage.md +39 -0
- package/docs/plugins/customLocator.md +119 -0
- package/docs/plugins/customReporter.md +16 -0
- package/docs/plugins/expose.md +75 -0
- package/docs/plugins/heal.md +44 -0
- package/docs/plugins/junitReporter.md +51 -0
- package/docs/plugins/pageInfo.md +34 -0
- package/docs/plugins/pause.md +43 -0
- package/docs/plugins/pauseOnFail.md +18 -0
- package/docs/plugins/retryFailedStep.md +75 -0
- package/docs/plugins/screencast.md +55 -0
- package/docs/plugins/screenshot.md +58 -0
- package/docs/plugins/screenshotOnFail.md +18 -0
- package/docs/plugins/stepTimeout.md +65 -0
- package/docs/plugins.md +40 -862
- package/docs/reports.md +18 -4
- package/docs/retry.md +48 -18
- package/docs/store.md +94 -0
- package/docs/timeouts.md +1 -1
- package/docs/tutorial.md +207 -155
- package/docs/webdriver.md +6 -73
- package/lib/actor.js +1 -36
- package/lib/command/run-multiple.js +1 -2
- package/lib/heal.js +2 -2
- package/lib/helper/Playwright.js +1 -15
- package/lib/helper/Puppeteer.js +0 -103
- package/lib/helper/WebDriver.js +1 -28
- package/lib/helper/extras/PlaywrightLocator.js +10 -0
- package/lib/locator.js +0 -13
- package/lib/plugin/aiTrace.js +4 -3
- package/lib/plugin/analyze.js +3 -4
- package/lib/plugin/junitReporter.js +1 -1
- package/lib/plugin/pauseOnFail.js +3 -1
- package/lib/plugin/retryFailedStep.js +11 -10
- package/lib/plugin/screencast.js +1 -1
- package/lib/plugin/screenshot.js +2 -7
- package/lib/plugin/screenshotOnFail.js +3 -1
- package/lib/plugin/stepTimeout.js +3 -2
- package/lib/recorder.js +1 -1
- package/lib/step/base.js +7 -7
- package/lib/step/comment.js +2 -2
- package/lib/step/helper.js +4 -4
- package/lib/step/meta.js +3 -3
- package/lib/step/record.js +3 -3
- package/lib/workers.js +0 -4
- package/package.json +3 -4
- package/docs/helpers/Mochawesome.md +0 -8
- package/docs/helpers/MockServer.md +0 -212
- package/docs/helpers/Polly.md +0 -44
- package/docs/helpers/Protractor.md +0 -1769
- package/docs/helpers/SoftExpectHelper.md +0 -352
- package/docs/react.md +0 -70
- package/lib/helper/Mochawesome.js +0 -96
- package/lib/helper/extras/PlaywrightReactVueLocator.js +0 -61
- package/lib/helper/extras/React.js +0 -65
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/coverage
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: coverage
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## coverage
|
|
11
|
+
|
|
12
|
+
Dumps code coverage from Playwright/Puppeteer after every test.
|
|
13
|
+
|
|
14
|
+
#### Configuration
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
plugins: {
|
|
18
|
+
coverage: {
|
|
19
|
+
enabled: true,
|
|
20
|
+
debug: true,
|
|
21
|
+
name: 'CodeceptJS Coverage Report',
|
|
22
|
+
outputDir: 'output/coverage'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Possible config options, More could be found at [monocart-coverage-reports][1]
|
|
28
|
+
|
|
29
|
+
* `debug`: debug info. By default, false.
|
|
30
|
+
* `name`: coverage report name.
|
|
31
|
+
* `outputDir`: path to coverage report.
|
|
32
|
+
* `sourceFilter`: filter the source files.
|
|
33
|
+
* `sourcePath`: option to resolve a custom path.
|
|
34
|
+
|
|
35
|
+
### Parameters
|
|
36
|
+
|
|
37
|
+
* `config`  
|
|
38
|
+
|
|
39
|
+
[1]: https://github.com/cenfun/monocart-coverage-reports?tab=readme-ov-file#default-options
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/customLocator
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: customLocator
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## customLocator
|
|
11
|
+
|
|
12
|
+
Creates a [custom locator][1] by using special attributes in HTML.
|
|
13
|
+
|
|
14
|
+
If you have a convention to use `data-test-id` or `data-qa` attributes to mark active elements for e2e tests,
|
|
15
|
+
you can enable this plugin to simplify matching elements with these attributes:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
// replace this:
|
|
19
|
+
I.click({ css: '[data-test-id=register_button]');
|
|
20
|
+
// with this:
|
|
21
|
+
I.click('$register_button');
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
This plugin will create a valid XPath locator for you.
|
|
25
|
+
|
|
26
|
+
#### Configuration
|
|
27
|
+
|
|
28
|
+
* `enabled` (default: `false`) should a locator be enabled
|
|
29
|
+
* `prefix` (default: `$`) sets a prefix for a custom locator.
|
|
30
|
+
* `attribute` (default: `data-test-id`) to set an attribute to be matched.
|
|
31
|
+
* `strategy` (default: `xpath`) actual locator strategy to use in query (`css` or `xpath`).
|
|
32
|
+
* `showActual` (default: false) show in the output actually produced XPath or CSS locator. By default shows custom locator value.
|
|
33
|
+
|
|
34
|
+
#### Examples:
|
|
35
|
+
|
|
36
|
+
Using `data-test` attribute with `$` prefix:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
// in codecept.conf.js
|
|
40
|
+
plugins: {
|
|
41
|
+
customLocator: {
|
|
42
|
+
enabled: true,
|
|
43
|
+
attribute: 'data-test'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
In a test:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
I.seeElement('$user'); // matches => [data-test=user]
|
|
52
|
+
I.click('$sign-up'); // matches => [data-test=sign-up]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Using `data-qa` attribute with `=` prefix:
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
// in codecept.conf.js
|
|
59
|
+
plugins: {
|
|
60
|
+
customLocator: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
prefix: '=',
|
|
63
|
+
attribute: 'data-qa'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
In a test:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
I.seeElement('=user'); // matches => [data-qa=user]
|
|
72
|
+
I.click('=sign-up'); // matches => [data-qa=sign-up]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Using `data-qa` OR `data-test` attribute with `=` prefix:
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
// in codecept.conf.js
|
|
79
|
+
plugins: {
|
|
80
|
+
customLocator: {
|
|
81
|
+
enabled: true,
|
|
82
|
+
prefix: '=',
|
|
83
|
+
attribute: ['data-qa', 'data-test'],
|
|
84
|
+
strategy: 'xpath'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
In a test:
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
I.seeElement('=user'); // matches => //*[@data-qa=user or @data-test=user]
|
|
93
|
+
I.click('=sign-up'); // matches => //*[data-qa=sign-up or @data-test=sign-up]
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
// in codecept.conf.js
|
|
98
|
+
plugins: {
|
|
99
|
+
customLocator: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
prefix: '=',
|
|
102
|
+
attribute: ['data-qa', 'data-test'],
|
|
103
|
+
strategy: 'css'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
In a test:
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
I.seeElement('=user'); // matches => [data-qa=user],[data-test=user]
|
|
112
|
+
I.click('=sign-up'); // matches => [data-qa=sign-up],[data-test=sign-up]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Parameters
|
|
116
|
+
|
|
117
|
+
* `config`  
|
|
118
|
+
|
|
119
|
+
[1]: https://codecept.io/locators#custom-locators
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/customReporter
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: customReporter
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## customReporter
|
|
11
|
+
|
|
12
|
+
Sample custom reporter for CodeceptJS.
|
|
13
|
+
|
|
14
|
+
### Parameters
|
|
15
|
+
|
|
16
|
+
* `config`  
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/expose
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: expose
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## expose
|
|
11
|
+
|
|
12
|
+
Exposes properties from helper instances as injectable test arguments.
|
|
13
|
+
Use it to access the underlying Playwright/Puppeteer `page`, the wdio `browser` client,
|
|
14
|
+
or any other helper internal directly from a Scenario:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
Scenario('listen for requests', async ({ I, page, browser }) => {
|
|
18
|
+
page.on('request', r => console.log(r.url()))
|
|
19
|
+
await page.evaluate(() => 1 + 1)
|
|
20
|
+
I.amOnPage('/')
|
|
21
|
+
})
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The injected value is a live proxy: every property access reads the *current*
|
|
25
|
+
helper property, so mid-test reassignments (popups, `switchToNextTab`,
|
|
26
|
+
`openNewTab`) are reflected automatically. Calls are not wrapped as
|
|
27
|
+
CodeceptJS steps — `await page.evaluate(...)` runs as native Playwright.
|
|
28
|
+
|
|
29
|
+
#### Configuration
|
|
30
|
+
|
|
31
|
+
`inject` maps an injection name to a `HelperName.propertyName` string. A
|
|
32
|
+
value with no dot is shorthand for "first configured browser helper that
|
|
33
|
+
exposes this property" (allowed properties: `page`, `browser`,
|
|
34
|
+
`browserContext`, `context`).
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
plugins: {
|
|
38
|
+
expose: {
|
|
39
|
+
enabled: true,
|
|
40
|
+
inject: {
|
|
41
|
+
page: 'Playwright.page',
|
|
42
|
+
browser: 'Playwright.browser',
|
|
43
|
+
browserContext: 'Playwright.browserContext',
|
|
44
|
+
frame: 'Playwright.context', // current frame set by switchTo
|
|
45
|
+
wdio: 'WebDriver.browser',
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Shorthand:
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
plugins: {
|
|
55
|
+
expose: {
|
|
56
|
+
enabled: true,
|
|
57
|
+
inject: {
|
|
58
|
+
page: 'page', // resolves to Playwright.page or Puppeteer.page
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Caveats
|
|
65
|
+
|
|
66
|
+
* The injected value is a `Proxy`, not the actual `Page`/`Browser` instance,
|
|
67
|
+
so `page instanceof Page` is `false`. Use duck typing instead.
|
|
68
|
+
* Cached method references lose the live binding. Call `page.click(...)`,
|
|
69
|
+
not `const click = page.click; click(...)`.
|
|
70
|
+
* In dry-run mode the underlying helper property is `undefined`; accessing
|
|
71
|
+
any property on the proxy returns `undefined` rather than throwing.
|
|
72
|
+
|
|
73
|
+
### Parameters
|
|
74
|
+
|
|
75
|
+
* `config`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/heal
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: heal
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## heal
|
|
11
|
+
|
|
12
|
+
Self-healing tests with AI.
|
|
13
|
+
|
|
14
|
+
Read more about healing in [Self-Healing Tests][1]
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
plugins: {
|
|
18
|
+
heal: {
|
|
19
|
+
enabled: true,
|
|
20
|
+
on: 'fail',
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
More config options are available:
|
|
26
|
+
|
|
27
|
+
* `healLimit` - how many steps can be healed in a single test (default: 2)
|
|
28
|
+
* `on` - trigger mode. `fail` (default), `file` (filter to a path), `url` (filter to a URL pattern).
|
|
29
|
+
|
|
30
|
+
#### `on=` modes
|
|
31
|
+
|
|
32
|
+
Heal always runs on step failures; `on=` narrows when it engages.
|
|
33
|
+
|
|
34
|
+
* **fail** — heal any failing step (default)
|
|
35
|
+
* **file** — heal only failures in `path=...[;line=...]`
|
|
36
|
+
* **url** — heal only failures when the current URL matches `pattern=...`
|
|
37
|
+
|
|
38
|
+
`on=step` and `on=test` are not supported and are rejected with an error.
|
|
39
|
+
|
|
40
|
+
### Parameters
|
|
41
|
+
|
|
42
|
+
* `config`
|
|
43
|
+
|
|
44
|
+
[1]: https://codecept.io/heal/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/junitReporter
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: junitReporter
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## junitReporter
|
|
11
|
+
|
|
12
|
+
Generates a JUnit-compatible XML report after a test run.
|
|
13
|
+
|
|
14
|
+
Unlike Mocha's `mocha-junit-reporter`, this plugin understands CodeceptJS steps and substeps.
|
|
15
|
+
For every `<testcase>` it includes:
|
|
16
|
+
|
|
17
|
+
* `<properties>` — the test's meta information: every `meta` key from `Scenario('...', { meta })`, plus its `tags` and `retries`
|
|
18
|
+
* `<system-out>` — an indented step/substep log (substeps are nested under their meta step); only failed steps are marked
|
|
19
|
+
* `<failure>` — for failed tests: the error message, type, stack trace and (optionally) the step trace
|
|
20
|
+
|
|
21
|
+
The produced file is consumable by Jenkins, GitLab CI, CircleCI, GitHub Actions test reporters, etc.
|
|
22
|
+
|
|
23
|
+
#### Configuration
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
"plugins": {
|
|
27
|
+
"junitReporter": {
|
|
28
|
+
"enabled": true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Possible config options:
|
|
34
|
+
|
|
35
|
+
* `outputName`: file name for the report. Default: `report.xml`.
|
|
36
|
+
* `output`: directory where the report is stored, relative to the project root. Default: the `output` directory.
|
|
37
|
+
* `testGroupName`: value of the `name` attribute on the root `<testsuites>` element. Default: `CodeceptJS`.
|
|
38
|
+
* `attachMeta`: add the test's meta information (`meta` keys, `tags`, `retries`) as `<properties>`. Default: true.
|
|
39
|
+
* `attachSteps`: add the step/substep log as `<system-out>`. Default: true.
|
|
40
|
+
* `stepsInFailure`: append the step trace to the `<failure>` body. Default: true.
|
|
41
|
+
|
|
42
|
+
CLI examples:
|
|
43
|
+
|
|
44
|
+
npx codeceptjs run -p junitReporter
|
|
45
|
+
npx codeceptjs run -p junitReporter:outputName=junit.xml
|
|
46
|
+
|
|
47
|
+
> ℹ When running with `run-workers`, steps are serialized between processes and substep nesting is flattened.
|
|
48
|
+
|
|
49
|
+
### Parameters
|
|
50
|
+
|
|
51
|
+
* `config` **any**
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/pageInfo
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: pageInfo
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## pageInfo
|
|
11
|
+
|
|
12
|
+
Collects information from web page after each failed test and adds it to the test as an artifact.
|
|
13
|
+
It is suggested to enable this plugin if you run tests on CI and you need to debug failed tests.
|
|
14
|
+
This plugin can be paired with `analyze` plugin to provide more context.
|
|
15
|
+
|
|
16
|
+
It collects URL, HTML errors (by classes), and browser logs.
|
|
17
|
+
|
|
18
|
+
Enable this plugin in config:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
plugins: {
|
|
22
|
+
pageInfo: {
|
|
23
|
+
enabled: true,
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Additional config options:
|
|
28
|
+
|
|
29
|
+
* `errorClasses` - list of classes to search for errors (default: `['error', 'warning', 'alert', 'danger']`)
|
|
30
|
+
* `browserLogs` - list of types of errors to search for in browser logs (default: `['error']`)
|
|
31
|
+
|
|
32
|
+
### Parameters
|
|
33
|
+
|
|
34
|
+
* `config`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/pause
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: pause
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## pause
|
|
11
|
+
|
|
12
|
+
Pauses test execution interactively. Replaces the legacy `pauseOnFail`
|
|
13
|
+
plugin. The default `on=fail` matches the old `pauseOnFail` behavior.
|
|
14
|
+
|
|
15
|
+
#### Configuration
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
plugins: {
|
|
19
|
+
pause: {
|
|
20
|
+
enabled: false,
|
|
21
|
+
on: 'fail',
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### `on=` modes
|
|
27
|
+
|
|
28
|
+
* **fail** — pause when a step fails (default)
|
|
29
|
+
* **test** — pause after each test
|
|
30
|
+
* **step** — pause before the first step (interactive walk-through)
|
|
31
|
+
* **file** — pause when execution reaches `path=...[;line=...]`
|
|
32
|
+
* **url** — pause when the browser URL matches `pattern=...`
|
|
33
|
+
|
|
34
|
+
CLI examples:
|
|
35
|
+
|
|
36
|
+
npx codeceptjs run -p pause
|
|
37
|
+
npx codeceptjs run -p pause:on=step
|
|
38
|
+
npx codeceptjs run -p pause:on=file:path=tests/login_test.js;line=43
|
|
39
|
+
npx codeceptjs run -p pause:on=url:pattern=/users/*
|
|
40
|
+
|
|
41
|
+
### Parameters
|
|
42
|
+
|
|
43
|
+
* `config`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/pauseOnFail
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: pauseOnFail
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## pauseOnFail
|
|
11
|
+
|
|
12
|
+
Starts an interactive pause when a test fails.
|
|
13
|
+
|
|
14
|
+
**Deprecated:** use the `pause` plugin with `on: 'fail'`, which is the default behavior.
|
|
15
|
+
|
|
16
|
+
### Parameters
|
|
17
|
+
|
|
18
|
+
* `config`
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/retryFailedStep
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: retryFailedStep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## retryFailedStep
|
|
11
|
+
|
|
12
|
+
Retries each failed step in a test.
|
|
13
|
+
|
|
14
|
+
Add this plugin to config file:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
plugins: {
|
|
18
|
+
retryFailedStep: {
|
|
19
|
+
enabled: true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Run tests with plugin enabled:
|
|
25
|
+
|
|
26
|
+
npx codeceptjs run --plugins retryFailedStep
|
|
27
|
+
|
|
28
|
+
#### Configuration:
|
|
29
|
+
|
|
30
|
+
* `retries` - number of retries (by default 3),
|
|
31
|
+
* `factor` - The exponential factor to use. Default is 1.5.
|
|
32
|
+
* `minTimeout` - The number of milliseconds before starting the first retry. Default is 150.
|
|
33
|
+
* `maxTimeout` - The maximum number of milliseconds between two retries. Default is 10000.
|
|
34
|
+
* `randomize` - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false.
|
|
35
|
+
* `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes:
|
|
36
|
+
* `amOnPage`
|
|
37
|
+
* `wait*`
|
|
38
|
+
* `send*`
|
|
39
|
+
* `execute*`
|
|
40
|
+
* `run*`
|
|
41
|
+
* `have*`
|
|
42
|
+
* `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list.
|
|
43
|
+
You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`.
|
|
44
|
+
To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well.
|
|
45
|
+
* `deferToScenarioRetries` - when enabled (default), step retries are automatically disabled if scenario retries are configured to avoid excessive total retries.
|
|
46
|
+
|
|
47
|
+
#### Example
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
plugins: {
|
|
51
|
+
retryFailedStep: {
|
|
52
|
+
enabled: true,
|
|
53
|
+
ignoredSteps: [
|
|
54
|
+
'scroll*', // ignore all scroll steps
|
|
55
|
+
/Cookie/, // ignore all steps with a Cookie in it (by regexp)
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### Disable Per Test
|
|
62
|
+
|
|
63
|
+
This plugin can be disabled per test. In this case you will need to add `step.retry()` to all flaky steps:
|
|
64
|
+
|
|
65
|
+
Use scenario configuration to disable plugin for a test
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
Scenario('scenario tite', { disableRetryFailedStep: true }, () => {
|
|
69
|
+
// test goes here
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Parameters
|
|
74
|
+
|
|
75
|
+
* `config`  
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/screencast
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: screencast
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## screencast
|
|
11
|
+
|
|
12
|
+
Records WebM video of tests using Playwright's screencast API.
|
|
13
|
+
|
|
14
|
+
When `captions` is enabled, action annotations are burned into the video;
|
|
15
|
+
when `subtitles` is enabled, a standalone `.srt` is also produced. Default
|
|
16
|
+
`on=fail` keeps videos for failed tests only; `on=test` keeps every test's
|
|
17
|
+
video.
|
|
18
|
+
|
|
19
|
+
Note: enabling Playwright's helper-level `video: true` together with this
|
|
20
|
+
plugin produces two independent recordings (`output/videos/*.webm` from the
|
|
21
|
+
helper, `output/screencast/*.webm` from this plugin).
|
|
22
|
+
|
|
23
|
+
#### Configuration
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
plugins: {
|
|
27
|
+
screencast: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
on: 'fail',
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### `on=` modes
|
|
35
|
+
|
|
36
|
+
* **fail** — record while running; delete on pass, keep on fail (default)
|
|
37
|
+
* **test** — record and keep every test's video
|
|
38
|
+
|
|
39
|
+
Other config options:
|
|
40
|
+
|
|
41
|
+
* `captions`: burn-in action overlays via `page.screencast.showActions()`. Default: true.
|
|
42
|
+
* `subtitles`: also write a standalone `.srt` file alongside the video. Default: false.
|
|
43
|
+
* `video`: record a video. With `video=false, subtitles=true`, only the `.srt` is produced. Default: true.
|
|
44
|
+
* `size`: pass-through `{ width, height }` for `screencast.start`.
|
|
45
|
+
* `quality`: pass-through 0–100 for `screencast.start`.
|
|
46
|
+
|
|
47
|
+
CLI examples:
|
|
48
|
+
|
|
49
|
+
npx codeceptjs run -p screencast
|
|
50
|
+
npx codeceptjs run -p screencast:on=test
|
|
51
|
+
npx codeceptjs run -p screencast:on=test;captions=false;subtitles=true
|
|
52
|
+
|
|
53
|
+
### Parameters
|
|
54
|
+
|
|
55
|
+
* `config`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/screenshot
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: screenshot
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## screenshot
|
|
11
|
+
|
|
12
|
+
Saves screenshots from the browser at points triggered by `on=`.
|
|
13
|
+
|
|
14
|
+
Replaces the legacy `screenshotOnFail` plugin. Default `on=fail` preserves the
|
|
15
|
+
old behavior (screenshot when a test fails). Pass `slides=true` (with `on=step`)
|
|
16
|
+
to generate a step-by-step slideshow report — replaces the legacy
|
|
17
|
+
`stepByStepReport` plugin.
|
|
18
|
+
|
|
19
|
+
#### Configuration
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
plugins: {
|
|
23
|
+
screenshot: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
on: 'fail',
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### `on=` modes
|
|
31
|
+
|
|
32
|
+
* **fail** — screenshot when a test fails (default)
|
|
33
|
+
* **test** — screenshot at the end of every test
|
|
34
|
+
* **step** — screenshot after every step
|
|
35
|
+
* **file** — screenshot for steps in `path=...[;line=...]`
|
|
36
|
+
* **url** — screenshot when the current browser URL matches `pattern=...`
|
|
37
|
+
|
|
38
|
+
Other config options:
|
|
39
|
+
|
|
40
|
+
* `uniqueScreenshotNames`: use unique names for screenshot. Default: false.
|
|
41
|
+
* `fullPageScreenshots`: make full page screenshots. Default: false.
|
|
42
|
+
* `disableScreenshots`: legacy switch to skip the plugin entirely.
|
|
43
|
+
* `slides`: generate a step-by-step slideshow report (requires `on=step`). Default: false.
|
|
44
|
+
* `deleteSuccessful`: when `slides=true`, drop slideshow directories of passing tests. Default: true.
|
|
45
|
+
* `animateSlides`: when `slides=true`, animate transitions between slides. Default: true.
|
|
46
|
+
* `ignoreSteps`: when `slides=true`, RegExps of step names to skip in the slideshow.
|
|
47
|
+
|
|
48
|
+
CLI examples:
|
|
49
|
+
|
|
50
|
+
npx codeceptjs run -p screenshot
|
|
51
|
+
npx codeceptjs run -p screenshot:on=step
|
|
52
|
+
npx codeceptjs run -p screenshot:on=step;slides=true
|
|
53
|
+
npx codeceptjs run -p screenshot:on=file:path=tests/login_test.js
|
|
54
|
+
npx codeceptjs run -p screenshot:on=url:pattern=/users/*
|
|
55
|
+
|
|
56
|
+
### Parameters
|
|
57
|
+
|
|
58
|
+
* `config`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
permalink: /plugins/screenshotOnFail
|
|
3
|
+
editLink: false
|
|
4
|
+
sidebar: auto
|
|
5
|
+
title: screenshotOnFail
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
|
9
|
+
|
|
10
|
+
## screenshotOnFail
|
|
11
|
+
|
|
12
|
+
Saves a screenshot when a test fails.
|
|
13
|
+
|
|
14
|
+
**Deprecated:** use the `screenshot` plugin with `on: 'fail'`, which is the default behavior.
|
|
15
|
+
|
|
16
|
+
### Parameters
|
|
17
|
+
|
|
18
|
+
* `config`
|