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

# assertVisually

> Run an AI assertion using a screenshot only.

Same shape as `assert`, but the agent reasons over the screenshot rather than
the DOM (web) or accessibility/XML hierarchy (mobile). Use this when the
property under test is purely visual, such as color, layout, icons, or charts,
or when the underlying structure is unavailable or unreliable.

## Parameters

| Parameter | Type      | Required | Description                                                           |
| --------- | --------- | -------- | --------------------------------------------------------------------- |
| `that`    | `string`  | Yes      | What must be true on the page, purely from the screenshot.            |
| `timeout` | `number`  | No       | Maximum time in milliseconds to wait.                                 |
| `iframe`  | `string`  | No       | URL or URL pattern of the iframe that contains the target element.    |
| `saveAs`  | `string`  | No       | Name of the variable to write this step's return value to.            |
| `retries` | `number`  | No       | Number of times to retry the step on failure before failing the test. |
| `skipped` | `boolean` | No       | Skip this step at execution time.                                     |

## Shorthand

Assertion text as a single string.

```yaml theme={null}
- assertVisually: there is a twitter profile shown on the page
```

## Examples

```yaml theme={null}
- assertVisually:
    that: |
      the module's two substeps (return 1 and return 2) both have green check
      marks to their left, but the top-level "return 3" step that comes after
      the module does NOT have a green check mark
    timeout: 60000
```

```yaml theme={null}
- assertVisually:
    that: |
      none of the step cards on the left-hand side of the editor have
      a green check mark next to them
```

On mobile, `assertVisually` evaluates the assertion from the screenshot only and
skips capturing the accessibility/XML hierarchy. Reach for it when the screen is
rendered in a way the hierarchy cannot describe (for example a WebView with
multiple pages) or the condition is purely visual.

```yaml theme={null}
- assertVisually: the cart shows a red error banner above the checkout button
```

## Related

* [Writing assertions](/core-concepts/writing-assertions)
* [Golden files](/guides/visual-testing/golden-files)
* [Test format](/core-concepts/test-format)
