A WebdriverIO plugin to take control over the name of error screenshots.
Add the reporter to your dev dependencies:
npm install wdio-errorshot-reporter --save-dev
Require and add the reporter to your wdio.conf.js:
// We need to require the reporter until I have managed to get it included in WDIO
const errorshot = require('wdio-errorshot-reporter');
// wdio.conf.js
module.exports = {
// ...
reporters: ['dot', errorshot],
// ...
};
To change the name of your screenshots you can use static text and placeholders:
// wdio.conf.js
module.exports = {
// ...
reporterOptions: {
errorshotReporter: {
template: 'foobar-%capId%_%timestamp%_%parent%-%title%'
}
},
// ...
};
The following placeholders can be used:
'capId'
or 'browser'
or 'browserName'
: Browser capability name, e.g. chrome, firefox
'timestamp'
: Timestamp of the screenshot
'parent'
: Parent name of the test, e.g. Mocha: describe()
'title'
: Title of the individual test, e.g. Mocha: it()
To run the unit tests and verify everything works as expected you can run:
npm run test
If you find any issues while using the package feel free to open an issue or contribute to existing issues.