ASSERTION_FAILED, giving the expected and the
actual value. So a test never has to wait for the app before checking it.
app.expect(target).toBe…().
Visibility and presence
expectVisible(target, options?)
MatcherInput · VisibleOptions · ElementSummary
Holds when at least one matching element is visible.
expectNotVisible(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when no matching element is visible: there is none, or it is hidden.
expectExists(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when a matching element is in the element tree, visible or not.
expectNotExists(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when no matching element is in the element tree.
expectCount(target, n, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly n elements match.
Content
expectText(target, text, options?)
MatcherInput · TextQuery · CallOptions · ElementSummary
Holds when exactly one element matches and its text equals text, or matches it when text is a
regular expression.
expectValue(target, value, options?)
MatcherInput · JsonValue · CallOptions · ElementSummary
Holds when exactly one element matches and its value equals value, or matches it when value is a
regular expression. The value is the text of an input, the state of a switch, the value of a slider or
picker, or the accessibilityValue.
A date / time picker’s value is what it shows, in the device’s local time:
"2031-12-24" (mode date),
"20:15" (time), "2031-12-24T20:15" (datetime), with seconds when they are not 0. A Date matches
when those parts agree. See date and time pickers.
expectLabel(target, text, options?)
MatcherInput · TextQuery · CallOptions · ElementSummary
Holds when exactly one element matches and its accessibility label equals text, or matches it when
text is a regular expression.
expectProp(target, prop, value, options?)
MatcherInput · JsonValue · CallOptions · ElementSummary
Holds when exactly one element matches and its prop prop has this JSON value. The host element’s props
are looked at first, then those of its component (e.g. disabled, value).
State
expectEnabled(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it is enabled.
expectDisabled(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it is disabled.
An element is disabled through
disabled, accessibilityState.disabled, aria-disabled or
editable={false}, also when it inherits it from an ancestor.
expectChecked(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it is checked: a switch, checkbox or radio, or any element
with accessibilityState.checked.
expectNotChecked(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it is unchecked.
An element without a checked state fails both
expectChecked and expectNotChecked.
expectFocused(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it has the input focus.
expectNotFocused(target, options?)
MatcherInput · CallOptions · ElementSummary
Holds when exactly one element matches and it does not have the input focus.
Chained form
expect(target)
MatcherInput · ElementExpectation
The same assertions in a chained form, like Detox and Jest. Both forms do the same thing: they wait for
idle and retry until the assertion holds. Each method takes the call options as its
last argument, and .not negates it.
A negated assertion about one element (
not.toHaveText, not.toHaveValue, …) still needs exactly one
match: it fails when there is none.