Known caveats
Read this page before you write a scenario. Each line summarizes one thing to watch for when you use that command or component; the link goes to the full explanation and how to write it. Pay special attention to the ones that go wrong silently (the step stays green while being wrong): check the value or state afterwards, as each line says.
Commands
App assertion (appIs)
- Bundle ID or package name only — there is no nickname mechanism, so write the bundle ID / package name directly.
- Foreground name in failures differs by OS — Android failures include the actual foreground package; iOS cannot read it, so the message lacks it.
- Unreadable foreground app on Android —
appIskeeps waiting and fails as "could not be read" atwaitSeconds; it is not a mismatch.
ifCanSelect, ios, android
ifCanSelectdecides immediately — it checks once; passwaitSeconds:to poll before deciding "not found".- Use
ifCanSelectfor maybe-present UI — there is no other "may or may not appear" argument; express dialogs and banners that may not show with it. ifCanSelectnever scrolls — even insidewithScroll*it matches only the current screen, so an off-screen element means the block does not run.- Declared interruptions are closed before the answer — a covered element would otherwise read as "not found" and take the wrong branch; declare
irregularHandlerfor such modals. - Two forms of branching — use plain Swift
iffor values already read andifCanSelectfor "is this on screen". ios { }/android { }are for small OS differences — use them inside shared scenarios for behavior that applies to only one OS.
clearInput
- Android: field under a popup window — the focusing tap would pick a suggestion and change another field, so the step fails first; close the popup beforehand.
- Non-input target fails before clearing —
clearInputtaps first, so a button, switch or link would be pressed; it refuses them, but an element wrapping exactly one input is accepted. - Fields whose value does not mirror input — a value that seems to remain may pass via OCR with note
clear-residual-not-drawn; otherwise it fails. - Whitespace cannot be verified — whitespace-only content is invisible to accessibility, so lost spaces go undetected; assert values with
valueIswhere whitespace matters. typeappends — clear first when replacing, or usetype(sel, "text", replace: true)to do both in one command.- Flutter iOS falls back to XCUITest for this command — the in-app bridge cannot clear it, adding roughly one to two seconds; no change in how you write it.
settle: falseskips the settle wait — the next step may see a moving screen, so use it only when the next step does not depend on final positions.
group, procedure, beforeEach, afterEach, beforeAll, afterAll, setUpDevice, tearDownDevice
procedure { }for code to skip after a failure — raw Swift directly inaction { }/expectation { }still runs after an earlier failure; put it inprocedure { }.beforeAll()instance properties are not shared — it runs in the first scenario's process; pass values withwriteRunMemo/readRunMemo, and if it fails the class's remaining scenarios fail unrun.setUpDevice()instance properties are not shared — pass values withwriteRunMemo/readRunMemo(setUpDevice()cannot write it); a failure fails the class's remaining scenarios on that device and is never retried.afterEach()runs even after a failure — use it for cleanup that must always happen, such as terminating the app.tearDownDevice()has its own process — it reads the run memo; runs even ifsetUpDevice()failed; does not run on dropped devices or in an interrupted run; its result is not counted in the test results.@Deleted/@Draftare excluded from bulk runs — they can only be run by exact ID, so a scenario marked this way silently does not run in all/folder/class runs.- Describe steps in the scene title — write the steps in the scene's title string.
exist, notExist, countIs
existreturn value chains into checks — chain text, value or id assertions onto it.exist/notExist/countIsalways take a selector — they resolve more than one element, so there is no implicit last-element form.notExistignores visibility — an element merely covered by a modal but still in the tree counts as present, and the check fails after the wait.- Absence passes behind a dialog (
absence-behind-modal) — a dialog in front can remove elements from the tree, sonotExistpasses (with this note) though the element is behind it; close the dialog first. - Absence read on another app (
absence-checked-on-another-app) — on Android,notExistpasses with this note while another app is in front and says nothing about your app; bring your app back first. countIsinside a scrolling list (count-in-scrolling-list) — the number of rows on the screen depends on its size and orientation, so the count can differ on another device; count what does not depend on the screen.- Truncated text on the visibility check — ellipsis (
text-ellipsized) or more than half drawn (text-partially-hidden) passes with a note, half or less fails; userequireVisible: falseif hiding is intended. existwith several matching elements — passes if the text of any match is visible (the remaining matches are checked when the first is not);[n]and relative selectors check only that one.- A failing
screen rendering checkis not a scenario mistake — the iOS Simulator stopped drawing text; run again without rewriting, and restart the Simulator if it repeats.
Find by image (findImage, findImages, existImage)
- Distance is recorded — read the recorded distance and number of candidates to choose
threshold. - Same-shape parts differing only in text — a different row can be grabbed under the default
threshold(0.15); check distances and tighten it, for example 0.03. - Capture samples per OS version and scale — the same row looks different across versions; put a sample for each version or state in the label folder.
- In a variant run, add templates taken for that variant to the same folder — when
existImageorimageIsfails and the variant has no image of its own, the failure message says one can be added withft_capture_elementandvariant; if one exists and still does not match, do not add another and check the screen for breakage.findImage/findImagesdo not say it: read the template file name in the record's note (nearest template …). waitSecondsdefaults to 0 — it looks once; passwaitSeconds: 3or similar right after a screen transition.- Failure message and attached screenshot — a failed
existImagereports the nearest distance andthresholdand attaches the judged screenshot. - Inside
withScrollDown { }it scrolls — passscroll: .noScrollto look at the current screen only. - Pass
scroll:to search while scrolling — as withexistandselect; function-name aliases such asfindImageWithScrollDowndo not exist. - No sample image is a configuration error — the step fails when the label folder has no sample at all.
- Vision anomalies are retried — odd feature prints on a busy Mac make the tool wait and search again (
vision-anomaly-retried); if it persists, rerun or restart the Mac. - Single-colour screenshot is retaken — an all-black or all-white app area is treated as not captured (
blank-screenshot-retaken) and fails if it stays so. - iOS inapp-boost captures like the text visibility check — on iOS in the default mode, a covered element is compared as the picture of whatever covers it.
- Chain assertions on a found element — this works when the element has a writable selector such as an id or unique label.
- Tap right after finding — moving the screen afterwards makes
tap()hit the old coordinates. - Candidates are accessibility element frames — parts that do not appear in accessibility cannot be found.
flick
flickis content-agnostic — it sends one fast stroke with shorter default durations thanswipe, and does not search for an element.- Target region via
scrollFrame:— pass the region as ascrollFrame:selector, the same asscroll. flickhas no notion of the edge — chained flicks do not tell you whether you arrived; verify the destination yourself afterwards.
Gestures for maps and canvases (doubleTap, pinchIn, pinchOut, gesture, hold)
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).setSliderValuecannot set a slider whose value is not in the snapshot — Flutter sliders in iOS xcuitest mode are like this. The default inapp-boost mode sets them.- Components whose result depends on the release speed can differ by mode — a partway swipe row may run to delete in inapp-boost but stop at the buttons in xcuitest (MCP's checks); check in the real run's mode and use a smaller ratio for the buttons.
settle: falseskips the settle wait — the next step may see a moving screen; use it only when the next step does not depend on final positions.
Image assertion (imageIs)
- No matching samples fails immediately — without samples whose label contains
label, the check fails at once. - Failure shows label and confidence — the message states what the image was classified as and how confident it was.
- In a variant run, an
imageIsfailure says whether the variant has its own image — add one withft_capture_elementandvariantonly when it has none.
installApp, removeApp, clearAppData
- Call
launchApp()afterinstallApp()on iOS inapp-boost — the install ends the in-app bridge, sotapand similar do not reach the app until the nextlaunchApp(). - Reinstalling keeps permissions — on an iOS Simulator, permission dialogs do not reappear after reinstall; use
clearAppData()for first-run state. clearAppData()resets permissions — permission dialogs appear again, which is the command to use for onboarding and first-run permission flows.- Physical iPhone:
clearAppData()reinstalls — it takes install time (reinstalled-to-clear-data) and needsappPathPhysicalplus--profile; without a valid source it fails without uninstalling. - Keychain / Keystore survive
clearAppData()— a first-run flag stored there is not reset, so first-run cannot be reproduced this way. - fleetest's own bridge cannot be the target — passing the bridge's ID to
removeApp/clearAppDatafails without sending anything. - Removing the app under test breaks the run — call
removeApp()on your own target only when you mean to end the scenario there. - Android install verification is turned off during install — Play Protect's check is disabled temporarily and restored, so the app is never sent to Google; set
playProtectBypassto false to stop this.
iosAlertHandler
- The same title can be registered several times with different buttons — the one matching a button on the alert shown is pressed.
- Empty or all-wildcard alternative fails at declaration — an empty alternative or one of only
*and invisible characters would match any alert, so declare concrete text.
irregularHandler
- Fires during operation and assertion waits — assertions poll the current tree, so a modal opening during
exist/textIsis closed too. - Up to 10 closes per step — change with
maxDismissals:; if the same thing remains after two closes, the tool gives up and records it was not fully closed. - Conditions close interruptions first —
ifCanSelectandrepeatWhileCanSelectclose declared interruptions before judging so a covered target does not read as "not found". - OS system dialogs are not touched — permission prompts and "Open in …?" belong to
iosAlertHandler, not this. - iOS separate-window modals — a fully covered screen drops out of the tree (so it never reads as a false pass), a partial cover leaves the rest, and taps reach the frontmost window.
Keyboard assertion (keyboardIsShown, keyboardIsNotShown)
- Unknown keyboard state is never "hidden" —
keyboardIsNotShowncan fail with "cannot determine the keyboard state" in iOS xcuitest mode; use inapp-boost or Android when you must confirm hiding.
launchApp, restartApp, terminateApp, openURL
launchAppalways terminates first — it never just foregrounds the app, so every call starts at the entry screen.launchAppkeeps app data — saved content and login state remain; useclearAppData()to erase.- iOS inapp-boost: other apps fail mid-scenario — the in-app bridge cannot drive another app; put steps on other apps (such as Settings) in a separate scenario under a profile naming that app.
- fleetest's own bridge cannot be the target — passing the bridge's ID to
launchApp/restartAppfails without sending anything. - Default app resolution — an omitted
appIDresolves from the run profile, app profile, then platform app;@TestClasshas noapp:, so running the same scenario under another profile changes the app; with several apps, pass the bundle ID or use a per-app profile. openURLdoes not restart the process — use it for deep links to an open app, andlaunchApp(url:)to restart then deliver.- First
openURLon a Simulator — a one-time "Open in …?" alert is dismissed automatically; if the session could not be re-pointed at the app, the step passes withopen-url-session-not-restored. openURLwhile the app is not running — the OS launches it, but that is not the command's purpose; uselaunchApp(url:).
home, back, appSwitcher, tapAppIcon, rotateTo, setAppearance, setTextSize, fold, unfold, hinge
- Bring the app back after leaving it — on iOS inapp-boost and Android, after
home(),appSwitcher(),tapAppIcon(),openURL()and similar, steps fail (app-in-background) untillaunchApp()ortapAppIcon(). back(settle:)depends on the screen — custom navigation may need an edge swipe, and Android's firstbackcloses an open keyboard; tap the app's own back button where it cannot go back.- Unchanged screen after
back()only adds a note — the step does not fail when the app ignores system back; tap its own back button or callback()again. back-stayed-on-screenand similar notes — aback()that stayed on the same screen (iOS) or left the app for the launcher (Androidback-left-app) stays green with a note; check where you landed.tapAppIconsearch order — current screen, then the drawer or home pages, and the App Library on iOS; it fails with "App icon not found" if never found.- iOS: a system alert hides the icons —
tapAppIconfails naming the alert; answer it in the scenario or registeriosAlertHandler. - Two-display Simulator tree mismatch —
tapAppIconnever taps when the home-screen tree does not match the shown display, and fails with a message saying so. - iOS
back()after the app was stopped — afterterminateApp(),removeApp()orclearAppData()it fails unsent, and in inapp-boosttapAppIcon()launches instead of tapping; start the app withlaunchApp()first. rotateTofollows the app's UI orientation — only.portraitand.landscapeexist, with identical frames across OS and frameworks.rotateTowaits for the change — it returns only once the orientation has actually changed.- Orientation reverts automatically — a scenario that rotates is restored at the end, with Android's auto-rotate setting too.
- The app must allow the orientation — otherwise it will not rotate; on Android a forbidden orientation fails right away naming the app's declaration.
- Android auto-rotate is disabled while rotating — otherwise the angle would not hold.
settle: falseskips the settle wait — the next step may see a moving screen; use it only when the next step does not depend on final positions.setAppearance/setTextSizechange the whole device and are undone after each scenario — the device returns to light /.defaultat the end of every scenario; use the run profile'sappearance/textSizeto apply it to every scenario.setAppearance/setTextSizecannot be used in run or device hooks — inbeforeRun/afterRun/setUpDevice/tearDownDevice/beforeAll/afterAllthe step fails, because the baseline is restored after each scenario and it would only affect the first test.- On Android
setAppearance/setTextSizemay recreate the screen — unless the app declaresuiMode/fontScaleinconfigChanges, the activity is destroyed and created again and in-memory state is lost. A stateless app then returns to its first screen: change the display condition at the start of the scenario, or relaunch the app and reopen the target screen. - A state set by
unfold()insetUpDevice()does not carry over to the second and later tests — it is restored after the first test; putunfold()inbeforeEach(). beforeEach/afterEachcan usesetAppearance/setTextSize— they run for every test, so the change applies to every test of the class.setAppearance/setTextSizecheck the device setting, not the app's look — an app whose colours do not follow the appearance becomes unreadable in dark mode and the text visibility check fails the step (a correct failure).- A check through MCP (
ft_run_scenario) does not verify that the app received the appearance — the device can be dark while the app stays light (a Simulator that does not deliver the setting). A real run (inapp-boost) detects it withdisplay-not-appliedand recovers. - On iOS in
inapp-boostmodesetAppearance/setTextSizealso check that the app received the setting — a Simulator that does not deliver the change fails the step withdisplay-not-applied, is recovered before the next scenario, andfleetest runruns that scenario once more;xcuitestmode and Android check only the device's setting. - Text size names map to each OS's own steps — iOS uses its text size steps (
.accessibilityalso turns on Larger Accessibility Sizes and puts it back at the end of the scenario); Android usesfont_scale0.85 to 2.0, and the on-screen ratio is not exactly the scale since Android 14. fold/unfold/hingeneed a foldable device — only the iPhone Duo Simulator and foldable Android Emulators work; a physical iPhone is skipped, and a physical foldable Android fails.- Non-foldable devices are skipped, not failed — the scenario is recorded as not applicable from that step on, so do not read it as a pass.
- Fold state is restored automatically — like
rotateTo, it reverts at the end of the scenario. - A not-applicable scenario is handed to a device that has not tried it — a scenario that is not applicable on one device (e.g.
fold()on a non-foldable one) is moved to another device of the same run; it is recorded as skipped only when every device tried it, and as failed (not run) when the devices that had not tried it dropped out. - Not applicable inside
beforeAll()is a failure —beforeAll()runs once per run and is not run again on another device. Put device-dependent preparation such asfold()insetUpDevice(). - Foldable Android lock screen —
fold()dismisses the swipe-up lock screen; a PIN or pattern lock cannot be dismissed. fold()/unfold()in the state they already are in do not fail — the state is read first, the event is still sent, and the step passes once the device is in that state.hingedoes not verify which screen shows — the switch angle depends on the previous state; usefold()/unfold()when you need a specific screen.- iOS fold uses an undocumented hinge event — a future Xcode may stop accepting it, and
fold/unfoldwould then fail loudly, never pass silently. - The iPhone Duo Simulator may keep crashing once unfolded — while SpringBoard and the keyboard restart after
unfold(), the app goes to the background and the keyboard disappears. The report lists how many times and when; check an action's result with a verification.
pressEnter, hideKeyboard
pressEnternewline vs. commit depends on the field — the field decides, not the command; seetypefor the same question about a trailing\n.- iOS
hideKeyboard()differs by framework — a background tap or the following Enter closes it, and that Enter fires the field's return-key action (search, submit); it fails if neither closes it; React Native inapp-boost sends no Enter. - A target under the keyboard —
tap/type/clearInputscroll first, then close the keyboard without side effects; if that fails,tappresses the visible part andtype/clearInputfail untouched. MCPft_tap/ft_typedo not close it, so callft_hide_keyboardfirst. - Keyboard state is a separate assertion — verify whether it is showing with the keyboard assertions.
settle: falseskips the settle wait — the next step may see a moving screen; use it only when the next step does not depend on final positions.
repeatWhileCanSelect, doUntilTrue
maxLoopCount:is only a cap — it stops a runaway loop and is not an assertion that the loop ran a specific number of times.- To wait for appear/disappear, do not loop — use
waitForDisplay/waitForCloseorwaitSeconds:instead ofdoUntilTrue; they already poll and record one step. - Each attempt is a group — attempts are recorded as
"<description> #n", and a failing command inside the block stops the scenario. doUntilTruestops only on its own limits —waitSeconds:andmaxLoopCount:apply; the 120-second single-command cap does not.- A
throwin the condition fails immediately — reserve throwing for a condition that can never become true, not for transient read errors.
Screen assertion (screenLooksLike)
- Experimental — Japanese descriptions work but their accuracy has not been measured.
- Requires macOS 27+ — on macOS 26 the check is skipped automatically; check availability with
fleetest doctor. - Not a strict gate — results depend on wording and how the screenshot is taken; use it for rough checks and write tree-based checks where failure is not acceptable.
- Does not count as an assertion — an
expectationwith onlyscreenLooksLikeis warned about as having no assertions, though a failure still aborts the scenario. - Describe the screen in the call — you always write what the screen should look like in the call itself.
screenshot
- Place it where you want the picture — the screenshot is embedded right after the step that took it.
- Android WebView may be missing — the capture can drop the WebView layer; it is filled in only when WebView debugging is on, so never assert a screen loaded from a screenshot; use
exist/notExist.
scroll (scrollTo, scrollDown, withScrollDown, scrollFrame, ...)
- A scroll in iOS inapp-boost mode has no inertia — one swipe moves about the container's visible height, so a scrollTo that reached its element while writing (xcuitest, MCP) can use up maxSwipes in the real run; give far elements a larger maxSwipes and close the keyboard first.
select, lastElement
selectnever fails by itself — a missing element becomes an empty element; only chained commands such as.textIs(...)can fail the step.- Android: refused while the app is not in front — it waits and fails instead of returning an empty element; bring the app back with
launchApp()ortapAppIcon()first. lastElementresets — it is empty at eachscenestart and after a failed grab, and empty with a warning if nothing was grabbed yet.selectwaits the default timeout — withoutwaitSeconds:it looks up todefaultTimeout(5 s) before returning an empty element; usewaitSeconds: 0to look once.
State assertion (enabledIsTrue, enabledIsFalse, checkIsON, checkIsOFF)
- Checked state comes from accessibility — iOS implementations report it differently and fleetest reads all of them (selected trait, switch value, React Native checkbox).
- Some elements never report a checked state —
checkIsONfails with "reports no check state"; verify a reflecting text withtextIsor have the app expose it.checkIsOFFpasses on such an element (warning at the end of the run). - Implementations that report only "on" —
checkIsOFFon an element never seen on passes without knowing the state, with only a warning at the end of the run. - Indeterminate state fails both — a partially checked element fails
checkIsONandcheckIsOFF. enabledIsTrue/enabledIsFalsejudge the state at select time — an element drawing no text (a loading skeleton row) returns an empty element, yet the state at select time is used.
suppressHandler, useHandler, disableHandler, enableHandler
- Prefer the block form
suppressHandler { }— automatic closing is restored even when a step inside fails. disableHandler()/enableHandler()span sections — they are the only pair that spanscondition/action/expectation.useHandler { }is nested only — it restores closing for the nested block, then the outer suppression resumes.- Suppressing does not stop the interruption showing — only closing is stopped, so a tap sent while a modal is up can still be swallowed.
- Failure note while suppressed — a failing step gets "a declared interruption was on screen but automatic closing is suppressed here"; nothing is added on success.
- Forgetting
enableHandler()leaves suppression on — it stays on for the rest of the scenario, includingafterEach()cleanup; use the block form. - OS system dialogs are unaffected — permission prompts belong to
iosAlertHandler, and an alert the scenario resolves directly is never taken either way.
swipe, swipePointToPoint, swipeElementToElement, swipeBy
swipedirection is the finger's movement — it is the only command not content-based; everyscroll*command uses content direction, so.downmoves the finger up.swipedoes not check that anything moved — the step stays green when there is nothing to move; verify afterwards withexistor similar.- Building blocks for maps and canvases —
swipeByandswipeElementToElementserve maps, image viewers and drawing canvases; see gestures. settle: falseskips the settle wait — the next step may see a moving screen; use it only when the next step does not depend on final positions.
tap, tapAppIcon
- Covered-element handling applies only where draw order is known — the next three notes apply to UIKit/React Native on iOS inapp-boost and Views/React Native on Android.
- Several matches, first one covered — an uncovered match is tapped with a note; if every match is covered, nothing is tapped and the step fails.
- Centre under a tab bar or footer — the list scrolls once, then the visible part is pressed with a note; a part thinner than 8pt/8dp fails without tapping.
- Target under a bar outside the list — without
scroll:nothing is tapped and the step fails suggesting a direction; addscroll:to scroll it out from under. - Target hidden behind a window or modal — on iOS inapp-boost the failure names the window or modal that left the target out of the tree; close it first.
- Unknown draw order: centre is pressed — SwiftUI, Compose, Flutter, xcuitest and MCP presses the centre even if covered, so make sure nothing covers the target at that step; a later failing check names the overlapper.
- App crashed, another app in front — the step fails without touching that tree, so an element with the same
#idin another app is never operated. tapwaits for the target to be enabled — up towaitSeconds:(5 s), then it taps anyway; skipped when the selector pinsenabled=falseorwaitSeconds: 0.- Appearance wait is short — only about 0.7 s without
waitSeconds:, so passwaitSeconds: 5orwaitForDisplayfor elements that appear late;typebehaves the same. tapthentypeworks — on Android a container may not take focus, andtyperecovers by locating the single input inside; seetype.- Android bottom gesture band — an element whose centre is in the gesture band is touched above it (note), so the OS cannot send the app to the background; an element wholly in the band is touched at its centre.
- iOS in-app "real touch would land elsewhere" note — the step stays green with
inapp-tap-outside-hit-area, but the same tap can fail on the XCUITest bridge; check that the element is truly reachable. - Coordinate taps are a last resort — prefer a selector in scenarios you keep, because coordinates hit whatever is there after the layout moves.
- A SwiftUI link may look like an element in MCP but not in scenarios — write
tap(element, linkText:). - Pass only the link's own text to linkText: — with surrounding words the tap lands on the centre of the whole string and may miss the link on some devices.
- An element reported as a small box at the top-left corner is not touched — a touch there lands on the status bar; point at a neighbouring element.
settle: falseskips the settle wait — the next step may see a moving screen; use it only when speed matters and the next step does not depend on final positions.
Text assertion (textIs, textContains, ...)
- Four rules for comparing text — compared as it looks on screen, half-width/full-width spaces and line breaks differ, empty expected values cannot be used with contains-style checks, and regexes are used as written.
- Empty regular expression fails before comparing — empty, spaces-only or invisible-only patterns would match any text, so
textMatchesand its siblings reject them. - Empty expected value fails before comparing — for contains/starts/ends-with checks an empty or invisible-only string would hold for any text; invisible characters are removed from both sides.
- Comparison is "same if it looks the same" — invisible characters are ignored, half-width and full-width spaces differ, NBSP equals a space;
strict: truedisables the normalization. - The element is assumed to exist — these commands wait up to
waitSecondsfor the value to change, so they can wait for a value update. - Negative and empty forms ignore visibility —
textIsNot,textIsEmptyand similar cannot confirm "not visible" from a screen match. - No
scroll:on text assertions — they verify a static screen, so scroll the target into view first withselect(selector, scroll: .down). - Chained checks use the grabbed value first — if it already satisfies the assertion the step records
(from the grabbed value)with no device round trip; otherwise it polls up towaitSeconds.
type
type("")fails before typing — it would do nothing; to empty a field useclearInput()ortype("", replace: true). A dry-run does not fail it but notes it, since values read from the screen and the run memo are empty there.- Android: field under a popup window — the focusing tap would select the suggestion, so the step fails before typing; close the popup first.
- Non-input target fails before typing —
typetaps first, so a button would be pressed; an element wrapping exactly one input types into it with a warning. - Typing into a filled field appends — the step stays green with only a note; use
replace: trueorclearInput(sel)first when replacing. - Line breaks (
\n) follow the OS — newline versus commit depends on the field; to commit usepressEnter(), and on iOS xcuitest a middle newline is not read back, so split the text. - The next action waits for the soft keyboard — up to 1.5 s before resolving its target, with
keyboard-not-shown-after-typeif it never appears; skipped when the text ends with a newline. tap(field)thentype("text")is supported — on Androidtyperecovers focus into the single inner field (type-focus-recovered); if ambiguous, writetype(sel, "text")instead.- Android: selector-less
typechecks where text went — with no focus reported the step passes withtype-focus-not-reported, so check the screen or use the selector form. - Android: selector-less input with another app in front — the text may go to that app (
ref-less-input-on-other-app); pass the field's selector. - Typed value is read back and repaired — missing or doubled characters are fixed, a mid-string drop clears and retypes once (
type-retyped), and a field transforming input is accepted (type-retype-abandoned), so check withvalueIs. - Android: field may not keep the whole text — a limited field shows "did not keep the last N character(s)" yet the result stays green; check with
textIs/valueIs. - Value does not move at all — OCR (macOS 27+) accepts text drawn in the field (
type-readback-unchanged); otherwise the input is re-sent once and then the step fails. On macOS 26 the screen cannot be read, so the step fails without re-sending. - iOS xcuitest: only the first 512 units of a field's value can be read — longer text is accepted when the readable part matches and the rest is not checked; check the whole text with
textIson the app's display. settle: falseskips the settle wait — the next step may see a moving screen; use it only when the next step does not depend on final positions.
Value assertion (valueIs, valueContains, ...)
- Use
value*for text fields — an empty field isvalueIsEmptyeverywhere, whiletextreturns the placeholder in Compose iOS, Flutter iOS and React Native, so do not asserttextIsEmptyon fields. - Negative and empty forms ignore visibility — none of these commands take
scroll:, the same rules as text assertions. - Chained checks use the grabbed value first — the device is polled only if that value does not yet satisfy the assertion.
Anything assertion (verify)
- A block with zero assertions is
inconclusive— it is neither passed nor failed and does not abort the scenario, so make sure the block really asserts something. - A failing command still aborts — if a command inside the block fails, the scenario aborts as usual.
wait, waitForDisplay, waitForClose, waitForSettle
- Appearance is already implicit — operations retry and assertions poll, so
wait()beforeexist()is redundant; raisewaitSeconds:instead. wait()is a last resort — use it only for settling with no selector to poll; usewaitForSettlerather than a fixedwait().waitForDisplayjudges visibility likeexist— it has norequireVisible: false; useexist(sel, requireVisible: false, waitSeconds: 15)to skip the visibility check.waitForDisplay/waitForClosenever scroll — scroll first or usescrollToif the element may be off-screen.
Selectors
Selector expressions
- The ancestor of a scope (>>) must have its contents under it in the tree — on iOS, a Compose Multiplatform Row/Column with only a
testTagmatches nothing as an ancestor (only on iOS). Write a unique#id, a label, or a relative selector instead.
Typed selector (Sel)
- Misspelled member is a compile error — unlike the string form,
.butonfails at compile time instead of silently becoming a literal label. scrollFrame:stays string-only — there is noSeloverload for that argument, even on commands with a fullSeloverload.- Do not narrow an element with an #id by type — on iOS the type can differ between the XCUITest bridge (MCP) and inapp-boost mode (
TabView(.page)iscollectionViewvsother), so a type filter passes through MCP and matches nothing in the real run; if the id matches several elements, pick with[n]or an ancestor. - Generated code uses the string form —
Selis for people who prefer to write selectors by hand.
Test data and running a class in one place
- A test does not rely on data another test created — prepare the data it changes in
beforeEach()orcondition, with an account of its own and unique names. - Write
run-setup.shandbeforeAll()so they are safe to repeat and to run at the same time — "create if missing" is fine; "delete everything and reload" erases others' data on a shared server. - Do not make cleanup a precondition of a pass — delete only what you created, and let leftovers not affect the result.
beforeRun()/afterRun()do not run in a debug run, a run without a profile or a dry-run — and a classvardoes not carry a value between them (separate processes); use the run memo.beforeRun()cannot use the device or compose.yaml servers — it runs once per run on the machine where you started fleetest; allowed domains and dataset overrides are that machine's; per-machine preparation goes inrun-setup.sh/beforeAll().afterRun()also runs after failed tests — skipped only in an interrupted run or after an abnormal end; not counted in the results;--fleetwith@RunHooksis refused.- A
beforeRun()that resets a shared server can break another run using it at the same time — MCP runs it on everyft_run_scenariocall; write it to be safe while other runs are in progress. @RunOnSingleMachinestops the load from being split between machines — use it only to gatherbeforeAll()or data on one machine, and also for a class that passes a value frombeforeAll()through the run memo.@RunOnSingleDeviceremoves the class's parallelism and defines no order — it prevents only simultaneous runs inside that class.- Calling a lock inside a lock is an error — nesting is an error whether the key is the same or not; pass all the keys you need in one call (calling a helper that takes a lock from inside a lock is nesting too).
- Consider
@RunInOrderinstead of a lock when the tests need not run at the same time — a@RunInOrderclass runs its tests one after another on one device, so no lock is needed. @RunInOrderhinders parallelism and skips the rest after a failure — first try one@Test;@Orderis required on every test; the app screen state carries over between tests unless a later test callslaunchApp()/clearAppData().
Run profile
- Every scenario starts in light and the default text size — the device is read and set before and after each scenario, also when the profile says nothing, and stays that way after the run; write
appearance/textSizeto keep dark or large text, and note that the MCPft_run_scenariodoes the same. - A value you wrote that cannot be set fails the scenario — an unwritten one that cannot be reset only warns; verified on an iOS 26.6.2 physical device and an iOS 27.2 Simulator.
- Hooks and the run memo are shared across variants —
beforeAll/afterAllrun once per class per run and the run memo is one for the whole run; putcurrentVariantin the key to keep values apart per variant. - Classes with placement attributes stay on one device across all variants and run variant by variant — a failure in the middle of
@RunInOrderstops only the rest of the same variant. - iOS "this app only" text size is invisible — a size set from Control Center for one app is not read by the tool;
displaySettingsin each result shows what was expected, read and changed.
UI component quirks (current limitations)
Always pass scrollFrame for horizontal containers
- A horizontal container without an id cannot be named, and a horizontal search does not reach further items — if it does not appear in the tree as a container,
scrollFrame:cannot point at it. Give the container an#idin the app.
While a modal is open, the screen behind it drops out of the tree
- React Native collapses under
accessibleancestors — on iOS only, inner elements ofTooltipandBottomSheetModalgo missing; the app must passaccessible={false}, so a scenario cannot fix it. - Flutter iOS overlay shrinks a11y rects — after an overlay, taps land in the wrong spot in xcuitest mode only; move to another screen and back before the next action.
Bottom sheet
- RN persistent sheet on iOS does not expand by search — swipe up from the sheet's title to open it fully before searching.
Selection field (read-only dropdown)
- Suggestion rows have no id — in Android View's
MaterialAutoCompleteTextViewand Flutter'sDropdownMenu, target suggestions by label.
Pull to refresh
- Long pull needed on SwiftUI and RN iOS — about 470pt is needed; a roughly 260pt swipe does not start the refresh, so use a raw
gesturedragging the full screen ratio. - xcuitest:
scrollToTop()can run an extra refresh — in lists whose rows lack#idor short lists not flush with the frame, the edge-confirming swipe becomes a pull. - Flutter iOS
scrollToTop()can also refresh — this is under investigation, so do not rely on a refresh count after it. - Do not read the refresh count after
scrollToTop()— verify the count before it in scenarios that check the refresh count. - Android is unaffected —
scrollToTop()/scrollToBottom()use accessibility scroll actions and never overscroll into a pull.
Animation (fade, switch)
- Flutter
AnimatedOpacitykeeps hidden elements in the tree — do not use "the element is absent" as a visibility check; judge by the app's state echo orcheckIsON/checkIsOFF.
Navigation
- Android View: toolbar back may not go back one level — with stacked detail screens the tap sometimes does nothing; use the OS
back()in multi-level stack scenarios.
Collapsing header
- RN collapsible tabs on iOS: first rows hide behind the header — fleetest cannot scroll them out from under it; tap a row that is visible below the header.
Types of input fields
- Android: non-focused popup content can be missing — autocomplete suggestion lists and tooltips may not appear in the tree; check the confirmed value through the app's echo.
- Android Flutter autocomplete suggestions are at the wrong position —
tapon a suggestion hits the field and stays green without selecting it; always verify the selected value afterwards. - Android refuses
ACTION_SET_TEXTon some fields — there is no workaround, but ordinarytypekeystrokes still work. - RN iOS suggestion below the field may not be tappable — in inapp-boost the keyboard stays up after
pressEnter()and hides the suggestion (under investigation); lay out the screen to avoid it or check the value via the app's echo.
FAB (floating action button)
- Android View
BottomAppBarfolds items into "More options" — folded rows cannot carry an id;tap("More options")to open the overflow first.
Infinite scroll
- RN
FlatListcan load pages without scrolling —onEndReachedmay fire when initial data fits one screen; there is no scenario-side workaround, so keep it in mind when asserting an exact initial row count.
Bars that hide on scroll
- Flutter
AnimatedSlidebar stays at its original place — the search does not scroll and the tap may land where the button no longer is. - Compose Multiplatform hidden bottom bar on iOS does not come back with scroll: .up — scroll back to the top of the list so the bar shows, then tap.