Skip to main content
Assertions are the usual way to check the screen. The methods on this page are for the rest: reading an element’s details into the test, waiting for the app or finding out why it is busy, setting up state through the app’s backdoors, and resetting it.

Reading elements

query(target, options?)

Types: MatcherInput · CallOptions · ElementSummary Returns the summaries of all matching elements, at once: it waits for the app to be idle like every call, but not for a match to appear. No match gives [].

attributes(target, options?)

Types: MatcherInput · CallOptions · ElementSummary Returns the summary of the single matching element, after waiting for it to exist (Detox getAttributes). Fails with MULTIPLE_MATCHES when several elements match.

getTree()

Types: TreeNode Returns the element tree as JSON, with semantic types: each node has type, testID, text, role, semanticType, a rounded rect and its children. The tree is also attached to failed tests (artifacts).

The element summary

query, attributes and every assertion return element summaries. A summary has: The text of a summary (also in error messages and elements.json) puts a space between separate texts, e.g. 张 张三 S2024001 for an avatar, a name and an ID. The runs of one text stay together: <Text>a<Text>b</Text></Text> gives ab. Matching by text is unchanged: it compares the text without those spaces.

Waiting for the app

waitForIdle(options?)

Types: WaitForIdleOptions Waits until the app is idle and resolves with the time it took, in milliseconds. Every call already does this; use it before work outside the driver, such as reading the app’s backend.

getIdleState()

Types: TrackerState Returns every tracker’s state right now: what keeps the app busy.
Each entry has the tracker’s name, whether it is idle, and busy, the reasons it is busy.

Setting up and resetting

backdoor(name, ...args)

Types: JsonValue Calls a backdoor that the app registered with quiesco.backdoor (in-app API), and resolves with its result. The arguments and the result are JSON; TypeScript interfaces are fine. An argument that is not JSON fails with NOT_SERIALIZABLE.
With a Backdoors declaration, the name, the arguments and the result are type-checked (typed backdoors).

reset()

A soft reset: clears the app’s storage, runs its onReset hooks, remounts it and waits for idle. Resolves with how long it took, in milliseconds. Quiesco does this before every test, so a test only calls it to start over in the middle.

Platform

platform

The platform under test: 'ios', 'android' or 'web'. A property, not a method. It is also this.platform in a Cucumber QuiescoWorld, and session.platform (per-platform steps).
A test that only runs on some platforms is better tagged.