Skip to content

Commit

Permalink
Setup golden test
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Jun 29, 2024
1 parent 482b1b6 commit 8c351f8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

# golden_toolkit
**/failures/*.png
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Golden",
"request": "launch",
"type": "dart",
"codeLens": {
"for": ["run-test", "run-test-file"]
},
"args": ["--update-goldens"]
}
]
}
2 changes: 2 additions & 0 deletions dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tags:
golden:
19 changes: 19 additions & 0 deletions test/flutter_test_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'dart:async';
import 'package:golden_toolkit/golden_toolkit.dart';

/// Used for golden tests to load the app fonts before running the tests.
/// ref: https://pub.dev/packages/golden_toolkit
Future<void> testExecutable(FutureOr<void> Function() testMain) async =>
GoldenToolkit.runWithConfiguration(
() async {
await loadAppFonts();
return testMain();
},
config: GoldenToolkitConfiguration(
enableRealShadows: true,
defaultDevices: const [
Device.phone,
Device.iphone11,
],
),
);

0 comments on commit 8c351f8

Please sign in to comment.