launchApp, restartApp, terminateApp, openURL

in Japanese(日本語)

Starts, restarts, stops the app under test, or delivers a deep link URL to it.

Functions

function description
launchApp(appID?, url:) Terminates the app if running, then launches it fresh, starting at the entry screen. With url:, delivers that URL right after launch (see openURL below for delivery details). Delivery waits for the first screen to render (until a tappable element appears, up to the default wait), because frameworks such as React Native discard a URL that arrives before the screen is up; if none appears, the URL is delivered anyway with the note launch-url-before-interactive-ui — the step does not fail. appID defaults to the default app (see Notes).
openURL(url) Delivers a URL (deep link) to the already-running app without restarting it (warm delivery) — the transition is pushed on top of the current screen. Requires a custom URL scheme; Universal Links / App Links (https://) depend on AASA/assetlinks.json resolution and can fall through to Safari on a Simulator. On iOS in inapp-boost mode, a URL that opens another app waits (up to 2 seconds) for the app to leave the foreground before the next step runs (on a physical device it waits for the app's own URLs too).
restartApp(appID?) Terminates and launches again, resetting in-process state. appID defaults the same way as launchApp().
terminateApp() Terminates the app.

Example

launchApp()                                  // default app for this run
launchApp("com.example.myapp")
launchApp(url: "myapp://product/42")         // fresh process, then deliver the URL
openURL("myapp://cart")                      // deliver to the already-running app
restartApp()
terminateApp()

Notes