iOS system alerts (iosAlertHandler)

in Japanese(日本語)

Announces one upcoming iOS system alert (permission prompt, ATT, "Open in …?") and the button to press on it.

Functions

function description
iosAlertHandler(alert:, button:) Registers one upcoming system alert. alert: (which alert, matched against its title) is required. Both alert: and button: use selector matching syntax (|| for alternatives, * for the match mode). Registers are consumed on press: register again for a second alert.

Example

iosAlertHandler(alert: "*Photo Library*", button: "Don't Allow")
iosAlertHandler(alert: "*wants to track*||*トラッキング*",
                 button: "Allow||許可")                              // both locales

Notes

Why this exists

Permission prompts, "Open in …?", and similar system alerts are drawn by SpringBoard, a separate process — they never appear in the app's own accessibility tree, so irregularHandler cannot see or close them.

mode how to handle alerts
inapp-boost (run profile default) Write them normally — tap("Allow"), exist(...), ifCanSelect(...) all reach across to SpringBoard when the app itself cannot resolve the selector. Nothing closes automatically unless you register it with iosAlertHandler.
xcuitest Write them as with inapp-boost.

The only alert closed automatically without any declaration is openURL's first-time confirmation.

Registering

While a system alert covers the app

This only applies while an iosAlertHandler registration is still pending. When an alert is covering the app, operations and assertions against the app do not proceed — the tool waits for the alert to clear (or be closed by a registered button), and fails with failureKind=system-ui-covered if it never does:

❌ 6. [action] tap "#btn_something"
   system UI is covering the app ("MyApp" Would Like to Access the Photo Library).
   The in-app bridge could still reach the app, but a person could not, so the step was not
   performed. None of the registered iosAlertHandler entries
   (*Photo Library*→Allow) matched a button on it.
   Buttons on this alert: "Select Photos" / "Allow Full Access" / "Don't Allow".
   Register the one you want pressed with iosAlertHandler(...), or dismiss it in the scenario.

Consequences of leaving an alert on screen