-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ed9c69
commit f0b3b59
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) | ||
# Licensed under the EUPL-1.2-or-later. | ||
# | ||
# You may obtain a copy of the Licence at: | ||
# https://joinup.ec.europa.eu/software/page/eupl | ||
# | ||
# SPDX-License-Identifier: EUPL-1.2 | ||
|
||
tags: | ||
# The tag "golden" is used by the "golden_toolkit" package. | ||
# | ||
# This will indicate that goldens are an expected test tag. All tests that use | ||
# testGoldens() will automatically be given this tag. This allows you to | ||
# easily target golden tests from the command line. | ||
golden: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
lib/sharezone_widgets/test_goldens/flutter_test_config.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) | ||
// Licensed under the EUPL-1.2-or-later. | ||
// | ||
// You may obtain a copy of the Licence at: | ||
// https://joinup.ec.europa.eu/software/page/eupl | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import 'dart:async'; | ||
import 'dart:io'; | ||
import 'dart:ui'; | ||
|
||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
|
||
Future<void> testExecutable(FutureOr<void> Function() testMain) async { | ||
const Device phoneLandscape = Device( | ||
name: 'phone_landscape', | ||
size: Size(667, 375), | ||
); | ||
|
||
return GoldenToolkit.runWithConfiguration( | ||
() async { | ||
await loadAppFonts(); | ||
await testMain(); | ||
}, | ||
config: GoldenToolkitConfiguration( | ||
// Due to slight differences in rendering across platforms, mostly around | ||
// text, the tests will only be run on a macOS machine on Github Actions. | ||
// This means that if you update the tests on a Linux or Windows machine | ||
// the golden tests will not pass on Github Actions. Instead you are | ||
// recommended to download the goldens directly from the failed Github | ||
// Actions job, and use those inside of your branch. | ||
// | ||
// See | ||
// https://github.com/flutter/flutter/issues/36667#issuecomment-521335243. | ||
skipGoldenAssertion: () => !Platform.isMacOS, | ||
defaultDevices: const [ | ||
Device.phone, | ||
phoneLandscape, | ||
Device.tabletLandscape, | ||
Device.tabletPortrait, | ||
Device.iphone11, | ||
], | ||
), | ||
); | ||
} |