# WebdriverIO setup

> Configure WebdriverIO with Mocha or Jasmine and choose the KwikQA, JSON, or JUnit reporter.

KwikQA diagnoses, repairs, and validates WebdriverIO end-to-end runs using Mocha or Jasmine. Use the KwikQA reporter to preserve nested suites, including the full `describe` path. See [unsupported frameworks](https://kwikqa.com/docs/setup/#unsupported-frameworks) for WebdriverIO with Cucumber.

## Configure Mocha

For a fresh TypeScript runner, use one WebdriverIO version across its packages. If your project already has its runner and browser configured, add `kwikqa` and append its reporter.

```
npm i -D kwikqa @wdio/cli @wdio/local-runner @wdio/mocha-framework @wdio/spec-reporter tsx
```

```
// wdio.conf.ts
import KwikqaReporter from "kwikqa/wdio-reporter";

export const config: WebdriverIO.Config = {
  runner: "local",
  specs: ["./test/specs/**/*.ts"],
  capabilities: [
    { browserName: "chrome", "goog:chromeOptions": { args: ["--headless=new"] } },
  ],
  baseUrl: "http://localhost:3000",
  framework: "mocha",
  mochaOpts: { ui: "bdd", timeout: 60_000 },
  reporters: ["spec", [KwikqaReporter, {}]],
};
```

Set `baseUrl` to your running app. Keep your own spec paths, capabilities, and browser or driver setup. For type checking, add `node`, `@wdio/globals/types`, and `@wdio/mocha-framework` to the TypeScript config's `types` array.

## Use Jasmine

Install `@wdio/jasmine-framework` at the same version as the runner. In the config above, replace the Mocha fields with:

```
framework: "jasmine",
jasmineOpts: { random: false },
```

For type checking, install `@types/jasmine` and use `jasmine` and `@wdio/jasmine-framework` in the TypeScript config in place of the Mocha framework type.

## Choose a reporter

| Reporter | Report path | When to use it |
| --- | --- | --- |
| KwikQA | `test-results/kwikqa` by default | Preserves the full suite path and the reporter can be added alongside your existing reports. |
| `@wdio/json-reporter` | The configured `outputDir` | Reads your existing per-worker JSON. Suite nesting can be flattened. |
| `@wdio/junit-reporter` | The configured `outputDir` | Reads your existing XML. Pass `--framework webdriverio` when the XML does not identify its runner. |

If your project uses `@wdio/json-reporter`, configure the output directory and pass it to `--report`.

```
reporters: ["spec", ["json", { outputDir: "./test-results/wdio-json" }]],
```

## Analyze a failing run

```
npx wdio run wdio.conf.ts
npx kwikqa analyze --report test-results/kwikqa --html
```

Pass the output path for the reporter you picked to both `analyze` and `fix`. If you needed `--framework webdriverio` to identify your JUnit report, repeat that flag for `fix`. Start with a clean report directory each time. To add page DOM, command, console, and network evidence, rerun with `npx kwikqa analyze --report test-results/kwikqa --capture`. Use `--local` for a report with failure groups without signing in. For eligible failures, continue with [your first repair](https://kwikqa.com/docs/first-repair/).

See [WebdriverIO's TypeScript setup](https://webdriver.io/docs/typescript/) and [JSON reporter](https://webdriver.io/docs/json-reporter/).

---

Source: https://kwikqa.com/docs/frameworks/webdriverio/, updated 2026-11-27
