Skip to main content

Quick Start

Four steps to a passing local browser test.

1. Install​

pnpm add -D @caps/core @caps/providers webdriverio

@caps/core is the config builder; @caps/providers supplies the cloud grids. Drop @caps/providers if you will only ever run locally. Add appium when you start testing native apps.

2. Create wdio.conf.js​

// The bare import registers cloud providers into @caps/core's registry.
// Required for remote: 'saucelabs' — without it buildWdioConfig() returns
// undefined instead of a config.
import '@caps/providers'
import { buildWdioConfig } from '@caps/core'

export const config = {
...buildWdioConfig({
envs: process.env,
remote: process.env.WDIO_REMOTE || 'local',
scope: process.env.WDIO_SCOPE || 'browser',
metal: process.env.WDIO_METAL || 'desktop',
framework: 'jasmine',
}),
specs: ['./test/specs/**/*.spec.js'],
}

buildWdioConfig() returns specs: []; the spread-and-override above is how you point it at your tests. Options it does not recognise are ignored, so anything else you want to change — baseUrl, maxInstances, hooks — also goes on the outer object.

3. Write a spec​

// test/specs/example.spec.js
describe('webdriver.io', () => {
it('has the expected title', async () => {
await browser.url('https://webdriver.io')

const title = await browser.getTitle()
expect(title).toContain('WebdriverIO')
})
})

4. Run​

wdio run wdio.conf.js

That is WDIO_REMOTE=local WDIO_SCOPE=browser WDIO_METAL=desktop — the default cell. It runs Chrome and Safari against a local driver on 127.0.0.1:4444.

Change one variable to change target:

WDIO_BROWSERS=chrome wdio run wdio.conf.js # Chrome only
WDIO_METAL=device wdio run wdio.conf.js # local Android + iOS browsers
WDIO_SCOPE=app wdio run wdio.conf.js # local native apps (needs Appium)
WDIO_REMOTE=saucelabs wdio run wdio.conf.js # Sauce Labs desktop browsers

Cloud runs need credentials:

SAUCE_USERNAME=your-user SAUCE_ACCESS_KEY=your-key \
WDIO_REMOTE=saucelabs wdio run wdio.conf.js

If nothing runs​

node -e "import('./wdio.conf.js').then(m => console.dir(m.config, { depth: 3 }))"

If capabilities is missing or the whole config is undefined, the import '@caps/providers' line is missing or was tree-shaken away. That import is the only thing that registers 'saucelabs'.

Next​

  • Examples — the environment for each of the six matrix cells
  • Usage — the full environment-variable reference
  • Architecture — how the matrix and provider registry work