Gestures for maps and canvases (doubleTap, pinchIn, pinchOut, gesture, hold)
Multi-touch gestures: double tap, pinch to zoom out, pinch to zoom in, and a raw multi-finger gesture builder for anything those three cannot express.
Functions
| function | description |
|---|---|
doubleTap(sel?, settle:, waitSeconds:) / doubleTap(x:y:settle:) |
Double taps. Omitting the selector taps the center of the screen. Writing tap twice does not substitute for it — the round trip exceeds the OS's double-tap detection window. On Android with gesture navigation, an element whose centre lies inside the band at the bottom edge of the screen is double-tapped on its part above the band (see tap). The x:y: form double taps raw coordinates (same system as tap(x:y:): iOS = pt, Android = px; returns nothing; the point is used as given) — prefer a selector whenever one is available. |
pinchOut(sel?, scale: 2.0, durationSeconds: 0.5, maxGestureSeconds:, settle:, waitSeconds:) |
Spreads two fingers apart = zoom in. scale must be greater than 1. durationSeconds is capped at 10 seconds by default — pass maxGestureSeconds: to allow up to 60 for this one call. |
pinchIn(sel?, scale: 0.5, durationSeconds: 0.5, maxGestureSeconds:, settle:, waitSeconds:) |
Pinches two fingers together = zoom out. scale must be greater than 0 and less than 1. Same cap as pinchOut. |
gesture(sel?, maxGestureSeconds:settle:waitSeconds:) { FTFinger(x:y:).move(x:y:durationSeconds:).hold(seconds:) } |
Replays one or more finger paths as a single continuous touch — for a pattern-lock swipe, a long-press that then drags, a two-finger rotate, or anything pinchOut/pinchIn/doubleTap/swipeBy cannot express. |
setPickerValue(sel, value, waitSeconds:) |
Sets one picker wheel — an iOS pickerWheel (date/time picker, UIPickerView) or an Android NumberPicker (shown as pickerWheel) — to a value in one step, so you do not drag a wheel or type into its field. Returns the element it grabbed. See the setPickerValue section below. |
setSliderValue(sel, number, waitSeconds:) |
Sets a slider to a number in one call. The number is what the snapshot shows as the slider's value (a % sign is ignored) |
hold(sel, holdSeconds: 3, maxGestureSeconds:, settle:, waitSeconds:, scroll:, maxSwipes:) { … } |
Runs the block while the finger stays down (for checking a component that only shows while pressed). holdSeconds defaults to 3 seconds. See the hold section below. |
When the centre of the target is outside the screen, doubleTap, a long press (tap(sel, holdSeconds:)) and (on Android) pinchOut / pinchIn fail without sending anything, because a touch outside the screen lands nowhere. Targets larger than the screen are not refused. Scroll the target into view first.
See swipe for swipeBy(sel?, dxRatio:dyRatio:durationSeconds:), the panning
gesture these are usually combined with.
Example
doubleTap("#photo")
pinchOut("#map", scale: 2.5)
pinchIn("#map", scale: 0.4)
swipeBy("#map", dxRatio: -0.3, dyRatio: 0.0) // pan left
gesture: a multi-finger path that never lifts
gesture("#pad_map") {
FTFinger(x: 0.3, y: 0.35).hold(seconds: 0.3)
.move(x: 0.6, y: 0.35, durationSeconds: 0.3)
.move(x: 0.6, y: 0.65, durationSeconds: 0.3)
}
gesture("#pad_map") { // two fingers = a hand-built pinch
FTFinger(x: 0.45, y: 0.5).move(x: 0.2, y: 0.5, durationSeconds: 0.5)
FTFinger(x: 0.55, y: 0.5).move(x: 0.8, y: 0.5, durationSeconds: 0.5)
}
Unlike calling swipePointToPoint (or any other gesture command) repeatedly — each call lifts the
finger — every FTFinger in a gesture block is replayed as one continuous touch sequence:
fingers touch down, move/hold in order, and only lift at the end of their own path. Coordinates
are ratios of the target's frame (0...1 is inside it; a point outside is fine as long as it's
still on screen), so the same gesture works at any resolution. Omitting the selector targets the
whole screen; loops and branches are allowed inside the block. Limits: 1–5 fingers, up to 625
points per finger, total duration capped at 10 seconds by default (maxGestureSeconds: raises it
to 60, same rule as the other gesture commands). To put a finger down late, use FTFinger(x:y:startSeconds:) (startSeconds is the delay in seconds from
the start of the gesture until that finger touches down; default 0 — meant for fingers after the first.
It must be a finite value of 0 or more). An invalid spec (no fingers, an off-screen point,
a non-positive duration, too long a gesture) fails the step without touching the device.
On iOS this command always runs through XCUITest, even in the default inapp-boost mode. Use cases: pattern lock, long-press-then-drag without lifting (e.g. reordering a list), a custom two-finger rotate, gestures needing 3+ fingers, drawing or signing. On an older Xcode without this API it cannot be sent and the step fails (unlike pinch, there is no alternative path).
setPickerValue: set a picker wheel by value
setPickerValue("#hour_wheel", "19") // the wheel the snapshot lists as pickerWheel
setPickerValue(".pickerWheel[2]", "30") // the second wheel (minutes) of a time picker
valueis the text the wheel shows ("09","30 minutes"), or digits only to match the number the row starts with:"19"also matches a row that reads19 o’clock, and"7"matches07. There is no partial match or rounding.- The selector must name one wheel — the wheel inside the picker, not the picker around it. A selector that resolves to anything but a
pickerWheel, or matches several wheels, fails without sending anything. - An Android
NumberPickershows no id on the wheel, even when the layout gives it one (the OS leaves it out of the accessibility data). Name it with.pickerWheelor.pickerWheel[2]. - If the wheel cannot reach the value (no such row, end of the list), the step fails and the message says the value it stopped at.
- iOS goes through the XCUITest bridge even in the default inapp-boost mode. On Android the wheel is stepped one row at a time (the wheel's own scroll action; typing into its field does not change it) until it reads the value or goes all the way round.
setSliderValue: set a slider by value
setSliderValue("#slider_volume", 75)
select("#txt_slider").textIs("volume=75")
- The number is what the snapshot shows as the slider's value (what
valueIsreads). The notation differs by OS and framework:75%(a percentage) on iOS UIKit, SwiftUI and React Native,75.0on iOS Compose Multiplatform, and75in the slider's own range on Android. A%sign is ignored and the numbers are compared. There is no rounding. - When the id is on a container that holds one slider, that slider is moved (Flutter on Android). A container with two or more sliders (the thumbs of a range slider) fails without sending anything.
- If the slider moves in steps that skip the value, or the value is out of range, the step fails and the message says the value it stopped at. On Android, a value outside the range and an element that is not a slider (no slider at the position you pointed to) fail right away without moving anything.
- A slider that accessibility actions (setting the value, or one step at a time) cannot move is set by tapping along its track and reading the value back. This works for sliders whose value jumps to where you tap (Material sliders, custom components that set the value from the touch, and so on). On iOS, sliders that only move when the thumb is dragged are moved through XCUITest. After setting a slider by tapping its track, the value is read again once the screen settles, and the step fails if the value did not hold (when the list scrolls during the tap, the value can change for a moment and then go back).
hold: verifying something that only shows while pressed
tap(sel, holdSeconds:) presses and releases within one step, so a component that only appears
while a finger is down (a tooltip, for example) is already gone by the time anything runs after
it. hold keeps the finger down for the whole block instead:
hold("#btn_tooltip_anchor", holdSeconds: 3) {
select("#txt_tooltip").textIs("This is a tooltip")
}
The finger lifts by itself holdSeconds after it went down; the block runs while it is still down. If the block finishes
before holdSeconds is up, hold waits for the release before returning. If the block
takes longer than holdSeconds, the finger is already up for the rest of it — this is noted but
not treated as a failure. Holds cannot be nested (start a second one only after the first one's
block has finished), and if the target cannot be resolved the block does not run at all. On iOS
in the default inapp-boost mode, the press always runs through the XCUITest bridge (same as
tap's long press).
Maps, image viewers, drawing canvases
For a map, image viewer, or drawing surface, operate it with these four commands: swipeBy to
pan (diagonal included), pinchOut/pinchIn to zoom, doubleTap to zoom in. Three things to
keep in mind:
-
The fingers of a pinch land at the same spot regardless of mode. On iOS the two fingers sit side by side along the region's long side, 0.8 inside its edges; on Android they sit on the region's short side, 90% of it apart, centred. On an older Xcode a different method is used instead, and a note on the step says so.
-
pinchOut()/pinchIn()written without a target pinch a small area at the centre of the screen, not the whole screen. A pinch does not happen when the two fingers land on different things: pinching the whole screen can put one finger on another component and turn the pinch into a pan of the map. fleetest therefore picks a spot where both fingers land on the same element, narrowing the span if it has to, and pinches the whole screen only when no such spot exists. -
On iOS, only double tap can fail to register, depending on the framework and the mode. The default inapp-boost mode (Simulator) runs every gesture on every framework. Android has no such split — every gesture works everywhere:
iOS SwiftUI / UIKit Compose Multiplatform Flutter React Native swipeBy(diagonal included)✅ ✅ ✅ — doubleTap✅ ✅ inapp-boost only ✅ △ pinchOut/pinchIn✅ ✅ ✅ ✅ gesture✅ ✅ ✅ ✅ - "inapp-boost only": works only in the default inapp-boost mode (Simulator). With a
profile set to
iosMode: "xcuitest"(or a physical device whose app is not development-signed, which falls back to XCUITest), a Compose app does not recognize the double tap (XCUITest cannot send a double tap Compose registers). - "△": it arrives, but a screen that detects taps in JavaScript (PanResponder and a clock, for example) can miss it intermittently.
- "—" means not verified.
- For using this from MCP, see MCP server.
- "inapp-boost only": works only in the default inapp-boost mode (Simulator). With a
profile set to
-
Where double tap does not register, check the zoom with
pinchOutinstead. On a screen where double tap means "zoom in" (maps, photos),pinchOutproduces the same zoom for you to verify. Pinch works on every framework, Compose included, in either mode:// instead of doubleTap("#map") pinchOut("#map") select("#zoom_level").textIs("x2")It is not a substitute when double tap does something other than zooming (a "like", for example); check that on the Simulator (inapp-boost mode) or on Android.
-
The zoom scale you ask for is not always the scale you get. Two fingers cannot move outside the region being pinched, so an extreme
scalecaps out at whatever that region's size allows. Verify that zooming happened rather than the exact scale — this holds up better across apps than asserting a precise value.
Notes
setPickerValueturns exactly one wheel. Name the wheel itself (.pickerWheel[n]or its#id), not the picker; several wheels or a non-wheel are refused before anything is sent.setSliderValuemay tap the slider's track. A slider that accessibility actions cannot move is set by tapping along its track (it passes through other values on the way).- A slider whose value does not appear in the snapshot cannot be set. Flutter sliders in iOS xcuitest mode are like this (the step fails without touching anything). The default inapp-boost mode sets them.
- Components whose result depends on the release speed can differ by mode. A row that shows action buttons when swiped partway and deletes itself when swiped far (custom swipe rows in Compose or Flutter) receives the release speed in iOS inapp-boost mode, so a larger ratio runs all the way to delete there, while xcuitest mode (and MCP's checks) may stop at the buttons with the same ratio (on a Compose row this split from
swipeBy(dxRatio: -0.5)). Check in the same mode as the real run, and use a smaller ratio (around-0.3) when you only want the buttons. settle: falseskips this command's post-action wait for the screen to settle (the next step may see a moving screen). See tap for details.