WebdriverIO report plugin. Create an HTML formatted report. compatible with webdriverio version 8
npm install wdio-html-nice-reporter # wdio-html-nice-reporter
A reporter for webdriver.io which generates a nice HTML report.
The name is silly but provides integration with webdriverio
typescript
// wdio.config.ts
import {ReportGenerator, HtmlReporter} from 'wdio-html-nice-reporter';
let reportAggregator: ReportGenerator;
const BaseConfig: WebdriverIO.Config = {
reporters: ['spec',
["html-nice", {
outputDir: './reports/html-reports/',
filename: 'report.html',
reportTitle: 'Test Report Title',
linkScreenshots: true,
//to show the report in a browser when done
showInBrowser: true,
collapseTests: false,
//to turn on screenshots after every test
useOnAfterCommandForScreenshot: false
}
]
]
};
`
Configuration Options:
$3
webdriver.io will call the reporter for each test suite. It does not aggregate the reports. To do this, add the following event handlers to your wdio.config.js
Add to browser config file:
`
let reportAggregator : ReportAggregator;
`
Add to browser config object:
`javascript
onPrepare: function(config, capabilities) {
reportAggregator = new ReportGenerator({
outputDir: './reports/html-reports/',
filename: 'master-report.html',
reportTitle: 'Master Report',
browserName: capabilities.browserName,
collapseTests: true
});
reportAggregator.clean();
}
onComplete: function (exitCode, config, capabilities, results) {
(async () => {
await reportAggregator.createReport();
})();
}
``