ClientUtils.JourneyCase (client_utils v0.6.17)
View SourceThe case for a journey's walk: one file per journey (@moduletag journey: "<slug>"), one test per stage (@tag stage: "<id>"), in the order of the
journey's .code_my_spec/journeys/<slug>.yml. ClientUtils.Check.JourneyCoverage
holds the file to the YAML.
The project names its own case, which the walks use:
defmodule JourneyCase do
use ClientUtils.JourneyCase,
otp_app: :my_app,
router: MyAppWeb.Router,
sandbox: &MyApp.DataCase.setup_sandbox/1
endsandbox takes %{async: false} and checks the repo out for the file.
The stages run in file order (--seed 0) on one of two PhoenixTest drivers:
- LiveView (the default, fast): one SQL sandbox for the whole file. A view dies with the stage that mounted it, so each stage reopens the page the one before it left, with the same cookies.
- One real Chromium session for the whole file: the local endpoint under
CMS_E2E=1, or a deployed app underCMS_JOURNEY_BASE_URL.
A stage starts from ctx.conn and hands its session, and anything a later
stage reads, to the next with keep/3. A stage that did not keep (it failed)
fails every later stage at once, naming it. What a walk makes for its whole
run (the fakes, a teardown) belongs in the file's own setup_all: an
on_exit in a stage runs when that stage ends.
In the browser the repo is a real pool the endpoint's processes must see, so no sandbox owner is started.
Summary
Functions
Whether this run drives a real browser rather than the LiveView driver.
Ends a stage: hands session, and more, to the stages after it, and with
CMS_JOURNEY_SLIDES_DIR set saves the stage's screenshot as the journey's
next slide.
Opens the file's one session, and the walk that carries it between stages.
A stage's setup: what the stage before it kept, unless that stage did not pass.
Functions
Whether this run drives a real browser rather than the LiveView driver.
Ends a stage: hands session, and more, to the stages after it, and with
CMS_JOURNEY_SLIDES_DIR set saves the stage's screenshot as the journey's
next slide.
Opens the file's one session, and the walk that carries it between stages.
A stage's setup: what the stage before it kept, unless that stage did not pass.