Pre-flight checks so a demo fails fast with a clear message instead of recording a broken page.
Checks:
:phoenix_test, :base_urlis set- the endpoint answers HTTP at that URL (
server: truein config/test.exs) - the narration adapter is usable (e.g. Piper installed, API key set)
- every
phx-track-staticasset linked from the root page returns 200 (mix assets.buildhas been run) - camera fixtures declared with
use PhxDemo.Case, camera_fixtures: [...]exist (and ffmpeg is installed if one needs converting). This check runs for every demo module, not once per run. SeePhxDemo.Camera. - when
music:is a MIDI file, fluidsynth is on PATH and a soundfont resolves (per demo module). SeePhxDemo.Midi. - when
music:is generated (%{elevenlabs: "prompt"}), the setting is valid and an ElevenLabs API key is set (per demo module). SeePhxDemo.MusicGen.
PhxDemo.Case runs this once per test run. Opt out with
use PhxDemo.Case, check_env: false.
Summary
Functions
Runs the checks once per VM. Later calls are free.
Asset URLs marked phx-track-static in an HTML page.
Functions
Runs the checks once per VM. Later calls are free.
Asset URLs marked phx-track-static in an HTML page.
iex> PhxDemo.Env.tracked_assets(~s(<link phx-track-static rel="stylesheet" href="/assets/app.css"><script defer phx-track-static src="/assets/app.js"></script><script src="/other.js"></script>))
["/assets/app.css", "/assets/app.js"]