Skip to content

Commit de41aa5

Browse files
authored
Merge pull request #8 from sncf-connect-tech/7-test_passed_on_exception
Resolves #7 Test stops and does not fail on Exception
2 parents 9da429e + 61cb0fd commit de41aa5

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

lib/world/widget_hooks.dart

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ class WidgetHooks implements Hook {
3737

3838
@override
3939
Future<void> onAfterStep(World world, String step, StepResult stepResult) async {
40-
if ([StepExecutionResult.fail, StepExecutionResult.error].contains(stepResult.result)) {
41-
var dumpFileName = _getDumpFilePath();
42-
currentWorld.dumpFile = File("$dumpFileName.txt");
43-
currentWorld.screenshot = File("$dumpFileName.png");
44-
await takeScreenshot(withWidgetTreeRender: true);
40+
try {
41+
if ([StepExecutionResult.fail, StepExecutionResult.error].contains(stepResult.result)) {
42+
var dumpFileName = _getDumpFilePath();
43+
currentWorld.dumpFile = File("$dumpFileName.txt");
44+
currentWorld.screenshot = File("$dumpFileName.png");
45+
await takeScreenshot(withWidgetTreeRender: true);
46+
}
47+
} catch(e) {
48+
throwsAssertionError;
4549
}
4650
}
4751

@@ -60,8 +64,7 @@ class WidgetHooks implements Hook {
6064
await disposeWidget();
6165
currentWorld.dispose();
6266
} catch (e) {
63-
log(e.toString());
64-
rethrow;
67+
throwsAssertionError;
6568
}
6669
}
6770
}

0 commit comments

Comments
 (0)