Pickers, sheets and system alerts

For AI agents: this page is Markdown at https://squiggle.sh/docs/flows/system-ui.md. Every docs page is listed at https://squiggle.sh/llms.txt, and all of them are one file at https://squiggle.sh/llms-full.txt.

A flow can drive the photo picker, the document picker, the share sheet, in-app browsers and permission prompts that iOS shows over your app. Select their controls by the text they show, like any other control.

These run on the iOS simulator. iOS draws them in a separate process, on top of your app, and Squiggle reads them from the simulator’s accessibility tree. Your flow doesn’t need a mock or a test-only code path to get past an attachment step. They are iOS’s own, so none of this applies to a React web app.

What a flow can drive

UIExamples
Sheets and pickers shown over your appThe photo picker (one photo or several), the document picker and the share sheet
In-app browsersA page opened with expo-web-browser (SFSafariViewController), full screen or as a sheet
System alertsPermission prompts, such as photo library access
The “Open in …?” alertWhen a deep link or openLink opens your app from the home screen, Squiggle presses Open on this alert for you: see below
Expo’s developer menuIts items, such as Reload: tap: { text: Reload }. Your app draws this menu, and Squiggle reads it the same way as the sheets above: an agent’s describe lists every item the menu shows

While one of these is up, your app’s own screen is covered. Squiggle stops listing the controls beneath it and refuses to tap them, because a real finger would land on the sheet instead. Agents see the same thing: describe marks each control on the sheet external. A step whose control is under a sheet that is still closing, such as a tap right after the tap on its Close, waits up to 2 seconds for the sheet to go and then looks again. Your agent’s tap waits the same way; describe and find report the screen as it is.

Your app’s own full-screen views work the same way. While a photo viewer drawn in a FullWindowOverlay, a React Native Modal or an alert from React Native’s Alert is open, the screen beneath it isn’t listed and its controls aren’t tapped. A control on top that shares its label with one beneath, such as an alert’s Sign out button over your own, is the one a step taps. Close the viewer first, then act on the screen. An overlay that lets touches through, such as an empty toast container that is always mounted, hides nothing.

Attach photos from the picker

Open the picker, wait for it, tap photos and confirm. The wait names the picker’s Collections tab, a label nothing in the app contains (see Wait for it to open). Every cell in the photo picker is labelled Photo, so nth picks one by position:

YAML
- tap: { testID: attach-photos }- waitFor: { visible: { text: Collections } }- tap: { text: Photo, nth: 2 }- tap: { text: Photo, nth: 4 }- tap: { testID: Add }- assert: { visible: { testID: attachment-count, text: Attachments 2 } }

nth counts from 1 in reading order: along the top row from left to right, then the next row. A bare text: Photo taps the first cell. For a single-photo picker, the tap on a photo closes the picker and returns it to your app.

The picker shows the simulator’s photo library. A new simulator has a few sample photos. To attach a particular image, add it to the library with an addMedia step before the picker opens. A relative path is read from the flow’s own folder:

YAML
- addMedia: [fixtures/receipt.jpg]

Attach a file from the document picker

The document picker opens on Recents, or in the folder it was last closed in. Tap the Browse tab to start from the list of locations, open one, and tap the file by its name:

YAML
- tap: { testID: attach-file }- waitFor: { visible: { text: Browse } }- tap: { text: Browse }- tap: { text: On My iPhone }- waitFor: { visible: { text: invoice-1042 } }- tap: { text: invoice-1042 }- assert: { visible: { text: invoice-1042.txt } }

A file’s label is its name without the extension, followed by its kind, date and size (invoice-1042, Text file, 12:00, 30 bytes), so text: invoice-1042 matches it. Your app then sees the whole file name.

On My iPhone starts empty on a simulator. Put the files your flow needs there with addMedia: a photo or a video goes to the photo library, and any other file to On My iPhone. Adding a file that is already there replaces it.

YAML
- addMedia: [fixtures/invoice-1042.txt]

Wait for it to open

A sheet appears a moment after the tap that opens it. Wait for one of its controls with waitFor: { visible: … }, which checks again until the control shows or the timeout passes (8 seconds unless you set timeout). Use notVisible to wait for something to go away.

Pick a label that nothing on your own screen contains. text can match part of an accessibility label your app sets without showing it as text: text: Photo matches an icon button labelled Attach photo, so the wait passes before the sheet opens. See Combine fields for when text matches part of a label.

A tap on the sheet, such as Add or Close, waits for the screen to stop moving before it touches the sheet, because iOS ignores a touch on a sheet or alert that is still sliding in. Expo’s developer menu ignores a Close pressed while it slides up, so a tap on a sheet your app presents also waits, up to a second, for it to finish. It waits again afterwards, so the next step can check your app straight away. Your agent’s tap waits the same way.

A tap on one of these sheets fails with the tap did nothing when, for 2 seconds after it, the sheet shows exactly what it showed before and your app doesn’t react. The tap isn’t sent again: check the sheet with a screenshot, then tap again or close it another way.

Every time Squiggle launches an Expo development build (a flow, squiggle up, your agent’s launch_app, Studio), it turns off the three-finger long press that opens the developer menu: on iOS 26, with that gesture on, a tap in the developer menu could crash your app. Your development build saves the setting, so the gesture stays off when you open the app yourself too. Shaking the device still opens the menu (squiggle device shake, or your agent’s device tool with shake: true), and so do ⌘ D and ⌃ D in the simulator. To turn the gesture back on, tap Go home in the developer menu, open the Settings tab and turn on Three-finger long-press under Menu Gestures. Squiggle turns it off again the next time it launches the app.

Each launch also turns off Show menu at launch. With it on, the developer menu opens over your app the first time the app runs on a new simulator, and the flow’s first step fails with covered. Your development build keeps the setting, so the menu stays closed at launch when you open the app yourself too; turn Show menu at launch back on in the developer menu’s Settings tab.

The system draws these sheets differently from one iOS version to the next. On iOS 26.4 the photo picker’s add button reads Done where iOS 18 reads Add, but both keep the identifier Add, so testID: Add taps it on either. The share sheet has a Close button on iOS 18; on iOS 26.4 it has none and closes on a tap beside it, which accessibility names dismiss popup. A step with when runs only on the version that shows its control.

Closing the share sheet:

YAML
- tap: { testID: share-button }- waitFor: { visible: { text: Copy } }- tap: { text: Close, when: { visible: { text: Close } } }- tap: { text: dismiss popup, when: { visible: { text: dismiss popup } } }

Close an in-app browser

The browser’s controls are listed by their labels: Done, Format Options and the address at the top, Back, Share, Reload and Open in Safari at the bottom. On iOS 26 Done shows as a checkmark. Tap it to close the browser and return to your app:

YAML
- tap: { testID: open-help }- waitFor: { visible: { text: Done } }- tap: { text: Done }- waitFor: { notVisible: { text: Done } }

Answer a permission prompt

Tap the button by its text. Your app is inactive while the prompt is up, so a step that names one of its controls fails until the prompt is answered.

YAML
- tap: { testID: ask-photos }- waitFor: { visible: { text: Allow Full Access } }- tap: { text: Allow Full Access }

iOS asks for each permission once. To see the prompt on every run, reset the permission at the start of the flow. It applies to the flow’s appId:

YAML
- setPermissions: { permissions: { photos: unset } }

iOS closes your app to apply some changes, such as any change to photos or microphone access. When it does, the step opens the app again on its first screen, so put setPermissions before the steps that navigate.

When the prompt is not what you are testing, grant the permission instead, and the app never shows it:

YAML
- setPermissions: { permissions: { location: allow } }

Photos access can only be reset this way. On the simulator iOS still asks after a grant or a refusal set from outside the app, so photos: allow and photos: deny are reported as unsupported: reset it and answer the prompt in the flow, as above.

The “Open in …?” alert

When a link opens your app from the home screen, for example an openLink after stopApp, or the first link into a fresh install, iOS first asks Open in “Your App”?. Squiggle presses Open for you, in flows, in intent programs and in your agent’s describe, find and tap, so nothing waits on it. Your flow needs no step for it. After stopApp, Squiggle doesn’t reconnect to the app a link opens: add a launchApp step after the openLink so the steps that follow reach your app.

Squiggle recognises the alert by its English text. On a simulator set to another language, add a step that taps the alert’s Open button by the text it shows.

Only this alert is answered for you. Permission prompts and other alerts stay yours to answer, as above. In a Niteshift task, Squiggle can’t press anything outside your app, so a link that has to open the app from the home screen is a step for the task’s agent; see Steps outside the app.

Limits

  • These controls have no testID. Select them by their text (text:), which is in the simulator’s language. Run flows in one language, or keep one flow per language.
  • Text is the label iOS gives the control, which can differ from what you see. The photo picker’s cells read Photo, not the file name. To see the labels, open the sheet and ask your agent to describe the screen.
  • A flow can’t continue in another app your app opens, such as Settings or Safari: iOS suspends your app while it is in the background.
  • On a macOS app, only the app’s own windows can be driven.

When a step fails