Writing Tests

Waiting Steps

Handle timing and synchronization in your tests

Waiting steps handle timing and synchronization. Instead of arbitrary sleep times, use intelligent waiting that knows when your application is actually ready.

Wait for AI Condition

Wait for conditions described in natural language — the most intelligent waiting tool.

Configuration:

  • until (required): Condition to wait for in natural language
  • timeout (required): Maximum seconds to wait for condition

Examples:

Wait until the loading spinner disappears
Wait until the product list loads
Wait until the user data appears

Wait for URL

Wait until the browser navigates to a URL matching a specific pattern.

Configuration:

  • urlRegex (required): Regular expression to match URL
  • timeout (required): Maximum seconds to wait for URL

Wait

Simple time-based waiting for specific durations. Not recommended — prefer AI-powered waiting instead.

Configuration:

  • time (required): Seconds to wait

Why AI-Powered Waiting?

Traditional tests fail because they either wait too little (acting before the app is ready) or wait too much (wasting time with unnecessary delays).

AI-powered waiting:

  • Understands visual cues — knows when loading is complete
  • Adapts to performance — waits exactly as long as needed
  • Handles edge cases — works across different environments and load conditions
  • Reduces flakiness — tests pass consistently regardless of timing variations

Instead of guessing timing:

Bad:  Wait 5 seconds        (might be too long or too short)
Good: Wait until the loading spinner disappears
Waiting Steps | QAbyAI Documentation | QAbyAI Docs