Settle.until constructor
Pump until target is on screen, then settle as standard does — for
data that arrives without announcing itself.
A step waits on what announces itself: frames, a tracked future, a live request until its headers are in. Two things a real app does every day announce nothing. A row that comes down a sync stream whose headers arrived long before, and a list that asks its local database for rows after the tap that opened it: the step settles on the empty state before either lands. This names what the step is waiting for instead:
await s.tap('Orders', settle: Settle.until('Order #1042'));
await s.act(
'An order placed on the other device reaches this one',
() => otherDevice.placeOrder('#1043'),
settle: Settle.until('Order #1043'),
);
target is anything a verb takes — visible text, a Key, a Finder, a
Target. The wait needs nothing from the app, and it is on the lane's
clock like every policy here: timeout of fake time under the fake
clock, where it is how to wait out a timer without knowing how long it
is, and of real time under ScenarioTime.real.
Not seeing target within timeout fails the step, with the screen
as it stood at the end of the wait as its picture. An empty list captured
and passed is the failure this exists to prevent, so running out is never
only a number on the step.
Implementation
const factory Settle.until(Object target, {Duration timeout}) = _Until;