Run flows

For AI agents: this page is Markdown at https://squiggle.sh/docs/run.md. Every docs page is listed at https://squiggle.sh/llms.txt, and all of them are one file at https://squiggle.sh/llms-full.txt.

Run a flow from the terminal or Studio, run a whole folder of flows across simulators, and re-run a flow every time you save it.

Run one flow

Terminal
squiggle flow checkout                   # by name, from .squiggle/flows/squiggle flow ./e2e/checkout.yaml        # by pathsquiggle flow - < generated.yaml         # from standard inputsquiggle flow checkout --fresh           # relaunch the app firstsquiggle flow checkout --udid web:http://localhost:5173   # a React web app

Each step prints as it runs, then the result. When a run fails, it names the failing step and saves a screenshot of the simulator under it. Before running again after a failure, use --fresh: the failed run left the app wherever it stopped. If the app isn’t running, the run launches it: an iOS app on the simulator, your macOS app, or your React web app in Squiggle’s window (see React web apps).

Terminal
squiggle flow loginflow login 19 steps · direct · in-process taps  ✔  0 tap                 tap text=Sign in                         259ms  ✔  1 type                enter email — type testID=email-input    1.3s  …  ✔ 18 assert              Welcome back — 1 assertion(s)               1ms  ✔ PASS  19 of 19 steps  11.6s

In Studio, open the Flows screen and press Replay on a flow. Each step’s result appears next to the simulator.

Run a flowStudio tour · 6 steps

Record a video of a run

Terminal
squiggle flow checkout --record

--record saves a video of the whole run under .squiggle/videos, and prints its path at the end. --record-tail 5000 keeps filming for that many milliseconds after the last step, up to 30 seconds.

When the app belongs to another project, such as a git worktree of this one, nothing is filmed and the run says which project owns it. Run the flow from that project, or pass --record-to <file> to save the video where you choose.

To film something longer, such as a 40-second replay, add a wait step for as long as you need. It always passes, and the video covers all of it:

YAML
flow: checkout-replaysteps:  - tap: { text: Replay }  - wait: 40000            # keep filming for 40 seconds  - assert: { visible: { text: Order placed } }

Don’t wait for an element that never appears to keep the recording going: that step fails, and so does the run.

Re-run on every save

Terminal
squiggle watch checkout

watch keeps the connection to the app open, so each re-run starts at once. If you save during a run, it finishes that run and then runs again, so the app is never left mid-step.

Run a folder of flows

Terminal
squiggle flows ./.squiggle/flows/smoke --shards 4

squiggle flows runs every flow in a folder and splits them across the booted simulators, so the suite gets faster with each one you add. --udid <udid> runs the suite only on that simulator; repeat it to name more. SQUIGGLE_UDID or udid in .squiggle/config.jsonc names one too. --clone-from <udid> clones a simulator to make more. --agentic or --scripted runs one kind of flow.

Why runs are fast

Most test runners sleep after every step, long enough for the slowest screen. Squiggle watches the app, and moves on as soon as it stops moving:

Three steps, two ways to wait
Fixed sleep after each step1.98 s
Squiggle: act when the app stops moving0.87 s
  • the step
  • the screen is still moving
  • waiting for nothing

This needs Squiggle running inside the app: a debug build on the simulator starts it itself, and Squiggle’s window loads it into a React web app. Without it, flows still run, but nothing in the app answers when Squiggle asks whether it has stopped moving: each wait moves on after three unanswered checks, so a step can act while a screen is still animating. The Run settings page lists the flags that change how steps are delivered and how long they wait.

More