UNPKG

wdio-html-enhanced-reporter

Version:

Light weight custom reporter for large wdio automation projects

74 lines (54 loc) โ€ข 2.01 kB
# ๐Ÿงพ 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)