jest-environment-wdio

Jest environment for running WebDriverIO tests

Usage no npm install needed!

<script type="module">
  import jestEnvironmentWdio from 'https://cdn.skypack.dev/jest-environment-wdio';
</script>

README

jest-environment-wdio

version MIT License

Run WDIO Tests using Jest

** NOTE ** Compatible with WDIO v5 ONLY!

Installation

NPM:

npm install jest-environment-wdio webdriverio --save-dev

Yarn:

yarn add jest-environment-wdio webdriverio --dev

Configuration

In the package.json update the jest configuration section

"jest": {
  "testEnvironment": "jest-environment-wdio",
  "testEnvironmentOptions": {
      "wdio": {
          "capabilities":{
              "browserName": "firefox"
          }
          // any wdio configuration options
      }
  }
}

testEnvironmentOptions Default Options. Does support all WDIO Configuraiton Options

{
    host: '127.0.0.1',
    port: 4444,
    protocol: 'http',
    waitForTimeout: '10000',
    connectionRetryTimeout: '90000',
    connectionRetryCount: 3,
    logLevel: 'debug',
    coloredLogs: true,
    capabilities: {
        browserName: 'chrome'
    }
}

API

global.browser

Access to the WDIO Browser Object

global.$

Alias for findElement

global.$

Alias for findElements

From here the WDIO v5 API documentation takes over.