Utility package providing comprehensive TypeScript type definitions for the WebdriverIO ecosystem
—
WebdriverIO client and test runner configuration including connection settings, logging, test execution options, and service integrations.
WebDriver server connection settings and authentication.
/**
* WebDriver connection configuration
*/
interface Connection {
/** Protocol: http or https */
protocol?: string;
/** WebDriver server hostname */
hostname?: string;
/** WebDriver server port */
port?: number;
/** Path to WebDriver endpoint */
path?: string;
/** Query parameters for driver server */
queryParams?: Record<string, string>;
/** Username for cloud services or authentication */
user?: string;
/** Access key or password for authentication */
key?: string;
}Core WebDriver client configuration extending connection settings.
/**
* WebDriver client configuration
*/
interface WebDriver extends Connection {
/** Logging verbosity level */
logLevel?: WebDriverLogTypes;
/** Per-logger log levels */
logLevels?: Record<string, WebDriverLogTypes>;
/** Connection retry timeout in milliseconds */
connectionRetryTimeout?: number;
/** Number of connection retry attempts */
connectionRetryCount?: number;
/** Custom headers for requests */
headers?: Record<string, string>;
/** Transform request options */
transformRequest?: (requestOptions: RequestLibOptions) => RequestLibOptions;
/** Transform response data */
transformResponse?: (response: RequestLibResponse, requestOptions: RequestLibOptions) => RequestLibResponse;
/** Strict SSL verification */
strictSSL?: boolean;
/** Custom agent for requests */
agent?: any;
/** Request/response logging */
logRequests?: boolean;
logResponses?: boolean;
}
/**
* WebDriver log levels
*/
type WebDriverLogTypes = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
/**
* HTTP methods
*/
type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE' | 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete' | 'options' | 'trace';WebdriverIO-specific configuration extending WebDriver client options.
/**
* WebdriverIO client configuration
*/
interface WebdriverIO extends WebDriver {
/** WebDriver automation protocol */
automationProtocol?: 'webdriver' | 'devtools' | 'stub';
/** Base URL for navigation commands */
baseUrl?: string;
/** Wait timeout for expect assertions */
waitforTimeout?: number;
/** Interval for wait polling */
waitforInterval?: number;
/** Regional Sauce Labs data center */
region?: SauceRegions;
/** Enable WebDriver Bidi */
enableDirectConnect?: boolean;
/** Custom command wrapper */
customCommandWrapper?: (commandName: string, fn: Function) => (...args: any[]) => any;
/** Transform command execution */
transformCommandLogOutput?: (result: any) => any;
}
/**
* Sauce Labs regions
*/
type SauceRegions = 'us' | 'eu' | 'us-west-1' | 'us-east-4' | 'eu-central-1' | 'staging';Complete test runner configuration including test execution, reporting, and service integration.
/**
* Test runner configuration
*/
interface Testrunner extends Hooks, WebdriverIO {
/** Test specification file patterns */
specs?: string[];
/** Files to exclude from test execution */
exclude?: string[];
/** Named test suites */
suites?: Record<string, string[]>;
/** Test execution capabilities */
capabilities: TestrunnerCapabilities;
/** Maximum concurrent test instances */
maxInstances?: number;
/** Maximum instances per capability */
maxInstancesPerCapability?: number;
/** Test framework (mocha, jasmine, cucumber) */
framework: string;
/** Framework-specific options */
mochaOpts?: WebdriverIO.MochaOpts;
jasmineOpts?: WebdriverIO.JasmineOpts;
cucumberOpts?: WebdriverIO.CucumberOpts;
/** Test reporters */
reporters?: ReporterEntry[];
/** Services for extending functionality */
services?: ServiceEntry[];
/** Bail on first test failure */
bail?: number;
/** Output directory for logs and reports */
outputDir?: string;
/** Connection options */
connectionRetryTimeout?: number;
connectionRetryCount?: number;
/** Debug mode */
debug?: boolean;
/** Execute tests */
execArgv?: string[];
/** Force exit after tests */
forceExit?: boolean;
/** Watch mode options */
watch?: boolean;
filesToWatch?: string[];
/** Spec file retry attempts */
specFileRetries?: number;
specFileRetriesDelay?: number;
specFileRetriesDeferred?: boolean;
/** Grouping and sharding */
groupLogsByTestSpec?: boolean;
shard?: ShardOptions;
/** Runner selection */
runner?: string | RunnerClass;
/** Root directory */
rootDir?: string;
/** TypeScript configuration */
tsConfigPath?: string;
tsConfigPathsOptions?: TSConfigPathsOptions;
/** Auto-compilation options */
autoCompileOpts?: {
autoCompile?: boolean;
tsNodeOpts?: Record<string, any>;
babelOpts?: Record<string, any>;
};
}Test execution sharding for parallel test distribution.
/**
* Test sharding configuration
*/
interface ShardOptions {
/** Total number of shards */
total: number;
/** Current shard index (starts from 1) */
current: number;
}TypeScript path mapping and compilation options.
/**
* TypeScript configuration options
*/
interface TSConfigPathsOptions {
/** Base URL for path mapping */
baseUrl?: string;
/** Path mapping configuration */
paths?: Record<string, string[]>;
/** Additional TypeScript options */
addMatchAll?: boolean;
}HTTP request and response type definitions.
/**
* HTTP response structure
*/
interface RequestLibResponse<Body = unknown> {
/** HTTP status code */
statusCode: number;
/** Parsed response body */
body?: Body;
/** Raw response buffer */
rawBody?: Buffer;
}
/**
* HTTP request options
*/
interface RequestLibOptions {
/** Request method */
method?: Method;
/** Request URL */
url?: string;
/** Request headers */
headers?: Record<string, string>;
/** Request body */
body?: any;
/** JSON flag */
json?: boolean;
/** Form data flag */
form?: boolean;
/** Timeout */
timeout?: number;
/** Follow redirects */
followRedirect?: boolean;
/** Max redirects */
maxRedirects?: number;
/** Proxy settings */
proxy?: string;
/** SSL verification */
strictSSL?: boolean;
}Test runner lifecycle event data structures.
/**
* Runner start event data
*/
interface RunnerStart {
/** Capability ID */
cid: string;
/** Test specifications */
specs: string[];
/** Runner capabilities */
capabilities: WebdriverIO.Capabilities;
/** Session ID */
sessionId?: string;
/** Is multiremote */
isMultiremote?: boolean;
/** Instance options */
instanceOptions?: Record<string, any>;
}
/**
* Runner end event data
*/
interface RunnerEnd {
/** Capability ID */
cid: string;
/** Test specifications */
specs: string[];
/** Runner capabilities */
capabilities: WebdriverIO.Capabilities;
/** Session ID */
sessionId?: string;
/** Is multiremote */
isMultiremote?: boolean;
/** Exit code */
failures: number;
/** Retry count */
retries: number;
}Usage Examples:
import type { Options } from "@wdio/types";
// Basic WebdriverIO configuration
const config: Options.Testrunner = {
specs: ["./test/**/*.spec.ts"],
capabilities: [{
browserName: "chrome",
"goog:chromeOptions": {
args: ["--headless"]
}
}],
baseUrl: "https://example.com",
framework: "mocha",
reporters: ["spec"],
services: ["chromedriver"],
mochaOpts: {
timeout: 60000
},
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
logLevel: "info"
};
// Connection configuration for remote WebDriver
const remoteConfig: Options.WebdriverIO = {
protocol: "https",
hostname: "hub.browserstack.com",
port: 443,
path: "/wd/hub",
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
logLevel: "warn",
connectionRetryTimeout: 180000
};Install with Tessl CLI
npx tessl i tessl/npm-wdio--types@9.19.1