WebdriverIO reporter
@brittlehq/wdio-reporter plugs into WebdriverIO’s reporter slot. It
captures WebDriver commands as they execute, optionally takes a
screenshot on failure, and posts one result per test to the hub as
each spec finishes.
Install
Section titled “Install”pnpm add -D @brittlehq/wdio-reporterConfigure
Section titled “Configure”Add the reporter to wdio.conf.ts:
import BrittleReporter from '@brittlehq/wdio-reporter';
export const config = { reporters: [ 'spec', [ BrittleReporter, { url: process.env.BRITTLE_URL, token: process.env.BRITTLE_TOKEN, screenshotOnFailure: true, }, ], ],};The reporter subscribes directly to the worker’s browser object.
No separate service entry is needed.
export BRITTLE_URL=https://brittle.your-domain.comexport BRITTLE_TOKEN=brt_svc_xxxxxxxxxxxxxxxxpnpm exec wdio run wdio.conf.tsWhat gets captured
Section titled “What gets captured”- Test result (pass / fail / skipped) plus duration.
- Full WebDriver command log: every navigate, click, find, type, script execution, and assertion the test issued. Polling loops (waitUntil, waitForDisplayed) collapse into group rows so the timeline stays readable.
- Screenshot on failure when
screenshotOnFailure: true. - The git commit, branch, and CI provider context.
WDIO-specific options
Section titled “WDIO-specific options”In addition to the shared options:
| Option | Type | Default | Notes |
|---|---|---|---|
screenshotOnFailure | boolean | false | Calls browser.takeScreenshot() after a failed test and attaches the PNG to the rich command log. |
Worker model
Section titled “Worker model”WebdriverIO spawns one worker per spec; the reporter automatically
converges them onto one Run row. For sharded runs across multiple
machines, set BRITTLE_RUN_NAME explicitly so every machine writes
to the same Run.
Common stumbles
Section titled “Common stumbles”- No
browser.takeScreenshot()available in the failure hook. If your tests crash the session (driver loses connection, page hangs past timeout), there’s no live driver to screenshot from. The reporter swallows the error and proceeds; no upload for that test. - Put
specbefore the Brittle reporter so console output stays readable. Order doesn’t affect correctness.
Next steps
Section titled “Next steps”- Configuration reference for every option, type, and default.
- Reporter overview for concepts that apply to every framework.