TraceAvatar
Menu

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.

invoice.trace.json
{
  "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

StepShowsFields
movethe cursor travels to the elementtarget
click / dblclicktravel, press, ripple, ringtarget
typetravel, text appearing in a chiptarget, text, mask?
keya shortcut chip (⌘↵, Ctrl+Enter)keys, target?
scrollscrolls the page or the elementto or by, target?
hovertravel, then staytarget, hold?
waitholds until the element exists, or a condition holdstarget, until?, timeout?
notea caption onlysay, 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.