Skip to content

Commit 36437ef

Browse files
committed
Add automated screenshot generation and update icons
Introduces integration tests and fastlane configuration for automated screenshot generation across multiple languages and devices. Updates app icons for Android, iOS, macOS, and Windows platforms. Adds new images and web icons, updates .gitignore for Ruby/Bundler, and modifies dependencies to support integration testing.
1 parent df76c71 commit 36437ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+730
-5
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ ios/Flutter/flutter_assets/
7070
ios/ServiceDefinitions.json
7171
ios/Runner/GeneratedPluginRegistrant.*
7272

73+
# Bundler (Ruby)
74+
ios/vendor/bundle/
75+
ios/.bundle/
76+
7377
# Web specific
7478
web/flutter.js
7579

@@ -82,3 +86,4 @@ coverage/
8286
*.swp
8387
*.swo
8488
.idea/
89+
/vendor
4.26 KB
Loading
2.15 KB
Loading
6.95 KB
Loading
14.9 KB
Loading
26.2 KB
Loading

image.png

988 KB
Loading
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import 'dart:typed_data';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:flutter_test/flutter_test.dart';
5+
import 'package:integration_test/integration_test.dart';
6+
import 'package:shared_preferences/shared_preferences.dart';
7+
import 'package:polyglot_pathways/main.dart' as app;
8+
9+
void main() {
10+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
11+
12+
// Get language from environment variable or default to 'en'
13+
const String languageCode = String.fromEnvironment(
14+
'SCREENSHOT_LANGUAGE',
15+
defaultValue: 'en',
16+
);
17+
18+
group('Screenshot Tests', () {
19+
testWidgets('Generate screenshots for $languageCode', (WidgetTester tester) async {
20+
// Clear SharedPreferences to start fresh
21+
final prefs = await SharedPreferences.getInstance();
22+
await prefs.clear();
23+
24+
// Set the language
25+
await prefs.setString('selectedLanguage', languageCode);
26+
27+
// Set onboarding as completed so we can navigate to main screens
28+
await prefs.setBool('has_completed_onboarding', true);
29+
30+
// Build the app
31+
await tester.pumpWidget(app.MyApp(prefs: prefs));
32+
await tester.pumpAndSettle(const Duration(seconds: 2));
33+
34+
// Wait for any animations
35+
await Future.delayed(const Duration(milliseconds: 500));
36+
37+
// Screenshot: Home Screen
38+
await takeScreenshot(tester, '01_home');
39+
40+
// Navigate to Achievements tab
41+
await tester.tap(find.text('Achievements').last);
42+
await tester.pumpAndSettle(const Duration(seconds: 2));
43+
await Future.delayed(const Duration(milliseconds: 500));
44+
await takeScreenshot(tester, '02_achievements');
45+
46+
// Navigate to Profile tab
47+
await tester.tap(find.text('Profile').last);
48+
await tester.pumpAndSettle(const Duration(seconds: 2));
49+
await Future.delayed(const Duration(milliseconds: 500));
50+
await takeScreenshot(tester, '03_profile');
51+
52+
// Navigate to Settings tab
53+
await tester.tap(find.text('Settings').last);
54+
await tester.pumpAndSettle(const Duration(seconds: 2));
55+
await Future.delayed(const Duration(milliseconds: 500));
56+
await takeScreenshot(tester, '04_settings');
57+
58+
// Go back to Home tab
59+
await tester.tap(find.text('Home').last);
60+
await tester.pumpAndSettle(const Duration(seconds: 2));
61+
await Future.delayed(const Duration(milliseconds: 500));
62+
63+
// Try to open language selection - look for language cards more carefully
64+
// First, scroll if needed to see language cards
65+
try {
66+
final scrollable = find.byType(Scrollable);
67+
if (scrollable.evaluate().isNotEmpty) {
68+
await tester.drag(scrollable.first, const Offset(0, -200));
69+
await tester.pumpAndSettle(const Duration(seconds: 1));
70+
}
71+
} catch (e) {
72+
// Ignore if scroll fails
73+
}
74+
75+
// Try to find and tap a language card by looking for InkWell widgets
76+
// that are likely language cards (they're tappable)
77+
try {
78+
final inkWells = find.byType(InkWell);
79+
if (inkWells.evaluate().length > 2) {
80+
// Skip the first few (might be navigation), tap a language card
81+
await tester.tap(inkWells.at(2));
82+
await tester.pumpAndSettle(const Duration(seconds: 2));
83+
await Future.delayed(const Duration(milliseconds: 500));
84+
await takeScreenshot(tester, '05_language_selection');
85+
86+
// Try to close the sheet and go back
87+
final closeButton = find.byIcon(Icons.close);
88+
if (closeButton.evaluate().isNotEmpty) {
89+
await tester.tap(closeButton.first);
90+
await tester.pumpAndSettle(const Duration(seconds: 1));
91+
}
92+
}
93+
} catch (e) {
94+
// If language selection fails, continue with onboarding screens
95+
print('Could not capture language selection: $e');
96+
}
97+
98+
// For onboarding screens, we need to restart the app
99+
// This is complex in integration tests, so we'll skip for now
100+
// and focus on the main app screens which are more important
101+
});
102+
});
103+
}
104+
105+
Future<void> takeScreenshot(WidgetTester tester, String name) async {
106+
await tester.binding.defaultBinaryMessenger.handlePlatformMessage(
107+
'flutter/screenshot',
108+
null,
109+
(ByteData? data) {},
110+
);
111+
112+
await IntegrationTestWidgetsFlutterBinding.instance.takeScreenshot(name);
113+
}
114+

ios/.ruby-version

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
3.2.9
2+

ios/Gemfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
source "https://rubygems.org"
2+
3+
# Fastlane version - update as needed
4+
# You can check your installed version with: fastlane --version
5+
gem "fastlane", ">= 2.229.0"
6+
7+
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
8+
eval_gemfile(plugins_path) if File.exist?(plugins_path)
9+

0 commit comments

Comments
 (0)