Runner.screenshots Method
Defines page screenshot settings.
screenshots(options) → this
deprecated: screenshots(path [, takeOnFails] [, pathPattern] [, pathPatternOnFails] [,fullPage] [,thumbnails]) → this
The options
object can include the following properties:
Option | Type | Description | Default |
---|---|---|---|
| String | The base path where to save screenshots. Note that to construct a complete path to these screenshots, TestCafe uses default path patterns. Use the |
|
| Boolean | Specifies whether to take screenshots when a test fails. |
|
| String | Specifies a custom path pattern for TestCafe screenshots. Use placeholders to mark the path’s dynamic components. | |
| String | Set the | |
| Boolean | Specifies whether to capture the full page, including content that is not visible due to overflow. |
|
| Boolean | Specifies whether to make thumbnails for captured screenshots. |
|
See Screenshots for details.
Pass the disableScreenshots
option to the runner.run method to disable screenshots:
runner.run({
disableScreenshots: true
});
Related configuration file properties:
- screenshots.path
- screenshots.takeOnFails
- screenshots.pathPattern
- screenshots.pathPatternOnFails
- screenshots.fullPage
- screenshots.thumbnails
Example
runner.screenshots({
path: 'reports/screenshots/',
takeOnFails: true,
pathPattern: '${DATE}_${TIME}/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png',
pathPatternOnFails: '${DATE}_${TIME}/failedTests/test-${TEST_INDEX}/${USERAGENT}/${FILE_INDEX}.png',
fullPage: true,
thumbnails: false
});