Scripted tests (YAML)
A scripted test is a YAML file of steps. quameleon-qa test cold-starts the app in QA mode, and for every step:
- waits until the app has settled, so a step never races the previous one;
- performs the action inside the app: the SDK injects the touch or text itself (
act.req), so there are no screen coordinates to maintain and the on-screen keyboard never covers a target; - checks the step’s expectations against what the step caused (requests, screens, events, UI);
- waits until the app has settled again, then re-checks the state expectations (current screen, UI) against that end state, so a check never passes because it caught a moment in passing;
- runs the test’s checks (no crash, no errors by default).
Settled
Section titled “Settled”Settled means idle, or, for screens that animate forever (a Lottie loop, a spinner), no request in flight and nothing but animation for 1 s (Android reports the frames, iOS the running layer animation). Idle means all of:
- the main thread is free;
- no frame was drawn for 300 ms in any of the app’s windows (Dialogs, React Native modals, popups and alert windows included, not just the screen under them);
- no request is in flight, and the last one ended at least 300 ms ago, so the UI a response triggers (a React Native re-render that enables a button) is drawn before the next step starts;
- at least 300 ms passed since the last action, so what an action starts a moment later (a navigation pop that waits for the keyboard to close) is waited for too.
After the cold launch, step 1 also waits (up to 10 s) for the app’s first screen or launch signal: a React Native
app’s main thread is idle while its JS bundle still loads, so “settled” alone could come before anything is drawn.
Before a tap or long_press, a target that is disabled (enabled: false in the hierarchy) gets up to 2 s to become
enabled; if it is still disabled, the tap is delivered anyway (it does nothing, as with a finger). Together these
cost at most about 300 ms on a step that made a request. Every signal between a step’s start and its settled end
carries the step’s id (step-3), so the replay timeline shows what each step caused.
The first failing step stops the test. The run is recorded, so every test leaves a replay, and the CLI exits 1
if any test failed.
export QA_EMAIL=qa@acme.com QA_PASSWORD=… # from your CI secret storenpx quameleon-qa test qa-tests --android-serial emulator-5554 --junit junit.xml # Androidnpx quameleon-qa test qa-tests --ios-udid booted --junit junit.xml # iOS Simulator▶ Sign in (qa-tests/sign-in.yaml) ✓ 1 type 11 chars into auth.email 930ms ✓ 2 type 8 chars into auth.password 640ms ✓ 3 tap auth.submit 1700ms ✗ 4 tap tab.library expected a network request matching "GET /api/library" within 10000ms no network signals received replay: qa-runs/sign-in/replay.htmlThe app needs the SDK in its QA build, nothing else.
| Platform | What the SDK drives |
|---|---|
| Android (device or emulator) | Views, Compose, React Native and WebViews: the SDK injects real touches into the top-most app window under the point (a Dialog, React Native modal, popup or bottom sheet above the screen), so everything that reacts to a finger reacts to a step. |
| iOS Simulator | UIKit, SwiftUI, React Native and WebViews. iOS has no public API to inject a touch, so the SDK triggers what is under the point: text inputs get focus; UIControls (buttons, switches, segmented controls) fire their actions; alert buttons run their action; table / collection rows are selected through their delegate; SwiftUI controls and accessible views are activated; tap and long-press gesture recognizers fire; WebView taps click the DOM element. React Native views are resolved through the React fiber tree in JS, which calls the component’s onPress / onLongPress (QA mode only). swipe / scroll_to move the UIScrollView under the finger (React Native ScrollView / FlatList too) and end like a flick, so pagers (react-native-pager-view, material top tabs) switch pages; a swipe down at the top of a list starts pull-to-refresh. A tap on an AVKit video (expo-video) shows its controls, as a finger does. type goes through the delegate like the keyboard (into a WebView field: its value, with input / change events); submit is the return key; back closes the keyboard, then pops the navigation stack, then dismisses a modal. |
A tap on iOS that nothing can handle this way fails the step with unsupported rather than passing silently (for
example a view that reads raw touches in touchesBegan). iOS devices (not simulators) aren’t supported. The
platform parity page has the full matrix.
A test file
Section titled “A test file”name: Sign inapp: android: com.acme.app # package ios: com.acme.app # bundle id (iOS Simulator runs) activity: .MainActivity # Android, default args: { env: staging } # Android intent string extras / iOS launch arguments (-env staging) clear_state: true # wipe app data first (iOS: UserDefaults, data container and the Simulator keychain)timeout: 10000 # per wait, ms (default 10000)checks: [no_crash, no_errors] # after every step (default)steps: - type: { into: auth.email, text: "${QA_EMAIL}" } - type: { into: auth.password, text: "${QA_PASSWORD}" } - tap: auth.submit expect: - network: POST /auth/v1/token - screen: Home - event: login.succeeded - tap: tab.library timeout: 15000 expect: - network: GET /api/library - ui: library.list - backEach file is one test with a fresh cold launch. A folder runs its files in name order, so 01-sign-in.yaml can leave
the app signed in for 02-…; use clear_state: true on the first test to make the whole suite start clean.
${NAME} is replaced from --var NAME=… or the environment; a name that is not set fails the test before it starts.
Typed text is never printed in the output.
Pass secrets as environment variables, not --var: command-line arguments end up in shell history, CI logs
and the process list. When a variable’s name contains PASS, SECRET, TOKEN or KEY (any case), its value is
also redacted as *** wherever it would otherwise appear: the console output, result.json, junit.xml and the
failed-assertion messages in the recording, even when it is used as a tap target or a label. Values shorter than 3
characters are not redacted.
Targets
Section titled “Targets”A target is a test id (Android resource-id name or content description, Compose testTag, React Native
testID), a visible label, or a text input’s placeholder (Email), as in q.ui.
Placeholders are static UI text; what the user typed is never in the hierarchy. The runner finds it in the live view hierarchy,
waiting up to the timeout for it to appear, and acts on its center. { x: 120, y: 340 } (window dp) is the fallback
for something with neither.
Only nodes whose center is on screen match: pagers and carousels keep off-screen pages in the hierarchy. For
type … into, a text input wins over other nodes with the same text (a field’s label above it often says “Email” too).
Labels match exactly first; when nothing does, a label or placeholder that differs only in case matches, on both
platforms: Android dialog buttons are drawn upper-case (“CANCEL”) and textTransform changes case, so tap: Cancel
works everywhere. ui: … label: compares the same way. Test ids always match exactly.
The hierarchy holds every visible window of the app, top-most first: an open Dialog, React Native Modal, bottom
sheet, popup or alert comes before the screen under it (flagged overlay), so a target that exists in both is
found, and tapped, on top. scroll_to treats a target that something tappable is drawn over, after it, (a tab bar, a
dialog’s button) as not visible yet; what is drawn before it, such as a sheet’s dimming view, never counts.
Actions
Section titled “Actions”| Step | What it does |
|---|---|
tap: <target> |
Taps the target’s center |
long_press: <target> |
Presses for 800 ms |
type: { into: <target>, text: "…" } |
Taps into to focus it, then replaces its text. type: "…" types into the focused input |
submit |
The focused input’s keyboard action (done, go, search…) |
back |
Like the hardware button: closes the keyboard if it is open, otherwise goes back |
swipe: up |
Swipes the screen (up, down, left, right); swipe: { on: <target>, dir: up } swipes inside one view |
scroll_to: <target> |
Swipes up until the target is visible ({ target, dir, max: 10, on }; on swipes inside one view, for a list that doesn’t fill the screen) |
wait: 500 |
Waits a fixed time. Rarely needed: every step already waits for idle |
expect: […] |
A step that only checks |
Every step can carry expect: (one item or a list) and its own timeout:. A step with platform: android or
platform: ios runs only on that platform, for native controls that differ (Media3 shows a player’s controls on
open, AVKit after a tap on the video, with other labels):
- platform: ios tap: Video # AVKit: show the controls expect: { ui: Play } - tap: Play # both platformsExpectations
Section titled “Expectations”Each one waits until it is true or the timeout passes, and only counts signals that arrived after the step began.
| Expectation | Passes when |
|---|---|
network: "POST /path" |
a matching request completes with 2xx/3xx; add status: 404 for an exact status. * and ** work as in q.network |
screen: Home |
Home is the current screen |
event: name |
your Quameleon.event(name) fired; props: { … } must match too |
ui: <target> |
it is visible; add label: "text" to check its text, or gone: true to wait for it to disappear |
probe: name with equals: value |
your probe returns the value |
settled: 800 |
the step’s UI settled within 800 ms (action latency) |
Checks
Section titled “Checks”checks run after every step, over that step’s signals: no_crash, no_errors, no_hangs, no_leaks,
no_blank_screens. The default is [no_crash, no_errors].
Output
Section titled “Output”For each test, --out (default qa-runs) gets a folder with the recording (session.ndjson, frames),
replay.html and result.json. --junit writes one JUnit suite per test and one case per step, which GitHub
Actions, Buildkite and GitLab show natively.