wdio-lambdatest-service-sdk
v5.2.5
Published
WebdriverIO service and CLI for LambdaTest Appium & browser automation
Maintainers
Readme
WDIO LambdaTest CLI
CLI for running WebdriverIO and Appium tests on LambdaTest. Use the CLI to generate or update WDIO configs that connect to LambdaTest (auth, capabilities, test status updates).
Table of Contents
- Features
- Installation
- Generate Config (recommended)
- CLI Commands
- Try the CLI with the Sample Project
- Steps to Run the Sample Project
- Specs Folder & Code Design
- Setup Command
- Manual Configuration
- Troubleshooting
- Development
- License
Features
- CLI: Interactive config generator (
wdio-lt generate/wdio-lt config), setup (wdio-lt setup), run (wdio-lt run), install (wdio-lt install), and REPL (wdio-lt repl) — all LambdaTest-focused. - Generate: Multi-select for test type, device type, platform, app/website; creates
LT_Test/<name>.conf.jsready to run. - Setup: Injects LambdaTest service into existing
*.conf.jsfiles. - Run: Run LambdaTest WDIO config (default: config in
LT_Test); pass WDIO options after--. - Install: Install
wdio-lambdatest-service-sdkin the current project; optional--config <path>to run setup after install. - REPL: Start an interactive REPL session on the LambdaTest grid (credentials from env or
LT_Testconfig). - Auth & status: Generated/setup configs use your credentials and report test status to the LambdaTest dashboard.
Installation
Works with Node.js (≥18) or Bun (≥1.0). No Bun required.
# Install the CLI (npm)
npm i wdio-lambdatest-service-sdk --save-dev
# Or with Bun
bun add wdio-lambdatest-service-sdk --devPeer dependency conflict (ERESOLVE)
If you see ERESOLVE unable to resolve dependency tree (e.g. WebdriverIO 5 or 6), use:
npm i wdio-lambdatest-service-sdk --save-dev --legacy-peer-depsOr:
npm i wdio-lambdatest-service-sdk --save-dev --forceGenerate Config (recommended)
Use the CLI to generate a WDIO config that is already wired to LambdaTest.
1. Install the CLI
npm i wdio-lambdatest-service-sdk --save-dev2. Run the generator
npx wdio-lt generateOr with Bun:
bunx wdio-lt generate3. Follow the prompts
- Test name – Build name and config filename.
- LambdaTest Username & Access Key – Or use
LT_USERNAME/LT_ACCESS_KEY. - Test type(s) – App Testing and/or Browser Testing (multi-select).
- Device type(s) – Real / Virtual (multi-select).
- Platform(s) – Android / iOS (multi-select).
- What to test – Application (Native App) / Website (Mobile Browser) (multi-select).
- App ID(s) – Per platform if native app (e.g.
lt://proverbial-android). - Parallel threads – 0 for sequential.
- Spec file path – e.g.
../specs/android-test.js(relative to config dir).
4. Output
- Config:
LT_Test/<TestName>.conf.js - Script in
LT_Test/package.json:test:<TestName>
5. Run
cd LT_Test
npm run test:<TestName>CLI Commands
| Command | Description |
|--------|-------------|
| wdio-lt generate | Interactively generate a new WDIO config for LambdaTest |
| wdio-lt config | LambdaTest config wizard (same as generate) |
| wdio-lt init | Alias for generate |
| wdio-lt setup [path] | Inject LambdaTest service into existing WDIO config files |
| wdio-lt run [configPath] | Run LambdaTest WDIO config (default: first config in LT_Test). Pass WDIO options after -- |
| wdio-lt install | Install wdio-lambdatest-service-sdk in current project. Use -c/--config <path> to run setup after install; --yarn to use yarn |
| wdio-lt repl [browser] | Start REPL on LambdaTest grid (default browser: chrome). Credentials from LT_USERNAME/LT_ACCESS_KEY or from LT_Test config |
| wdio-lt --help | Show help |
| wdio-lt --version | Show version |
Full usage (all commands)
With npx (Node.js):
# Show help and version
npx wdio-lt --help
npx wdio-lt -h
npx wdio-lt --version
npx wdio-lt -v
# Generate – create a new WDIO config (interactive)
npx wdio-lt generate
npx wdio-lt gen
npx wdio-lt init
npx wdio-lt config
# Setup – inject LambdaTest service into existing configs
npx wdio-lt setup
npx wdio-lt setup .
npx wdio-lt setup ./android-sample
npx wdio-lt setup ./path/to/your/project
# Run – execute LambdaTest config (default: LT_Test)
npx wdio-lt run
npx wdio-lt run LT_Test/MyTest.conf.js
npx wdio-lt run -- --spec ./specs/foo.js --watch
# Install – add LambdaTest service to current project
npx wdio-lt install
npx wdio-lt install --config ./android-sample
npx wdio-lt install --yarn
# REPL – interactive session on LambdaTest grid
npx wdio-lt repl
npx wdio-lt repl chrome
npx wdio-lt repl firefoxWith Bun:
bunx wdio-lt --help
bunx wdio-lt --version
bunx wdio-lt generate
bunx wdio-lt config
bunx wdio-lt run
bunx wdio-lt install
bunx wdio-lt repl chrome
bunx wdio-lt setup
bunx wdio-lt setup ./android-sampleUsing the installed binary (after npm i wdio-lambdatest-service-sdk --save-dev):
# From project root (node_modules/.bin in PATH)
wdio-lt --help
wdio-lt --version
wdio-lt generate
wdio-lt config
wdio-lt run
wdio-lt install
wdio-lt repl chrome
wdio-lt setup
wdio-lt setup ./android-sample
# Or via npm run (add to package.json "scripts")
npm run lt:generate # "lt:generate": "wdio-lt generate"
npm run lt:run # "lt:run": "wdio-lt run"
npm run lt:setup # "lt:setup": "wdio-lt setup ./android-sample"Alternative binary name (same CLI):
npx wdio-lambdatest generate
npx wdio-lambdatest setup ./android-sampleLegacy commands (backward compatible):
npx wdio-lambdatest-setup ./android-sample
npx wdio-lambdatest-generatorTry the CLI with the Sample Project
- Clone the sample repo
git clone https://github.com/LambdaTest/LT-appium-nodejs-webdriverio
cd LT-appium-nodejs-webdriverio- Install the CLI
npm i wdio-lambdatest-service-sdk --save-dev- Set credentials
Linux / macOS:
export LT_USERNAME="your_username"
export LT_ACCESS_KEY="your_access_key"Windows (PowerShell):
$env:LT_USERNAME = "your_username"
$env:LT_ACCESS_KEY = "your_access_key"- Generate a config and run
npx wdio-lt generate
cd LT_Test && npm run test:<TestName>Or run the existing samples: see Steps to Run the Sample Project.
Steps to Run the Sample Project
After cloning LT-appium-nodejs-webdriverio and setting credentials:
Android
cd android-sample
npm install
npm run SingleAndroidApp
# or: npm run paralleliOS
cd ios-sample
npm install
npm run single
# or: npm run parallelEnsure configs point to the correct spec paths (e.g. ../specs/android-test.js) and include the LambdaTest service. Results appear in the terminal and on the LambdaTest App Automation Dashboard.
Specs Folder & Code Design
The sample repo uses a shared specs/ folder at the root. Use the same layout so generated configs can reuse specs.
Recommended layout:
LT-appium-nodejs-webdriverio/
├── android-sample/
├── ios-sample/
├── specs/ # Shared test specs
│ ├── android-test.js
│ ├── ios-test.js
│ └── ...
├── LT_Test/ # Generated configs (from wdio-lt generate)
└── package.json- Use paths like
../specs/android-test.jsin configs underLT_Testor sample dirs. - When running
wdio-lt generate, set the spec path to e.g.../specs/android-test.jsso the generated config uses the shared specs.
Setup Command
Use the CLI to add the LambdaTest service to existing WDIO configs:
wdio-lt setup ./path/to/your/projectThis will:
- Find
*.conf.jsfiles recursively. - Add the service configuration.
- Set
logLeveltoerror. - Comment out hardcoded credentials so env vars or service options are used.
Manual Configuration
If you prefer not to use the CLI, add the service to your wdio.conf.js:
const path = require('path');
exports.config = {
logLevel: 'error',
services: [
[path.join(__dirname, 'node_modules/wdio-lambdatest-service-sdk'), {
user: process.env.LT_USERNAME,
key: process.env.LT_ACCESS_KEY
}]
],
// ...
};Prefer using wdio-lt generate or wdio-lt setup so paths and specs are set correctly.
Troubleshooting
"Cannot read properties of null (reading 'launcher')" or "No specs found"
Regenerate or fix the config with the CLI so the service path and spec paths are correct:- Run
npx wdio-lt generateand use the new config, or - Run
npx wdio-lt setup ./path/to/projectto re-inject the service. - Ensure specs in the config point to existing files (e.g.
../specs/android-test.jsfromLT_Test).
- Run
ERESOLVE / peer dependency errors
Install with--legacy-peer-depsor--force(see Installation).Wrong or missing spec path
When generating, use a path relative to the config file (e.g.../specs/android-test.js). Re-runwdio-lt generateif needed.
Development
This package ships a CLI (wdio-lt) and a WebdriverIO service/launcher used by generated and setup configs.
Project structure
wdio-lambdatest-service/
├── bin/
│ ├── cli.js
│ ├── setup.js
│ └── generate-config.js
├── lib/cli/
│ ├── setup.js
│ ├── generate.js
│ ├── run.js
│ ├── install.js
│ ├── repl.js
│ └── style.js
├── src/
│ ├── launcher.js
│ └── service.js
├── index.js
└── package.jsonRequirements
- Node.js: >= 18.0.0
- Bun: >= 1.0.0 (optional)
License
ISC
