# olef record

Source: https://olef.dev/docs/reference/cli/record

Generated from **Olef 3.0.2**. [All commands](https://olef.dev/docs/reference/commands) · [Capabilities and requirements](https://olef.dev/docs/reference/capabilities)

These entries describe available commands, not a sequence to run. Check prerequisites before changing app, device, or cloud state. Global options are listed in the [command catalog](https://olef.dev/docs/reference/commands#global-options).

## olef record

Turn what was done in a session (an agent's commands, a person's viewer input) into a test folder: `record save <name>` cleans up the journal, writes a Bash script of one olef command per step, replays it once from a fresh start, and saves `tests/olef/<name>/`

```bash
olef record --help
```

Output: **json**.

### olef record start

Start a recording in this session, optionally from a fresh start (`--app P --clear-data --launch`): what follows becomes the test. The viewer's Record button runs this

```bash
olef record start --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--app <PACKAGE>` | The app the test is for (default: the session's app, else the app in front) |
| `--clear-data` | Clear the app's data first, so the recording starts where the test will |
| `--launch <ACTIVITY>` | Launch the app first, optionally at this activity (`.MainActivity`) |
| `--expect-text <TEXT>` | With --launch: wait until this text is on screen |
| `--expect-rid <RESOURCE_ID>` | With --launch: wait until this resource id or test tag is on screen |
| `--json` | Accepted for compatibility; output is always JSON. |

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef record start --app io.github.andriyo.shadowdroid.sample --clear-data --launch .MainActivity --expect-rid status_text
```

### olef record stop

Stop the recording; keeps the screen it ended on (the last step's checks are read against it). `record save` then makes the test

```bash
olef record stop --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef record save

Clean up the recording, compile it into a test folder, replay it once from a fresh start (putting back any step removed by mistake), and write `tests/olef/<NAME>/` (test.sh, screens/, README.md, recording.json, and responses/ + expect/ when the proxy captured the flow). Works on the whole session when no recording was started

```bash
olef record save --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** The test's name (folder name): letters, digits, `-` and `_` |
| `--out <DIR>` / `-o` | The test folder (default: `<tests.dir>/<NAME>`, `tests/olef/<NAME>`) |
| `--from <MARK>` | Start at this `record mark` |
| `--to <MARK>` | End at this `record mark` |
| `--last <N>` | Only the last N commands |
| `--journal <DIR>` | Read this session folder's journal instead of the current session's (a closed session, or one left by a script) |
| `--no-verify` | Skip the replay check: write the folder as compiled |
| `--force` | Replace an existing test folder's generated files (mocks/, data/ and other files are kept) |
| `--json` | Accepted for compatibility; output is always JSON. |

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef record save mission_recovery
olef record save checkout --from cart-ready --no-verify
olef record save login --to logged-in -o tests/olef/login
```

### olef record status

Whether a recording is on, and how much it holds

```bash
olef record status --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef record show

The recording as it would be saved: each step as its script line, what clean-up would remove and why, and the script. Changes nothing

```bash
olef record show --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--from <MARK>` | Start at this `record mark` |
| `--to <MARK>` | End at this `record mark` |
| `--last <N>` | Only the last N commands |
| `--journal <DIR>` | Read this session folder's journal instead of the current session's (a closed session, or one left by a script) |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef record step

Name the commands that follow (a step of the test): `record step "pay with the saved card"` becomes `step pay-with-the-saved-card`

```bash
olef record step --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** What the following commands do |
| `--json` | Accepted for compatibility; output is always JSON. |

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef record step "pay with the saved card"
```

### olef record mark

Name the current point (`logged-in`), for `record save --from/--to`

```bash
olef record mark --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `<name>` | **Required.** |
| `--json` | Accepted for compatibility; output is always JSON. |

### olef record check

Add a check at this point (it must hold now), written into the test as a `ui wait` marked `# checked by you`

```bash
olef record check --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--text <TEXT>` | Match text by case-insensitive substring. Single-target actions prefer a unique full-text match; multiple remaining matches are ambiguous |
| `--rid <RID>` | Match by resource-id substring; actions prefer a unique exact match |
| `--desc <DESC>` | Match by content-description substring; actions prefer a unique exact match |
| `--has-text <TEXT>` | The element shows this text (its own, its description, or inside it) |
| `--checked <BOOL>` | The element is checked (`false`: unchecked) Values: `true`, `false`. |
| `--selected <BOOL>` | The element is selected (`false`: not selected) Values: `true`, `false`. |
| `--enabled <BOOL>` | The element is enabled (`false`: disabled) Values: `true`, `false`. |
| `--gone` | The element is gone |
| `--json` | Accepted for compatibility; output is always JSON. |

Examples from the CLI (replace sample packages, selectors, and paths with your own):

```bash
olef record check --rid status_text --has-text claimed
olef record check --rid mission_telemetry_switch --checked
```

### olef record discard

Forget the recording so far: `record save` starts from here

```bash
olef record discard --help
```

Output: **json**.

| Argument | Description |
| --- | --- |
| `--json` | Accepted for compatibility; output is always JSON. |
