selectIndexOnFinder method
Implementation
Future<void> selectIndexOnFinder(Finder finder, int index,
{TestStep? step, Future<void> Function()? onBeforeSelection}) async {
if (index < 0) {
throw EnsembleTestFailure('selectIndex requires a non-negative index');
}
await tapFinder(
finder,
step: step,
onBeforeTap: () async {
if (step != null) await _emitEvidenceBoundary(step);
await onBeforeSelection?.call();
},
);
final options = selectIndexOptions().evaluate().toList();
if (index >= options.length) {
throw EnsembleTestFailure('selectIndex: no option at index $index');
}
await tester.tap(find.byWidget(options[index].widget));
await runtime.settleAfterAction();
}