app.device controls the app’s process and the device it runs on: start the app again with launch
arguments or a deep link, send it to the background, rotate the screen, switch to dark mode, go offline.
Each change is undone before the next test (between tests), so tests stay independent.
System UI outside the app — permission dialogs, biometrics, notifications — is on system UI;
screenshots are on screenshots.
App lifecycle
relaunch(options?)
RelaunchOptions
Terminates the app and starts it again — always a new process. The app keeps its data unless clearData
or reinstall is set. Resolves once the app has connected.
Without
@quiesco/native, an app that cannot start with the link is started first and the link is opened
after the launch, with a warning: getInitialURL will not return it then.
terminate()
relaunch(), every element call fails at once with APP_NOT_RUNNING,
without waiting.
sendToBackground()
bringToForeground(),
element calls fail with APP_IN_BACKGROUND. Not on the web (ACTION_NOT_SUPPORTED).
bringToForeground()
ACTION_NOT_SUPPORTED).
install()
binaryPath (apps). A running app is stopped:
start it with relaunch().
uninstall()
ACTION_NOT_SUPPORTED): use
relaunch({ clearData: true }) there.
appState
What the test did to the app last: 'running', 'background' or 'terminated'. A property, not a method.
openUrl(url)
app.openUrl: opens a deep link.
pressBack()
app.pressBack: the Android back button, or the browser’s back on
the web.
Network ports
reversePort(port)
localhost:port from an Android device (adb reverse). A no-op on
the iOS simulator and the web, which share the host’s network.
unreversePort(port)
reversePort. A no-op on the iOS simulator and the web.
Device state
setOrientation(orientation)
Orientation
Rotates the app to 'portrait' or 'landscape' and resolves once the app’s window has the new shape and
the app is idle. The app must not lock its orientation (app.json "orientation": "default").
setAppearance(scheme)
ColorScheme
Switches the system color scheme to 'light' or 'dark', and checks that the app reports the new one.
The app must follow the system (app.json "userInterfaceStyle": "automatic").
setFontScale(scale)
0.5 to 4, and resolves with the scale applied. iOS uses the nearest
Dynamic Type size and applies it live; Android starts the app again (data kept). Not on the web.
setLocale(locale)
'ja-JP'; null goes back to the device
default. The app is started again with it (data kept).
- It passes when the app’s preferred language (iOS
AppleLanguages, what expo-localization reads) or its JS locale is the new one. - iOS resolves
Intland the app’s native strings only to a language listed inCFBundleLocalizations. Without it a warning says so; an app localized in JS works as it is.
setLocation(latitude, longitude)
setPermission(name, state)
Permission · PermissionState
Changes a permission while the app runs. state is 'grant', 'revoke' or 'reset'; the names are
those of permissions (camera, microphone, location, notifications,
contacts, photos, calendar).
- Revoke on Android kills the app. Quiesco starts it again (data kept) before resolving, so the app is back on its first screen.
'reset'means not determined, as after a fresh install: the app’s next request shows the system dialog again. Android: revoked, with “don’t ask again” cleared; iOS:simctl privacy reset; web: the browser asks.- On iOS, notifications and the camera can only be reset by reinstalling the app. Quiesco reinstalls
and starts it, deleting its data (needs
binaryPath; a warning says so).
setNetwork(state)
NetworkState
'offline': the app’s new fetch / XMLHttpRequest / WebSocket connections fail as they do without a
network. Quiesco’s own connection keeps working, and connections already open stay open. 'online' undoes
it.
- Android also turns Wi-Fi and mobile data off, and the web reports
navigator.onLine === false, so NetInfo sees it there. - The iOS simulator has no network switch: NetInfo keeps reporting online.
- It lasts across relaunches, until
'online'or the next test.
setURLBlacklist is app.sync.ignoreUrls.add() here).
clipboard.set(text)
@quiesco/native (≥ Phase 6.6).
clipboard.get()
@quiesco/native (≥ Phase 6.6); on iOS a read falls back to simctl pbpaste.
setStatusBar(options)
StatusBarOptions
Overrides the status bar — clock, battery, signal — for clean screenshots. Nothing to do on the web, which
has no status bar.
resetStatusBar()
Screenshots
app.device.screenshot() takes a PNG of the screen, an element or a whole scrolling page: see
screenshots.
Between tests
- Before each test Quiesco starts an app a previous test left terminated, and brings a backgrounded one back.
- Every device change is undone before the next test, and when the session ends: permissions go back to the configured ones, the rest to what the device had. Only what was changed is touched.
- A call that starts the app again (
setLocale,setFontScaleon Android, a revoke on Android) leaves it on its first screen.