performAction method
Performs the action
Implementation
Future<void> performAction(
{Function(int)? setAsDone, int actionIndex = 0}) async {
debugPrint('Performing ${actionType.toValue} action $actionIndex');
try {
switch (actionType) {
case ActionType.press:
await tester!.tap(finder!);
break;
case ActionType.enterText:
await tester!.enterText(finder!, enterText!);
break;
case ActionType.pumpAndSettle:
await tester!.pumpAndSettle();
break;
case ActionType.futureAwait:
await _executeFutureAwait();
break;
case ActionType.customAction:
await customAction!();
break;
case ActionType.pump:
await _executePump(setAsDone, actionIndex);
return;
case ActionType.drag:
await tester!.drag(finder!, dragOffset!);
break;
}
if (executePumpAndSettle) {
debugPrint('Executing pumpAndSettle');
await tester!.pumpAndSettle(const Duration(milliseconds: 500));
} else {
debugPrint('* Avoiding the pumpAndSettle');
}
} catch (e, stacktrace) {
_printError(e, actionIndex, surplusMessage: '\n$stacktrace');
return;
}
if (setAsDone != null) setAsDone(actionIndex);
debugPrint('Action ${actionType.toValue} #$actionIndex done');
return;
}