mix demo.record (phx_demo v0.1.1)

Copy Markdown View Source

Records every demo (see PhxDemo.Case) and renders the videos.

mix demo.record                         # every demo under test/
mix demo.record test/demos/posts_demo_test.exs
mix demo.record test/demos/posts_demo_test.exs:5 --gif
mix demo.record --render-only tmp/demos/my_app_web-demos-posts_demo/create-a-post

It runs mix test --only phx_demo <paths> with MIX_ENV=test, then, after the run finishes (Playwright writes the video when the browser context closes), renders each recorded demo with PhxDemo.Render.

Demos that fail are still rendered (handy for debugging), but the task exits non-zero.

Options

  • --gif: also render a GIF
  • --no-mp4: skip the MP4
  • --no-render: only record
  • --render-only DIR: skip recording and render an existing demo directory (repeatable)
  • --update-baselines: save this run's scene screenshots as the new drift baselines (see PhxDemo.Drift)
  • --no-drift: skip the visual drift check

Visual drift never fails the task. It prints a warning (and a ::warning annotation on GitHub Actions) with a diff image.

Demo files are ordinary ExUnit test files (*_test.exs). Keep them out of your normal mix test run with ExUnit.start(exclude: [:phx_demo]) in test/test_helper.exs. This task overrides that with --only phx_demo.