Update the screenshot driver

The driver now saves the screenshots to the correct folder in the android metadata
folder and uses the same language codes as in the Play Store.
This commit is contained in:
Roland Geider
2022-05-10 17:40:56 +02:00
parent 9d554b391d
commit e19126ed47
41 changed files with 34 additions and 17 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -34,16 +34,31 @@ import '../test/workout/gym_mode_screen_test.mocks.dart';
import '../test_data/exercises.dart';
import '../test_data/workouts.dart';
Future<void> takeScreenshot(tester, binding, name) async {
Future<void> takeScreenshot(tester, binding, String language, String name) async {
if (Platform.isAndroid) {
await binding.convertFlutterSurfaceToImage();
await tester.pumpAndSettle();
}
await binding.takeScreenshot(name);
await binding
.takeScreenshot('fastlane/metadata/android/$language/images/phoneScreenshots/$name.png');
}
// Languages for which the translations are almost complete in weblate
const languages = ['de', 'en', 'es', 'it', 'jp', 'ca', 'pt', 'ru', 'tr', 'zh', 'fr', 'he'];
// Available languages in weblate for the android metadata
const languages = [
'ca',
'de-DE',
'en-US',
'es-ES',
'fr-FR',
'hi-IN',
'hr',
'it-IT',
'nb-NO',
'ru-RU',
'tr-TR',
'uk',
'zh-CN'
];
void main() {
final binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
@@ -419,24 +434,26 @@ void main() {
group('Generate screenshots', () {
for (final language in languages) {
testWidgets('nutritional plan detail - $language', (WidgetTester tester) async {
await tester.pumpWidget(createNutritionalPlanScreen(locale: language));
final languageCode = language.split('-')[0];
testWidgets('gym mode screen - $language', (WidgetTester tester) async {
await tester.pumpWidget(createGymModeScreen(locale: languageCode));
await tester.tap(find.byType(TextButton));
await tester.pumpAndSettle();
await takeScreenshot(tester, binding, '$language/03-nutritional-plan');
await takeScreenshot(tester, binding, language, '03 - gym mode');
});
testWidgets('nutritional plan detail - $language', (WidgetTester tester) async {
await tester.pumpWidget(createNutritionalPlanScreen(locale: languageCode));
await tester.tap(find.byType(TextButton));
await tester.pumpAndSettle();
await takeScreenshot(tester, binding, language, '04 - nutritional plan');
});
testWidgets('body weight screen - $language', (WidgetTester tester) async {
await tester.pumpWidget(createWeightScreen(locale: language));
await tester.pumpWidget(createWeightScreen(locale: languageCode));
await tester.pumpAndSettle();
await takeScreenshot(tester, binding, '$language/05-weight');
});
testWidgets('gym mode screen - $language', (WidgetTester tester) async {
await tester.pumpWidget(createGymModeScreen(locale: language));
await tester.tap(find.byType(TextButton));
await tester.pumpAndSettle();
await takeScreenshot(tester, binding, '$language/05-gym-mode');
await takeScreenshot(tester, binding, language, '05 - weight');
});
}
});

View File

@@ -7,7 +7,7 @@ Future<void> main() async {
try {
await integrationDriver(
onScreenshot: (String screenshotName, List<int> screenshotBytes) async {
final File image = await File('screenshots/$screenshotName.png').create(recursive: true);
final File image = await File(screenshotName).create(recursive: true);
image.writeAsBytesSync(screenshotBytes);
return true;
},