assertNoDefectsWithAI
AI-powered visual testing to detect UI defects and anomalies.
Experimental, needs an AI CLI
This command uses an AI model, so it needs an AI CLI configured in Settings → AI. See the AI assistant. The AI can answer differently between runs.
The assertNoDefectsWithAI command looks at the current screen for common visual defects and fails when it finds one. It checks for text cut off mid-word, overlapping text or elements, elements off-screen or clipped, a blank screen where content is expected, broken layout, unreadable contrast, placeholder or debug text (such as lorem ipsum, null or NaN) and broken images or icons.
Normal design choices, such as an ellipsis on a long list item or an intentional empty state with a message, are not counted as defects. System UI such as the status bar or the keyboard is not judged either.
Use it as a general smoke test that a screen renders as expected.
Syntax
- assertNoDefectsWithAI- assertNoDefectsWithAI:
optional: falseParameters
| Parameter | Type | Description |
|---|---|---|
optional | boolean | Optional. When true, a failed check is shown in red but the flow continues. Default true. |
timeout | number | Optional. Maximum time to wait for the AI, in milliseconds. Default 60000. |
When the check fails, the reason lists the defects the AI found.
How Astra Scout runs it
- The step sends one AI request with the screenshot and the list of UI elements. Choose the provider and model in Settings → AI → AI commands in flows.
- Astra Scout never concludes that a screen has no visual defect from the element list alone. If no screenshot is available, the verdict of the run is Unsure.
- If the AI reports a confidence below 0.6, the verdict is also Unsure.
- If the screen shows the test infrastructure (WebDriverAgent, the home screen or a system dialog) instead of your app, the step fails with a low confidence rather than judging the app.
- Put the step before any step that types a password. After a secret is typed, AI steps send no screenshot. See No screenshots after typing a secret.
