Files
flutter/test_driver/screenshot_driver.dart
Roland Geider e19126ed47 Update the screenshot driver
The driver now saves the screenshots to the correct folder in the android metadata
folder and uses the same language codes as in the Play Store.
2022-05-10 17:40:56 +02:00

19 lines
547 B
Dart

import 'dart:io';
import 'package:integration_test/integration_test_driver_extended.dart';
// cf. https://dev.to/mjablecnik/take-screenshot-during-flutter-integration-tests-435k
Future<void> main() async {
try {
await integrationDriver(
onScreenshot: (String screenshotName, List<int> screenshotBytes) async {
final File image = await File(screenshotName).create(recursive: true);
image.writeAsBytesSync(screenshotBytes);
return true;
},
);
} catch (e) {
print('An error occurred: $e');
}
}