Condition-Based Waiting Overview Flaky tests often guess at timing with arbitrary delays. This creates race conditions where tests pass on fast machines but fail under load or in CI. Core principle: Wait for the actual condition you care about, not a guess about how long it takes. When to Use Use when: - Tests have arbitrary delays ( , , ) - Tests are flaky (pass sometimes, fail under load) - Tests timeout when run in parallel - Waiting for async operations to complete Don't use when: - Testing actual timing behavior (debounce, throttle intervals) - Always document WHY if using arbitrary time…