WebdriverIO Reporter
The Testream WebdriverIO Reporter generates CTRF reports and uploads test results to Testream. It integrates with WebdriverIO's reporter system and handles CTRF report generation for you.
Installation
npm install --save-dev @testream/webdriverio-reporter
Basic Configuration
Add the reporter and launcher service to your wdio.conf.ts:
const testreamConfig = {
apiKey: process.env.TESTREAM_API_KEY || "",
uploadEnabled: true,
};
export const config: Options.Testrunner = {
reporters: ["spec", ["@testream/webdriverio-reporter", testreamConfig]],
services: [["@testream/webdriverio-reporter", testreamConfig]],
};
The services entry registers a launcher service that automatically aggregates per-worker CTRF reports and uploads the merged result when the test run completes.
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | - | Required Testream API key |
uploadEnabled | boolean | true | Enable/disable automatic upload |
failOnUploadError | boolean | false | Fail the test run if upload fails |
branch | string | auto | Git branch name |
commitSha | string | auto | Git commit SHA |
repositoryUrl | string | auto | Git repository URL |
outputDir | string | ctrf | CTRF output directory |
outputFile | string | ctrf-report.json | CTRF report filename |
buildName | string | - | Build name |
buildNumber | string | auto | Build number |
buildUrl | string | auto | Build URL |
testEnvironment | string | - | Environment name |
appName | string | - | Application name |
appVersion | string | - | Application version |
testType | string | e2e | Test type (e.g., api, unit) |
Full Configuration Example
const testreamConfig = {
apiKey: process.env.TESTREAM_API_KEY || "",
uploadEnabled: true,
failOnUploadError: true,
outputDir: "ctrf",
outputFile: "ctrf-report.json",
testType: "e2e",
appName: "My App",
appVersion: "1.0.0",
buildName: process.env.GITHUB_WORKFLOW,
testEnvironment: process.env.TEST_ENV || "ci",
};
export const config: Options.Testrunner = {
runner: "local",
specs: ["./test/specs/**/*.ts"],
maxInstances: 5,
capabilities: [
{
browserName: "chrome",
"goog:chromeOptions": { args: ["--headless", "--disable-gpu"] },
},
],
logLevel: "info",
framework: "mocha",
reporters: ["spec", ["@testream/webdriverio-reporter", testreamConfig]],
services: [["@testream/webdriverio-reporter", testreamConfig]],
mochaOpts: { ui: "bdd", timeout: 60000 },
};
GitHub Actions Example
name: WebdriverIO Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Run WebdriverIO tests
env:
TESTREAM_API_KEY: ${{ secrets.TESTREAM_API_KEY }}
run: npx wdio run wdio.conf.ts
Notes
Git Context Detection
In CI environments like GitHub Actions, GitLab CI, and CircleCI, git context (branch, commit SHA, repository URL) is automatically detected from environment variables. You only need to provide these values explicitly if running outside of standard CI environments.
Sample Project
The testream/webdriverio-jira-reporter repository is a complete working example of a WebdriverIO project integrated with Testream. It includes example tests, full reporter configuration, and a ready-to-use GitHub Actions workflow.