wdio-html-enhanced-reporter
Version:
Light weight custom reporter for large wdio automation projects
74 lines (54 loc) โข 2.01 kB
Markdown
# ๐งพ wdio-html-enhanced-reporter
A **clean**, **lightweight**, and **customizable HTML reporter** for WebdriverIO, built on top of `@wdio/reporter`. This reporter provides a structured, interactive test report with support for nested suites, logs, screenshots, and test status indicators โ all rendered with plain HTML, CSS, and vanilla JavaScript.
## ๐ฆ Features
- โ
Nested `describe` / `it` block support
- ๐งช Test status indicators (pass, fail, skip)
- ๐ธ Screenshot integration
- ๐ชต Per-test log output
- ๐ Multi-suite hierarchy handling
- ๐ก Simple HTML+CSS+JS (no React/Bootstrap)
- ๐ผ Works seamlessly with WebdriverIO v9+
- ๐งฉ Extendable for your custom logic
## ๐ ๏ธ Installation
```bash
npm install wdio-html-enhanced-reporter --save-dev
```
## Update your wdio.conf.js:
```js
const SCREENSHOT_DIR = 'test-reports/screenshots';
exports.config = {
reporters: [
'spec',
[
'html-enhanced',
{
outputDir: './test-reports',
filename: 'my-report.html',
reportTitle: 'Custom Report',
showInBrowser: false,
screenshotDir: SCREENSHOT_DIR,
},
],
],
onPrepare: function () {
// Create screenshots directory if it doesn't exist
if (!fs.existsSync(SCREENSHOT_DIR)) {
fs.mkdirSync(SCREENSHOT_DIR, { recursive: true });
}
},
afterTest: async function (test) {
// Generate a filename based on test info and timestamp
const timestamp = DateTime.now().toFormat('yyyyMMdd-HHmmss.u');
const filepath = path.join(SCREENSHOT_DIR, `${timestamp}.png`);
const relativeFilePath = `./screenshots/${path.basename(filepath)}`;
// Save the screenshot
await browser.saveScreenshot(filepath);
process.emit('test:screenshot', relativeFilePath);
},
};
```
๐ฆ Available on [NPM](https://www.npmjs.com/package/wdio-html-enhanced-reporter)
๐ป Source code and documentation on [GitHub](https://github.com/mayankshukla94/wdio-html-enhanced-reporter)