Wdio Timeline Reporter

5.1.4 · active · verified Tue Apr 21

Wdio Timeline Reporter is a WebdriverIO reporter that generates an aggregated HTML report for test results, providing a timeline visualization of test execution. The current stable version is 5.1.4, with active development indicated by recent minor releases. Its key differentiators include combining test summaries, detailed test runs with embedded screenshots, error stack traces, and runtime information into a single, static HTML file. It aims to streamline debugging by providing all necessary information in one place, reducing the need to switch between terminal logs and separate screenshot files. It works seamlessly with Mocha and Jasmine frameworks in WebdriverIO v5+ and later.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure the `wdio-timeline-reporter` and its mandatory `TimelineService` in a `wdio.conf.js` file, including basic reporter options and how to add custom context to tests. It assumes WebdriverIO v5+ is installed.

import { TimelineService } from 'wdio-timeline-reporter/timeline-service';

exports.config = {
  runner: 'local',
  specs: [
    './test/specs/**/*.ts'
  ],
  exclude: [],
  maxInstances: 10,
  capabilities: [{
    maxInstances: 5,
    browserName: 'chrome',
    acceptInsecureCerts: true
  }],
  logLevel: 'info',
  bail: 0,
  baseUrl: 'http://localhost',
  waitforTimeout: 10000,
  connectionRetryTimeout: 120000,
  connectionRetryCount: 3,
  services: [
    [TimelineService, {
      // Optional: Configure screenshot management via TimelineService
      embedImages: true, // Embed screenshots as base64 in HTML
      screenshotStrategy: 'on:error' // Take screenshots only on test failure
    }]
  ],
  framework: 'mocha',
  reporters: [
    ['timeline', {
      outputDir: './timeline-report', // Mandatory: Directory for reports and screenshots
      fileName: 'custom-timeline-report.html', // Optional: Custom report file name
      embedImages: true // Embed images in report, overrides service setting if different
    }]
  ],
  mochaOpts: {
    ui: 'bdd',
    timeout: 60000
  },
  // Your tests go here (e.g., in ./test/specs/**/*.ts)
  // Example test content:
  // describe('My Test Suite', () => {
  //   it('should perform a successful action', async () => {
  //     await browser.url('https://webdriver.io');
  //     await expect(browser).toHaveTitleContaining('WebdriverIO');
  //   });
  //
  //   it('should add context data', async () => {
  //     await browser.url('https://example.com');
  //     TimelineService.addContext(this, { data: 'some useful info' });
  //     await expect(browser).toHaveTitle('Example Domain');
  //   });
  // });
};

view raw JSON →