Scenarios

Reference for scenario fields and every step type, with all options and defaults.

On this page
  1. Scenario
  2. Checkpoints
  3. Interactions
  4. Scroll motion
  5. Navigation and waiting
  6. Selectors
  7. Helpers

The guide to writing scenarios is Interaction scenarios. This page lists every field.

Scenario

FieldTypeDefaultDescription
idstringrequiredStable id used to match captures: letters, digits, ., _, -, max 80
namestringidShown in reports
pathstring"/"Opened relative to baseURL before the steps run
urlstring—Absolute http(s) URL, instead of baseURL + path
viewportsstring[]allNames of viewports to run in
stepsStep[][]See below. Checkpoint labels must be unique within the scenario
timeoutnumber (ms)capture.scenarioTimeoutOverall scenario timeout
skipboolean | string—Skip the scenario; a string documents why
tagsstring[]—Free-form

Checkpoints

StepFields
capturelabel (required), frames? (default capture.frames.enabled), maxWindow? (ms, overrides capture.maxWindow), screenshot? (default true)
screenshotlabel (required), fullPage?, selector? (one element instead of the viewport)

Labels: 1–80 characters, letters, digits, spaces, ., _, -, starting with a letter or digit.

TypeScript
{ type: "capture", label: "menu-open" }
{ type: "capture", label: "intro", frames: false }        // timing and samples only, no filmstrip
{ type: "capture", label: "hero", maxWindow: 8000 }       // allow a longer motion window
{ type: "screenshot", label: "footer", selector: "footer" }

Interactions

Each interaction is a trigger: the first motion after it becomes t = 0 of the next checkpoint.

StepFieldsNotes
clickselector, button? (left, right, middle), clickCount? (1–3), position? {x, y}, force?, timeout?position is relative to the element's top-left corner
hoverselector, position?, force?, timeout?
movex, y (viewport CSS px), steps? (1–100 intermediate mousemove events)Moves the mouse
fillselector, value, timeout?The value is never written to captures, reports or error messages
presskey (Playwright key name: Enter, Escape, ArrowDown, …), selector? (focus first), timeout?
scrollx?, y? (absolute CSS px), selector? (a container)Instant positioning, not scroll motion
scrollIntoViewselector, block? (start, center, end, nearest), timeout?Instant positioning, not scroll motion

force: true skips Playwright's actionability checks. timeout defaults to capture.actionTimeout.

Scroll motion

StepFields and defaults
scrollTotarget (px on the scroll axis, or a selector), behavior (smooth | instant, default smooth), via (auto | lenis | native, default auto), axis?, offset?, selector? (a native container)
wheeldeltaX (0), deltaY (0), steps (1, max 100), interval (16 ms), position? (default: viewport centre)
waitForScrollSettledtimeout (5000 ms), threshold (0.5 px), stableFrames (6), minStableMs (100 ms)
  • via: "auto" scrolls through the first attached Lenis instance when there is one, otherwise natively (with a SCROLL_NATIVE note); via: "lenis" requires Lenis.
  • wheel sends real wheel events, so smooth-scroll engines react exactly as they do for users.
  • waitForScrollSettled resolves when every scroller moved less than threshold per sample for stableFrames consecutive samples and at least minStableMs. On timeout it adds SCROLL_NOT_SETTLED instead of failing.

See Lenis for what is recorded.

StepFieldsNotes
gotopath? (relative to baseURL) or url?, waitUntil? (load, domcontentloaded, networkidle, commit)url takes precedence
waitForselector, state? (attached, detached, visible, hidden; default visible), timeout?
waitForAnimationstimeout? (default capture.waitForAnimationsTimeout)Waits until motion settles. A timeout is a warning, not a failure
waitduration (ms, max 60000)Fixed delay. Prefer waitFor / waitForAnimations; use only for timers

After every navigation MotionPR waits for the page to be ready: network idle (bounded by capture.networkIdleTimeout), web fonts (document.fonts.ready), non-lazy images and settled page-load animations. Each of these produces a diagnostic instead of silently continuing: NETWORK_NOT_IDLE, FONTS_NOT_READY, IMAGES_NOT_LOADED.

Selectors

Selectors are Playwright selectors (CSS, text=…, role=…) and must match exactly one element. An empty selector is a config error.

Helpers

defineScenario(scenario) and defineSteps(steps) return their argument unchanged and only add types, for scenarios kept in separate modules.