main
 1
 2import 'package:blood_pressure_app/app.dart';
 3import 'package:blood_pressure_app/screens/home_screen.dart';
 4import 'package:flutter/material.dart';
 5import 'package:blood_pressure_app/l10n/app_localizations.dart';
 6import 'package:flutter_test/flutter_test.dart';
 7import 'package:integration_test/integration_test.dart';
 8
 9import 'util.dart';
10
11void main() {
12  final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
13  testWidgets('Screenshot settings', (WidgetTester tester) async {
14    final localizations = await AppLocalizations.delegate.load(const Locale('en'));
15
16    await tester.pumpWidget(App());
17    await tester.pumpAndSettle();
18    await tester.pumpUntil(() => find.byType(AppHome).hasFound);
19    // home
20
21    await tester.tap(find.byIcon(Icons.settings));
22    await tester.pumpAndSettle();
23    // settings
24
25    await tester.dragFrom(
26      tester.getCenter(find.text(localizations.animationSpeed)),
27      tester.getCenter(find.text(localizations.animationSpeed)) - tester.getCenter(find.text(localizations.timeFormat))
28    );
29    await tester.pumpAndSettle();
30
31    await binding.convertFlutterSurfaceToImage();
32    await tester.pump();
33    await binding.takeScreenshot('03-example_settings');
34
35    await tester.scrollUntilVisible(find.text(localizations.exportImport, skipOffstage: false), 50.0);
36    await tester.pumpAndSettle();
37    await tester.tap(find.text(localizations.exportImport));
38    await tester.pumpAndSettle();
39
40    await binding.takeScreenshot('05-export_example');
41  });
42}