Skip to content
Draft, pre-release documentation

Try it: run a scenario and read the report

This run uses no model. A scripted login runs against a local page in Chrome inside a Kasm session, every step is a DOM action over the Chrome DevTools Protocol, and the page answers each check. You finish with a passing report, a failing report and a verdict for each.

It uses the 01-cdp-chrome example in the toolkit.

  • A Kasm Workspaces deployment you can reach, with a Chrome workspace image that has the runtime built in (the chrome:nix image).
  • A Kasm API key and secret allowed to set environment variables when it requests a session (request_kasm), and the username the key acts as. Without an API key Kasm drops the environment the example sends, including the Chrome flags that turn the debugging port on.
  • The username and password of a Kasm user. The example uploads files into the session and downloads the report, and those two endpoints accept only Kasm’s login cookie.
  • uv and python3 on your PATH.

No model is needed. The script unsets KASM_RUNTIME_VISION_ENDPOINT and KASM_RUNTIME_VISION_MODEL, so the run stays model-free even if your shell has them set.

In the SDK’s examples directory, copy settings.env.example to settings.env and fill in the Kasm block. Keep every line as an export: the provisioning helper runs as a separate process and sees only exported variables.

Terminal window
export KASM_URL=https://kasm.example.com
export KASM_API_KEY=...
export KASM_API_KEY_SECRET=...
export KASM_SESSION_USER=...
export KASM_USERNAME=...
export KASM_PASSWORD=...
export KASM_VERIFY_TLS=true

KASM_VERIFY_TLS also takes false or a path to a CA bundle, for a deployment with a self-signed certificate.

01-cdp-chrome/scenario.yaml names the application, turns on browser control and lists eight steps:

app: chrome
window: "Chrom"
process: "chrome"
cdp: true
launch_timeout_s: 90
steps:
- action: cdp_navigate "http://127.0.0.1:8901/login.html"
- action: cdp_query "#username"
- action: cdp_fill "#username" "demo-user"
- action: cdp_fill "#password" "demo-password"
- action: cdp_click "button.login"
- action: cdp_wait "location.hash === '#/dashboard'" 15
- action: cdp_wait "document.getElementById('who').textContent === 'demo-user'" 10
- action: cdp_url

The login page is a local fixture that the script uploads and serves over loopback HTTP inside the session. The two cdp_wait steps are the assertions: each is a JavaScript expression that must become true within its timeout. They read location.hash because the fixture, like many single-page apps, never changes its window title.

The same folder holds scenario-stale-selector.yaml, the same flow with the login button’s selector left as it was before a rename. It fails on purpose, so you can read a failure.

Terminal window
cd 01-cdp-chrome
./run.sh

The script requests a session through the Kasm API, opens the session’s viewer in your browser, uploads the fixture and both scenario files, runs them in one kasm-session-runtime run invocation, downloads the output into out/ and destroys the session. On a nix image the viewer shows the runtime’s sidebar, and each step appears there as it runs.

The script exits with status 1. The second scenario is broken, and the exit code follows the worse of the two verdicts.

Optional: keep the session afterwards to look around. The script prints the command that destroys it.

Terminal window
KEEP_SESSION=1 ./run.sh

out/summary.json:

{
"schema": "nix-testbench-report/1",
"verdict": "app-failed",
"scenarios": [
{ "name": "scenario", "file": "scenario.yaml", "verdict": "pass", "outcome": "pass" },
{ "name": "scenario-stale-selector", "file": "scenario-stale-selector.yaml", "verdict": "app-failed", "outcome": "app-failed" }
]
}

One scenario passed and one failed, so the invocation as a whole is app-failed and exits 1. Scenarios lists the verdicts and exit codes.

out/scenario/report.md starts with the verdict and its reasons, then the evidence.

# Action Backend Result
1 cdp_navigate "http://127.0.0.1:8901/login.html" cdp loaded http://127.0.0.1:8901/login.html
2 cdp_query "#username" cdp found <input> id=“username” name=“username” visible=true enabled=true
3 cdp_fill "#username" "demo-user" cdp filled #username with 9 character(s)
4 cdp_fill "#password" "demo-password" cdp filled #password with 13 character(s)
5 cdp_click "button.login" cdp clicked <button> id=“login-button” text=“Log in” visible=true enabled=true
6 cdp_wait "location.hash === '#/dashboard'" 15 cdp predicate holds
7 cdp_wait "document.getElementById('who').textContent === 'demo-user'" 10 cdp predicate holds
8 cdp_url cdp location.href = http://127.0.0.1:8901/login.html#/dashboard

Every row names the backend that ran it, here always cdp. Other runs show atspi, xtest, vision, shell or none, and the column matters when a step fails: a DOM click and a click located on screen fail for different reasons. Rows 3 and 4 record how many characters were typed and never the value. The real table also has an Expect column, which reads -- here because no step asks for a visual check.

With no model configured, the report says so in three places:

  • The visual section reads rendered: false, error_dialog: false and description: no visual judgment (deterministic-only mode). Nothing was judged, so rendered: false is not a finding.
  • The last section reads deterministic_only=true and note: vision endpoint not configured -- no visual judgment.
  • The probes table shows the boot check, the process and the window. Those and the steps decide pass.

out/scenario-stale-selector/report.md gives the reason on its first line:

step 4 (cdp_click "button#submit-login") failed: no element matches "button#submit-login" after 5s; candidates on the page: input#username[name=username], input#password[name=password], button#login-button "Log in"

The verdict is app-failed: the page answered and the element was absent. A lost browser connection gives test-error. The candidates show that the page loaded and button#login-button "Log in" exists, so the selector is stale.

Each scenario’s folder holds report.json, trace.jsonl, screenshots/ (for example 02-step-1-cdp-navigate.jpg), DONE, and a baseline-candidate/ image saved because no baseline existed. The failed run adds screenshots/99-failure.png, the screen at the moment of failure. Promote the baseline candidate to a baseline to have later runs compared against it.

Copy scenario.yaml, change the URL and selectors, and run it the same way. A selector that fails names the candidates on the page. Write a scenario lists the actions and checks.

Everything here happens inside one page’s DOM. The browser’s own toolbar, an extension popup or a native dialog has no selector; How an action reaches an application lists what reaches them.