onAfterStep method
Run after a step has executed
Implementation
@override
Future<void> onAfterStep(
World world,
String step,
StepResult stepResult,
) async {
if (stepResult.result == StepExecutionResult.fail ||
stepResult.result == StepExecutionResult.error ||
stepResult.result == StepExecutionResult.timeout) {
try {
final screenshotData = await takeScreenshot(world);
world.attach(screenshotData, 'image/png', step);
} catch (e, st) {
world.attach('Failed to take screenshot\n$e\n$st', 'text/plain', step);
}
}
}