onAfterStep method
Run after a step has executed
Implementation
@override
Future<void> onAfterStep(
World world, String step, StepResult stepResult) async {
if ([StepExecutionResult.fail, StepExecutionResult.error]
.contains(stepResult.result)) {
await takeScreenshot(withWidgetTreeRender: true, prefix: 'FAILED');
currentWorld.reportFilesPath
.where((file) => file.contains('FAILED'))
.forEach((failedFile) {
currentWorld.attach(failedFile, 'txt', step);
});
}
}