Reading elements
query(target, options?)
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?)
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()
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?)
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()
TrackerState
Returns every tracker’s state right now: what keeps the app busy.
name, whether it is idle, and busy, the reasons it is busy.
Setting up and resetting
backdoor(name, ...args)
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.
Backdoors declaration, the name, the arguments and the result are type-checked
(typed backdoors).
reset()
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).