Docs
The trace format
Steps, targets, captions and the schema.
A trace is plain JSON with version: 1. The schema ships at trace-avatar/schema.json, so your editor can check traces as you write them.
{
"version": 1,
"meta": { "title": "Create an invoice", "viewport": { "w": 1440, "h": 900 }, "seed": 7 },
"avatar": { "name": "Sarah · Sales", "image": "/sarah.png", "color": "#2456d8" },
"steps": [
{ "type": "click", "target": { "sel": "[data-testid=new-invoice]" }, "say": "Start here." },
{ "type": "wait", "target": { "sel": "#customer" }, "timeout": 5000 },
{ "type": "type", "target": { "role": "textbox", "name": "Customer" }, "text": "Ada Stores" },
{ "type": "key", "keys": "Mod+Enter", "say": "Save with ⌘↵." },
{ "type": "hover", "target": { "text": "Total" }, "hold": 1200, "pause": true }
]
}Steps
| Step | Shows | Fields |
|---|---|---|
move | the cursor travels to the element | target |
click / dblclick | travel, press, ripple, ring | target |
type | travel, text appearing in a chip | target, text, mask? |
key | a shortcut chip (⌘↵, Ctrl+Enter) | keys, target? |
scroll | scrolls the page or the element | to or by, target? |
hover | travel, then stay | target, hold? |
wait | holds until the element exists, or a condition holds | target, until?, timeout? |
note | a caption only | say, hold? |
Fields any step may carry
say: the caption.highlight: a ring around the element.pause: stop after this step until the viewer presses play.t: ms from the start; omit it and the step follows the previous one.page: the page it happens on (see Pages and waits).checkpoint: where Do it for me resumes after the viewer steps in.
Targets
A target takes any of sel (CSS selector), role + name (accessible role and name), text (visible text) and xy (recorded pixels, scaled to the screen). They are tried in that order, so a guide survives layout changes. at: { rx, ry } aims at a point inside the element, and an optional path ([[t, x, y], …]) replays a real pointer path.
Checking a trace
validate(trace) returns every problem with a path to it, and createTrace throws a TraceError for an invalid trace.
The full reference is in the README on GitHub.