Skip to content

feat(tooling): record screenshots as video, with a pointer and callouts - #704

Merged
huichen merged 1 commit into
mainfrom
feat/screenshot-video
Sep 17, 2026
Merged

huichen merged 1 commit into
mainfrom
feat/screenshot-video

Conversation

@huichen

@huichen huichen commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #703, which added the screenshot harness (rendering the real desktop/mobile UI against demo data in a headless Chrome). Two gaps were left: no video, and nothing on screen saying where the user tapped.

Video (desktop + mobile)

python3 scripts/screenshots/capture.py video-desktop            # every scenario
python3 scripts/screenshots/capture.py video-desktop chat rename  # or some
python3 scripts/screenshots/capture.py video-mobile chat

Chrome's screencast only emits a frame when the page changes, so a fixed -framerate would compress idle stretches and make the video feel sped up. Frames are written with their real timestamps and encoded with those delays, so the scenario's pace is preserved. ffmpeg is checked before recording starts, so a missing install fails immediately rather than after a long capture. (ffmpeg blocks reading stdin when it is not a terminal — -nostdin is what makes the encode finish.)

Video and screenshots share one scenario table, so nothing is maintained twice.

Pointer indicator

In a video of a phone UI, nothing shows where the finger landed. A blue dot now follows every tap/hover, with an expanding ring at the tap itself. It is drawn inside the page, so it appears in stills as well — which is what lets a single screenshot read as "and then tap here".

Callouts

A marks step draws a numbered badge on a target (by accessible name, or raw x/y) with a label beside it:

{ "marks": [{ "at": "工作区", "label": "① 工作区列表", "dy": -34 },
            { "at": "对话",   "label": "② 对话列表,可左右滑动切换", "dy": -34 }] }

dx/dy/side place a callout when two targets are close; numbers accumulate across a scenario, marksClear restarts them, and pointerHide removes the dot for a clean product shot. --annotate false disables both overlays. mobile/tabs-annotated is a committed worked example, so the feature stays exercised.

Also

  • Fixed the label placement while verifying it: the anchor is zero-sized, so pinning right:30px pushed a right-hand label off the opposite screen edge. It has to be left:30px.
  • Docs now state the four use cases the harness covers — release notes between two versions, a test checklist for those changes, a single feature diagram, and a flow walkthrough — plus video, with a recipe for each, so a request can be answered from docs/guide/screenshots.zh-CN.md alone.
  • Makefile untouched (as before, this is driven as a script, not make targets).

Verification

  • node --check on the driver, ast.parse on capture.py, scenario JSON parses.
  • Video recorded and re-verified on both platforms: frames extracted from the mp4s show real UI; the pointer dot tracks the taps across frames (mobile: tab → files icon; desktop: menu item).
  • Callouts verified on both platforms by magnifying the captured PNGs: labels fully visible, beside the badge, not off-screen.
  • scripts/check-docs.py clean for the changed docs.
  • No media committed: git status shows no png/mp4/jpg.

The screenshot harness could only produce stills, and a still of a multi-step flow
does not say *where* the user tapped — on a phone that is most of the story.

- **Video, on both platforms**: `video-desktop` / `video-mobile` record scenarios
  to mp4. Chrome's screencast only emits a frame when the page changes, so frames
  are written with their real timestamps and encoded with those delays; pauses
  stay pauses instead of being flattened to a fixed frame rate. ffmpeg is checked
  up front so a missing install fails before recording starts. (`efmpeg` blocking
  on stdin when it is not a terminal is what `-nostdin` fixes.)

- **Pointer indicator**: a blue dot follows every tap/hover, with a ring on the
  tap itself, drawn inside the page so it lands in both stills and video. This is
  what makes mobile footage followable.

- **Callouts**: a `marks` step draws a numbered badge on a target (by accessible
  name or raw coordinates) with a label beside it, so a screenshot can explain
  itself. `dx`/`dy`/`side` place a callout when two targets are close; numbers
  accumulate across a scenario, `marksClear` restarts them, and `pointerHide`
  removes the dot for a clean product shot. `--annotate false` disables both.

`mobile/tabs-annotated` is a worked example, so the feature stays exercised.

Also fixes the label placement: the anchor is zero-sized, so pinning `right:30px`
pushed a right-hand label off the opposite edge — it has to be `left:30px`. The
docs state the four use cases this now covers (release notes between two
versions, a test checklist for those changes, a single feature diagram, a flow
walkthrough) plus video, so a request can be answered from the doc alone.
@huichen
huichen enabled auto-merge (squash) September 17, 2026 10:24
@huichen
huichen merged commit c9e3f1f into main Sep 17, 2026
12 checks passed
@huichen
huichen deleted the feat/screenshot-video branch September 17, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant