home, back, appSwitcher, tapAppIcon, rotateTo, setAppearance, setTextSize, fold, unfold, hinge

in Japanese(日本語)

OS-level navigation: home screen, back, app switcher, home screen icon, screen rotation, the device's appearance and text size, and folding a foldable device.

Functions

function description
home() Goes to the home screen.
back(settle:) Goes back to the previous screen (Android = back key / iOS = the navigation bar's back button, falling back to a left-edge swipe when there is none).
appSwitcher() Opens the app switcher. On a home-button iPhone (e.g. iPhone SE) the switcher is a hardware double-press that cannot be sent, so the scenario is recorded as skipped (not applicable) from that step on instead of failing.
tapAppIcon(name?) Finds and taps the app icon on the home screen. name is matched exactly against the name shown under the icon on the home screen. When omitted it is the app profile's appName for that OS (ios.appName / android.appName).
rotateTo(.portrait, settle:) / rotateTo(.landscape, settle:) Rotates the app UI to that orientation. Only these two values exist. To run every scenario in landscape without writing this, set orientation in the run profile.
setAppearance(.light) / setAppearance(.dark) Switches the device's appearance and reads it back; the step fails if the value read back differs from the one requested (it succeeds if the device already had it). The device returns to light at the end of the scenario.
setTextSize(.small / .default / .large / .extraLarge / .accessibility) Switches the device's text size and reads it back; the step fails if the value read back differs from the one requested (it succeeds if the device already had it). The device returns to .default at the end of the scenario.
fold(waitSeconds:) Folds a foldable device to the outer screen and waits until the device reports it switched (up to waitSeconds, default = the run's default timeout). Fails if it does not switch.
unfold(waitSeconds:) Unfolds to the inner (large) screen. Same rules as fold.
hinge(90) Sets the hinge angle, 0 (folded) to 180 (unfolded); about 130 is the half-open book posture. Does not check which screen shows.

setTextSize steps

The value the tool sets on the device for each name. What the app shows (how much larger it draws) is up to the app; an app that does not follow the text size looks unchanged.

Name iOS step (the name passed to devicectl) iOS UIContentSizeCategory (what the app receives) Android font_scale
.small small UICTContentSizeCategoryS 0.85
.default large (the iOS standard) UICTContentSizeCategoryL 1.0
.large extra-large UICTContentSizeCategoryXL 1.15
.extraLarge extra-extra-extra-large UICTContentSizeCategoryXXXL 1.3
.accessibility accessibility-large (also turns on "Larger Accessibility Sizes") UICTContentSizeCategoryAccessibilityL 2.0

Example

launchApp()
tap("#settings")
back()                  // return to the previous screen
home()
tapAppIcon()             // find and tap the app icon by the app profile's name
appSwitcher()
rotateTo(.landscape)
rotateTo(.portrait)
setAppearance(.dark)    // dark mode (back to light after the scenario)
setTextSize(.extraLarge)
fold()                  // foldable devices only
unfold()
hinge(130)              // half-open book posture (no argument label: hinge(degrees: 130) does not compile)

Notes