Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rpii/wdio-html-reporter

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpii/wdio-html-reporter - npm Package Compare versions

Comparing version 7.0.0 to 7.7.0

.mocharc.json

81

package.json
{
"name": "@rpii/wdio-html-reporter",
"version": "7.0.0",
"description": "WebdriverIO report plugin. Create a basic HTML formatted report. compatible with webdriverio version 6",
"main": "build/index.js",
"types": "wdio-html-reporter.d.ts",
"version": "7.7.0",
"description": "WebdriverIO report plugin. Create an HTML formatted report. compatible with webdriverio version 7",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build:test": "babel test/* -d build-test",
"build": "babel src/* -d build/ && babel test/* -d build-test",
"build": "tsc",
"symlink": "npm link",
"use:symlink": "npm link @rpii/wdio-html-reporter",
"clean": "rimraf ./build ./build-test ./reports ./logs",
"clean:build": "rimraf ./build",
"clean": "rimraf ./lib ./reports ./logs",
"clean:build": "rimraf ./lib",
"clean:reports": "rimraf ./reports",
"test": "mocha build-test/**/*.js --require @babel/register",
"test:invalid": "mocha build-test/invalid.test.spec.js --require @babel/register",
"test:reporter": "mocha build-test/reporter.spec.js --require @babel/register",
"clean:logs": "rimraf ./logs",
"test": "mocha ./test/**/*.ts",
"test:invalid": "mocha ./test/invalid.test.spec.ts",
"test:reporter": "mocha ./test/reporter.spec.ts",
"copyjs": "copyfiles --flat --verbose js/*.* ./reports/html-reports/"

@@ -37,3 +37,3 @@ },

],
"author": "Adrien Ruiz Gauder <caritsqa@gmail.com>",
"author": "Rich Peters <16782353+rpii@users.noreply.github.com>",
"license": "MIT",

@@ -46,4 +46,2 @@ "bugs": {

"@log4js-node/log4js-api": "^1.0.2",
"@rpii/wdio-report-events": "^0.1.3",
"@wdio/reporter": "^7.7.0",
"copyfiles": "^2.3.0",

@@ -53,49 +51,26 @@ "fs-extra": "^9.0.0",

"image-to-base64": "^2.2.0",
"mocha": "^8.4.0",
"moment": "^2.29.1",
"moment-duration-format": "^2.3.2",
"dayjs": "^1.10.5",
"open": "^8.2.0"
},
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/node": "^7.14.2",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-proposal-function-bind": "^7.12.13",
"@babel/plugin-proposal-optional-catch-binding": "^7.14.2",
"@babel/plugin-syntax-export-default-from": "^7.12.13",
"@babel/preset-env": "^7.14.4",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.13.16",
"babel-plugin-source-map-support": "^2.1.3",
"@types/node": "^14.14.31",
"@types/chai": "^4.2.18",
"@types/mocha": "^8.2.2",
"@wdio/types": "7.7.3",
"@rpii/wdio-report-events": "^0.1.3",
"@wdio/reporter": "^7.7.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.3.2",
"concat": "^1.0.3",
"chai": "^4.3.4",
"log4js": "^6.3.0",
"mocha": "^8.4.0",
"rimraf": "^3.0.2"
"rimraf": "^3.0.2",
"@wdio/cli": "^7.7.3",
"typescript-string-operations": "^1.4.1"
},
"contributors": [
"Adrien Ruiz Gauder <caritsqa@gmail.com>",
"Gisella Fama <gisella.fama@gmail.com>",
"George Crawford <george.crawford@ft.com>",
"Christian Bromann <github@christian-bromann.com>",
"Markus Benning <ich@markusbenning.de>",
"Rich Peters <16782353+rpii@users.noreply.github.com>",
"Orozbek Askarov <oroz.askarov@gmail.com>"
],
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
},
"mocha": {
"ui": "bdd"
}
"Rich Peters <16782353+rpii@users.noreply.github.com>"
]
}

@@ -1,65 +0,43 @@

# wdio-html-reporter
#@rpii/wdio-html-reporter
A reporter for webdriver.io which generates a HTML report.
Compatible with webdriverio version 7, with a typescript type file.
Compatible with webdriverio version 7.7
####Newest Features:
Totally rewritten in typescript.
Update typescript types for webdriverio 7.7
No more jquery, uses only vanilla js
####New Feature: Styles are provided in a css file and can be modified
No more moment.js dependency
####New Feature: All major vulnerabilities in dependencies fixed
use 'html' for reporter definition
Removed need for global scope reportAggregator in client code
####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](https://www.npmjs.com/package/@rpii/wdio-html-reporter-pdf)
## Information
This project is a fork of [wdio-html-format-reporter](https://www.npmjs.com/package/wdio-html-format-reporter)
That project has not been updated and doesnt work with the latest webdriverio 5.x or 6.x.
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.
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.
## Configuration
This module has been tested with mocha and now cucumber. It works with both.
The following code shows the default wdio test runner configuration. Just add an HtmlReporter object as another reporter to the reporters array:
## Installation
###A functioning wdio.config.ts is provided in the [/samples/wdio.config.ts](/samples/wdio.config.ts)
The easiest way is to keep the `@rpii/wdio-html-reporter` as a devDependency in your package.json:
below are snippets from that file
```javascript
{
"devDependencies": {
"@rpii/wdio-html-reporter": "~7.0.0"
}
}
```
```typescript
// wdio.config.ts
import {ReportAggregator, HtmlReporter} from '@wdio/html-reporter';
let reportAggregator: ReportAggregator;
Or, you can simply do it with:
```
yarn add @rpii/wdio-html-reporter --dev
```
## Configuration
The 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:
```javascript
// wdio.conf.js
import { ReportAggregator, HtmlReporter} from '@rpii/wdio-html-reporter' ;
module.exports = {
const BaseConfig: WebdriverIO.Config = {
reporters: ['spec',
[HtmlReporter, {
debug: true,
["html", {
outputDir: './reports/html-reports/',

@@ -103,3 +81,3 @@ filename: 'report.html',

let reportAggregator = new ReportAggregator({
reportAggregator = new ReportAggregator({
outputDir: './reports/html-reports/',

@@ -109,9 +87,5 @@ filename: 'master-report.html',

browserName : capabilities.browserName,
collapseTests: true,
// to use the template override option, can point to your own file in the test project:
// templateFilename: path.resolve(__dirname, '../template/wdio-html-reporter-alt-template.hbs')
});
collapseTests: true
});
reportAggregator.clean() ;
global.reportAggregator = reportAggregator;
},

@@ -121,3 +95,3 @@

(async () => {
await global.reportAggregator.createReport();
await reportAggregator.createReport();
})();

@@ -134,4 +108,5 @@ },

const log4js = require('@log4js-node/log4js-api');
const logger = log4js.getLogger('default');
const logger = log4js.getLogger(this.options.debug ? 'debug' : 'default');

@@ -143,54 +118,8 @@ ### To use a custom handlebars template for reports

## Add Message and Screenshots to the Html Report:
### To generate a pdf file from this report
## To show messages in the html report
Requires 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)
Add the function below to your test code and call it when you want to output a message
```javascript
logMessage(message) {
process.emit('test:log', message);
}
```
## To take Screenshots:
Add a function that you can call from anywhere in your test:
```
takeScreenshot(message) {
const timestamp = moment().format('YYYYMMDD-HHmmss.SSS');
fs.ensureDirSync('reports/html-reports/screenshots/');
const filepath = path.join('reports/html-reports/screenshots/', timestamp + '.png');
this.browser.saveScreenshot(filepath);
this.logMessage(message) ;
process.emit('test:screenshot', filepath);
return this;
}
```
## To take a screenshot after any test fails:
```
wdio.conf.js
afterTest: function (test) {
const path = require('path');
const moment = require('moment');
// if test passed, ignore, else take and save screenshot.
if (test.passed) {
return;
}
const timestamp = moment().format('YYYYMMDD-HHmmss.SSS');
const filepath = path.join('reports/html-reports/screenshots/', timestamp + '.png');
browser.saveScreenshot(filepath);
process.emit('test:screenshot', filepath);
},
```
## 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.
## Sample Output:

@@ -229,3 +158,3 @@

let reportAggregator = new ReportAggregator({
reportAggregator = new ReportAggregator({
outputDir: './reports/html-reports/',

@@ -241,4 +170,4 @@ filename: 'master-report.html',

global.reportAggregator = reportAggregator;
reportAggregator = reportAggregator;
},
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc