Skip to main content
Some of what a test needs is not part of the app: a Face ID prompt, a push notification, the dialog that asks for a permission. These methods live on 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?)

Enrolls a face or fingerprint, or removes it with 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()

Presents a matching face or finger to the authentication the app is showing, so it succeeds.

biometrics.fail()

Presents an unknown face or finger. As on a real device, the system keeps its retry prompt up afterwards: the app gets no result until the prompt is answered (match again, or cancel it with 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()

Shakes the device (iOS: the Simulator’s Device > Shake; Android emulator: pushes on the accelerometer), then waits for the app to be idle.

clearKeychain()

iOS: resets the simulator’s keychain, for every app on it. Android has no keychain and fails with ACTION_NOT_SUPPORTED: use relaunch({ clearData: true }), which deletes the app’s data, Keystore keys included.

Notifications

sendNotification({ title, body?, data? })

Types: NotificationSpec Delivers a notification. It also works while the app is in the background.
  • iOS: a simulated remote push (simctl push), with data next to aps in 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 (config permissions), or let the app ask and answer with allowPermission().
  • Android: an emulator has no push service, so the notification is posted as the app (it needs the notifications permission). Tapping it opens the app with data as intent extras; the push library’s callbacks do not fire.

openNotification(title, options?)

Types: 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?)

Types: SystemQuery · SystemWaitOptions Taps system UI outside the app, then waits for the app to be idle.

system.expectVisible(query, options?)

Types: SystemQuery · SystemWaitOptions Waits until such system UI is on screen. Fails with ELEMENT_NOT_FOUND, listing the texts it saw.

system.expectNotVisible(query, options?)

Types: 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?)

Types: 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 })

Types: 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 the permissions config or setPermission instead (per platform).

system.allowPermission(options?)

Types: 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?)

Types: 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:
While a permission dialog (another activity) is in front, Android pauses the app’s JS timers. Quiesco’s idle wait notices that the app went to the background and returns, so the tap that opened the dialog completes.

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 Native Modal is 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’s openAuthSessionAsync, SafariViewService) or Safari when they are in front: type with system.type, tap with system.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 with system.tapAt above it. A React Native Modal shown a second time in a session can be missing from the tree XCUITest reports; app.* reaches its views.
On the Android emulator, 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.
While a dialog is open the page runs no script and takes no input. So:
  • 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_OPEN naming 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;
  • beforeunload prompts are always accepted: leaving or reloading the page is never held up.