@codeceptjs-plugins/html-snapshot-on-fail
This plugin takes a snapshot of the current page HTML and saves it to a file when a test fails.
Installation
npm i --save-dev @codeceptjs-plugins/html-snapshot-on-fail
yarn add --dev @codeceptjs-plugins/html-snapshot-on-fail
Basic usage
exports.config = {
plugins: {
htmlSnapshotOnFail: {
require: "@codeceptjs-plugins/html-snapshot-on-fail",
enabled: true
}
}
}
configure custom output directory
const path = require('path')
exports.config = {
plugins: {
htmlSnapshotOnFail: {
require: "@codeceptjs-plugins/html-snapshot-on-fail",
enabled: true,
rootDir: path.resolve('output'),
dirname: 'error-html-snapshots'
}
}
}
connect to allure reporter
exports.config = {
plugins: {
allure: {
require: "<require path>",
},
htmlSnapshotOnFail: {
require: "@codeceptjs-plugins/html-snapshot-on-fail",
enabled: true,
reporter: 'allure' // key of registered allure plugin in "exports.config.plugins"
}
}
}