Skip to content

Pacing helpers

All of these no-op the waits when E2E_DEMO is unset, except that clicks and fills still happen immediately and still record transcript events.

FunctionRole
demoFocus(page, step, title, note?, opts?)Chapter: transcript + caption + bring-to-front + dwell
demoChapter(page, step, title)demoFocus without a note
demoAnnounce(page, note)Current-action line only
demoDwell(page, ms?)Pause (default 2400ms)
demoSee(page, ms?)Short dwell (default 1200ms)
demoScreenshot(page, name)Rest-frame viewport PNG (pointer hidden)
demoPoint(page, locator, opts?)Scroll into view, aim, optional shot
demoClick(page, locator, opts?)Aim, optional shot, click
demoClickAndWaitUrl(page, locator, url, opts?)Same, then waitForURL
fillField(page, locator, value, opts?)Aim, optional shot, then type
fillIdentityEmail(page, locator, email)Sequential keys (80ms)
fillTypedValue(locator, value, delay?)Click, record, type or fill
fillShown(page, locator, value, opts?)Aim, optional shot, then locator.fill

demoClick options: { force?: boolean; waitAfter?: boolean; shot?: string; pulseMs?: number; afterClickMs?: number }. fillField / fillShown / demoClickAndWaitUrl also take pulseMs / afterClickMs. demoFocus takes { chapterMs?: number } as a fifth argument. App-wide defaults: configureDemoWalk({ pacing }) — see configureDemoWalk.

shot writes a teaching still after the pointer and held click ring are on the control, before the action — on the stills path. Video skips the hold and the file so the camera does not freeze on a still-pose; keep shot on the spec anyway. Each click uses one ring (held, then released — fade on demo, snap-off on CI). On video there is no hold: the ring pulses, then the click lands when that pulse is done.

demoScreenshot slugs the name (Vitepress Homevitepress_home.png) and hides the pointer (rest frame) when it writes a file. Video skips the write. When a stills record dir exists, files land in <stamp>/screenshots/. On headed stills they also copy into E2E_DEMO_SCREENSHOT_DIR or artifactsDir.

Released under the MIT License.