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

wdio-timeline-reporter

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wdio-timeline-reporter

A WebdriverIO reporter. Creates a simple HTML report after test runs

  • 2.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
decreased by-60.27%
Maintainers
1
Weekly downloads
 
Created
Source

Wdio Timeline Reporter

Build StatusNPM versionnpm

A one stop shop WebdriverIO reporter for an aggregated visualisation of your test results because "Seeing is believing"

example.png

Why use it?

Because we spend a lot of time debugging failing tests switching from terminal output to viewing error screenshots etc. This reporter aggregates all the typical information you will need into one report. Run tests and have a nice timeline of events you can look back at to further verify everything looks ok. Quite a few other use cases out there...

Features include:
  1. Works great with Mocha and Jasmine frameworks. Also works with Cucumber but every step will be reported as a test)
  2. Loud Summary of the Test Results.
  3. Detail of each test run including all screenshots captured during test execution.
  4. Test Results filtering. Great for focusing on failed tests
  5. Error stack trace attached to test.
  6. Ability to add additional information to test at runtime.
  7. No post processing required. On completion of wdio test process, a static html report file will ge generated.
  8. Screenshot service to manage the taking of screenshots including resizing of the images.

An example html report can be found here

Instructions on how to install WebdriverIO can be found here.

Installation

npm install --save wdio-timeline-reporter

A dependency will be added to your package.json

{
  "dependencies": {
    "wdio-timeline-reporter": "^2.0.1"
  }
}

Usage

Add timeline to the reporters array in your wdio config file.

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['timeline'],
  // ...
};

Reporter Configuration

The following configuration options are supported:

optiondefaulttypedescription
outputDir./stringdirectory you want the report html file written to. It defaults to the current working directory
filenametimeline-reporter.htmlstringname of the html file. File has to have html extension or default filename will be used
embedImagesfalsebooleanuse this if you want to embed screenshots as base64 to the report. Great option if you wish to archive just one artifact on CI server but be weary of the size the file could be

If you wish to override the default configuration add a timelineReporter object to reporterOptions in your wdio config as shown below.

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['timeline'],
  reporterOptions: {
    timelineReporter: {
        outputDir: './output',
        fileName: 'test-report.html',
        embedImages: true
    }
  },
  // ...
};

Add additional information to test context

It is possible to add additional information to a test using the addContext static method. This can be useful for adding important information that could help in debugging failed tests for example a user created during the test run with a dynamic username

Basic usage

The TimelineReporter.addContext static method accepts either a string parameter or an object literal with two properties title and value e.g

{ title: 'sessionId', value: 'b59bb9ec-ab15-475e-9ce6-de8a14ca0cd3' }

value could be also be a link

Mocha example
const TimelineReporter = require('wdio-timeline-reporter');

describe('Suite', function() {
    it('Test', function() {
        // object literal parameter
        TimelineReporter.addContext({
          title: 'Test User',
          value: 'user id created during the test'
        });

        // value as anchor tag
        TimelineReporter.addContext({
          title: 'Test User',
          value: '<a href="">Some important link related to test</a>'
        });

        // string parameter
        TimelineReporter.addContext('This test might be flaky');
    });
});

Screenshot Service

The Screenshot Service is a webdriverIO service written to work in tandem with timeline reporter. As you can guess from the name, the service takes screenshots during tests execution. You have the option to reduce the size and quality of the images. This is configurable using options the service provides. You would not require to specify screenshotPath in wdio.conf.js as the service will replicate the feature provided by supplying that property.

Usage

Import or require the module from wdio-timeline-reporter as shown below and then add ScreenshotService to the services array in your wdio config file.

// wdio.conf.js
const ScreenshotService = require('wdio-timeline-reporter/screenshot-service')

module.exports = {
  // ...
  services: [ ScreenshotService ],
  // ...
};

Service Configuration

If you wish to override the default configuration, add a screenshotService object to your wdio config as shown below.

// wdio.conf.js
const ScreenshotService = require('wdio-timeline-reporter/screenshot-service')

module.exports = {
  // ...
  services: [ ScreenshotService ],
  screenshotService: {
        outputDir: './output',
        images: {
            quality: 80,
            resize: true,
            reductionRatio: 2
        },
        strategy: 'verbose'
    }
  // ...
};

Configuration options are explained below

optiondefaulttypedescription
outputDir./stringdirectory where screenshots will be saved. Defaults to working directory
images{ quality: 70, resize: false, reductionRatio: 1 }object (quality and reductionRatio are of type Number and resize is a boolean)if resize is true, service will use quality and reductionRatio values to resize the images. Resizing is a great option if you chose to embed your images as base64. Allowed range for images.quality are 1 - 100 inclusive and 1 - 5 for images.reductionRatio
strategynonestringnone will not take any screenshots, error will take screenshots only on error, verbose will take screenshots before every click

Keywords

FAQs

Package last updated on 01 Oct 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc