Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

wdio-html-nice-reporter

rpii292.4kMIT8.1.7TypeScript support: included

WebdriverIO report plugin. Create an HTML formatted report. compatible with webdriverio version 8

html, reporter, webdriverio, wdio, wdio-plugin, wdio-reporter, wdio-html-reporter

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

Bug fix: rework to allow much bigger suites to be processed with nunjucks. it was hitting the js string limit. thanks to user babz218

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

Information

This project is a rewrite of @rpii/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

below are snippets from that file.


// 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 suites

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:

    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 report

Requires an additional plugin to keep the support lightweight for those that dont want it. see @rpii/wdio-html-reporter-pdf

Sample Output:

Report Screenshot

browserName

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

changelog

Changelog:

8.1.7:
    Removed javascript files
    Moved suite rendering to typescript from nunjucks template to avoid memory error from longer test runs
    Removed json.stringify from console.info to avoid memory error
    Updated styles on reports with new template
8.0.6:
    Protect against missing video file if nunjucks html generation
8.0.5:
    Protect against missing image file if nunjucks html generation
8.0.4:
    Total rework to remove issue with webdriverio cutting off the report generation
    (https://github.com/rpii/wdio-html-reporter/issues/86)
8.0.3:
    further fixes to async json write in html reporter.
    (https://github.com/rpii/wdio-html-reporter/issues/86)
8.0.2:
    further fix to async json write in html reporter.
    (https://github.com/rpii/wdio-html-reporter/issues/86)
8.0.1:
    async json write was not awaited correctly and could be missed.
    (https://github.com/rpii/wdio-html-reporter/issues/86)
8.0.0:
    major fix for out of memory errors --thanks to (https://github.com/owens-ben)
    (https://github.com/rpii/wdio-html-reporter/issues/84)
7.9.2:
    Security Update: log4js 
    add default for report options:
        collapseTests = false ;
        collapseSuites = false ;
7.9.1:
    Feature: [Add support for taking videos of each test] 
                See sample/wdio.config.ts for configuration. 
                Requires updated or patched wdio-video-reporter
                (https://github.com/rpii/wdio-video-reporter)

7.9.0:
    Bugfix: [Address duplicate tests and suites being displayed when using nested suites #74] 
    (https://github.com/rpii/wdio-html-reporter/issues/74)

7.8.7:
    Bugfix: [Address issues caused by JSON.stringify running out of string memory.  Now saves screenshots as links to drastically reduce menory usage #71])(https://github.com/rpii/wdio-html-reporter/pull/71)
    set reporterOption linkScreenshots:true

7.8.5:
    Bugfix: [Fixes empty Assertion block due to AssertionError #71])(https://github.com/rpii/wdio-html-reporter/pull/71)

7.8.4:
    Feature: [add logic to show/hide failed/passed tests #69])(https://github.com/rpii/wdio-html-reporter/pull/69)
7.8.3:
    Bugfix: [Fix logic for 'expandable-control' elements 'click' event #6])(https://github.com/rpii/wdio-html-reporter/pull/68)

7.8.1:
    Cleanup: update dependencies, remove cucumber warning 
    Add note on how to resolve the multiple types ts error
7.8.0:
    Changes:  changes in webdriverio reporting broke the cucumber support.
               handlebars is not capable of supporting the recursion needed to 
               render a suite that contains suites.
               Had to switch to numjucks to have cucumber work.
               As a result you can no longer supply your own template file.
               Cucumber has nested suites in suites and duplicated data.
               Had to work around that.
7.7.15:
    Bugfix: remove @wdio/types  
7.7.14:
    Bugfix: catch json write error  

 7.7.13:

    Bugfix: update to webdriverio 7.7.6, fix compile fail  

    Bugfix: webdriverio 7.7.4 event structure was changed, update to match. caused assertion display to fail  

    Bugfix: fix file case error in copyFiles  

    Bugfix: cleanup async behaviour of createReport    

    Bugfix: fix start time setting

    Totally rewritten in typescript.

    No more jquery, uses only vanilla js

    No more moment.js dependency

    use 'html-nice' for reporter definition

    Removed need for global scope reportAggregator in client code

    Add collapseTests and collapseSuites options,default to false

    sort suites by time order

    display spec file in suite header