Testing
vp test
runs src/routes.test.tsx with Vitest, which is part of Vite+. The tests ask the
app's routes what the server owes Turbo and the phone apps:
- Pages render the document, with the bundle's tags tracked in
<head>, and leave out the navbar in the apps. - The inline form answers with
text/vnd.turbo-stream.html, puts the message first, replaces the form, and broadcasts it. An empty message gets422. - The standalone form redirects with
303, to/in a browser and to/refresh_historical_locationin the apps. An empty message renders the page with422. - A frame request gets the frame alone, and a plain visit gets the whole page.
- Unknown paths get
404.
How the tests work
No server runs. The test file loads every file in routes/ and serves each on the address its path gives it, as
Void does (index is its folder, [id] a parameter), with src/main.ssr.tsx for every other address: a test asks
with app.request(path, init). Tests run in Node, not in a Worker, so the Cloudflare
bindings are replaced with fakes (Void's testing guide):
vi.mock("void/db", () => ({ db: { select, insert }, desc, getBookmark })); // an in-memory list of rows
vi.mock("void/live", () => ({ defineLiveStream: () => ({ publish }) })); // records what was broadcast
Add a test next to each route you add: what it answers, with which status and content type, for a browser and for the apps.
One set of flows, for the browser and both apps
What the browser does, and what the phone apps do, is checked by Maestro flows in
flows/. A flow is written once and runs in three places, because the pages are the same HTML in
all three. Only what the apps draw themselves differs: their bars, tabs, buttons, sheets and alerts.
vp run test:browser # the flows in Chromium
vp run test:ios # the same flows in the iOS app, on a Mac
vp run test:android # and in the Android app, on a Mac
vp run test:all # everything: what CI runs (`vp run ci`), then iOS and Android
Each starts a Void dev server in Vite's test mode (port 4173) and runs the flows against it: in Chromium, or in the
app built for that server, on the tests' own simulator or emulator
(Hotwire Native). Maestro checks the certificate as any browser does, so
mkcert's CA must be trusted (vp run setup:certs); nothing skips the check. On Linux, Chromium trusts it through
~/.pki/nssdb, which exists only once Chrome has run: setup:certs makes it first, with certutil
(libnss3-tools), or mkcert says "no Firefox and/or Chrome/Chromium security databases found" and every flow stops
at a certificate error.
Test mode is how the test server gets data of its own: vite.config.ts gives Void's persistTo the folder
.void/test in that mode, which the run empties first, and sets VOID_REMOTE=0, Void's switch that keeps the data
local even in a project that turns remote mode on. Your own data, in .void/, stays as it was. A dev server is what
Void gives the most: it applies the migrations when it starts, has a session secret of its own, and catches the email
the app sends in its inbox, where the sign-in flow reads its code (Signing in). It watches no
files, so a page never reloads while a flow runs. The production build is checked by vp build.
One test run at a time: they all serve on port 4173 and keep their data in .void/test, so a second one stops with
"Another test run is running". vp run test:all runs them one after another.
Only the flows a change touched run: below.
| Flow | Checks, in all three | What differs in the apps |
|---|---|---|
navigation.yaml |
The top-level pages open under the same names: About, and back to the messages | Native tabs, not links. The web navbar is gone, and the link to the form is a native New button |
inline-form.yaml |
The message appears in place, under the form, and the form empties; an empty message shows its error | The "Message sent." notice is a native toast, which Maestro can't read: the flow asserts it in a browser |
new-message.yaml |
The form on its own page: an empty message shows its error; a message is in the list afterwards, and the footer shows the D1 bookmark the cookie carried | The page is a modal, which the native New button opens, with a native Send; sending closes it and reloads the list |
live-updates.yaml |
A message from another browser (send.js, a plain form post) reaches the open page once, and still does after leaving the page and coming back; the page that sends shows its own message once |
Leaving is another tab, not a visit |
stats-frame.yaml |
The lazy frame loads from /stats when it comes into view |
|
search-messages.yaml |
The search filters the messages, one that arrived live included, and says when none match | A native search bar, not the page's field |
otp-sign-in.yaml |
The code's form replaces the email's; a wrong code shows Better Auth's error; the code from the email in Void's inbox (otp.js) signs in; signing out |
"Sign out" is in a native menu, and asks first in a native alert. That messages still arrive live once signed in is checked in a browser only: an app's Messages tab keeps the page it loaded before |
passkey.yaml |
In a browser and both apps: "Add passkey" makes one, and the list shows it; signed out, "Sign in with Passkey" signs in with it. The flow touches its device's reader, which the command has for it (touch.js, Signing in) |
iOS asks in sheets of its own, which the flow presses, then looks for a face, which the simulator is told it sees. Android asks in a sheet of its own too, and then the example's test keeper of passkeys (native/android/keeper), which asks for no finger |
passkey-sign-up.yaml |
Signed out, "Sign up with Passkey" makes an account for the address in the email field and signs it in; the account says "Not confirmed" until the code from Void's inbox confirms the address, where there is an inbox; signed out, the passkey signs in; "Delete this account" asks first, in the page, and then the account is gone | The same sheets and reader as passkey.yaml: the two share them (parts/passkey-make.yaml, parts/passkey-use.yaml) |
about.yaml |
The appearance turns dark, stays dark when the app or the page starts again, and goes back to the device's | The app's own bars turn dark too. The share sheet and "Rate this app", which a browser does not have |
guide.yaml |
The About page links the guide; /guide is its first page, read on GitHub, and a link to another page stays on the site |
A screen on the About tab's stack |
How one file runs in three places:
- The header is
appId: ${APP}, and the tasks giveAPP: the server's address in a browser, the app's id on a phone.launchAppopens either. Maestro's command line runs a flow in a browser only when its header saysurl, and then nowhere else, soflows:webandtest:browserrun each flow through a two-line file with that header, which they make in.dev/flows-web/. APP_URLis the server as the Mac reaches it, for a flow's scripts:send.jsposts a message as another browser would, andotp.jsreads the sign-in code from Void's inbox.- What only one of them has is a step under
runFlow: when::platform: Web,platform: iOS,platform: Android, ortrue: ${maestro.platform != 'web'}for both apps. That is for what the apps draw themselves; a step on the page is everyone's. - A field is found by its label (
aria-label), throughflows/parts/field.yaml: Maestro reads the label as the field'sidin a browser, and as its text in the apps.parts/type.yamltypes into one, inside aretrythat checks the field holds the whole text: a new device's keyboard drops the first letters while it first opens.parts/sign-out.yamlsigns out, andparts/appearance.yamlwaits after the appearance changes (Hotwire Native). - A flow can start from where a failed run left it. Against a dev server the data and the app stay: the sign-in flow signs out first when it finds the app signed in.
A flow sees the page as a person does: what shows, never the page's JavaScript.
- A field's text is what is typed in it. Empty, a browser and iOS read its placeholder, and Android its label: so a
flow checks that a form emptied by where the message is (
below: "Send", and once on the screen), not by the placeholder. - Each piece of text is its own in a browser: a
<p>with a<code>in it is two texts, which iOS reads as one. A pattern that ends with the text (.*${output.email}) matches both. An element below the fold is not shown until ascrollUntilVisiblebrings it into view, at Maestro's own speed: a faster swipe does not move the page in the Android app. - Text matches the whole text, ignoring case. A checkbox's state cannot be read, and a transparent element counts as shown: show state as text, and hide what is off.
- A broadcast sent before the page has subscribed is not for it: the flow sends again until one arrives
(
retry). Broadcasts arrive in order, so once a later one shows, the page has had the earlier ones. - A flow sees only the screen, and on the dev server the list is as long as your data, up to its 50 messages: what
a flow uses goes where a person finds it without scrolling (the form above the newest-first list), and what is
further down is reached with
scrollUntilVisible. - The iPhone app's tab bar floats over the foot of the page, and what is under it counts as shown: a tap on a link
there is the bar's, and the flow is on another tab. A link at the foot of a page is brought to the middle first
(
scrollUntilVisiblewithcenterElement: true), aspasskey-sign-updoes for "Delete this account". - What the server answers (streams,
422, redirects) isvp test's to check, and a flow does not see console errors.
While you work, run the flows against the dev server you keep running, with no build, in the browser and in the workspace's apps. Their messages stay in the dev server's data:
vp run flows:web # the flows your changes touched, in Chromium
vp run flows:ios # the same, in the iOS app of the workspace
vp run flows:android new-message # one: flows/new-message.yaml, in the Android app
vp run flows:web live-updates --watch # that one now, and again at each save that changes a step
When a flow fails, its screenshots and the screen's elements for each step are in .dev/maestro/.
Only the flows a change touched
A flow is slow: it starts a browser or drives a phone. So each flow in each place is a task of its own
(flow:web:about, flow:ios:about, flow:android:about…: three from each flow file, which vite.config.ts
makes), and Vite Task keeps its pass together with the files that pass was made
of. Until one of those files changes, the pass is replayed, with its screenshots, in no time. vp run flows:* and
vp run test:* run every flow's task: after a change, that runs the flows the change can break, and no others.
| You change | Flows that run again in the browser | In each phone app |
|---|---|---|
src/sign-in.ts |
otp-sign-in |
otp-sign-in |
routes/messages/new.tsx |
new-message |
new-message |
routes/about.tsx |
about, guide, navigation, live-updates: the four that open About |
All eleven: an app loads every tab's page when it opens |
src/components/layout.tsx, a Stimulus controller, src/app.css |
All eleven: every page has these | All eleven |
Swift (native/ios/App/) |
None | iOS's eleven, none of Android's |
A path configuration (public/configurations/) |
None | All eleven of both |
flows/about.yaml |
about |
about |
flows/parts/field.yaml |
The seven that use a field | The same seven |
flows/parts/passkey-make.yaml |
passkey, passkey-sign-up |
The same two |
flows/send.js |
live-updates, otp-sign-in, search-messages |
The same three |
A guide page, routes.test.tsx, a page no flow opens |
None | None |
Nobody lists a flow's files. Three things that are already there find them:
- Void loads a route's file when a request first needs it, and what that file imports with it.
- Vite's dev server knows each file it handed out, to the Worker and to the browser. While a flow runs, the
server notes them (
flowTraceinvite.config.ts); the dev server and the test server are both Vite's, so both do. - Vite Task tracks the files a task reads. When the flow has passed, its task
(
tasks/flow.ts) reads the files the server noted, and with them the flow's file, the scripts it runs, the migrations, the settings (vite.config.ts,void.config.ts,tsconfig.json,package-lock.json,mise.toml, and.envwhen you have one) and, for a phone app's flow, the app's own code. Those are then the pass's inputs.
The flow itself runs in the command you ran (vp run flows:web, vp run test:browser…), which the flow's task asks
for it. Vite Task tracks every process a cached task starts, and on Linux Chrome does not start under that
("session not created: Chrome instance exited"): so a flow's task starts nothing, and reads.
A pass is kept for each server apart: one against your dev server says nothing of the test server, whose data is empty. To see what would run, without running it, and to run everything whatever changed:
FLOWS_MODE=test vp run --dry-run flow:web # each flow in the browser: "cache hit", or the file that changed
FLOWS_MODE=test vp run --dry-run flow:ios # and in the iOS app
vp run --no-cache test:browser # every flow, in the browser
vp cache clean # forget every pass
A file that no flow's pass was made of is a page no flow checks: change it, and the dry run says nothing would run.
What to know:
- The run stops at the first flow that fails. Its pass is not kept, nor are the flows after it run: fix it and run again, which starts from that flow.
- The browser's code is one bundle, so a change to any controller runs every flow. So does a change to
vite.config.tsor to the tasks that run the flows. - A phone app loads every tab when it opens, so each of its flows is made of each tab's page: a change to one runs all of that app's flows. A page behind a tab runs the flows that open it.
- The data is not a file. A flow passes on whatever the server holds: it makes what it checks, and never counts on what another flow left.
- A file saved while a flow runs leaves that flow without a pass ("Changed while the flow ran"): it may have seen either version.
- One flow at a time on a server. A second run on the same server waits for the flow that is running ("Waiting for the flow…"). A run you stop gives its turn up at once.
- Every flow from nothing is the slow case: each flow starts Maestro for itself, which takes about 8 s in
Chromium, 8 s on Android and 22 s on iOS before its first step. On a Mac,
vp run test:allfrom nothing takes about 15 minutes (the 8 flows 3 min 40 s in Chromium, 6 min 30 s in the iOS app and 4 minutes in the Android app, each app with its device's start); with nothing changed, under 10 seconds. One flow takes 10 to 45 s in the browser, and 15 to 65 s in an app.
The deployed app
A flow runs against a deployed app when HOTWIRE_URL gives its address, one flow at a time:
HOTWIRE_URL=https://<your app> vp run flows:web passkey-sign-up
No server here notes the files that flow was made of, so no pass is kept: it runs each time, and what it makes (an
account, a message) stays in the deployed app's data, unless the flow takes it away as a person would:
passkey-sign-up.yaml ends by deleting its account, on the account page. The app has no route for tests
(Signing in). A deployed app has no inbox either: the task gives the flow an
empty INBOX_TOKEN, and a flow leaves out what reads a code there, as passkey-sign-up.yaml leaves out confirming
the address (runFlow: when: true: ${INBOX_TOKEN != ''}). A flow that is nothing without the inbox, such as
otp-sign-in.yaml, is a dev server's only. In a phone app the flow runs in the app the device has: build it for
that address first (HOTWIRE_URL=… vp run ios, Deploying).
Looking at the app from Claude Code
The app's .mcp.json starts Maestro's MCP server, with the Maestro in mise.toml. Claude
Code asks to allow it when it starts in the app's directory. Then Claude lists the devices, takes screenshots, reads
the screen and runs a step at a time on the web app (the chromium device), the iOS simulator and the Android
emulator: to find a selector, or write or fix a flow. To run whole flows it runs the tasks (vp run flows:*, vp run test:*), which cost it nothing per step. The app's AGENTS.md holds these rules for any
agent.
Claude works on the same code as you, in your checkout, so its changes show in your workspace as it saves them.
When it runs the app, it runs its own, in Vite's agent mode, with data of its own:
| You | Claude | The test runs | |
|---|---|---|---|
| Runs | vp dev, vp run workspace |
vp dev --mode agent, and --mode agent after a task |
vp run test:* |
| Dev server | https://hotwire.localhost:5173 |
https://agent.hotwire.localhost:5174 |
https://test.hotwire.localhost:4173 |
Data (Void's persistTo) |
.void/ |
.void/agent |
.void/test, emptied each run |
Prebundled dependencies (Vite's cacheDir) |
node_modules/.vite |
node_modules/.vite/agent |
node_modules/.vite/test |
| Phone apps on | the workspace's simulator and emulator | the "Hotwire Test" simulator and hotwire-test emulator |
the same |
So you can both test and play at once: what Claude sends never shows in your messages, and its apps are on devices
you don't watch. Each has a name of its own, as a browser keeps cookies and passkeys by name, not by port: on
localhost alone, signing in to one would sign you out of the others. A dev server whose prebundled dependencies another mode's server rebuilt answers every request with
"The file does not exist at node_modules/.vite/deps…", which is why each mode has its own. Its commands are yours with --mode agent, such as vp run flows:web --mode agent, never a step
of its own around them. Each port is strict, so a second dev server in the same mode fails rather than moving to
the next port, where the apps would not find it. Port 443 they share, on a Mac: there one of them, the first to
start, tells iOS which app each name names (Signing in). Void's local database commands (vp exec void db studio, seed,
push) act on the data of the mode that last started a dev server or a build: start yours again before using them.
In CI
.github/workflows/check.yml runs on every pull request and on main, on a
Linux runner, in a few minutes. mise loads the tools from mise.toml (Node, Vite+, and for the flows Java, Maestro
and mkcert), then it runs what you run: vp install --frozen-lockfile, vp run setup:certs, and vp run ci, which
is vp check, vp test, vp build and vp run test:browser. When a flow fails, the run keeps .dev/maestro/ as an
artifact. Every flow runs there, in Chromium: a runner starts with no pass kept. Vite+ can
restore them between runs, which this workflow does not do.
The flows in the phone apps are not in CI. They need a Mac: vp run test:all runs them after everything CI runs,
so run it before a pull request that changes the app, and say in the pull request what passed. A hosted runner cannot
carry them: a macOS one has 3 cores and 7 GB for the simulator, the build, the dev server and Maestro at once, and a Linux
one loses the emulator mid-run. A check that fails by itself teaches everyone to ignore it.