iOS QA SDK: scenario runner, in-app bug reporter and device dashboard
Flow tests and an in-app bug reporter for SwiftUI and UIKit apps, shipped as the Selvage Swift package.
A scenario is written once in YAML, compiled to canonical JSON and played against the app. Every run leaves evidence and a verdict.
One file holds two YAML documents split by ---: the config (appId, name, tags, seed, mocks, lanes) and the list of steps. It sits at Scenarios/Modules/<Module>/<Screen>/<id>.yaml. Sub-flows live in Common/Shared and are pulled in with runFlow, and Common/compiler.yaml holds the settings both compilers read.
The dialect's home: SCENARIOS.md documents every step, and a kernel test fails when a step is missing from it.
The compiler turns each file into canonical JSON with its sub-flows inlined. An unknown key, command or argument is an error that names file:line:column, prints the line and puts a caret under the fault.
compile.py on the Mac, ScenarioYAMLCompiler inside the app. parity.sh compiles the catalogue with both and fails on the first byte that differs.
Cheap checks come first, so a broken catalogue never costs a build or a device.
run.sh checks the quarantine list, then the compile, lint, doctor and seal gates and the project's own gates; a failing gate exits 4. On the test lane a health hook can stop the run with exit 3 before the build.
After sub-flows are inlined the first step is launchApp, exactly one per scenario, and an openLink right after it is folded into the launch. The seed (locale, link and the app's own values) travels with the launch. onFlowStart runs before it, onFlowComplete after the steps whether they passed or not.
The app gets FLOW_SEED, a ScenarioLaunchEnvelope as JSON, and applies what it understands.
Each step resolves its selector (id, text, index and the rest) and acts: tap, type, scroll, wait. repeat, retry, runFlow and measure nest, and ${VARIABLES} resolve at run time.
Mac lane: one xcodebuild run drives several simulator clones in parallel. Device lane: ScenarioDevice plays the same steps inside the app, started from the debug menu or the dashboard.
assertVisible, assertNotVisible, assertCount, assertTrue and assertNetwork check what the screen and the network promised. A failed assertion fails the scenario on that step.
On failure the runner attaches the accessibility tree and the nearest identifiers it could see.
While the steps run, each SDK records what happened: screens, network, logs. Secrets are masked before anything is written to disk.
Per scenario: progress.jsonl, steps/NNN.png, network-trace.jsonl, scenario.mp4 and more, attached to the result bundle. The bug reporter drops the named headers, query items and body keys as each entry is recorded, and storage.json redacts any key nobody classified.
The run ends with a status per scenario and files a person and a machine can both read.
report.html, summary.md, junit.xml and run.json in a timestamped folder under ~/Desktop/SelvageReport/XCUITestsReport, where latest points at the newest run.
A Mac with Xcode, a simulator, Python 3 and PyYAML. run.sh is Tools/scenario-runner/run.sh in the Selvage checkout, run from the project root.
run.sh check run.sh --lane mock --only 01-sign-in run.sh --file ~/Desktop/draft.yaml --domain Login run.sh device <link> --file x.yaml xcodebuild test -scheme Selvage-Package -destination 'platform=iOS Simulator,name=iPhone 17 Pro'
The repository has no CI workflow. Its own guard is an opt-in pre-push hook (core.hooksPath .githooks) that runs the scrub gate with --require-list. The runner's README describes the job for a Mac agent with Xcode and a simulator runtime, and leaves the CI system to the host.
python3 -m pip install --user pyyaml Tools/scenario-runner/run.sh --lane test --env <environment>/<module> --domain Checkout --no-video --allow-busy
Only 0 and 1 are a verdict; 2, 3, 4 and 130 are not
Scenarios written in a YAML dialect compile to one wire format.
BugReport packs what a tester saw into one archive.
ScenarioDashboard serves a page and a WebSocket from inside the app.