HTML Reporter
@rpii/wdio-html-reporter is a 3rd party package, for more information please see GitHub | npm A reporter for webdriver.io which generates a HTML report.
Compatible with webdriverio version 6, with a typescript type file. ####New Feature: All major vulnerabilities in dependencies fixed ####New Feature: tests are collapsible as well as suites
####New Feature: adds support for creating a PDF file from the html report. Requires an additional plugin to keep the support lightweight for those that dont want it. see @rpii/wdio-html-reporter-pdf
#
InformationThis project is a fork of wdio-html-format-reporter That project has not been updated and doesnt work with the latest webdriverio 5.x or 6.x.
This project does. A pull request was submitted to that project, but it appears to be inactive. Due to name conflict issues, this package had to be put in my user namespace. it is now in npm.
This module has been tested with mocha and now cucumber. It works with both.
#
InstallationThe easiest way is to keep the @rpii/wdio-html-reporter
as a devDependency in your package.json:
Or, you can simply do it with:
#
ConfigurationThe following code shows the default wdio test runner configuration. Just add an HtmlReporter object as another reporter to the reporters array. Syntax shown requires babel:
#
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
#
To use a logger for debuggingA new feature for developers is to add a log4js logger to see detailed debug output. See the test/reporter.spec.js for configuration options. If you dont want to use the logging, include in your project @log4js-node/log4js-api and you can quiet all debugging. via:
#
To use a custom handlebars template for reportsUncomment the templateFilename above, and in the ReportAggregator. You must provide an absolute path to the file you can modify the alt-template above if you wish The template must support all the constructs in the default template. You may add more or just change the formatting and css.
#
Add Message and Screenshots to the Html Report:#
To show messages in the html reportAdd the function below to your test code and call it when you want to output a message
#
To take Screenshots:Add a function that you can call from anywhere in your test:
#
To take a screenshot after any test fails:#
To take a screenshot after each test completes:Set the option useOnAfterCommandForScreenshot to true
This option is used if you are not using either of the screenshot options above.