Browse Source

neon: Make generating screenshots easier and more reliable

pull/52/head
jld3103 2 years ago
parent
commit
4364d008c6
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 1
      packages/neon/integration_test/screenshot_test.dart
  2. 12
      packages/neon/test_driver/integration_test.dart

1
packages/neon/integration_test/screenshot_test.dart

@ -277,6 +277,7 @@ Future main() async {
// Show Photos folder // Show Photos folder
await tester.tap(find.text('Photos')); await tester.tap(find.text('Photos'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.pump();
await binding.takeScreenshot('files_photos'); await binding.takeScreenshot('files_photos');

12
packages/neon/test_driver/integration_test.dart

@ -3,16 +3,14 @@ import 'dart:io';
import 'package:integration_test/integration_test_driver_extended.dart'; import 'package:integration_test/integration_test_driver_extended.dart';
Future<void> main() async { Future<void> main() async {
final screenshotsDir = Directory('screenshots'); Directory('screenshots').createSync();
if (screenshotsDir.existsSync()) {
screenshotsDir.deleteSync(recursive: true);
}
screenshotsDir.createSync();
try { try {
await integrationDriver( await integrationDriver(
onScreenshot: (final screenshotName, final screenshotBytes) async { onScreenshot: (final screenshotName, final screenshotBytes) async {
File('screenshots/$screenshotName.png').writeAsBytesSync(screenshotBytes); final file = File('screenshots/$screenshotName.png');
if (!file.existsSync()) {
file.writeAsBytesSync(screenshotBytes);
}
return true; return true;
}, },
); );

Loading…
Cancel
Save