@wdio/mcp 3.5.2 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -263,31 +263,30 @@ appium
263
263
  # Server runs at http://127.0.0.1:4723 by default
264
264
  ```
265
265
 
266
- ## BrowserStack
266
+ ## Cloud Providers
267
267
 
268
- Run browser and mobile app tests on [BrowserStack](https://www.browserstack.com/) real devices and browsers without any
269
- local setup.
268
+ Run browser and mobile app tests on cloud real devices and browsers without any local setup. Currently supports
269
+ [BrowserStack](https://www.browserstack.com/), [Sauce Labs](https://saucelabs.com/), and
270
+ [LambdaTest](https://www.lambdatest.com/).
270
271
 
271
272
  ### Prerequisites
272
273
 
273
- Set your credentials as environment variables:
274
+ Set your provider credentials as environment variables or in your MCP client config:
275
+
276
+ <details>
277
+ <summary>BrowserStack</summary>
274
278
 
275
279
  ```bash
276
280
  export BROWSERSTACK_USERNAME=your_username
277
281
  export BROWSERSTACK_ACCESS_KEY=your_access_key
278
282
  ```
279
283
 
280
- Or add them to your MCP client config:
281
-
282
284
  ```json
283
285
  {
284
286
  "mcpServers": {
285
287
  "wdio-mcp": {
286
288
  "command": "npx",
287
- "args": [
288
- "-y",
289
- "@wdio/mcp@latest"
290
- ],
289
+ "args": ["-y", "@wdio/mcp@latest"],
291
290
  "env": {
292
291
  "BROWSERSTACK_USERNAME": "your_username",
293
292
  "BROWSERSTACK_ACCESS_KEY": "your_access_key"
@@ -297,11 +296,72 @@ Or add them to your MCP client config:
297
296
  }
298
297
  ```
299
298
 
299
+ </details>
300
+
301
+ <details>
302
+ <summary>Sauce Labs</summary>
303
+
304
+ ```bash
305
+ export SAUCE_USERNAME=your_username
306
+ export SAUCE_ACCESS_KEY=your_access_key
307
+ ```
308
+
309
+ ```json
310
+ {
311
+ "mcpServers": {
312
+ "wdio-mcp": {
313
+ "command": "npx",
314
+ "args": ["-y", "@wdio/mcp@latest"],
315
+ "env": {
316
+ "SAUCE_USERNAME": "your_username",
317
+ "SAUCE_ACCESS_KEY": "your_access_key"
318
+ }
319
+ }
320
+ }
321
+ }
322
+ ```
323
+
324
+ | `SAUCE_USERNAME` | Sauce Labs username (required) |
325
+ | `SAUCE_ACCESS_KEY` | Sauce Labs access key (required) |
326
+
327
+ The data center is set per-session via the `region` parameter in `start_session` (defaults to `eu-central-1`).
328
+
329
+ </details>
330
+
331
+ <details>
332
+ <summary>LambdaTest (TestMu)</summary>
333
+
334
+ ```bash
335
+ export TESTMU_USERNAME=your_username
336
+ export TESTMU_ACCESS_KEY=your_access_key
337
+ ```
338
+
339
+ ```json
340
+ {
341
+ "mcpServers": {
342
+ "wdio-mcp": {
343
+ "command": "npx",
344
+ "args": ["-y", "@wdio/mcp@latest"],
345
+ "env": {
346
+ "TESTMU_USERNAME": "your_username",
347
+ "TESTMU_ACCESS_KEY": "your_access_key"
348
+ }
349
+ }
350
+ }
351
+ }
352
+ ```
353
+
354
+ | `TESTMU_USERNAME` | LambdaTest username (required) |
355
+ | `TESTMU_ACCESS_KEY` | LambdaTest access key (required) |
356
+
357
+ </details>
358
+
300
359
  ### Browser Sessions
301
360
 
302
361
  Run a browser on a specific OS/version combination:
303
362
 
304
363
  ```javascript
364
+ // BrowserStack
305
365
  start_session({
306
366
  provider: 'browserstack',
307
367
  platform: 'browser',
@@ -315,56 +375,154 @@ start_session({
315
375
  session: 'Login flow'
316
376
  }
317
377
  })
378
+
379
+ // Sauce Labs
380
+ start_session({
381
+ provider: 'saucelabs',
382
+ platform: 'browser',
383
+ browser: 'chrome',
384
+ os: 'Windows', // combined with osVersion → platformName
385
+ osVersion: '11', // e.g. "11", "15" (numbered Mac naming)
386
+ region: 'eu-central-1', // default: eu-central-1
387
+ reporting: {
388
+ build: 'v1.2.0',
389
+ session: 'Login flow'
390
+ }
391
+ })
392
+
393
+ // LambdaTest
394
+ start_session({
395
+ provider: 'testmu',
396
+ platform: 'browser',
397
+ browser: 'chrome',
398
+ os: 'Windows', // combined with osVersion → platformName
399
+ osVersion: '11', // e.g. "11", "Sequoia" (optional)
400
+ reporting: {
401
+ project: 'My Project',
402
+ build: 'v1.2.0',
403
+ session: 'Login flow'
404
+ }
405
+ })
318
406
  ```
319
407
 
408
+ > **Provider-specific `os` / `osVersion` behavior:**
409
+ > - **BrowserStack** — `os` and `osVersion` map to separate `bstack:options.os` / `bstack:options.osVersion` fields.
410
+ > - **Sauce Labs / LambdaTest** — `os` and `osVersion` are combined into the W3C `platformName` capability (e.g., `os: 'Windows'` + `osVersion: '11'` → `platformName: 'Windows 11'`). Both providers use `platformName` values like `"Windows 11"`, `"MacOS Sequoia"`, or `"Linux"`.
411
+
320
412
  ### Mobile App Sessions
321
413
 
322
- Test on BrowserStack real devices. First upload your app (or use an existing `bs://` URL):
414
+ Test on cloud real devices. First upload your app (or use an existing app URL):
323
415
 
324
416
  ```javascript
325
- // Upload a local .apk or .ipa (returns a bs:// URL)
326
- upload_app({path: '/path/to/app.apk'})
417
+ // BrowserStack: returns bs:// URL
418
+ upload_app({ provider: 'browserstack', path: '/path/to/app.apk' })
419
+
420
+ // Sauce Labs: returns storage:filename= reference
421
+ upload_app({ provider: 'saucelabs', path: '/path/to/app.apk' })
327
422
 
328
- // Start a session with the returned URL
423
+ // LambdaTest: returns lt:// URL
424
+ upload_app({ provider: 'testmu', path: '/path/to/app.apk' })
425
+
426
+ // Start a session
329
427
  start_session({
330
428
  provider: 'browserstack',
331
- platform: 'android', // android | ios
332
- app: 'bs://abc123...', // bs:// URL or custom_id from upload
429
+ platform: 'android',
430
+ app: 'bs://abc123...',
333
431
  deviceName: 'Samsung Galaxy S23',
334
- platformVersion: '13.0',
335
- reporting: {
336
- project: 'My Project',
337
- build: 'v1.2.0',
338
- session: 'Checkout flow'
339
- }
432
+ platformVersion: '13.0'
433
+ })
434
+
435
+ // Sauce Labs native app
436
+ start_session({
437
+ provider: 'saucelabs',
438
+ platform: 'android',
439
+ app: 'storage:filename=myapp.apk',
440
+ deviceName: 'Samsung.*',
441
+ platformVersion: '16'
442
+ })
443
+
444
+ // LambdaTest native app
445
+ start_session({
446
+ provider: 'testmu',
447
+ platform: 'android',
448
+ app: 'lt://abc123...',
449
+ deviceName: 'Pixel 7',
450
+ platformVersion: '13'
340
451
  })
341
452
  ```
342
453
 
454
+ ### Mobile Browser Sessions
455
+
456
+ Run a browser on a cloud mobile emulator/simulator without uploading an app:
457
+
458
+ ```javascript
459
+ // BrowserStack — Chrome on Android emulator
460
+ start_session({
461
+ provider: 'browserstack',
462
+ platform: 'android',
463
+ browser: 'chrome',
464
+ deviceName: 'Google Pixel 7',
465
+ platformVersion: '13'
466
+ })
467
+
468
+ // Sauce Labs — Safari on iOS simulator
469
+ start_session({
470
+ provider: 'saucelabs',
471
+ platform: 'ios',
472
+ browser: 'safari',
473
+ deviceName: 'iPhone 15',
474
+ platformVersion: '18',
475
+ region: 'eu-central-1'
476
+ })
477
+
478
+ // LambdaTest — Chrome on Android emulator
479
+ start_session({
480
+ provider: 'testmu',
481
+ platform: 'android',
482
+ browser: 'chrome',
483
+ deviceName: 'Pixel 7',
484
+ platformVersion: '13'
485
+ })
486
+ ```
487
+
488
+ > **Note:** Mobile browser sessions do not require `app`, `appPath`, or `noReset`. The provider launches a browser on the emulator directly.
489
+
343
490
  Use `list_apps` to see previously uploaded apps:
344
491
 
345
492
  ```javascript
346
- list_apps() // own uploads, sorted by date
347
- list_apps({sortBy: 'app_name'})
348
- list_apps({organizationWide: true}) // all uploads in your org
493
+ list_apps({ provider: 'browserstack' })
494
+ list_apps({ provider: 'saucelabs', sortBy: 'app_name' })
495
+ list_apps({ provider: 'testmu' })
496
+ list_apps({ provider: 'browserstack', organizationWide: true })
349
497
  ```
350
498
 
351
- ### BrowserStack Local
499
+ ### Local Tunnel
352
500
 
353
- To test against URLs that are only accessible on your local machine or internal network, enable the BrowserStack Local
354
- tunnel:
501
+ To test against URLs that are only accessible on your local machine or internal network, enable a local tunnel:
355
502
 
356
503
  ```javascript
504
+ // Auto-start tunnel (provider manages lifecycle)
357
505
  start_session({
358
- provider: 'browserstack',
506
+ provider: 'saucelabs',
359
507
  platform: 'browser',
360
- browser: 'chrome',
361
- browserstackLocal: true // starts tunnel automatically
508
+ tunnel: true // auto-starts tunnel before session
509
+ })
510
+
511
+ // Use an already-running tunnel
512
+ start_session({
513
+ provider: 'saucelabs',
514
+ platform: 'browser',
515
+ tunnel: 'external' // uses existing tunnel
362
516
  })
363
517
  ```
364
518
 
519
+ The `tunnel` parameter replaces the deprecated `browserstackLocal`, `saucelabsLocal`, and `testmuLocal` params. Set it to `true` to auto-start the tunnel (stopped automatically after the session), or `'external'` to use a tunnel already running on your machine.
520
+
521
+ > **Note**: Sauce Connect and TestMu Tunnel require their respective binaries. The `wdio://saucelabs/local-binary` and `wdio://testmu/local-binary` resources provide platform-specific download URLs and setup instructions.
522
+
365
523
  ### Reporting Labels
366
524
 
367
- All session types support `reporting` labels that appear in the BrowserStack Automate dashboard:
525
+ All session types support `reporting` labels that appear in the provider dashboard:
368
526
 
369
527
  | Field | Description |
370
528
  |---------------------|-----------------------------------------|
@@ -372,12 +530,14 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
372
530
  | `reporting.build` | Tag sessions with a build/version label |
373
531
  | `reporting.session` | Name for the individual test session |
374
532
 
375
- ### BrowserStack Tools
533
+ ### Cloud Provider Tools
534
+
535
+ | Tool | Description |
536
+ |--------------|-------------------------------------------------------------------------------|
537
+ | `upload_app` | Upload a local `.apk` or `.ipa` to the provider; returns an app URL/reference |
538
+ | `list_apps` | List apps previously uploaded to the provider's app storage |
376
539
 
377
- | Tool | Description |
378
- |--------------|------------------------------------------------------------------------|
379
- | `upload_app` | Upload a local `.apk` or `.ipa` to BrowserStack; returns a `bs://` URL |
380
- | `list_apps` | List apps previously uploaded to your BrowserStack account |
540
+ Both tools require a `provider` parameter (`'browserstack'`, `'saucelabs'`, or `'testmu'`).
381
541
 
382
542
  ## Features
383
543
 
@@ -487,6 +647,8 @@ All session types support `reporting` labels that appear in the BrowserStack Aut
487
647
  | `wdio://session/current/geolocation` | Device geolocation |
488
648
  | `wdio://session/current/capabilities` | Resolved WebDriver capabilities for the active session |
489
649
  | `wdio://browserstack/local-binary` | BrowserStack Local binary download URL and start command |
650
+ | `wdio://saucelabs/local-binary` | Sauce Connect binary download URL and start command |
651
+ | `wdio://testmu/local-binary` | TestMu Tunnel binary download URL and start command |
490
652
 
491
653
  ## Usage Examples
492
654
 
@@ -794,8 +956,8 @@ MCP resources — no extra tool calls needed:
794
956
  - `wdio://session/{sessionId}/code` — generated JS for any past session by ID
795
957
 
796
958
  The generated script reconstructs the full session — including capabilities, navigation, clicks, and inputs — as a
797
- standalone `import { remote } from 'webdriverio'` file. For BrowserStack sessions it includes the full try/catch/finally
798
- with automatic session result marking.
959
+ standalone `import { remote } from 'webdriverio'` file. For cloud provider sessions it includes the full try/catch/finally
960
+ with automatic session result marking via the provider's REST API.
799
961
 
800
962
  ### Trace Recording
801
963