/hearth:hearth-connect-testsfrom TestZeus Hearth
Configures existing Playwright, Selenium, or Appium test suites to run on a Hearth farm. Handles environment variables, Playwright version matching, and CI setup for GitHub Actions and GitLab CI.
Ships in TestZeus Hearth. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Goal: the user's existing tests run on the farm with the smallest possible change, reading the farm's URL and key from the environment.
Docs: https://test-zeus-ai.github.io/testzeus-hearth/guide/playwright/, https://test-zeus-ai.github.io/testzeus-hearth/guide/selenium/, https://test-zeus-ai.github.io/testzeus-hearth/guide/devices/
HEARTH_URL and HEARTH_KEY from the environment. Never hard-code a key, never print it,
never commit it. Prefer sending the key in a header over ?token= in a URL (URLs end up in
logs).HEARTH_URL is set.ls package.json pyproject.toml requirements*.txt pom.xml build.gradle* *.csproj 2>/dev/null
ls playwright.config.* wdio.conf.* conftest.py 2>/dev/null
npx playwright --version 2>/dev/null; pip show playwright 2>/dev/null | grep -i ^version
echo "HEARTH_URL=${HEARTH_URL:-unset} HEARTH_KEY=${HEARTH_KEY:+set}"
hearth status # pools, their engines and Playwright versions
If HEARTH_URL or HEARTH_KEY is unset, set them up first (the hearth-setup skill), or ask the
user to export them in their own terminal.
hearth connect prints the connection settings for this farm (URL per protocol and the pools'
versions); use it to confirm the endpoints below.
Client and farm must share major.minor. The gateway reads it from the client's User-Agent
and refuses a mismatch before connecting:
this farm runs Playwright 1.65 for chromium, not 1.60; use a matching client version
(428 no_pool).
ENGINE/DEVICE column of hearth status, or
curl -fsS -H "Authorization: Bearer $HEARTH_KEY" "$HEARTH_URL/api/pools" (playwrightVersion).@playwright/test / playwright in package.json,
playwright in Python, com.microsoft.playwright in Maven, Microsoft.Playwright in .NET).major.minor (ask first: it changes the
project's dependency) or ask the farm's operator to add a pool for the project's version
(https://test-zeus-ai.github.io/testzeus-hearth/guide/pools-and-scaling/). Do not pass ?version= to force a mismatched
pool.Endpoints, on the one farm URL (ws/wss for Playwright and CDP):
| Client | Endpoint | Key |
|---|---|---|
| Playwright | /playwright/chromium, /playwright/firefox, /playwright/webkit | Authorization: Bearer header |
CDP (connectOverCDP) | /cdp/chromium | ?token= (no header option in most clients) |
| Selenium | /wd/hub (chrome or firefox) | basic-auth password, user hearth |
| Appium | /wd/hub with platformName Android or iOS | basic-auth password or bearer header |
In playwright.config.ts, keep everything else and add connectOptions when HEARTH_URL is set:
import { defineConfig, devices } from "@playwright/test";
const farm = process.env.HEARTH_URL?.replace(/^http/, "ws");
const connect = (engine: "chromium" | "firefox" | "webkit") =>
farm
? {
// Playwright Test asks for headless unless told otherwise; headless farm sessions have no
// video and no live view.
headless: false,
connectOptions: {
wsEndpoint: `${farm}/playwright/${engine}`,
headers: { Authorization: `Bearer ${process.env.HEARTH_KEY}`, "x-hearth-name": `e2e ${engine}` },
timeout: 180_000, // longer than the pool's queue timeout (120 s by default)
},
}
: {};
export default defineConfig({
projects: [
{ name: "chromium", use: { ...devices["Desktop Chrome"], ...connect("chromium") } },
{ name: "firefox", use: { ...devices["Desktop Firefox"], ...connect("firefox") } },
{ name: "webkit", use: { ...devices["Desktop Safari"], ...connect("webkit") } },
],
});
Each worker's browser is one farm session. Keep workers at or below the team's limit
(maxSessions from GET /api/me; 0 means no limit), with some headroom: a session's slot is
freed a few seconds after its browser closes (once its video is saved), and a worker over the limit
is refused at once with 429 team_limit; it does not wait. Always set headless: false, or the sessions have no video.
Override the browser fixture in conftest.py:
import os
import pytest
@pytest.fixture(scope="session")
def browser(playwright, browser_name):
url = os.environ.get("HEARTH_URL")
if not url:
b = getattr(playwright, browser_name).launch()
else:
b = getattr(playwright, browser_name).connect(
f"{url.replace('http', 'ws', 1)}/playwright/{browser_name}",
headers={"Authorization": f"Bearer {os.environ['HEARTH_KEY']}"},
timeout=180_000,
)
yield b
b.close()
playwright.chromium().connect(ws + "/playwright/chromium", new BrowserType.ConnectOptions().setHeaders(Map.of("Authorization", "Bearer " + key)))
and playwright.Chromium.ConnectAsync($"{ws}/playwright/chromium", new() { Headers = ... }).
Full examples: https://test-zeus-ai.github.io/testzeus-hearth/guide/playwright/.
Point the remote driver at $HEARTH_URL/wd/hub with the key as the basic-auth password:
// selenium-webdriver (Node)
const hub = process.env.HEARTH_URL.replace("://", `://hearth:${process.env.HEARTH_KEY}@`) + "/wd/hub";
const driver = await new Builder().usingServer(hub).forBrowser("chrome").build();
from selenium.webdriver.remote.client_config import ClientConfig
hub = os.environ["HEARTH_URL"] + "/wd/hub"
config = ClientConfig(remote_server_addr=hub, username="hearth", password=os.environ["HEARTH_KEY"])
driver = webdriver.Remote(command_executor=hub, options=webdriver.ChromeOptions(), client_config=config)
Always driver.quit() (in finally or a teardown): a session without quit() holds a slot until
the 5-minute idle timeout. browserVersion and platformName are ignored for browsers; pick a
pool with "hearth:options": {"pool": "<name>"} if the farm has several.
Same /wd/hub. Apps must be uploaded first and referenced by hash; see the hearth-devices
skill. Capabilities the farm owns (udid, ports, app URLs, ...) are dropped.
npx playwright test --project chromium -g "<one fast test>" # or: pytest -k <one test>
Then check it reached the farm: hearth sessions (or
curl -fsS -H "Authorization: Bearer $HEARTH_KEY" "$HEARTH_URL/api/sessions?limit=5") lists the
session with state done. Its video is in the web UI at $HEARTH_URL/sessions/<id>. If it
failed, use the hearth-debug-session skill.
Tell the user to add a secret HEARTH_KEY (and HEARTH_URL as a variable) in their CI settings.
Do not add secrets yourself. The farm URL must be reachable from the CI runners (Ingress or load
balancer, not localhost).
jobs:
e2e:
runs-on: ubuntu-latest
env:
HEARTH_URL: ${{ vars.HEARTH_URL }}
HEARTH_KEY: ${{ secrets.HEARTH_KEY }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npm ci
# No `npx playwright install`: browsers run on the farm.
- run: npx playwright test --workers 8
e2e:
image: node:22
variables:
HEARTH_URL: https://hearth.example.com # HEARTH_KEY: a masked, protected CI/CD variable
script:
- npm ci
- npx playwright test --workers 8
On a runner with Docker, the job can start its own farm: install the CLI with
curl -fsSL https://raw.githubusercontent.com/test-zeus-ai/testzeus-hearth/main/install.sh | sh, run hearth up local, then
export HEARTH_URL=http://localhost:8080 HEARTH_KEY="$(hearth key)". This costs several minutes
of image pulls per run; a shared farm is faster.
HEARTH_URL still work.git grep -n hth_ finds nothing).done.major.minor equals a farm pool's version.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub test-zeus-ai/testzeus-hearth --plugin hearth4 skills in this plugin
/hearth-debug-sessionInvestigate a failed or stuck Hearth session - find it, read the gateway's error, download its video and device log, take a live screenshot of a running session, stop it, and map the error to a fix. Use when a test failed on the Hearth farm, a connect or new-session request was refused (401, 404, 428, 429, 502), a session ended early, or the user asks what happened in a session./hearth-devicesAdd Android emulators and iOS simulators to a TestZeus Hearth farm and run Appium tests on them - add a Mac with `hearth hosts add` and one pasted join line, choose its simulators with `hearth hosts plan`, drain, remove and reconnect hosts, in-cluster Android emulator pods, app upload by hash, and the Appium capabilities the farm accepts. Use when the user wants mobile or device testing on Hearth, wants more iOS capacity, a host is offline or unreachable, a device pool shows no READY devices, or an Appium session is refused./hearth-setupInstall the Hearth CLI and bring up a Hearth browser and device farm (local kind cluster, AWS or GCP, or an existing Kubernetes cluster with Helm), get an API key into the environment without exposing it, and verify the farm with `hearth status`. Use when the user wants to set up, install, start, upgrade or tear down Hearth, or when `hearth` is not installed yet.Other plugins' skills for the same job