Contract UI tests are scripts in *.test.contract files that drive the built app by testId on a clock the driver controls. They are the main check that screens, navigation and data sources work together, and they run the same on the web host and on an iOS simulator.
Running
bun exact.mjs test web # every *.test.contract, headless Chrome
bun exact.mjs test web read.test.contract # one file
EXACT_SIM=<simulator UUID> bun exact.mjs test iostest web builds the web app first. test ios builds when the build is missing or older than its sources (help.mjs).
Each test launches the app fresh with its own store, after its first data has landed. Nothing is left running; a failed test exits 1.
The runner starts the app's server from app.json commands.server, here the local test server. It refuses to run when a server already answers on that port. "server": {"database": false} tells Exact to skip its scratch database (app.json).
EXACT_SIM names the simulator by UUID for repeatable runs (README). Without it Exact picks a booted iPhone or the newest Pro.
These tests do not run in GitHub Actions.
The language as used here
The full grammar is "Authored tests" in Exact's contract-grammar.md. Lines before the first test apply to every test in the file.
Step | Meaning | Example |
|---|---|---|
| Launch line: open the app at a route | vault.test.contract L3 |
| Launch line: seed for the driver's randomness | vault.test.contract L2 |
| Launch line: the app's clock start. | |
| Press a control. A disabled control fails the step | |
| Scroll inside a view | |
| Replace a field's text. | |
| Press a key in a field | |
| The platform's Back | |
| Relaunch on the same store, then wait for data | |
| A node exists or not | |
| A node's text | |
| A state, resource or field, dotted | |
| A control's | |
| Wait until every request in flight has answered, clock unmoved | |
| Finish transitions | |
| Advance the app's clock | vault.test.contract L35 ( |
| Poll on real time with the clock frozen, for state a stream reaches later | |
| Fetches whose URL starts with the prefix fail as a refused connection; | |
| The driver, not the app, calls the test server. The path is resolved against the first loopback origin granted in |
A request that answers outside 200 to 299 fails the step. The mocks use this for assertions: /activity/posts and /dev/assert-* answer 409 when the condition does not hold.
Files
File | Tests | Backend |
|---|---|---|
3 | Live | |
12 | Live | |
4 | Live | |
1 | Local test server (notify | |
6 | Reads from live | |
2 |
| |
13 | Mostly none (local key storage); one test connects to the local test server as a custom server | |
7 | Local test server, mock notify. Each test first arms | |
3 | Local test server, mock vault | |
15 | Mock agents server on port 3068, opened at the | |
1 | None. Runs the crypto self test inside the host runtime and compares three literals from the parity vectors |
Total: 67 tests. The test vector phrase is legal winner thank year wave sausage worth useful legal winner thank yellow, a published BIP-39 vector, never a real identity. Fixture key files use a seed of 32 identical bytes.
Known baseline failures
The files carry no comments about expected failures. PR #1484 records that the Read contract had "three missing live-home child-0 failures, identical on clean main". Three tests in read.test.contract depend on child-0 on the live home ("a child document pushes and Back returns home", "document rows name their authors", "a failed load shows Retry and recovers"); that these are the three is inferred. This is the cost of asserting against live content; see Open site: implementation and evidence.
Related
Verify and visual checks, which runs these same files
Seed site read API and Publishing signed blobs, the live backends
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime