Skip to main content
A check says what must be true of an iOS app after a flow, such as “The Mozilla bookmark opens mozilla.org”. Mobster runs the flow, then decides on the app’s accessibility tree and any app-state expectations you registered. Test your app walks through a first one. A check is a YAML file in .mobster/checks, and mobster test runs them all. mobster verify runs one, from flags (--text …) or a file (--check), and --save NAME writes the file. The MCP tools take the same fields as arguments (MCP server).
You get this in the next release, not in Mobster for Mac 0.4.0 or Mobster CLI 0.4.4.
mobster test guide prints the check file, the assertions and how to read a result on one page of about 1,500 tokens, for you or a coding agent. The Agent Skill ships the same page.

The check file

A check of Firefox for iOS, built from mozilla-mobile/firefox-ios:
A .json file with the same shape works too. Rules:
  • An unknown key at any level is an error, so a typo can’t quietly weaken a check.
  • launch and budget take an object or null. A boolean, number, string or list is an error.
  • text and no_text take a string or a list of strings. A list becomes one assertion per string.
  • The project root is the folder that holds .mobster/, found by walking up from the check file. Without one, it is the check file’s folder. Your home folder is never a project, so keep checks in your app’s folder.
  • YAML is read with PyYAML’s safe_load. Quote a value that YAML would read as something else, such as "YES" or "1.0".

Get autocomplete in your editor

A check file has a JSON Schema at https://mobster.dev/schema/check.json. A check Mobster saves names it on its first line:
Put the same line at the top of a check you write by hand. VS Code with Red Hat’s YAML extension, or any editor that runs yaml-language-server, then completes the keys and underlines a typo as you type. In a JetBrains IDE, map the URL to .mobster/checks/*.yaml under Settings › Languages & Frameworks › Schemas and DTDs › JSON Schema Mappings. The schema never refuses a check Mobster reads. Mobster still checks what a schema can’t see, such as a /regex/ that doesn’t compile, and names the line when the check loads.

Keep test credentials out of the repository

A sign-in flow needs a test account. Name its variables in .mobster/env.example, which you commit, and keep the values in your Keychain:
Write ${TEST_EMAIL} in launch.args, launch.env, launch.url and in steps. A run fills the names in when it starts:
  • Values stay out of the project. env set writes the value to the login Keychain, per project folder, and adds only the name to env.example. It never takes a value as an argument, and nothing prints one.
  • Masked everywhere the run writes. Every text file in the run folder, the step list and the progress lines show •••••• where a value was. check.yaml keeps ${TEST_PASSWORD}. A check that uses a project secret runs its steps with a model every time and keeps no replay, because a recorded path could hold the value.
  • Steps reach your model. A secret in a step goes to the model that types it. Use a throwaway test account. A screenshot of a field that shows its text isn’t masked.
  • A missing value refuses the run. A name with no value, or one missing from env.example, ends the run couldnt_run (class usage) before a simulator starts, and names the variable.
  • CI. With no Keychain value, an environment variable of the same name supplies it, so a CI job sets TEST_PASSWORD as its own secret.
Mobster for Mac’s API lists and sets them: GET, POST and DELETE /api/project/env take the project folder as root, and never return a value.

The project folder

A .gitignore an earlier Mobster wrote, word for word, gains the folders it lacks; one you edited is left as it is. A run_id is the local time plus 4 random hex characters, such as 20261001-101500-3f9a.

Assertions

Every assertion is an object with exactly one kind key. Mobster checks it against the accessibility tree that WebDriverAgent reports for the app. No model, OCR or pixel comparison is involved. Any assertion can also have a name: a label of up to 120 characters used in reports.

Check app state your app saves

An app that implements the mobster.business/1 protocol can publish a small snapshot of its saved model on a Mobster simulator, and a check can assert on its fields. Register the bundle, the field names and named starting states in .mobster/fixtures.json, apart from the YAML fixtures in .mobster/fixtures/. A check picks a registered adapter and fixture. It can’t pass a command, URL or file path through business.
Before launch, Mobster resets the app and writes Documents/mobster-business.json: schema: "mobster.business/1", a fresh runToken, generation: 0 and the fixture’s state. It launches the app with -MobsterBusinessRun <runToken>. Your app checks the token, loads a test model from the seed, and writes its saved model back to the same file, atomically, with the same token and generation 1 or more. It writes again after each change, from the saved value, not from the screen. A seed the app never rewrote can’t satisfy an assertion. reset: none and real iPhones refuse this fixture. Each business.expect field is compared against one snapshot the app wrote. Field names are literal keys. true differs from 1, and the numbers 1 and 1.0 are equal. A mismatch fails the check. A missing, stale or malformed snapshot ends couldnt_run, class business_evidence. An empty business.expect can’t make a check pass by itself. A fixture write or cleanup with an unknown outcome stops the run with no retry and says what to reconcile. The snapshot is what your app says it saved. It doesn’t check a server, and Mobster reads no other app data.

Selectors

A selector has at least one of these fields, and every field given must match. A string written /pattern/ or /pattern/i is a regular expression, matched with Python’s re.search. i ignores case. A pattern is up to 500 characters, and an invalid one is a usage error.

Matching

Before comparing, Mobster normalizes text: NFKC, curly quotes and dashes become ASCII, invisible marks such as zero-width spaces are removed, and every run of whitespace becomes one space.
  • text and no_text ignore case and match a substring of one element’s label or value. They never join two elements, so “Mozilla” in one element and “Firefox” in the next don’t make “Mozilla Firefox”.
  • Selector fields are exact and case-sensitive, unless they are a /regex/.
  • equals on a value assertion compares by its type. true and false compare on/off meaning, so 1, on and yes equal true. A number compares the first number in the element’s value, at the expected number’s precision, with thousands separators removed. A string compares exactly.
  • equals, at_least and at_most on a count are whole numbers from 0.

What counts as shown

An element is shown when WebDriverAgent reports it visible, its frame overlaps the app’s frame, and it isn’t the application or a window. Each element is judged on its own, so the rows of a SwiftUI Form or List are shown even when iOS reports their container hidden. Content scrolled out of view isn’t shown: scroll to it first, with swipe and until from a coding agent, or in a plain-English step. Secure text fields count as shown, so visible: {role: field, label: Password} works. Their value reads as bullets.

Timing

Mobster decides on a settled screen, with every assertion on one read:
  1. It reads the tree, waits 0.3 s, and reads again. Two reads with the same fingerprint are settled.
  2. When a settled read satisfies every assertion, that read decides.
  3. Otherwise it reads again every 0.5 s until the assertion timeout (5 s by default, --assert-timeout from 0 to 60).
  4. At the timeout the last read decides, and the result says whether the screen was still changing.
Two assertions that hold on two different reads never combine into a pass.

Compare the screen to a baseline

A snapshot entry in expect compares the screen the check ends on to a baseline PNG:
A snapshot is decided by pixels, not the accessibility tree, so it isn’t an assertion: it has no name, equals or selector, and --expect and the MCP expect list don’t take it. A changed screen fails the check (rule 7 below). A first run records the baseline and needs review (rule 8). Screenshots that must not change says how the comparison works, where baselines live and how to update them.

Check a sound the iPhone plays

expect: [{sound: sent}] passes when the iPhone plays a sound you recorded once, such as the chime your app makes when a message sends. Mobster compares the shape of the sound’s spectrum in code, with no model. Set MOBSTER_EXPERIMENTAL_SOUND=1 to use it. Record the sound once per app, from a short WAV (16-bit PCM, up to 5 s) of that sound alone:
Commit the file. The fingerprint is a few kilobytes and matches at any volume, anywhere in the recording. During a run, Mobster records the iPhone’s sound for 20 seconds from the first step, through the same path as listen, and matches it when the steps end. A sound heard passes, with the time it was heard. A sound not heard fails with the best match it found, and a missing fingerprint or recording fails and says why. It works on a real iPhone over USB only. On a simulator the sound plays on your Mac, so the assertion fails and says so. Sound sent to Bluetooth or AirPlay isn’t heard. Opening the phone’s capture device resets its USB network link for a moment, which can pause WebDriverAgent, so try it on your device before you rely on it.

Check widgets, Spotlight and other system surfaces

surfaces checks what your app puts outside its own window: a widget, a Live Activity, its Spotlight results, the share sheet. Mobster drives each one from outside the app with WebDriverAgent on a simulator, reads it from its accessibility tree, and judges it with the assertions above. A surface runs after the check’s steps, and the app comes back to the front before the verdict is read. Set MOBSTER_EXPERIMENTAL_SYSTEM_SURFACES=1 to use it. Without it, a check with the key is refused.
Every surface takes name (its label in the report) and expect, what must show once the surface is up. spotlight, share_sheet and control_center also take pick, an element to tap (text for its label, or a selector), and then, what must show after it. A surface with no expect and no then checks nothing and is refused. The strings Mobster looks for are English, so run the simulator in English. On a simulator:
  • Control Center shows no controls, so a pick there has nothing to tap.
  • siri: shows nothing.
  • A pick inside the share sheet misses, because the sheet reports its targets’ frames from its own top edge. A pick of the app’s own menu item works.

What fails, and how

A surface that doesn’t show, or whose assertion doesn’t hold, is a fail-level finding with the surface’s frame, and the next surface still runs. The verdict is failed, class finding. An action WebDriverAgent never answered ends the run as unknown_outcome, and is never sent again. Surfaces run on simulators only. On a real iPhone the run ends couldnt_run, class environment, before it presses anything.

No simulator path

The app_clip step takes via: url, nfc, qr, banner or maps. Only url runs on a simulator. The others end the run as couldnt_run with “Not on a simulator”, so a check that names a tag or a place card can’t pass by skipping it. Mobster doesn’t push Live Activity updates from a server: start and update the activity in your app’s steps.

Verdicts and exit codes

ctrl+c exits 130 (SIGTERM 143, SIGHUP 129), and the run ends as couldnt_run, class stopped. A usage error in mobster verify exits 3, not 2, because 2 means needs review. The first rule that applies decides: A crash also takes the place of rules 3 and 4 when they’re wda, launch or a stopped replay, because WebDriverAgent losing a crashed app is the app’s failure. It never replaces stopped, usage, budget or unknown_outcome. Logs, crashes and video says how Mobster sees a crash. unlaunched_process compares the app’s process at the end with the processes the run’s own launches started, read from the simulator. An iPhone or an Android device gives no such read, so the rule doesn’t apply there, and run.log says so. held_before_flow uses one read taken after launch and the deep link, before any step. Add an expectation that only holds after the flow. What the model says about its own run is never an input to the verdict.

The result JSON

mobster verify --json prints one object, the same one saved as result.json in the run folder and returned by the MCP tools. Its schema is mobster.verify/1. The shape:

The run folder

The report shows your app’s own icon, the largest one its Info.plist lists, beside its name. Frames are JPEGs at half the simulator’s width. Every run has 01-launch, one frame per step, the verdict frame, and the same frame with the accessibility overlay: each shown element outlined in violet, and each asserted element in green when its assertion held or red when it failed, numbered in the check’s order. A run folder stays under 20 MB and keeps at most 60 step frames. mobster verify --save NAME also copies check.yaml to .mobster/checks/NAME.yaml, replacing a file of that name. NAME is lowercase letters, digits and dashes, up to 60 characters. When the run passes, Mobster keeps the steps Smart took in .mobster/cache/replay/, as mobster test --fresh does, so the saved check’s first mobster test on the same simulator model and iOS version replays them. A step that types text Smart made up, rather than text the check spells out, needs Smart on each run. A run of a check file (--check) records nothing.