WebdriverIO

Setting up handshake reporter for WebdriverIO framework

We support reporting services for the WebdriverIO test framework. To get started,

  1. Download https://www.npmjs.com/package/wdio-handshake-reporter - npm install wdio-handshake-reporter

  2. Execute this command to confirm the successful installation npx shake --help

pnpm i wdio-handshake-reporter && pnpx shake --help

Command line

you will see the below message or similar for npx shake --help

npx shake -b TestResults TestReports

assumes you have saved your TestResults in the folder named "TestResults", then we export the TestResults to a folder called "TestReports".

  • Requires Venv Activation before using it

  • Replaces Existing TestReports if found

  • Generates static output

you can serve the static reports located at TestReports like with, serve: npx serve TestReports

Sample Message

Shake CLI: A tool to use handshake CLI with a custom reporter context.

Note: To use most commands in Shake CLI, you need to first activate the virtual environment.

--version or -v: Checks if the version matches with the required version against the python-build. If not, it installs the required version.
--build or -b: Requires two arguments - TestResults followed by TestReports. TestResults is where your results are stored, and TestReports is where the generated reports will be saved.
--download or -d: Downloads the raw build for the dashboard. This command is typically called automatically post-installation.
--help or -h: Prints this help message.
Examples:
npx shake --build Results Reports
npx shake -b Results Reports
npx shake -d
npx shake --download

Sample Config Files


import type { Options } from "@wdio/types";
import { attachReporter } from "wdio-handshake-reporter";

const options: Options.Testrunner = {
	runner: "local",
	autoCompileOpts: {
		autoCompile: true,
		tsNodeOpts: {
			project: "./tsconfig.json",
			transpileOnly: true,
		},
	},
	specs: ["./features/**/*.feature"],
	logLevel: "info",
	framework: "cucumber",
	reporters: ["spec"],
	cucumberOpts: {
		require: ["./features/step-definitions/steps.ts"],
	},

};

export const config = attachReporter(options, {
	resultsFolderName: "TestResults",
	port: 6969,
	addScreenshots: true,
	testConfig: {
		projectName: "test-wdio-cucumber",
	},
});
import { join, dirname } from 'node:path';
import { attachReporter } from "wdio-handshake-reporter"

const metaConfig = {
    reporterSyncTimeout: 40e3, // IMPORTANT
    runner: 'local',
    specs: [
        './test-mocha/specs/test.e2e.js',
        './test-mocha/specs/package-version.e2e.js',
    ],
    maxInstances: 10,
    specFileRetries: 1,
    //
    capabilities: [{
        browserName: 'chrome',
        'goog:chromeOptions': {
            args: ['headless', 'disable-gpu']
        }
    }],
    logLevel: 'info',
    bail: 0,
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    framework: 'mocha',
    mochaOpts: {
        ui: 'bdd',
        timeout: 60000,
        grep: "(version|login)"
    },
    beforeTest: async function () {
        await browser.takeScreenshot();
    },
    afterTest: async function () {
        await browser.takeScreenshot();
    }
}

export const config = attachReporter(metaConfig, {
    resultsFolderName: "TestResults",
    port: 6966,
    requestsTimeout: 360e3,
    addScreenshots: true,
    testConfig: { projectName: 'test-wdio-mocha' },
    logLevel: "error",
    exportOutDir: "TestReports"
});

API Reference

attachReporter(...)

We would expect the attachReporter function to handle the required configuration for your file. attachReporter will add the required service: HandshakeService and HandshakeReporter to the services and reporters in the webdriver.Config

attachReporter(YOUR_CONFIG, HANDSHAKE_SPECIFIC_CONFIG) -> Returns the modified webdriver.Config

Know More


Refer to the below files on how it is implemented:

Last updated