execute static method
Implementation
static Future<void> execute(
TestStepExecutor executor,
OperationDescriptor descriptor,
String operationName,
Map<String, dynamic> input,
{Future<void> Function()? beforeMutation,
TestStep? step}) async {
final handlerKey = descriptor.handlerKey;
if (handlerKey == 'lifecycle.resetAppState') {
// Keep the boundary at the reset operation itself. This makes the
// lifecycle operation publish its ordered event immediately before it
// clears runtime state, without a caller-installed mutation callback.
await executor.emitLifecycleEvidenceBoundary(
operationName,
step: step,
);
await _resetAppState(executor, input);
return;
}
if (handlerKey == 'lifecycle.restartApp' ||
handlerKey == 'lifecycle.launchApp') {
// Publish before resetTestRuntime clears the current UI and runtime
// state. Keep lifecycle evidence ownership here, beside the mutation.
await executor.emitLifecycleEvidenceBoundary(
operationName,
step: step,
);
await _restartApp(executor, input);
return;
}
if (handlerKey == 'lifecycle.goBack') {
// Keep evidence ownership beside the route mutation, after resolving
// which navigator will be popped and immediately before that pop.
await _goBack(executor, operationName, step);
return;
}
final handler = _handlers[handlerKey];
if (handler == null) {
throw ArgumentError.value(
operationName,
'name',
'Unsupported lifecycle action',
);
}
await handler(executor, input, beforeMutation: beforeMutation);
}