Socket
Socket
Sign inDemoInstall

wdio-html-nice-reporter

Package Overview
Dependencies
92
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    wdio-html-nice-reporter

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


Version published
Weekly downloads
15K
decreased by-5.22%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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

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.

Keywords

FAQs

Last updated on 19 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc