On this page
Docker
There is no xtest container to run. xtest is hosted, so the only Docker that matters here is yours: the container your application under test runs in, and whether the browser doing the testing can reach it.
Testing a container from the Cloud browser
The Cloud browser runs on our servers, so it can only open addresses the public internet can resolve. A container on your laptop is not one of those. Publish it to a staging hostname, or use a tunnel while you are trying things out.
# The cloud browser reaches your app over the public internet,
# so bind the container to a host the internet can resolve.
services:
web:
image: your-app:latest
ports:
- "8080:8080"
environment:
# Absolute links have to point at the address the browser will use,
# or a redirect will send the test to http://localhost:8080.
PUBLIC_URL: "https://staging.your-company.example"Testing a container on your own machine
Install the xtest app on the computer the container is running on, a Mac or a PC, and pick that computer's browser in the device picker. The browser is then on the same machine as the container, so localhost means what you expect. Android emulators get the same treatment: a localhost address is forwarded to your machine when the steps replay.
# With the xtest app on the computer running the container, the AI drives
# that computer's own browser, so http://localhost:8080 is the same localhost
# the container publishes to and it just works. Same on a Mac and on a PC.
docker compose up -d
# Optional, to check it yourself first:
open http://localhost:8080 # macOS
start http://localhost:8080 # WindowsTwo things that catch people out
A container that serves absolute links built from its own hostname will redirect a test somewhere it cannot follow, so set the public URL explicitly. And a self-signed certificate on a staging container will stop the browser before your app ever renders.
[Academy courses]