The Mysterious Failure
Your test worked yesterday. You didn’t change anything. Today it fails. You run it again. It passes. You run it a third time. It fails again. The test is flaky. Sometimes it works, sometimes it doesn’t. Same code, different results. You stare at the failure logs. The error says: “Element not found: Submit button.” But the button is right there on the page. You can see it in the screenshot. What’s happening? The answer: Your test ran too fast. It tried to click the “Submit” button before the button finished loading. On a fast network, it works. On a slow network, it fails. This is the #1 reason tests fail: Timing issues. Not broken code. Not wrong logic. Just timing.The Speed Mismatch
Tests run at computer speed. Applications run at internet speed. Your test says:- Send the form data to the server (200ms)
- Wait for server response (500ms)
- Render the confirmation dialog (100ms)
- Total: 800ms before ‘Confirm’ button exists”
The Real-World Example
Let’s see this in action with a checkout test:- Browser navigates to checkout page
- Server fetches checkout data
- Page renders form fields
- Takes 1 second
- Test tries immediately (0.1 seconds after step 2)
- Email field doesn’t exist yet
- Test fails
The Solution: Waits
The fix is simple: Tell your test to wait for things to load.How Autonoma Handles Waits
When you addWait until: Checkout form loads, Autonoma doesn’t just pause for a fixed time. It actively checks:
- Is the checkout form visible?
- No? Check again (every 100ms)
- Still no? Check again
- Found it? Proceed to next step
- Timeout after reasonable navigation time? Fail the test
- Fast loads: Test proceeds immediately after load (not waiting full 3 seconds)
- Slow loads: Test waits up to the timeout (not failing prematurely)
- Broken pages: Test fails with clear timeout error
The Overuse Philosophy
Here’s the key principle: It’s better to have too many waits than too few. Too few waits:- Tests are fast but flaky
- Fail randomly based on network speed
- Unreliable in CI/CD
- Team loses trust in tests
- Tests are slightly slower but reliable
- Always pass when app works correctly
- Trustworthy in CI/CD
- Team depends on tests
Where to Add Waits
Add waits after any action that triggers loading or changes: After navigation:Real-World Test with Proper Waits
Let’s build a complete test with waits in all the right places:The Two Types of Waits
Autonoma offers two wait types: 1. Conditional waits (preferred):- “Wait until: Products load”
- “Wait until: Submit button appears”
- “Wait until: Success message displays”
- “Wait 2 seconds”
- “Wait 5 seconds”
- You’re waiting for animations (not dependent on loading)
- You’re debugging timing issues
- There’s no clear condition to check
Common Timing Mistakes
Mistake 1: No wait after navigationThe Flaky Test Detector
If your test:- Passes sometimes, fails sometimes
- Fails with “element not found” errors
- Works on your machine, fails in CI/CD
- Fails more often on slower networks

