Skip to main content

Browsers

What you will learn
  • How Testplane works with browsers
  • How to describe browsers in configuration
  • What browser sources are available: local, Docker, cloud
  • How to choose the right approach for your task

Introduction​

Testplane runs tests in real browsers and is not tied to specific versions or a single browser source.

You describe the required browsers in the browsers section, and the gridUrl parameter determines where to get them from: locally, from a Docker grid (e.g., Selenoid), or from a remote cloud (BrowserStack, Sauce Labs).

General workflow

  1. Testplane reads the browsers section
  2. For each browser, it takes the gridUrl (common or overridden at the browser level)
  3. Connects to the grid and launches the browser with the specified desiredCapabilities

Usually, all browsers use one source (one gridUrl), but if necessary, it can be set separately for each browser.

Browser Configuration​

The browsers section describes which browsers the tests run in.

testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
browsers: {
chrome: {
gridUrl: "local",
desiredCapabilities: {
browserName: "chrome",
browserVersion: "125.0",
},
windowSize: "1920x1080",
headless: true,
},

"chrome-mobile": {
gridUrl: "local",
desiredCapabilities: {
browserName: "chrome",
browserVersion: "125.0",
"goog:chromeOptions": {
mobileEmulation: {
deviceName: "iPhone 12 Pro",
},
},
},
headless: true,
},
},
} satisfies ConfigInput;

The key in browsers (chrome, chrome-mobile) is the logical browser name. It is used in CLI and reports. The name does not limit the actual settings: you can specify any browserName and browserVersion in desiredCapabilities.

The browser version is set in desiredCapabilities.browserVersion. For local browsers, Testplane will download the required version if it is supported.

windowSize: "1920x1080" sets the window size, which is important for screenshot tests.

Headless Mode​

The headless: true parameter enables running the browser without a graphical interface.

Important points

  • Test behavior is identical: from the test's perspective, a browser with headless: true and headless: false works exactly the same. For example, when running with headless: true, you can still take screenshots, work with the DOM, and execute any commands.

  • The parameter is required in environments without UI: in environments without a graphical interface (e.g., in CI jobs), you must use headless: true, otherwise you will get errors like cannot open display and similar.

Mobile Emulation​

For Chrome, use goog:chromeOptions.mobileEmulation:

const desiredCapabilities = {
"goog:chromeOptions": {
mobileEmulation: {
deviceName: "iPhone 12 Pro",
},
},
};

For other supported settings, see the official documentation.

For Firefox, you can emulate a mobile user-agent via moz:firefoxOptions:

const desiredCapabilities = {
"moz:firefoxOptions": {
prefs: {
"general.useragent.override":
"Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15",
"layout.css.devPixelsPerPx": "3.0",
},
args: ["--width=390", "--height=844"],
},
};

Local Browsers​

The easiest way to get started with Testplane. Tests run on browsers and drivers installed on your machine.

Installing Dependencies​

Download all browsers and drivers specified in the config that support automatic installation:

npx testplane install-deps

Download only selected browsers (by logical name from config):

npx testplane install-deps chrome-dark

Specify specific versions:

npx testplane install-deps chrome@130 firefox@104

By default, browsers and drivers are downloaded to the .testplane directory in the user's home folder. The path can be changed via the TESTPLANE_BROWSERS_PATH environment variable:

TESTPLANE_BROWSERS_PATH=./node_modules/.testplane npx testplane install-deps

Removing Browsers​

Delete the .testplane directory in the home folder or the directory specified in TESTPLANE_BROWSERS_PATH.

Browser Support​

Below is a table of supported browsers:

BrowserAuto-downloadDriver Auto-downloadWebDriver Launch
Chrome+++
Firefox+++
Edge−++
Safari−++

Supported browser versions depending on OS:

OSWindowsMacOSUbuntu 20Ubuntu 22Ubuntu 24
Chrome73+73+73+73+73+
Firefox60+60+60+91+126+
Edge*****
Safari−*−−−

* — browser auto-download is not supported, but if the browser is installed by the user, Testplane will use the installed version.

Running Tests​

There are two options:

  • Via the --local CLI option:
npx testplane --local
  • Via gridUrl: "local" in configuration:
testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
browsers: {
chrome: {
gridUrl: "local",
desiredCapabilities: {
browserName: "chrome",
browserVersion: "125.0",
},
windowSize: "1920x1080",
headless: true,
},
},
} satisfies ConfigInput;

Pros and Cons​

Advantages​

  • High test execution speed
  • No costs for cloud services
  • Simple setup and easy debugging

Limitations​

  • Limited set of browser versions
  • OS dependency: screenshots may differ

Local browsers are suitable for development, quick runs, and debugging, but not ideal for screenshot testing across different OSes.

Browsers in Docker Containers​

Docker containers provide an isolated and reproducible environment for local development and CI/CD. With gridUrl: "docker", Testplane downloads images, manages Selenoid and browser containers, and removes the containers and network after the run. Images remain available locally for subsequent runs.

Installing Docker​

  1. Install Docker Engine using the instructions for your Linux distribution. For Ubuntu, see the Ubuntu installation guide.

  2. Follow the post-installation steps to run Docker without sudo. For a standard installation, add your user to the docker group:

    sudo usermod -aG docker "$USER"

    Log out and log back in for the group change to take effect.

  3. Check access from the terminal where you run Testplane:

    docker run hello-world

Choosing Browser Images​

Use images built for Selenoid: they start a browser's WebDriver server when the container starts. A generic Linux image or an image containing only a browser binary is not enough. The WebDriver port and path must match the image; the defaults are 4444 and /.

Ready-made images are available from:

Choose a version tag from the package page. To build your own image, use gemini-testing/images. For private registries, run docker login first. Testplane provides a default Selenoid controller image, so you only need to choose browser images.

Running Browsers in Local Docker​

Set gridUrl: "docker" and specify an image for each browser:

testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
gridUrl: "docker",
sessionsPerBrowser: 1,
browsers: {
chrome: {
desiredCapabilities: { browserName: "chrome" },
docker: { image: "ghcr.io/gemini-testing/browsers/chromium:126.0" },
},
firefox: {
desiredCapabilities: { browserName: "firefox" },
docker: { image: "selenoid/firefox:125.0" },
},
},
} satisfies ConfigInput;

The image tag determines the browser version. desiredCapabilities.browserVersion does not select or download a different image. See the docker reference for additional settings.

Run your tests:

npx testplane --browser chrome

Testplane prepares the images and starts the required containers automatically. You do not need to start Selenoid or create browsers.json yourself.

Accessing an Application on the Host​

If your application runs on the host, start it, for example on port 3000, and set baseUrl accordingly:

export default {
baseUrl: "http://host.docker.internal:3000",
// ... other settings
};

Inside a browser container, localhost refers to that container. host.docker.internal provides access to the host. The application must listen on an interface reachable from containers, for example 0.0.0.0. Absolute URLs and redirects must also be reachable from the container.

Testplane adds host.docker.internal:host-gateway for Docker by default. If you specify docker.hosts, include that entry when you need host access: your array replaces the default.

Preparing Images for CI​

To download and prepare images before the test stage, run:

npx testplane prepare-docker

This command prepares images without starting Selenoid or browser sessions. On Apple Silicon, it may also build a cached image with a compatible CDP adapter for an amd64 Chrome or Yandex Browser image. Run preparation and tests against the same Docker daemon to reuse these images. A regular test run performs the same preparation automatically, so this separate step is optional.

Platforms and Parallelism​

When downloading an image, Testplane prefers the Docker daemon's native platform. If the image does not support it, Testplane uses linux/amd64 when available. On ARM machines, running such an image requires emulation, such as Rosetta in Colima. Images already cached for the native platform or linux/amd64 are reused.

To pin a platform, set docker.platform for the browser and, if needed, docker.selenoidPlatform for Selenoid. With an explicit platform, Testplane does not fall back to another architecture. If a cached image does not match, pull or build it for the requested platform.

When all configured browsers use Docker and system.parallelLimit is not set, Testplane automatically limits parallelism to max(1, floor(CPUs × 5 / 4)). It uses the smaller of the CPU counts available to Testplane and the Docker daemon; if the daemon's count is unavailable, it uses the local count. Set system.parallelLimit to override this limit and sessionsPerBrowser to limit individual browsers.

You can set gridUrl: "docker" for individual browsers and use local browsers or a remote grid for the others. The --local flag switches the run to local browsers even when the config specifies Docker.

If you need to manage images and containers yourself, see Manual Docker Grid Setup.

Pros and Cons​

Advantages​

  • A consistent browser environment for local runs and CI
  • Testplane manages the container lifecycle
  • Browser versions are pinned by image tags

Limitations​

  • Requires Docker and disk space for images
  • Consumes more resources than local browsers
  • Different CPU architectures can affect rendering; use the same image and platform when comparing screenshots

Remote Grids​

Cloud services such as BrowserStack and Sauce Labs provide a wide range of browsers, OSes, and real devices for cross-browser testing.

Connection and Authentication​

To connect, you need to specify the service's gridUrl and pass credentials via user and key. It is recommended to store them in environment variables.

The basic browser configuration remains the same, only the gridUrl changes, and cloud provider-specific options are added:

testplane.config.ts
export default {
browsers: {
chrome: {
gridUrl: "https://hub.browserstack.com/wd/hub",
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
desiredCapabilities: {
browserName: "chrome",
browserVersion: "125.0",
"bstack:options": {
os: "Windows",
osVersion: "11",
projectName: "My Test Project",
buildName: "Build 1.0",
},
},
windowSize: "1920x1080",
headless: true,
},

"chrome-mobile": {
gridUrl: "https://hub.browserstack.com/wd/hub",
user: process.env.BROWSERSTACK_USERNAME,
key: process.env.BROWSERSTACK_ACCESS_KEY,
desiredCapabilities: {
browserName: "chrome",
browserVersion: "125.0",
"goog:chromeOptions": {
mobileEmulation: {
deviceName: "iPhone 12 Pro",
},
},
"bstack:options": {
os: "Windows",
osVersion: "11",
projectName: "My Test Project",
buildName: "Build 1.0",
},
},
headless: true,
},
},
};

Session Customization​

Different services have their own options:

BrowserStack (bstack:options)

  • OS and its version (os, osVersion)
  • Screen resolution (resolution)
  • Local testing (local)
  • Enable logs and debugging (debug, networkLogs, consoleLogs)

Sauce Labs (sauce:options)

  • Name and build (name, build)
  • Tags (tags)
  • Time limits (commandTimeout, idleTimeout, maxDuration)
  • Video and logs (recordVideo, recordLogs)

Timeouts and Debugging​

Cloud services strictly limit the execution time of a single command, session idle time, and maximum session duration.

For debugging, the following are available:

  • Session logs
  • Video of each run
  • VNC or similar for browser viewing
  • Network logs

Pros and Cons​

Advantages​

  • Wide selection of browsers, versions, and operating systems
  • No need to maintain your own infrastructure
  • Built-in debugging tools: logs, video, network traces

Limitations​

  • Cost of usage with a large number of runs
  • Dependency on network quality and possible latency
  • Strict session execution time limits

Cloud grids are suitable for cross-browser and mobile testing when you need wide platform coverage without the costs of your own infrastructure.

How to Choose a Browser Source​

It is recommended to choose one browser source for the entire project (or for each test pack if you split them into groups). Choose the approach that covers your main needs:

Local Browsers for Most Projects​

If you don't use screenshot tests and speed of execution is important (e.g., for development and debugging), local browsers are the simplest and fastest option. They don't require additional infrastructure and work directly on your machine.

Docker for Stable Screenshots​

When screenshot stability between different machines and operating systems is important, and you're ready to work with Docker images, use Docker. Use the same browser image and platform locally and in CI to minimize rendering differences.

Cloud Grids for Scaling​

If you need screenshot stability, high parallelism for thousands of tests, or testing on many browser and OS combinations, cloud grids are suitable. You won't have to maintain your own infrastructure, and you'll have access to a wide range of browsers and devices. The downside is the cost with a large number of runs.

tip

For development and debugging, you can use local browsers (run with --local), even if Docker or cloud is used in CI. This will speed up iterations when writing tests.

Debugging​

There are two ways to enable verbose logs.

  1. Via configuration:

    testplane.config.ts
    export default {
    browsers: {
    // ... your browsers
    },
    system: {
    debug: true,
    },
    };
  2. Via environment variables (with limited webdriverio logging level):

    testplane_system_debug=true WDIO_LOG_LEVEL=error npx testplane --local -b chrome