-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix #235 - fix issue taking a screenshot on an Android device
- Resolved #170: Added example code to ensure json report is save to disk even when the test run fails. Also added script to generate a HTML report from a JSON report
- Loading branch information
1 parent
6736af3
commit 9667db0
Showing
19 changed files
with
275 additions
and
1,302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...th_integration_test/integration_test/gherkin/hooks/attach_screenshot_after_step_hook.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:flutter_gherkin/flutter_gherkin.dart'; | ||
import 'package:gherkin/gherkin.dart'; | ||
|
||
class AttachScreenshotAfterStepHook extends Hook { | ||
@override | ||
Future<void> onAfterStep( | ||
World world, | ||
String step, | ||
StepResult stepResult, | ||
) async { | ||
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); | ||
} | ||
|
||
return super.onAfterStep(world, step, stepResult); | ||
} | ||
} | ||
|
||
Future<String> takeScreenshot(World world) async { | ||
final bytes = await (world as FlutterWorld).appDriver.screenshot(); | ||
|
||
return base64Encode(bytes); | ||
} |
Oops, something went wrong.