app.device and drive the device or the system’s own UI.
They work on iOS simulators and Android emulators (on Android the emulator’s console fakes the sensors, so
not on a real device). On the web they fail with ACTION_NOT_SUPPORTED (tag such tests @native,
test tags), except system.tap, system.expectVisible and system.expectNotVisible, which
answer the page’s JavaScript dialogs.
Biometrics
A typical Face ID / fingerprint login test:biometrics.enroll(enrolled?)
enroll(false). enrolled defaults to true. On
Android, Quiesco sets a screen-lock PIN (fingerprints need one) and goes through Settings’ enrollment
screens; the app is brought back to the front afterwards. The enrollment is undone before the next test.
biometrics.match()
biometrics.fail()
system.tap). Several failures in a row lock the sensor for a while (on the Android
emulator from about 0.5 s up to 30 s).
Device
shake()
clearKeychain()
ACTION_NOT_SUPPORTED: use relaunch({ clearData: true }), which deletes the
app’s data, Keystore keys included.
Notifications
sendNotification({ title, body?, data? })
NotificationSpec
Delivers a notification. It also works while the app is in the background.
- iOS: a simulated remote push (
simctl push), withdatanext toapsin the payload. The app’s push library receives it while the app is in front. The system shows it only when the app may show notifications: grant them before the app starts (configpermissions), or let the app ask and answer withallowPermission(). - Android: an emulator has no push service, so the notification is posted as the app (it needs the
notificationspermission). Tapping it opens the app withdataas intent extras; the push library’s callbacks do not fire.
openNotification(title, options?)
OpenNotificationOptions
Taps the notification titled title, as a user opening it: on iOS its banner, or in Notification Center
once the banner is gone; on Android in the notification shade. Resolves when the app is in front and idle.
Details:
- It waits for the notification to be posted, so one the app schedules a few seconds ahead is found. On iOS
the time the system UI runner takes to start does not count against
timeoutMs. - A tap counts once the app comes to the front. On iOS, when it does not, it looks again; in a stack of the app’s notifications it taps the newest one. After a tap it may take 3 s more to tap again.
- On iOS the app’s earlier notifications stay in Notification Center, across reboots and reinstalls, and
group with the new one: the first tap expands the group, and on iOS 27 the next one reveals an “Open”
button to tap. With a slow simulator, raise
timeoutMs.
System UI
app.device.system finds and taps UI outside the app’s React views: a permission dialog, the biometric
prompt, a web page’s JavaScript dialog (what it includes). Elements are found
by a query:
Give
text, id or both. Each call waits up to timeoutMs (10 s) for the UI to show up (or go away).
On iOS system UI slides in: an element is used once two reads 250 ms apart agree on where it is (for
tap, expectVisible, type and the permission dialogs).
system.tap(query, options?)
SystemQuery · SystemWaitOptions
Taps system UI outside the app, then waits for the app to be idle.
system.expectVisible(query, options?)
SystemQuery · SystemWaitOptions
Waits until such system UI is on screen. Fails with ELEMENT_NOT_FOUND, listing the texts it saw.
system.expectNotVisible(query, options?)
SystemQuery · SystemWaitOptions
Waits until no such system UI is on screen. Fails with ASSERTION_FAILED, naming the text still there.
system.type(query, text, options?)
SystemQuery · SystemWaitOptions
Taps the field matching query and types text into it with the device’s input; then waits for the app
to be idle. When a label and a field have the same text, the field is used (a label “Email” next to its
input). On iOS the text goes through the keyboard, so any text works. On Android printable ASCII is sent
as key events (input text); other text is pasted through @quiesco/native’s clipboard.
system.tapAt({ x, y })
Point
A system-level touch at a point of the screen (points / dp from the top-left corner), over whatever is
there. For example, tapping above iOS’s share sheet closes it. On iOS it first waits (up to 2 s) until the
system UI on screen stops moving. Then it waits for the app to be idle.
Permission dialogs
The app asks for a permission and the system shows its dialog; the test answers it as a user would. To start a test with a permission already granted, use thepermissions config or
setPermission instead (per platform).
system.allowPermission(options?)
SystemWaitOptions
Taps the dialog’s allow button, whatever the device language. On Android it finds the button by its id,
including “while using the app”; on iOS by its position, as iOS lays the buttons out. Resolves when the
app is in front and idle.
system.denyPermission(options?)
SystemWaitOptions
Taps the dialog’s deny button, the same way (on Android also “don’t ask again”). Resolves when the app is
in front and idle.
Answer a permission dialog in the test that brings it up. Alerts outlive the app: one a test leaves
open is dismissed before the next (cancel, else its first button), except a permission dialog. Either
answer to it sticks (a denied notification permission only goes away with a reinstall), so the next test
fails with
RESET_FAILED naming it. To ask for a permission again, reset it first:
What system UI includes
Besides the system’s own UI (SpringBoard on iOS, other packages on Android),system.* sees UI that is
not React:
-
Android: the app’s own dialog windows, e.g. the date dialog of
DateTimePickerAndroid. A React NativeModalis such a window too. -
iOS: the app’s UIKit views (an inline
DateTimePicker’s days, the keyboard’s keys, the share sheet), and the web page of an authentication session (expo-web-browser’sopenAuthSessionAsync, SafariViewService) or Safari when they are in front: type withsystem.type, tap withsystem.tap. The app’s React views are in that tree as well; tapping them is a real touch all the same. Close the share sheet withsystem.tapAtabove it. A React NativeModalshown a second time in a session can be missing from the tree XCUITest reports;app.*reaches its views.
openAuthSessionAsync needs a browser with Custom Tabs (an image with Google
Play); the AOSP images have none.
On iOS, system UI belongs to SpringBoard. Quiesco builds a small XCUITest runner the first time it is
needed (once per Xcode version, cached in ~/Library/Caches/quiesco/ios-runner, about 10 s) and starts it
on the simulator (2–4 s, once per session).
Web: JavaScript dialogs
On the web,alert, confirm and prompt stay open until the test answers them, as a user would: they
count as system UI. The dialog’s message is a node with id dialog.message. Its buttons are OK (id
dialog.accept) and, for confirm / prompt, Cancel (dialog.dismiss). An accepted prompt gets its
default value.
- the action that opened it returns as soon as the dialog is up, without waiting for idle;
- any other call on the app fails at once with
DIALOG_OPENnaming the dialog: answer it first. A screenshot fails too, as the page does not paint; - a dialog still open when the test ends is dismissed before the next one, with a warning;
beforeunloadprompts are always accepted: leaving or reloading the page is never held up.