WebdriverIO reporter
Install @qualflare/webdriverio, add it to the reporters in wdio.conf.js and upload every worker's report as one launch with the Qualflare CLI.
Last updated
@qualflare/webdriverio is the Qualflare reporter for WebdriverIO 8 and 9: each worker writes its results, with per-attempt retries, screenshots and the browser or device it ran on, to ./qualflare-results, and qf <identifier> collect merges them into one launch.
| Fact | Detail |
|---|---|
| Package | @qualflare/webdriverio on npm |
| Works with | WebdriverIO 8 or 9, Node.js 18.20 or later |
| qf | qf ≥ 0.1.24 (requires qf 0.1.24 or later) for screenshots |
| License | Apache-2.0 |
| Source | Qualflare/qualflare-webdriverio on GitHub |
| Without the reporter | --format junit with WebdriverIO's JUnit reporter |
Before you begin
- The Qualflare CLI,
qf: Install the CLI. - A saved login:
qf login <identifier>with a project access token whose creator still holds the project role that uploads need Editor+ · project (requires the Editor role or higher in the project) (Authenticate with qf login). - The Identifier of the environment the results belong to (Environments).
Install
npm install --save-dev @qualflare/webdriverioConfigure
// wdio.conf.js
export const config = {
// ...
reporters: ['spec', ['@qualflare/webdriverio', { environment: 'staging' }]],
};| Option | Type | Default | Required | Description |
|---|---|---|---|---|
resultsDir | string | ./qualflare-results | No | Where reports and screenshots go. Not |
screenshots | boolean | true | No | Attach the screenshots WebdriverIO takes. Variable |
platform | string | from capabilities | No | Set it only for multiremote. |
Running Appium through WebdriverIO? Use @qualflare/appium, the same reporter with the Appium label: see Mobile reporters.
Every reporter shares the other settings: see Reporter configuration.
Set environment to the environment's Identifier: a name such as Staging fails the upload with HTTP 400 (Environment).
Run and upload
npx wdio run wdio.conf.js
qf <identifier> collect ./qualflare-resultsRun in CI
- name: Upload results to Qualflare
if: ${{ !cancelled() }}
env:
QF_TOKEN: ${{ secrets.QF_TOKEN }}
QF_BRANCH: ${{ github.head_ref || github.ref_name }}
QF_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
npm install -g @qualflare/cli
qf login ci --force
qf ci collect ./qualflare-resultsif: ${{ !cancelled() }} uploads the results when tests fail, and QF_BRANCH and QF_COMMIT record a pull request's own branch and commit (Pull request branches). For GitLab CI/CD, Jenkins and Azure Pipelines, see Run the upload when tests fail.
Sharding and retries
- Every worker writes its own report, and
qfmerges the reports that share a run ID. Workers take it fromQUALFLARE_RUN_ID, then the CI run ID, then thewdio runlauncher process, so one run lands in one launch. - Add the optional service,
services: ['@qualflare/webdriverio/service'], when you start WebdriverIO more than once in one process, or to delete this package's reports from earlier runs before each run. --shardgives each test its shard index. See Merge sharded CI jobs into one launch.- Mocha
this.retries(n)gives one test with every attempt; it is flaky when a retry passed.
What gets uploaded
- Status and retries.
- Screenshots.
- The platform:
web, oriosandandroidfor an Appium session. - Device capabilities.
- A test ID that includes the capability, so Chrome and Firefox keep separate histories.
A test sets its own metadata with the qualflare calls; a masked parameter's value is dropped before the report is written:
import { qualflare } from '@qualflare/webdriverio/runtime';
it('checks out', async () => {
qualflare.label('owner', 'payments');
qualflare.link('https://jira.example.com/PAY-12', { type: 'issue' });
qualflare.parameter('card', '4242…', { masked: true });
await qualflare.step('fill the form', async () => {
await $('#card').setValue('4242 4242 4242 4242');
});
});qf doesn't read the branch, commit, language or milestone from the report: set them on the upload (Branch, commit, language and milestone).
Troubleshooting
- WebdriverIO's Cucumber runner isn't supported yet.
specFileRetriesreports a re-run spec file as duplicate tests.- On WebdriverIO 8 with Jasmine,
afterTesthooks are told a failed spec passed. environment "Staging" does not exist in this project: use the environment's Identifier, or pass--environmenton the upload (Environment).- Screenshots can't be downloaded:
qfis older than 0.1.24. Upgrade qf.
Related
Cucumber.js reporter
Install @qualflare/cucumberjs, add its formatter to cucumber.json and upload the qualflare-results folder with the Qualflare CLI after cucumber-js runs.
Appium reporter
Install @qualflare/appium for Appium suites run through WebdriverIO, add it to wdio.conf.js and upload iOS and Android results with the Qualflare CLI.