From 56942255e25decd9c25e31b45c836ddcb5bbb7e0 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Wed, 10 Apr 2024 23:34:22 +0200 Subject: [PATCH] setup golden toolkit --- pubspec.yaml | 1 + test/flutter_test_config.dart | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 test/flutter_test_config.dart 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), + ), +];