Skip to main content
This guide provides practical, real-world examples of YAML tests for common scenarios.

Important Note About Test Execution

All tests automatically open the app when they start. You do NOT need to include manual open_app steps at the beginning of your tests. The examples below demonstrate the correct pattern: starting with instructions, validations, or extractions.

Basic Examples

Simple Validation (iOS)

Test that verifies an app launches correctly:
test:
  metadata:
    name: "App Launch Test"
    platform: ios

  build:
    name: "Finance App"

  blocks:
    - type: validation
      step_description: "The home screen is visible"

    - type: validation
      step_description: "The account balance is displayed"

Android App Validation

test:
  metadata:
    name: "Android App Launch"
    platform: android

  build:
    name: "Notes App"

  blocks:
    - type: validation
      step_description: "The notes list is visible"

    - type: validation
      step_description: "The add note button is displayed"

Login Flows

Simple Login (iOS)

Basic login test with hardcoded credentials:
test:
  metadata:
    name: "User Login"
    platform: ios

  build:
    name: "SaaS App"

  blocks:
    - type: instructions
      step_description: "Enter '[email protected]' in the email field"

    - type: instructions
      step_description: "Enter 'password123' in the password field"

    - type: instructions
      step_description: "Tap the login button"

    - type: validation
      step_description: "The dashboard screen is visible"

Login with High Level Instruction

Using a single instruction for the entire login flow:
test:
  metadata:
    name: "Login with Variables"
    platform: android

  build:
    name: "SaaS App"

  blocks:
    # The agent will automatically complete all required steps
    - type: instructions
      step_description: "Login with the username 'test-user' and the password 'jdmm4K0UyHt4gwMz'"

    - type: validation
      step_description: "Successfully logged in"

Mobile Login with Biometrics Check

Login flow with conditional:
test:
  metadata:
    name: "Mobile Login with Biometrics"
    platform: ios

  build:
    name: "Banking App"

  blocks:
    - type: if
      condition: "Biometric authentication prompt is shown"
      then:
        - type: instructions
          step_description: "Dismiss the biometric prompt"

    - type: instructions
      step_description: "Enter '[email protected]' in the email field"

    - type: instructions
      step_description: "Enter 'securepass' in the password field"

    - type: instructions
      step_description: "Tap login"

    - type: validation
      step_description: "The home screen is visible"

Data Extraction and Validation

Extract and Verify Price

Ensuring price consistency across screens:
test:
  metadata:
    name: "Price Consistency Check"
    platform: ios

  build:
    name: "E-commerce App"

  blocks:
    - type: instructions
      step_description: "Tap the first product"

    - type: extraction
      step_description: "The product price on the detail screen"
      variable_name: detail-price

    - type: instructions
      step_description: "Tap 'Add to Cart'"

    - type: instructions
      step_description: "Open the cart"

    - type: validation
      step_description: "The cart shows price of {{detail-price}}"

    - type: instructions
      step_description: "Proceed to checkout"

    - type: validation
      step_description: "The checkout total matches {{detail-price}}"

Extract Order ID for Later Use

Capturing data for verification:
test:
  metadata:
    name: "Order Confirmation"
    platform: android

  build:
    name: "Shopping App"

  blocks:
    - type: instructions
      step_description: "Complete the checkout process"

    - type: extraction
      step_description: "The order confirmation number"
      variable_name: order-id

    - type: validation
      step_description: "Order confirmation displays 'Order #{{order-id}}'"

    - type: instructions
      step_description: "Navigate to order history"

    - type: validation
      step_description: "Order {{order-id}} appears in the order list"

Extract Multiple Values

Working with multiple extracted variables:
test:
  metadata:
    name: "Shopping Cart Validation"
    platform: ios

  build:
    name: "E-commerce App"

  blocks:
    - type: instructions
      step_description: "Add first product to cart"

    - type: extraction
      step_description: "The first product price"
      variable_name: price-1

    - type: instructions
      step_description: "Continue shopping"

    - type: instructions
      step_description: "Add second product to cart"

    - type: extraction
      step_description: "The second product price"
      variable_name: price-2

    - type: instructions
      step_description: "Open cart"

    - type: validation
      step_description: "First item shows price {{price-1}}"

    - type: validation
      step_description: "Second item shows price {{price-2}}"

Conditional Logic

Optional Popup Handling

Handling popups that may or may not appear:
test:
  metadata:
    name: "Handle Optional Permissions"
    platform: ios

  build:
    name: "Photo App"

  blocks:
    - type: if
      condition: "A photo access permission dialog is visible"
      then:
        - type: instructions
          step_description: "Tap 'Allow'"

    - type: instructions
      step_description: "Tap 'Create Album'"

    - type: validation
      step_description: "The album creation screen is displayed"

Different Paths Based on State

Branching based on user state:
test:
  metadata:
    name: "Dashboard Access"
    platform: android

  build:
    name: "App"

  blocks:
    - type: if
      condition: "The user is already logged in"
      then:
        - type: validation
          step_description: "The dashboard is visible"
      else:
        - type: instructions
          step_description: "Complete the sign up flow"
        - type: validation
          step_description: "The dashboard is now visible"

Nested Conditionals

Complex conditional logic:
test:
  metadata:
    name: "Payment Method Selection"
    platform: ios

  build:
    name: "Checkout App"

  blocks:
    - type: instructions
      step_description: "Proceed to payment"

    - type: if
      condition: "A saved payment method is available"
      then:
        - type: instructions
          step_description: "Select saved payment method"
      else:
        - type: instructions
          step_description: "Tap 'Add New Payment Method'"

        - type: if
          condition: "Apple Pay is available"
          then:
            - type: instructions
              step_description: "Select Apple Pay"
          else:
            - type: instructions
              step_description: "Enter credit card details"

    - type: instructions
      step_description: "Complete payment"

Loops and Iteration

Load All Content

Loading paginated content:
test:
  metadata:
    name: "Load All Products"
    platform: android

  build:
    name: "E-commerce App"

  blocks:
    - type: instructions
      step_description: "Navigate to products screen"

    - type: while
      condition: "A 'Load More' button is visible"
      body:
        - type: instructions
          step_description: "Tap 'Load More'"

    - type: validation
      step_description: "All products are displayed"

Dismiss Multiple Notifications

Clearing all notifications:
test:
  metadata:
    name: "Clear All Notifications"
    platform: android

  build:
    name: "Social App"

  blocks:
    - type: instructions
      step_description: "Open notifications"

    - type: while
      condition: "Notification items are present"
      body:
        - type: instructions
          step_description: "Swipe left on the first notification"

        - type: instructions
          step_description: "Tap 'Delete'"

    - type: validation
      step_description: "No notifications remain"

When Manual Navigation IS Needed

Mobile App Lifecycle Testing

kill_app vs go_home:
  • kill_app: Completely terminates the app. Use for testing cold-start behavior and state persistence after termination.
  • go_home: Goes to home screen but keeps app in background. Use for testing background/foreground transitions.
Example of when kill_app/open_app is appropriate (testing state persistence after app termination):
test:
  metadata:
    name: "App State Persistence After Kill"
    platform: ios

  build:
    name: "Notes App"

  blocks:
    # App already open
    - type: instructions
      step_description: "Create a new note with text 'Test Note'"

    - type: instructions
      step_description: "Navigate to settings"

    # Kill the app completely and reopen
    - type: manual
      step_type: kill_app

    - type: manual
      step_type: wait
      step_description: "2"

    - type: manual
      step_type: open_app

    # Verify state persisted after cold start
    - type: validation
      step_description: "App reopens to settings screen"

    - type: instructions
      step_description: "Navigate to notes list"

    - type: validation
      step_description: "Note with text 'Test Note' is visible"
Example of go_home for testing background/foreground behavior:
test:
  metadata:
    name: "Background State Preservation"
    platform: android

  build:
    name: "Video App"

  blocks:
    - type: instructions
      step_description: "Start playing a video"

    - type: validation
      step_description: "Video is playing"

    # Go to home screen (app stays in background)
    - type: manual
      step_type: go_home

    - type: manual
      step_type: wait
      step_description: "3"

    # Reopen the app from background
    - type: manual
      step_type: open_app

    # Verify video resumed (app was in background, not killed)
    - type: validation
      step_description: "Video continues playing from where it left off"
Testing deep link navigation:
test:
  metadata:
    name: "Deep Link Navigation"
    platform: ios

  build:
    name: "Shopping App"

  blocks:
    - type: validation
      step_description: "App is on the home screen"

    # Navigate via deep link
    - type: manual
      step_type: navigate
      step_description: "myapp://product/12345"

    - type: validation
      step_description: "Product detail page for item 12345 is displayed"

Opening System Apps

Testing cross-app workflows by opening system apps like Photos, Contacts, or Settings:
test:
  metadata:
    name: "Share to Photos Integration"
    platform: ios

  build:
    name: "Camera App"

  blocks:
    - type: instructions
      step_description: "Take a photo"

    - type: instructions
      step_description: "Tap the share button"

    - type: instructions
      step_description: "Select 'Save to Photos'"

    - type: validation
      step_description: "Success message is displayed"

    # Open Photos app to verify the image was saved
    - type: manual
      step_type: open_app
      step_description: "com.apple.mobileslideshow"

    - type: validation
      step_description: "The recently taken photo is visible in the library"
Android example with Contacts:
test:
  metadata:
    name: "Import Contacts Feature"
    platform: android

  build:
    name: "CRM App"

  blocks:
    - type: instructions
      step_description: "Tap 'Import from Contacts'"

    # Open Contacts to verify integration
    - type: manual
      step_type: open_app
      step_description: "com.google.android.contacts"

    - type: instructions
      step_description: "Select a contact"

    # Return to our app (it should handle the selection)
    - type: validation
      step_description: "The selected contact is imported into the CRM"

Location-Based Testing

Testing features that depend on GPS location:
test:
  metadata:
    name: "Store Locator Feature"
    platform: ios

  build:
    name: "Retail App"

  blocks:
    # Set location to San Francisco (lat,long format)
    - type: manual
      step_type: set_location
      step_description: "37.7749,-122.4194"

    - type: instructions
      step_description: "Tap 'Find Nearby Stores'"

    - type: validation
      step_description: "Stores in San Francisco area are displayed"

    # Change location to New York
    - type: manual
      step_type: set_location
      step_description: "40.7128,-74.0060"

    - type: instructions
      step_description: "Refresh the store list"

    - type: validation
      step_description: "Stores in New York area are now displayed"
Geofencing test:
test:
  metadata:
    name: "Geofence Notification"
    platform: android

  build:
    name: "Delivery App"

  blocks:
    - type: instructions
      step_description: "Enable location notifications"

    # Simulate arriving at a store location (lat,long format)
    - type: manual
      step_type: set_location
      step_description: "34.0522,-118.2437"

    - type: manual
      step_type: wait
      step_description: "3"

    - type: validation
      step_description: "Arrival notification is displayed"

Advanced Patterns

Form Submission with Validation

Complete form flow:
test:
  metadata:
    name: "Registration Form"
    platform: android

  build:
    name: "App"

  blocks:
    - type: instructions
      step_description: "Tap 'Sign Up'"

    - type: instructions
      step_description: "Enter 'John Doe' in the name field"

    - type: instructions
      step_description: "Enter '[email protected]' in the email field"

    - type: instructions
      step_description: "Enter 'SecurePass123!' in the password field"

    - type: instructions
      step_description: "Enter 'SecurePass123!' in the confirm password field"

    - type: instructions
      step_description: "Check the terms and conditions checkbox"

    - type: instructions
      step_description: "Tap 'Create Account'"

    - type: validation
      step_description: "Account created successfully"

    - type: validation
      step_description: "Welcome message is shown"

Search with No Results Handling

Search flow with conditional result handling:
test:
  metadata:
    name: "Product Search"
    platform: ios

  build:
    name: "E-commerce App"

  blocks:
    - type: instructions
      step_description: "Enter a random item in the search box"

    - type: instructions
      step_description: "Tap search"

    - type: if
      condition: "Search results are displayed"
      then:
        - type: validation
          step_description: "At least one product is shown"

        - type: instructions
          step_description: "Tap the first result"
      else:
        - type: validation
          step_description: "No results message is displayed"

        - type: validation
          step_description: "Search suggestions are shown"

Multi-Step Checkout

Complete e-commerce checkout flow:
test:
  metadata:
    name: "Complete Checkout"
    platform: ios

  build:
    name: "Shopping App"

  blocks:
    # Product selection
    - type: instructions
      step_description: "Search for 'laptop'"

    - type: instructions
      step_description: "Tap the first product"

    - type: extraction
      step_description: "The product name"
      variable_name: product-name

    - type: extraction
      step_description: "The product price"
      variable_name: product-price

    - type: instructions
      step_description: "Tap 'Add to Cart'"

    # Cart review
    - type: instructions
      step_description: "Tap cart icon"

    - type: validation
      step_description: "Cart contains '{{product-name}}'"

    - type: validation
      step_description: "Price shows {{product-price}}"

    - type: instructions
      step_description: "Tap 'Proceed to Checkout'"

    # Shipping info
    - type: instructions
      step_description: "Enter '123 Main St' in the address field"

    - type: instructions
      step_description: "Enter 'New York' in the city field"

    - type: instructions
      step_description: "Select 'NY' from state dropdown"

    - type: instructions
      step_description: "Enter '10001' in the zip code field"

    - type: instructions
      step_description: "Tap 'Continue to Payment'"

    # Payment
    - type: instructions
      step_description: "Enter '4111111111111111' in the card number field"

    - type: instructions
      step_description: "Enter '12/25' in the expiry field"

    - type: instructions
      step_description: "Enter '123' in the CVV field"

    - type: instructions
      step_description: "Tap 'Place Order'"

    - type: extraction
      step_description: "The order confirmation number"
      variable_name: order-id

    - type: validation
      step_description: "Order confirmation page displays order #{{order-id}}"

    - type: validation
      step_description: "Product '{{product-name}}' is listed in the order"

Best Practices

Validate Outcomes, Not Transient States

Validate the result of an action, not brief loading/transition states. Transient UI may vanish before screenshot capture.
# INCORRECT - transient state
- type: validation
  step_description: "Loading spinner is visible"

# CORRECT - meaningful outcome
- type: validation
  step_description: "The product list is displayed"

Use Wait Blocks Sparingly

Steps have built-in retry logic. Only add waits for known significant delays (after kill_app, system-level pauses).
# INCORRECT - unnecessary wait
- type: instructions
  step_description: "Tap 'Login'"
- type: manual
  step_type: wait
  step_description: "2"
- type: validation
  step_description: "Dashboard is visible"

# CORRECT - validation retries automatically
- type: instructions
  step_description: "Tap 'Login'"
- type: validation
  step_description: "Dashboard is visible"

Do NOT Start with Manual Navigation

# INCORRECT - unnecessary manual step
blocks:
  - type: manual
    step_type: open_app  # DON'T DO THIS
  - type: instructions
    step_description: "Tap login"

# CORRECT - start with action
blocks:
  - type: instructions
    step_description: "Tap login"

Use Descriptive Variable Names

# INCORRECT - unclear names
- type: extraction
  step_description: "The price"
  variable_name: var1

# CORRECT - descriptive names
- type: extraction
  step_description: "The product price"
  variable_name: product-price

Validate After Important Actions

- type: instructions
  step_description: "Tap 'Submit Order'"

# Always validate the result
- type: validation
  step_description: "Order confirmation is displayed"