Skip to content

Commit

Permalink
github: reduce no. of tested screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
adil192 committed Aug 14, 2024
1 parent fdf61b0 commit 241c124
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion scripts/generate_screenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
flutter test \
--reporter expanded \
--update-goldens \
--dart-define=LOCALIZE_SCREENSHOTS=true \
--dart-define=ALL_SCREENSHOTS=true \
test/screenshot_goldens_test.dart
22 changes: 12 additions & 10 deletions test/screenshot_goldens_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ void _screenshot({
required String goldenFileName,
required Widget child,
}) {
const allScreenshots = bool.fromEnvironment('ALL_SCREENSHOTS');
final chosenLocaleCodes = allScreenshots ? localeNames.keys : const ['en'];
const chosenGoldenDevices = allScreenshots
? GoldenScreenshotDevices.values
: [
GoldenScreenshotDevices.flathub,
GoldenScreenshotDevices.android,
];

group(goldenFileName, () {
for (final localeCode in localeNames.keys) {
/// Some locales have font issues where text is not displayed properly.
Expand All @@ -154,14 +163,7 @@ void _screenshot({
];
if (localesWithFontIssues.contains(localeCode)) continue;

const nonEnglishDevices = [
GoldenScreenshotDevices.flathub,
GoldenScreenshotDevices.android,
];

for (final goldenDevice in (localeCode == 'en'
? GoldenScreenshotDevices.values
: nonEnglishDevices)) {
for (final goldenDevice in GoldenScreenshotDevices.values) {
testWidgets(
'for ${goldenDevice.name} in $localeCode',
(tester) async {
Expand Down Expand Up @@ -216,8 +218,8 @@ void _screenshot({

debugDisableShadows = true;
},
skip: localeCode != 'en' &&
!const bool.fromEnvironment('LOCALIZE_SCREENSHOTS'),
skip: !chosenLocaleCodes.contains(localeCode) ||
!chosenGoldenDevices.contains(goldenDevice),
);
}
}
Expand Down

0 comments on commit 241c124

Please sign in to comment.