diff --git a/pubspec.yaml b/pubspec.yaml index 1745e90..11387bf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,6 +49,7 @@ dev_dependencies: flutter_native_splash: 2.3.5 flutter_test: sdk: flutter + golden_toolkit: 0.15.0 google_fonts: 3.0.1 integration_test: sdk: flutter diff --git a/test/flutter_test_config.dart b/test/flutter_test_config.dart new file mode 100644 index 0000000..c51cd3d --- /dev/null +++ b/test/flutter_test_config.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'package:flutter/widgets.dart'; +import 'package:golden_toolkit/golden_toolkit.dart'; + +Future testExecutable(FutureOr Function() testMain) async { + return GoldenToolkit.runWithConfiguration( + () async { + await loadAppFonts(); + await testMain(); + }, + config: GoldenToolkitConfiguration(defaultDevices: _defaultDevices), + ); +} + +const _defaultDevices = [ + Device( + name: 'iPhone 8', + size: Size(375, 667), + devicePixelRatio: 2.0, + ), + Device( + name: 'iPhone 13 Pro', + size: Size(390, 844), + devicePixelRatio: 3.0, + safeArea: EdgeInsets.only(top: 44, bottom: 34), + ), + Device( + name: 'iPhone 15 Pro Max', + size: Size(430, 932), + devicePixelRatio: 3.0, + safeArea: EdgeInsets.only(top: 44, bottom: 34), + ), +];