guessedLandingNotice function
The sentence a scenario whose steps depended on the machine's speed owes its author, or null when none did.
Said as the scenario ends rather than failed on, and the same under the
runner and a plain flutter test: a step that is right only because the
real loop turned fast enough is a flaky expectation on a slower machine as
much as it is a changed picture. It states the hazard and nothing more —
what to do about it depends on what the work is.
Implementation
String? guessedLandingNotice(String scenario, Map<String, int> guessed) {
if (guessed.isEmpty) return null;
String step(String label, int turn) =>
'`${label.isEmpty ? 'the first frame' : 's.$label'}` '
'(turn $turn of $realWorkTurns)';
var steps = [
for (var MapEntry(key: label, value: turn) in guessed.entries)
step(label, turn),
];
return '"$scenario": ${steps.join(', ')} finished drawing only after '
'turns of the real event loop, on work the app did not announce. On a '
'slower machine that work can land after the step has moved on.';
}