Run WebdriverIO on TestingBot Across Browsers
On this page
So far every spec has run in the Chrome on your machine. Your users also use Firefox, Safari and Edge, on Windows and macOS, and you probably do not have all of those installed. Because WebdriverIO speaks the standard WebDriver protocol, moving to a cloud grid is a configuration change: point the runner at the grid, add credentials, list the browsers you want. The specs and page objects stay exactly as they are.
This chapter adds a second config file that runs the four spec files on Chrome and Firefox on Windows 11 and Safari on macOS Sequoia on TestingBot, groups each run into a build, and marks every session passed or failed.
Install the TestingBot service#
npm install --save-dev @wdio/testingbot-service
@wdio/testingbot-service is maintained in the WebdriverIO repository and released with it; version 10.2.0 (November 2026) matches the WebdriverIO 10.2.0 used in this course. It hooks into the runner's lifecycle and does three things:
- before each test, it sends the test's name to the session, so the TestingBot dashboard shows which test was running at each point of the video;
- after each spec file, it calls the TestingBot API to set the session's name (the
describetitle) and its passed or failed state, from the results the runner collected; - if you set
tbTunnel: true, it starts TestingBot Tunnel before the run and stops it afterwards (see the end of this chapter).
Without the service the tests still run, but every session in the dashboard shows an unknown state, because the grid cannot know whether your assertions passed.
Export your key and secret from the TestingBot account page as environment variables, so they never end up in the repository:
export TESTINGBOT_KEY=your-key
export TESTINGBOT_SECRET=your-secret
A separate cloud config#
Keep wdio.conf.ts for local runs and create wdio.testingbot.conf.ts next to it. It imports the local config and overrides what changes:
import { config as baseConfig } from './wdio.conf.js'
const build = process.env.TB_BUILD ?? `local-${new Date().toISOString().slice(0, 16)}`
export const config: WebdriverIO.Config = {
...baseConfig,
user: process.env.TESTINGBOT_KEY,
key: process.env.TESTINGBOT_SECRET,
hostname: 'hub.testingbot.com',
protocol: 'https',
port: 443,
path: '/wd/hub',
services: [['testingbot', {}]],
maxInstances: Number(process.env.TB_PARALLEL ?? 2),
capabilities: [
{
browserName: 'chrome',
browserVersion: 'latest',
platformName: 'WIN11',
'goog:chromeOptions': {
prefs: {
credentials_enable_service: false,
'profile.password_manager_enabled': false,
'profile.password_manager_leak_detection': false
}
},
'tb:options': { build }
},
{
browserName: 'firefox',
browserVersion: 'latest',
platformName: 'WIN11',
'tb:options': { build }
},
{
browserName: 'safari',
browserVersion: 'latest',
platformName: 'SEQUOIA',
'tb:options': { build }
}
]
}
What each part does:
-
userandkeyauthenticate you.hostname,protocol,portandpathsend WebDriver traffic to TestingBot's hub instead of a local driver. (WebdriverIO can guess the TestingBot hub from the length of the key, but spelling it out makes the config readable and does not depend on that guess.) -
capabilitieslists one entry per browser configuration.browserName,browserVersionandplatformNameare the W3C capabilities;latest,latest-1and so on pick a version relative to the newest one. The WebdriverIO documentation page has a capabilities picker for every browser, version and operating system TestingBot offers. -
tb:optionsholds TestingBot-specific settings.buildgroups every session of this run under one build in the dashboard. Here it comes from theTB_BUILDenvironment variable, or a timestamp for runs from your laptop; chapter 8 sets it to the CI run id. The capabilities builder generates the other options, such as screen resolution, time zone and whether to record a video. -
goog:chromeOptions.prefsswitches off Chrome's password manager. That is not a TestingBot setting; it fixes a real failure described below. -
maxInstancesis how many sessions run at once. Chapter 7 is about choosing it.
The service needs no options for this. Leave the session name out of tb:options as well: the service overwrites it with the describe title at the end of each spec file.
Add a script to package.json:
"wdio:tb": "wdio run ./wdio.testingbot.conf.ts"
Every session of your cloud run shows up in the TestingBot dashboard with an unknown result, even though the terminal says all specs passed. What is missing?
The grid only sees WebDriver commands; whether an assertion passed is known to your runner. The service sends that result after each spec file. A build name groups sessions but does not set their state.
Run it#
TB_PARALLEL=1 npm run wdio:tb
WebdriverIO starts one worker per spec file and capability, twelve in all (four spec files times three browsers), and each worker becomes one TestingBot session. The spec reporter prints a block per worker:
[Safari 18.6 macOS #2-1] Running: Safari (v18.6) on macOS
[Safari 18.6 macOS #2-1] Session ID: c8ec9081f1e8-44d37b678a8c-178419b39429-179455674534-76445883
[Safari 18.6 macOS #2-1]
[Safari 18.6 macOS #2-1] » test/specs/login.e2e.ts
[Safari 18.6 macOS #2-1] Login
[Safari 18.6 macOS #2-1] ✓ logs in with valid credentials and out again
[Safari 18.6 macOS #2-1] ✓ shows an error for a wrong password
[Safari 18.6 macOS #2-1]
[Safari 18.6 macOS #2-1] 2 passing (9.7s)
The session id in the output is the TestingBot session id, so you can paste it into the dashboard search. In the dashboard, the build contains twelve sessions named Login, Selectors, Waiting and Assertions, each with its browser, a passed or failed state, a video and the WebDriver command log.
What the first cloud run found#
The specs passed locally in Chrome. On the grid, the first run of this course's suite had four failed sessions out of twelve, and each one taught something:
Chrome's password manager covered the page. The Login spec failed on Chrome on Windows with Expected: "You logged out of the secure area!" but Received: "You logged into a secure area!". The session video showed why: after the login, Chrome opened a "Change your password" dialog, because the practice site's well-known demo password appears in breach lists. The dialog sat over the page and swallowed the Logout click. Local Chrome had not shown it. The goog:chromeOptions.prefs block above turns the password manager and its leak check off, and the Login spec passed on the next run.
aria/Password matched the label in Firefox, and silently found the wrong element in Safari. Chapter 2 tells that story; the fix was a role selector and an id.
A checkbox test failed in Chrome and Safari too. It runs in the same session right after the login test of the Selectors spec, and both failures went away once the login problems above were fixed. Tests in one spec file share a browser session (chapter 7), so a failure early in a file can leave the browser in a state that breaks the next test. Fix the first failure in a file before you investigate the ones after it.
None of these show up when you only run Chrome on your own machine. That is the case for running the suite on several browsers before you trust it, and for always looking at the video before changing a test (chapter 9).
A spec passes in local Chrome but fails on Chrome on the grid: a click on "Logout" has no effect. What do you do first?
A click "with no effect" usually means something else received it: a dialog, a cookie banner, an overlay. The video shows it in seconds. A pause or a different selector is a guess that may hide the cause.
Testing a site on localhost or a private network#
The browsers on the grid cannot reach http://localhost:3000 on your laptop or a staging server behind a firewall. The TestingBot service can start a tunnel for the run:
services: [['testingbot', { tbTunnel: true }]]
The service downloads and starts TestingBot Tunnel before the first session, tags every capability so its traffic goes through that tunnel, and closes it when the run completes. Set baseUrl to your local address and the specs work unchanged. The local website testing course explains how the tunnel works and how to debug it, and the tunnel documentation lists its options, which you can pass as tbTunnelOpts.
You set baseUrl: 'http://localhost:4200' and run on TestingBot. Every test fails at browser.url() with a connection error. What fixes it?
On the grid, localhost is the remote virtual machine, not your laptop, and 127.0.0.1 is the same thing. The tunnel gives the remote browser a route to your machine.
If you want to drive the same grid from the Puppeteer API through WebdriverIO, or run accessibility checks in these sessions, see the WebdriverIO with Puppeteer and accessibility testing with WebdriverIO documentation.