Overview
TestDriver provides AI-powered assertions that can verify complex visual states and conditions on screen without requiring explicit element locators or coordinates.AI Assertions
assert()
Make an AI-powered assertion about the current screen state.assertion(string) - Natural language description of what should be true
Promise<boolean> - true if assertion passes, throws error if fails
Basic Assertions
Pattern: Polling Assertions
For conditions that may take time to become true, use polling:Extracting Information
remember()
Extract and remember information from the screen using AI.description(string) - What information to extract from the screen
Promise<string> - Extracted information
Examples
Use Cases
Dynamic Content:Testing Patterns
Test-Driven Assertions
Structure tests with clear arrange-act-assert pattern:Multi-Step Assertions
Verify state at each step of a workflow:Soft Assertions
Collect multiple assertion failures without stopping:Complete Example
Best Practices
Be specific in assertions
Be specific in assertions
More specific assertions are more reliable:
Assert state changes
Assert state changes
Verify state before and after actions:
Use polling for dynamic content
Use polling for dynamic content
Some assertions may need time to become true:
Extract before comparing
Extract before comparing
Use
remember() to extract values for detailed comparisons:Combine with traditional assertions
Combine with traditional assertions
Mix AI assertions with framework assertions for comprehensive testing:

