Wait

Overview

The Wait action pauses workflow execution for a specified duration. It allows you to introduce deliberate delays between workflow steps to ensure proper timing, system processing, and synchronization.

circle-info

Purpose

Use Wait to pause execution and allow time for:

  • Backend processing to complete

  • Email delivery

  • Database synchronization

  • UI animations or transitions

  • User think-time simulation


When to Use Wait

✅ Good Use Cases

Scenario
Reason

API Processing

Wait for server to process data before verification

Email Testing

Wait for email delivery before checking inbox

Database Sync

Allow time for database replication/sync

UI Animations

Let animations complete before interaction

Scheduled Jobs

Wait for background jobs to execute

Cache Invalidation

Allow cache to clear before next operation

❌ Anti-Patterns (Don't Do)

  • ❌ Use as error handling (use Retry instead)

  • ❌ Excessive waits (slows down test suite)

  • ❌ Arbitrary waits without reason

  • ❌ Fixed waits for variable operations (use polling instead)


Configuration

Basic Setup

  1. Open your workflow

  2. Click "Add Action" → Select "Wait"

  3. Configure duration:

    • Value: Enter number

    • Unit: Seconds, Minutes, or Hours

  4. Add optional description (recommended)

  5. Connect to workflow - Place between relevant steps

  6. Save

Configuration Options

Example Configurations

Short Wait (Seconds)

Medium Wait (Seconds to Minutes)

Longer Wait (Minutes)


Practical Examples

Example 1: Email Verification Workflow

Example 2: Order Processing with Database Sync

Example 3: Background Job Completion

Example 4: Cascading Operations


Best Practices

✅ Do

  • Document the reason - Add description explaining why wait is needed

  • Use minimum necessary time - Don't add extra buffer unnecessarily

  • Test to determine duration - Run test multiple times to find right wait time

  • Consider retry logic - Combine with Retry for more resilience

  • Monitor impact - Track if wait significantly affects test speed

  • Use polling when possible - Some systems support polling instead of fixed waits

❌ Don't

  • Use arbitrary long waits - 5 minutes wait for no reason

  • Cascade many waits - Multiple waits significantly slow tests

  • Skip documentation - Always explain why wait is needed

  • Forget about failure scenarios - What if operation takes longer?

  • Ignore test duration impact - Sum all waits to understand total time

  • Wait without verification - Always verify something happened after wait


Timing Strategies

Strategy 1: Minimum Viable Wait

Find the absolute minimum time needed:

Strategy 2: Buffer Strategy

Add buffer to minimum time for reliability:

Strategy 3: Conditional Wait

Wait based on previous operation:


Combining Wait with Other Actions

Wait + Retry

Reliable pattern for operations with variable timing:

Wait for Polling

Monitor status with waits:


Performance Impact

Wait Duration Analysis

Optimization Tips

  • ✅ Use minimum necessary duration

  • ✅ Optimize independent operations to reduce wait impact

  • ✅ Review and reduce waits regularly

  • ✅ Monitor performance trends

  • ✅ Consider async operations for long-running tasks


Troubleshooting

Issue: Wait seems too short, test fails intermittently

Solution:

  1. Add 30% buffer to current wait time

  2. Run test multiple times to confirm

  3. Check if system is under load (affects timing)

  4. Consider using monitoring instead of fixed wait

Issue: Wait seems too long, slowing tests

Solution:

  1. Gradually reduce wait time (test each step)

  2. Look for operation completion indicators

  3. Switch to polling if available

  4. Run during different times to see if timing varies

Issue: Wait duration varies based on load

Solution:

  1. Use longer wait time to account for peak load

  2. Combine with Retry action for flexibility

  3. Consider time-of-day scheduling

  4. Monitor and adjust based on metrics

Issue: Test still fails after wait

Symptoms:

  • Operation timeout after wait

  • Expected data not available

Causes:

  • System under heavy load

  • Operation taking longer than expected

  • Wait placement is incorrect

Solutions:

  1. Increase wait duration

  2. Add Retry logic with exponential backoff

  3. Add intermediate verification step

  4. Check system health/performance


Advanced Configuration

Conditional Wait

Wait with Maximum


Real-World Scenarios

E-Commerce Checkout

API Testing with Database



Summary

  • Wait pauses workflow for specified duration

  • Use for synchronization between dependent operations

  • Document why each wait is necessary

  • Optimize duration for reliability and speed

  • Combine with Retry for variable-timing operations

  • Monitor impact on total test execution time


Next: Learn about Retry Action for handling failures automatically.

Last updated