When you don't know the steps in advance (exploring an app, reproducing a bug), keep a terminal running and act on it one command at a time, reading the screen in between.
$ testingterm new --name app -- npm run dev
k3f9
$ testingterm wait --text "ready"
ok after 812ms
$ testingterm screen
[cursor 0,12 · 100x30 · title "dev" · alt screen · mouse on]
...
$ testingterm press Down Down Enter
$ testingterm click --text "Save"
clicked "Save" at row 4 col 12
$ testingterm screenshot
/tmp/testingterm/k3f9/k3f9-1764870000.png (1632x1052)
$ testingterm close
closed k3f9With one terminal running, commands use it. With several, pass --id <id>; testingterm ls lists them, including terminals opened by scripts that are still running.
Reading the screen
testingterm screen: the text, with a header line showing the cursor, size, title and modes (alternate screen, mouse reporting, kitty keyboard).testingterm screen --styles: each span with its colors and attributes.testingterm screen --json: everything, machine readable.testingterm scrollback: everything printed, including lines that scrolled away.testingterm find "text": where text is, in cells and screenshot pixels.
Acting
| Command | Example |
|---|---|
type |
testingterm type 'hello\n' |
press |
testingterm press ctrl+c, testingterm press j --count 5 |
paste |
testingterm paste "$(cat notes.txt)" |
click |
testingterm click 412 230, --cell 10 4, --text "Save", --double, --right |
move, drag, wheel |
testingterm drag 10 4 30 4 --cell |
resize |
testingterm resize 120 40 |
signal |
testingterm signal SIGINT |
theme |
testingterm theme Dracula |
Waiting
$ testingterm wait --text "Done"
$ testingterm wait --regex "\d+ passed"
$ testingterm wait --gone "Loading"
$ testingterm wait --stable 300
$ testingterm wait --exit --timeout 60000On timeout it prints the screen and exits 1.
Starting options
testingterm new takes --size 120x40, --cwd, --env KEY=VALUE, --theme, --isolate, --record, --profile, --headed, and the capability flags. A command given as one string with spaces runs through sh -c.