waitUntil
Observes state until it matches matching, polling every pollInterval.
The deadline is measured with the monotonic clock in real time. Inside runTest, delay uses virtual time, so call this from withContext(Dispatchers.Default) when the observed work runs on another thread; prefer advanceUntilIdle() for work on the test scheduler. The observe block must return promptly and cooperate with cancellation: a deadline cannot interrupt arbitrary code. One observation is made even for a zero timeout, and errors from observe propagate unchanged.
val count = waitUntil(2.seconds, observe = { model.count }) { it >= 3 }Return
The first matching observation.
Parameters
The total observation budget, at least zero.
The positive delay between observations.
Reads the state without modifying it.
Returns whether an observation satisfies the condition.
Throws
with the last observation when the deadline passes.