CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-wdio--cli

WebdriverIO testrunner command line interface for test automation

Pending
Overview
Eval results
Files

cli-commands.mddocs/

CLI Commands

WebdriverIO CLI provides comprehensive command-line interface for test execution, interactive development, project configuration, and plugin management.

Capabilities

Run Command

Execute WebdriverIO test suite with extensive configuration options. This is the default command when no explicit command is specified.

wdio run <configPath> [options]

# Options:
--watch                     # Run in watch mode for development
--hostname, -h <hostname>   # Automation driver host address
--port, -p <port>          # Automation driver port
--path <path>              # Path to WebDriver endpoints (default "/")
--user, -u <user>          # Username for cloud service authentication
--key, -k <key>            # Access key for cloud service authentication
--logLevel, -l <level>     # Logging verbosity: trace|debug|info|warn|error|silent
--bail <number>            # Stop after N test failures
--baseUrl <url>            # Base URL for tests
--waitforTimeout <ms>      # Default wait timeout in milliseconds
--framework <framework>    # Test framework: mocha|jasmine|cucumber
--reporters <reporters>    # Test reporters configuration
--suite <suites>           # Test suites to execute (repeatable)
--spec <specs>             # Specific spec files to run (repeatable)
--exclude <patterns>       # Patterns to exclude from execution (repeatable)
--coverage                 # Enable code coverage collection
--updateSnapshots <mode>   # Snapshot update mode: all|new|none
--tsConfigPath <path>      # TypeScript configuration file path
--repeat <count>           # Repeat specific specs and/or suites N times
--shard <current>/<total>  # Run tests in parallel shards

Usage Examples:

# Basic test execution
wdio run wdio.conf.js

# Run specific suite
wdio run wdio.conf.js --suite regression

# Run specific specs
wdio run wdio.conf.js --spec ./tests/login.js --spec ./tests/checkout.js

# Run with custom configuration
wdio run wdio.conf.js --baseUrl https://staging.example.com --logLevel debug

# Run in watch mode for development
wdio run wdio.conf.js --watch

# Run with cloud service credentials
wdio run wdio.conf.js --user $SAUCE_USERNAME --key $SAUCE_ACCESS_KEY

REPL Command

Interactive WebDriver session for manual testing and debugging.

wdio repl <option> [capabilities] [options]

# Parameters:
<option>         # Browser or device option (chrome, firefox, safari, edge, etc.)
[capabilities]   # JSON capabilities string or file path

# Options:
--platformVersion, -v <version>  # OS version for mobile devices
--deviceName, -d <device>        # Device name for mobile devices  
--udid, -u <udid>               # Device UDID for mobile devices
--hostname, -h <hostname>        # WebDriver server hostname
--port, -p <port>               # WebDriver server port
--user, -u <user>               # Cloud service username
--key, -k <key>                 # Cloud service access key

Usage Examples:

# Start Chrome REPL session
wdio repl chrome

# Start mobile device REPL
wdio repl android --deviceName "Pixel 4" --platformVersion "11"

# Start cloud REPL session
wdio repl chrome -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY

# Start with custom capabilities
wdio repl chrome '{"browserName": "chrome", "browserVersion": "latest"}'

Config Command

Interactive configuration wizard for setting up WebdriverIO projects.

wdio config [options]

# Options:
--yes      # Skip prompts and use default values
--dev      # Install packages as dev dependencies

Usage Examples:

# Start configuration wizard
wdio config

# Quick setup with defaults
wdio config --yes

Install Command

Install WebdriverIO services, reporters, frameworks, or plugins.

wdio install <type> <name> [options]

# Parameters:
<type>    # Package type: service|reporter|framework|plugin
<name>    # Package name (without @wdio/ prefix)

# Options:
--config <path>  # Configuration file path
--dev           # Install as dev dependency

Usage Examples:

# Install a reporter
wdio install reporter spec

# Install a service
wdio install service chromedriver

# Install a framework
wdio install framework mocha

# Install with custom config file
wdio install service sauce --config ./custom.conf.js

Common Patterns

Default Command Behavior

When no command is specified, WebdriverIO CLI defaults to the run command:

# These commands are equivalent:
wdio wdio.conf.js
wdio run wdio.conf.js

Configuration File Discovery

The CLI supports automatic configuration file discovery:

# Looks for wdio.conf.js in current directory
wdio run

# Explicit configuration file
wdio run ./config/wdio.staging.conf.js

Environment Variable Support

Many options can be set via environment variables:

# Set credentials via environment
export WDIO_USER=username
export WDIO_KEY=accesskey
wdio run wdio.conf.js

# Override log level
export WDIO_LOG_LEVEL=debug
wdio run wdio.conf.js

Types

Command Arguments

interface RunCommandArguments {
  configPath: string;
  coverage?: boolean;
  watch?: boolean;
  hostname?: string;
  port?: number;
  path?: string;
  user?: string;
  key?: string;
  logLevel?: 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
  bail?: number;
  baseUrl?: string;
  shard?: Options.ShardOptions;
  waitforTimeout?: number;
  framework?: string;
  reporters?: Reporters.ReporterEntry[];
  suite?: string[];
  spec?: string[];
  exclude?: string[];
  mochaOpts?: WebdriverIO.MochaOpts;
  jasmineOpts?: WebdriverIO.JasmineOpts;
  cucumberOpts?: WebdriverIO.CucumberOpts;
  updateSnapshots?: Options.Testrunner['updateSnapshots'];
  tsConfigPath?: string;
  repeat?: number;
  ignoredWorkerServices?: string[];
}

interface ReplCommandArguments {
  platformVersion: string;
  deviceName: string;
  udid: string;
  option: string;
  capabilities: string;
}

interface InstallCommandArguments {
  config?: string;
  type: 'service' | 'reporter' | 'framework' | 'plugin';
  name: string;
}

Install with Tessl CLI

npx tessl i tessl/npm-wdio--cli

docs

cli-commands.md

configuration.md

index.md

programmatic-api.md

watch-mode.md

tile.json