codeceptjs
Version:
Supercharged End 2 End Testing Framework for NodeJS
59 lines (44 loc) • 1.87 kB
Markdown
---
permalink: /plugins/screenshot
editLink: false
sidebar: auto
title: screenshot
---
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## screenshot
Saves screenshots from the browser at points triggered by `on=`.
Replaces the legacy `screenshotOnFail` plugin. Default `on=fail` preserves the
old behavior (screenshot when a test fails). Pass `slides=true` (with `on=step`)
to generate a step-by-step slideshow report — replaces the legacy
`stepByStepReport` plugin.
#### Configuration
```js
plugins: {
screenshot: {
enabled: true,
on: 'fail',
}
}
```
#### `on=` modes
* **fail** — screenshot when a test fails (default)
* **test** — screenshot at the end of every test
* **step** — screenshot after every step
* **file** — screenshot for steps in `path=...[;line=...]`
* **url** — screenshot when the current browser URL matches `pattern=...`
Other config options:
* `uniqueScreenshotNames`: use unique names for screenshot. Default: false.
* `fullPageScreenshots`: make full page screenshots. Default: false.
* `disableScreenshots`: legacy switch to skip the plugin entirely.
* `slides`: generate a step-by-step slideshow report (requires `on=step`). Default: false.
* `deleteSuccessful`: when `slides=true`, drop slideshow directories of passing tests. Default: true.
* `animateSlides`: when `slides=true`, animate transitions between slides. Default: true.
* `ignoreSteps`: when `slides=true`, RegExps of step names to skip in the slideshow.
CLI examples:
npx codeceptjs run -p screenshot
npx codeceptjs run -p screenshot:on=step
npx codeceptjs run -p screenshot:on=step;slides=true
npx codeceptjs run -p screenshot:on=file:path=tests/login_test.js
npx codeceptjs run -p screenshot:on=url:pattern=/users/*
### Parameters
* `config`