> For the complete documentation index, see [llms.txt](https://docs.drizz.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drizz.dev/writing-tests/system-commands.md).

# System commands

System commands act on the app and the device rather than on anything on screen. They have fixed syntax and are written in capitals.

|                      |                                                                    |
| -------------------- | ------------------------------------------------------------------ |
| **Platforms**        | Android · iOS — with differences, see below                        |
| **Separator**        | A space. `OPEN_APP:com.shopease.android` is legacy but still works |
| **Package argument** | Required on `OPEN_APP`, `KILL_APP`, `CLEAR_APP`, `MINIMISE_APP`    |
| **Variables**        | `OPEN_APP {{app_package}}` works                                   |
| **Watch out**        | `CLEAR_APP` is effectively a no-op on iOS                          |

## Prerequisites

* A connected device or emulator
* An open test file
* A registered app and its package name — `com.shopease.android` in these examples

## Copy this

```
OPEN_APP com.shopease.android
Wait Until 5 Seconds

Tap on Log in
Type 9000000000 in the mobile number field
Tap on Continue
Wait Until 3 Seconds
Type 123456 in the OTP field
Tap on Verify
Wait Until 5 Seconds

Validate that the home screen is visible

CLEAR_APP com.shopease.android
```

## All nine commands

| Command                                    | What it does                                    | Argument                                  | Required  |
| ------------------------------------------ | ----------------------------------------------- | ----------------------------------------- | --------- |
| `OPEN_APP <package>`                       | Launches the app                                | Package name                              | Yes       |
| `KILL_APP <package>`                       | Force-stops the app and clears it from memory   | Package name                              | Yes       |
| `CLEAR_APP <package>`                      | Wipes app data and resets to first-launch state | Package name                              | Yes       |
| `MINIMISE_APP <package>`                   | Sends the app to the background                 | Package name                              | Yes       |
| `PRESS_DEVICE_BACK_BUTTON`                 | Presses the Android hardware back button        | None                                      | —         |
| `SET_GPS(latitude=<lat>, longitude=<lon>)` | Sets the device location                        | Named args in parentheses, latitude first | Yes, both |
| `ENABLE_WIFI`                              | Turns wifi on                                   | None                                      | —         |
| `DISABLE_WIFI`                             | Turns wifi off                                  | None                                      | —         |
| `TOGGLE_LOCATION`                          | Toggles location services                       | None                                      | —         |

```
OPEN_APP com.shopease.android
KILL_APP com.shopease.android
CLEAR_APP com.shopease.android
MINIMISE_APP com.shopease.android
PRESS_DEVICE_BACK_BUTTON
SET_GPS(latitude=12.9716, longitude=77.5946)
ENABLE_WIFI
DISABLE_WIFI
TOGGLE_LOCATION
```

## Syntax rules

<table data-search="false"><thead><tr><th>Rule</th><th>Detail</th></tr></thead><tbody><tr><td><strong>Space before the package name</strong></td><td><code>OPEN_APP com.shopease.android</code> is the current form</td></tr><tr><td><strong>Legacy separator</strong></td><td><code>OPEN_APP:com.shopease.android</code> (colon, no space) still works and appears in older scripts. It is tolerated, not recommended</td></tr><tr><td><strong>Unsupported form</strong></td><td><code>OPEN_APP:(com.shopease.android)</code> — colon plus parentheses — is not supported</td></tr><tr><td><strong>Package argument required</strong></td><td>On <code>OPEN_APP</code>, <code>KILL_APP</code>, <code>CLEAR_APP</code> and <code>MINIMISE_APP</code>. A bare <code>OPEN_APP</code>, or <code>KILL_APP :</code> with nothing after it, fails by design. The editor offers a package-name dropdown for these commands</td></tr><tr><td><strong>Spelling</strong></td><td><code>MINIMIZE_APP</code> (US spelling) and <code>MINIMISE_APP</code> are both accepted</td></tr><tr><td><strong><code>SET_GPS</code> arguments</strong></td><td>Named, in parentheses, latitude first. Use real coordinates — ETA, pricing, distance and availability all key off them</td></tr><tr><td><strong>One action per line</strong></td><td>System commands are not chained</td></tr></tbody></table>

```
SET_GPS(latitude=12.9716, longitude=77.5946)
```

## Using a variable for the package

For a script that runs against more than one build or environment:

```
SET app_package = "com.shopease.android"
OPEN_APP {{app_package}}
```

{% hint style="danger" %}
**Never pass a whole dataset to `OPEN_APP`.** `OPEN_APP {{my_dataset}}` serializes the entire row and the package name is parsed out of the wrong part of it — the app either fails to launch or launches something unexpected. Bind a single variable, not a dataset.
{% endhint %}

## Platform behavior

{% tabs %}
{% tab title="Android" %}

| Command                                  | Behavior                                               |
| ---------------------------------------- | ------------------------------------------------------ |
| `OPEN_APP` / `KILL_APP` / `MINIMISE_APP` | ✅ Supported                                            |
| `CLEAR_APP`                              | ✅ Real data wipe. The app resets to first-launch state |
| `PRESS_DEVICE_BACK_BUTTON`               | ✅ Presses the hardware back button                     |
| `SET_GPS`                                | ✅ Supported                                            |
| `ENABLE_WIFI` / `DISABLE_WIFI`           | ✅ Supported                                            |
| `TOGGLE_LOCATION`                        | ✅ Supported                                            |
| {% endtab %}                             |                                                        |

{% tab title="iOS" %}

| Command                                  | Behavior                                                                  |
| ---------------------------------------- | ------------------------------------------------------------------------- |
| `OPEN_APP` / `KILL_APP` / `MINIMISE_APP` | ✅ Supported                                                               |
| `CLEAR_APP`                              | ⚠️ Effectively does nothing - iOS doesn't support                         |
| `PRESS_DEVICE_BACK_BUTTON`               | ❌ Doesn't exist on iOS. Use `Tap on the back button` or a left-edge swipe |
| `SET_GPS`                                | ⚠️ Set, but not reliably readable back on every device target             |
| `ENABLE_WIFI` / `DISABLE_WIFI`           | ⚠️ Effectively does nothing - iOS doesn't support                         |
| `TOGGLE_LOCATION`                        | ⚠️ Effectively does nothing - iOS doesn't support                         |
| {% endtab %}                             |                                                                           |
| {% endtabs %}                            |                                                                           |

## Write a teardown

1. Decide the platforms the test runs on.
2. Add the teardown for those platforms as the last steps of the test.
3. Validate the state the teardown leaves behind.

{% tabs %}
{% tab title="Android" %}
`CLEAR_APP` wipes app data, so one line resets the app to first launch.

```
# Android teardown
CLEAR_APP com.shopease.android
```

{% endtab %}

{% tab title="iOS" %}
`CLEAR_APP` is a no-op on iOS: a script that relies on it for clean state passes on Android and reuses state on iOS. Reset inside the app, or install fresh between tests.

```
# Cross-platform teardown
Tap on the profile icon
Scroll down until "Log out" is visible
Tap on Log out
Validate that the login screen is visible
```

{% endtab %}
{% endtabs %}

## Ordering

`OPEN_APP` comes first. Comments, `CLEAR_APP`, `SET_GPS`, `PRESS_DEVICE_BACK_BUTTON`, API steps and waits are allowed before it, for setting location or clearing state before the app launches.

```
CLEAR_APP com.shopease.android
SET_GPS(latitude=12.9716, longitude=77.5946)
OPEN_APP com.shopease.android
Wait Until 5 Seconds
```

## Validate after them

System commands report nothing about the screen that follows. Follow the ones that change state with a validation.

```
KILL_APP com.shopease.android
OPEN_APP com.shopease.android
Wait Until 5 Seconds
Validate that the login screen is visible
```

## Common mistakes

<table data-search="false"><thead><tr><th>What you wrote</th><th>What happens</th></tr></thead><tbody><tr><td><code>OPEN_APP</code> with no package name</td><td>Fails by design. The argument is required</td></tr><tr><td><code>OPEN_APP:(com.shopease.android)</code></td><td>Not a supported form. Use a space</td></tr><tr><td><code>open_app com.shopease.android</code></td><td>System commands are written in capitals</td></tr><tr><td><code>OPEN_APP {{my_dataset}}</code></td><td>The whole row is serialized and the package name is parsed out of the wrong part of it</td></tr><tr><td><code>CLEAR_APP</code> as the clean-state step in an iOS suite</td><td>Passes, does nothing, and the next test starts logged in</td></tr><tr><td><code>PRESS_DEVICE_BACK_BUTTON</code> in a cross-platform script</td><td>Works on Android, doesn't exist on iOS. Use <code>Tap on the back button</code> or a left-edge swipe</td></tr><tr><td><code>TOGGLE_LOCATION</code> as a dependable precondition</td><td>Unreliable. Drive the setting through the app or a module instead</td></tr><tr><td><code>KILL_APP</code> and <code>OPEN_APP</code> on consecutive lines with no wait</td><td>The first tap after launch lands on a splash screen</td></tr><tr><td>Two system commands on one line</td><td>Only one is executed. One per line</td></tr></tbody></table>

## Next

* [Which variable do I use?](/writing-tests/which-variable.md) — binding a package name per environment
* [The shape of a test](/writing-tests/writing-tests.md) — where setup and teardown sit
* [Command index](/writing-tests/command-index.md) — every command in one table

***

*Last updated: 6 August 2026*
