import type { … } from '@quiesco/core'; the in-app types come from @quiesco/agent, the runner options from
the runner’s package. The string unions (Direction, Permission …) are constants.
Matchers
MatcherInput
type MatcherInput = ElementQuery | string;
ElementQuery
interface ElementQuery {
/** testID: exact string or RegExp. */
id?: TextQuery;
/** Text of the element's subtree (the deepest matching element is returned). */
text?: TextQuery;
/** accessibilityLabel / aria-label. */
label?: TextQuery;
/** accessibilityRole / role. */
role?: string;
/**
* A semantic type (`'button'`, `'input'`, `'switch'`, ...: the same on every platform), a host
* component type (`'RCTView'`, `'div'`) or the displayName of a component rendering the element.
*/
type?: SemanticType | (string & {});
/** Some descendant matches (Detox `withDescendant`). */
has?: ElementQuery | string;
/** The element itself does not match. */
not?: ElementQuery | string;
/** Inside the single element matched by this matcher (Detox `withAncestor`). */
within?: ElementQuery | string;
/** n-th match (0-based) in render order, the same order on every platform. */
index?: number;
}
TextQuery
type TextQuery = string | RegExp;
Results
ElementSummary
/** What the agent reports about a matched element. */
interface ElementSummary {
/** Host component type, e.g. `RCTView`, `RCTText`, `div`. */
type: string;
testID?: string;
text: string;
role?: string;
label?: string;
rect: Rect | null;
visible: boolean;
/**
* Visible fraction of the element's area (0–1): the part inside the window and inside every
* ancestor that clips its content (scroll views, `overflow: hidden`). 0 when hidden by style.
*/
visibleRatio: number;
/** Platform-independent kind, when the element is one of SEMANTIC_TYPES. */
semanticType?: SemanticType;
/** Has the input focus (text inputs; the focused DOM element on the web). */
focused: boolean;
/** False when disabled (`disabled`, `accessibilityState.disabled`, `aria-disabled`, `editable={false}`). */
enabled: boolean;
/** Checked state of switches, checkboxes and radios (`accessibilityState.checked`, `aria-checked`, Switch `value`). */
checked?: boolean | 'mixed';
/** Current value: TextInput text, Switch / Slider / Picker value, or `accessibilityValue`. */
value?: JsonValue;
/** Serializable subset of the element's props (functions and React elements are dropped). */
props: Record<string, JsonValue>;
}
Rect
/** Rectangle in the platform's logical units (dp on Android, pt on iOS, CSS px on web), window coordinates. */
interface Rect {
x: number;
y: number;
width: number;
height: number;
}
TreeNode
interface TreeNode {
type: string;
testID?: string;
text?: string;
role?: string;
semanticType?: SemanticType;
/** Rounded rect. */
rect?: Rect;
children: TreeNode[];
}
TrackerState
/** State of one idle tracker. */
interface TrackerState {
name: string;
idle: boolean;
/** Human-readable busy reasons, e.g. `GET https://api.example.com/todos (1200ms)`. */
busy: string[];
/**
* frame-stable only samples while a call waits, so after a sync timeout it reports idle: these are its
* busy reasons when the latest wait for idle ended while the element tree was still changing.
*/
lastWait?: string[];
/**
* In a SYNC_TIMEOUT: the tracker was idle at the timeout but busy this many ms before it,
* and `busy` is what it was busy with then.
*/
idleForMs?: number;
}
TrackerName
type TrackerName = 'network' | 'timer' | 'react' | 'idle-callback' | 'frame-stable' | 'native' | 'native-module';
Points
Point
/** A point: in an element's own coordinates (`point`) or in window coordinates (`tapAt`), logical units. */
interface Point {
x: number;
y: number;
}
TimedPoint
/** A finger's position at a time: ms from the start of the gesture. */
interface TimedPoint {
x: number;
y: number;
t: number;
}
Call options
CallOptions
/** Options every Driver call accepts. */
interface CallOptions {
/** Per-call timeout (agent side). Default: `sync.timeoutMs`. */
timeoutMs?: number;
/** `false` skips waiting for idle around this call (infinite animations etc.). */
sync?: boolean;
}
ActionOptions
interface ActionOptions extends CallOptions {
mode?: ActionMode;
}
TapOptions
/** `tap()` options. */
interface TapOptions extends ActionOptions {
/** Where to touch, in the element's own coordinates (default: its center). */
point?: Point;
}
LongPressOptions
/** `longPress()` options. */
interface LongPressOptions extends ActionOptions {
/** How long to hold (default 800 ms). */
durationMs?: number;
/** Where to touch, in the element's own coordinates (default: its center). */
point?: Point;
}
LongPressAtOptions
/** `longPressAt()` options. */
interface LongPressAtOptions extends ActionOptions {
/** How long to hold (default 800 ms). */
durationMs?: number;
}
TypeOptions
/** `type()` options. */
interface TypeOptions extends ActionOptions {
/**
* Type one character at a time, as a user does, so the app sees every keystroke (debounced search,
* input masks, `onKeyPress`). Default: the whole text at once.
*/
perCharacter?: boolean;
/** With `perCharacter`: time between two characters (default 80 ms). The call waits for idle at the end. */
intervalMs?: number;
}
ScrollOptions
/** `scroll()` options. */
interface ScrollOptions extends ActionOptions {
/** How far to scroll, in logical units. */
distance?: number;
/** Where the finger starts inside the element, normalized 0–1 (default: around the center). */
from?: Point;
}
ScrollToIndexOptions
/** `scrollToIndex()` options. */
interface ScrollToIndexOptions extends ActionOptions {
/** Where the item lands in the list: 0 top, 0.5 middle, 1 bottom (FlatList's `viewPosition`). */
viewPosition?: number;
}
SwipeOptions
/** `swipe()` options. */
interface SwipeOptions extends ActionOptions {
speed?: Speed;
/** How far to swipe, in logical units. */
distance?: number;
/** Where the finger starts inside the element, normalized 0–1 (default: around the center). */
from?: Point;
}
DragOptions
/** `drag()` options. */
interface DragOptions extends ActionOptions {
/** How long to hold before moving (default 800 ms: enough for a long-press drag). */
holdMs?: number;
speed?: Speed;
}
PinchOptions
/** `pinch()` options. */
interface PinchOptions extends ActionOptions {
/** The fingers' axis in radians (default 0: horizontal). */
angle?: number;
speed?: Speed;
}
RotateOptions
/** `rotate()` options. */
interface RotateOptions extends ActionOptions {
speed?: Speed;
}
MultiTouchOptions
/** `multiTouch()` options. */
interface MultiTouchOptions extends ActionOptions {
/** The points are in this element's own coordinates (it must be visible) instead of the window's. */
within?: MatcherInput;
}
VisibleOptions
interface VisibleOptions extends CallOptions {
/** Minimum visible fraction of the element's area, 0–1 (Detox's `toBeVisible(75)` is `{ ratio: 0.75 }`). */
ratio?: number;
}
WaitForIdleOptions
/** `waitForIdle()` options. */
interface WaitForIdleOptions {
/** How long to wait. Default: `sync.timeoutMs`. */
timeoutMs?: number;
}
Device
RelaunchOptions
interface RelaunchOptions {
/** Launch arguments (any JSON), merged over the config's `launchArgs`; read with `quiesco.launchArgs()`. */
args?: LaunchArgs;
/** Open the app with this deep link (e.g. `myapp://todos/1`; on the web its path is opened). */
url?: string;
/** Delete the app's data first (native: the app's storage; web: a fresh browser context). */
clearData?: boolean;
/** Uninstall and install the app first (needs the app's `binaryPath`; web: like clearData). */
reinstall?: boolean;
/** Permissions to grant before the launch, besides the config's. */
permissions?: Permission[];
}
StatusBarOptions
/** Status bar overrides for clean screenshots; unset fields keep the real value. */
interface StatusBarOptions {
/** The clock, `H:MM` / `HH:MM` (e.g. `9:41`). */
time?: string;
/** 0–100. */
batteryLevel?: number;
charging?: boolean;
/** Wi-Fi signal, 0–3 bars. */
wifiBars?: number;
/** Cellular signal, 0–4 bars. */
cellularBars?: number;
/** The data network shown next to the bars; `hide` hides the cellular indicator. */
dataNetwork?: 'wifi' | '3g' | '4g' | 'lte' | '5g' | 'hide';
}
NotificationSpec
/** A notification for `app.device.sendNotification()`. */
interface NotificationSpec {
title: string;
body?: string;
/** Custom data: iOS puts it next to `aps` in the push payload, Android into the launch intent's extras. */
data?: Record<string, string>;
}
OpenNotificationOptions
/** `app.device.openNotification()` options. */
interface OpenNotificationOptions {
/** How long to wait for the notification to be posted (default 10000 ms). */
timeoutMs?: number;
}
SystemQuery
/** Text (exact, or a RegExp) and / or id (the full id, or the part after `:id/`). */
interface SystemQuery {
text?: string | RegExp;
id?: string;
}
SystemWaitOptions
interface SystemWaitOptions {
/** How long to wait for the system UI to show up (or go away). Default 10 s. */
timeoutMs?: number;
}
ScreenshotTarget
/** What `app.device.screenshot` captures: an element, or with `fullPage` the whole content of a scroll view (`true`: the screen's). */
type ScreenshotTarget = MatcherInput | { fullPage: true | MatcherInput };
ScreenshotOptions
/** `app.device.screenshot()` options. */
interface ScreenshotOptions {
/** With an element: all of the element, scrolled and stitched (default false). */
full?: boolean;
/** Also save the PNG to the scenario's artifacts under this name. */
name?: string;
}
WebView
WebElementQuery
/** A WebView locator as written in tests: `{ text }` also takes a RegExp. */
type WebElementQuery = ({ css: string } | { xpath: string } | { id: string } | { text: TextQuery }) & { index?: number };
PageElement
interface PageElement {
tag: string;
id: string;
text: string;
value: string | null;
visible: boolean;
disabled: boolean;
/** In the page's CSS pixels, relative to its viewport. */
rect: { x: number; y: number; width: number; height: number };
}
JSON
JsonValue
type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
JsonPrimitive
/** Any value that survives JSON.stringify / JSON.parse unchanged. */
type JsonPrimitive = string | number | boolean | null;
In the app
WithQuiescoOptions
/** `withQuiesco()` options. */
type WithQuiescoOptions = {
enabled?: boolean;
env?: NodeJS.ProcessEnv;
projectRoot?: string;
artifactsDir?: string | false;
nativeModules?: boolean;
argv?: readonly string[];
};
Backdoor
/** A backdoor: test-only function the host can call. Arguments and result must be JSON-serializable. */
type Backdoor = (...args: never[]) => unknown;
StorageAdapter
/** Clears one persistent store during soft reset (AsyncStorage, MMKV, SecureStore, ...). */
interface StorageAdapter {
name: string;
clear(): void | Promise<void>;
}
Runners
QuiescoVitestOptions
interface QuiescoVitestOptions {
/** Tag names when quiesco.config renames them (`tags` there). */
tags?: Partial<TagNames>;
/** Default 300 s (the first test includes starting the session). */
testTimeout?: number;
/** Extra tags of your own to declare, e.g. `['@smoke']`. */
extraTags?: readonly string[];
/** Parallel workers, each with its own device. Default 1 (serial). */
workers?: number;
}
RegisterOptions
interface RegisterOptions extends LifecycleOptions {
/**
* Use your own World (must extend QuiescoWorld). Default QuiescoWorld. A plain constructor type, not
* `typeof QuiescoWorld`: that one is generic over the world parameters, which no subclass satisfies.
*/
world?: new (options: IWorldOptions<any>) => QuiescoWorld<any>;
/** Default step timeout. Each driver call has its own sync timeout; this caps a whole step. Default 60 s. */
stepTimeoutMs?: number;
/** BeforeAll timeout: booting an emulator can take minutes. Default 10 min. */
setupTimeoutMs?: number;
/**
* Timeout of the per-scenario reset (Before). It can start the app again when it is gone, which waits up to
* 3 × the connect timeout. Default 3 min.
*/
resetTimeoutMs?: number;
}
LifecycleOptions
interface LifecycleOptions {
/** Config instead of loading `quiesco.config.*` (QUIESCO_CONFIG picks another file). */
config?: QuiescoConfig;
/** Platform instead of QUIESCO_PLATFORM. */
platform?: Platform;
/** Session factory (tests, custom setups). */
createSession?: (options: SessionOptions) => Promise<Session>;
env?: NodeJS.ProcessEnv;
/**
* The parallel worker this lifecycle runs in, from the runner adapter: the config function
* gets it, and the session takes its own device, port and artifacts directory. Default: the only worker.
*/
worker?: WorkerInfo;
/** Where the repeated-failure hint goes. Default: the console. */
logger?: Logger;
}
ScenarioTags
/**
* A scenario's tags: a flat list (one level), or grouped by Gherkin level, outermost first
* (feature, rule, scenario, examples).
*/
type ScenarioTags = readonly string[] | readonly (readonly string[])[];
ScenarioResult
interface ScenarioResult {
tags: readonly string[];
failed: boolean;
/** The failure (an Error, or the runner's message), to tell repeated identical failures apart. */
error?: unknown;
}
AfterResult
interface AfterResult {
/** For runners with attachments: screenshot, element tree, logs, … */
attachments: Attachment[];
/** Files written for this test (evidence, logs, video): runners without attachments print them. */
files: string[];
}
Attachment
interface Attachment {
data: Buffer | string;
mediaType: string;
/** Shown by reporters that name attachments. */
fileName?: string;
}
SessionOptions
interface SessionOptions {
config: QuiescoConfig;
platform: Platform;
logger?: Logger;
/** Override the device provider (tests, custom providers). */
provider?: DeviceProvider;
/**
* The parallel test worker this session belongs to: its own device, server port
* (`server.port + index`) and artifacts directory. Default: the only worker.
*/
worker?: WorkerInfo;
/** How often the app's process is checked while waiting for it to reconnect. Default 500 ms. */
crashPollMs?: number;
}
WorkerInfo
/** The parallel test worker a provider serves; each worker needs its own device. */
interface WorkerInfo {
/** 0-based worker index. */
index: number;
/** Number of workers in the run (1 when running serially). */
count: number;
}
ScenarioInfo
interface ScenarioInfo {
tags?: readonly string[];
/** The scenario's name: its artifacts directory. */
name?: string;
}
ScenarioArtifacts
interface ScenarioArtifacts {
/** For the report: screenshots, logs and the timeline summary inline; videos / traces by path. */
attachments: Attachment[];
/** Files written for this scenario. */
files: string[];
}
Evidence
interface Evidence {
screenshot?: Buffer;
tree?: TreeNode | null;
/** The condensed element list and the route. */
elements?: ResultOf<AgentMethods['listElements']>;
idle?: TrackerState[];
/** Why a piece could not be collected. */
errors: string[];
/** The app crashed: element tree, list and idle state are not collected. */
crash?: QuiescoError;
}