> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdriver.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# assert

> Validate conditions during a test using the assert command.

<div className="replay-block">
  <iframe src="https://app.dashcam.io/replay/6866b1f7409e098717b014e0?share=Kohr7lQghGz3kPx7ZW2Bg&embed=true&timestamp=90000&playbackRate=5" width="1000" height="350" />
</div>

```yaml testdriver/assert.yaml highlight={5,6} theme={null}
version: 6.0.0
steps:
  - prompt: assert the testdriver login page shows
    commands:
      - command: assert
        expect: the TestDriver.ai Sandbox login page is displayed
```

## Description

The `assert` command validates that a specific condition is true. It ensures that a task completed successfully by checking the screen for the expected outcome. If the condition isn't met, the test will fail.

## Arguments

| Argument | Type      | Description                                                                                                        |
| -------- | --------- | ------------------------------------------------------------------------------------------------------------------ |
| `expect` | `string`  | The condition to check. This should describe what you expect to see on the screen.                                 |
| `async`  | `boolean` | (Optional) If set to `true`, the test will continue without waiting for the assertion to pass. Default is `false`. |
| `invert` | `boolean` | (Optional) If set to `true`, will fail if the assertion passes.                                                    |

## Example usage

```yaml theme={null}
command: assert
expect: the video is playing
```

### Example with `async`

```yaml theme={null}
command: assert
expect: There is no error message
async: true
```

## Notes

* Use `async: true` to speed up tests by allowing non-blocking assertions. However, the test will still fail if the condition isn't met.
* Ensure the `expect` string clearly describes the condition to avoid ambiguity.
