https://github.com/rpii/wdio-html-reporter
Fork for cleanup of wdio-html-format-reporter
https://github.com/rpii/wdio-html-reporter
Last synced: about 1 month ago
JSON representation
Fork for cleanup of wdio-html-format-reporter
- Host: GitHub
- URL: https://github.com/rpii/wdio-html-reporter
- Owner: rpii
- License: mit
- Fork: true (webdriverio-community/wdio-html-reporter)
- Created: 2023-08-30T23:30:19.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-29T23:10:39.000Z (8 months ago)
- Last Synced: 2025-05-04T21:51:50.646Z (about 1 month ago)
- Language: TypeScript
- Size: 8.97 MB
- Stars: 1
- Watchers: 0
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changes.md
- License: LICENSE
Awesome Lists containing this project
- awesome-webdriverio - HTML - Generates a nice HTML report. (Plugins / Reporters)
README
# wdio-html-nice-reporter
A reporter for webdriver.io which generates a nice HTML report.
The name is silly but provides integration with webdriverio### New: no longer beta.
### New: cleaned up and switched logging to wdio-logging. Samples are updated.
You need to remove the log4Js logger initialization from your config### New: rewritten as an ES module for webdriverio 8 compatibility.
You may need changes in your test app### Bug fix: webdriverio was shutting down in the middle of json async write.
### Bug fix: json write was not awaited for correctly
### Great new improvement: no more out of memory errors due to json.stringify
### Great new feature: take videos of each test
## [Changelog](https://github.com/rpii/wdio-html-reporter/blob/master/changes.md)
## Information
This project is a rewrite of [@rpii/wdio-html-reporter](https://www.npmjs.com/package/wdio-html-reporter)
It is written in typescript with many enhancements.## Configuration
### WDIO.config.ts
The following code shows the default wdio test runner configuration. Just add an HtmlReporter object as another reporter to the reporters array:
### A functioning wdio.config.ts is provided in the [/samples/wdio.config.ts](/samples/wdio.config.ts)
below are snippets from that file.
```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:
### To generate a master report for all suiteswebdriver.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();
})();
}```
### To generate a pdf file from this reportRequires an additional plugin to keep the support lightweight for those that dont want it.
see [@rpii/wdio-html-reporter-pdf](https://www.npmjs.com/package/@rpii/wdio-html-reporter-pdf)## Sample Output:

## browserName
This must be set manually. Its not available at config time since the browser object doesnt exist until you start a session.