diff --git a/screenshots/README.md b/screenshots/README.md index 06df390..26e2132 100644 --- a/screenshots/README.md +++ b/screenshots/README.md @@ -30,8 +30,5 @@ As a user I want to see the most relevant screenshots in the store, so that I ca ## Run the generator -```console -sh screenshots/generate_screenshots.sh -``` - -Screenshots will be stored in the _screenshots/_ folder. +- Android +- [iOS](screenshots/ios/README.md) diff --git a/screenshots/generate_screenshots.dart b/screenshots/generate_screenshots.dart index b29130e..f767245 100644 --- a/screenshots/generate_screenshots.dart +++ b/screenshots/generate_screenshots.dart @@ -131,7 +131,7 @@ extension on WidgetTester { await binding.convertFlutterSurfaceToImage(); await pumpAndSettle(); } - await binding.takeScreenshot("$_platformFolder/$name"); + await binding.takeScreenshot("$_platformFolder/${const String.fromEnvironment('deviceName')}/$name"); await pumpAndSettle(); } } diff --git a/screenshots/generate_screenshots.sh b/screenshots/generate_screenshots.sh index bea315b..fafbf76 100644 --- a/screenshots/generate_screenshots.sh +++ b/screenshots/generate_screenshots.sh @@ -1,5 +1,9 @@ +deviceName="$1" + fvm flutter drive \ + -d "$deviceName" \ --dart-define="cameraStubImage=assets/camera_stub_image.jpg" \ + --dart-define="deviceName=$deviceName" \ --driver=test_driver/screenshot_driver.dart \ --target=screenshots/generate_screenshots.dart \ --debug \ diff --git a/screenshots/ios/README.md b/screenshots/ios/README.md new file mode 100644 index 0000000..4284299 --- /dev/null +++ b/screenshots/ios/README.md @@ -0,0 +1,22 @@ +# Generate iOS screenshots + +## Context + +The command below will generate screenshots for all the screen sizes required by App Store using iOS Simulator. + +## Run the generator + +```console +sh screenshots/ios/generate_screenshots.sh +``` + +Screenshots will be stored in the _screenshots/ios/generated/_ folder. + +## List of devices + +- iPhone 8 Plus +- iPhone 13 Pro +- iPhone 13 Pro Max +- iPhone 15 Pro +- iPhone 15 Pro Max +- iPad Pro (12.9-inch) (6th generation) diff --git a/screenshots/ios/generate_screenshots.sh b/screenshots/ios/generate_screenshots.sh new file mode 100644 index 0000000..f084f23 --- /dev/null +++ b/screenshots/ios/generate_screenshots.sh @@ -0,0 +1,13 @@ +devices_array=("iPhone 8 Plus" "iPhone 13 Pro" "iPhone 13 Pro Max" "iPhone 15 Pro" "iPhone 15 Pro Max" "iPad Pro (12.9-inch) (6th generation)") + +open -a Simulator + +for i in "${devices_array[@]}"; do # https://www.baeldung.com/linux/shell-script-iterate-over-string-list#2-understanding--and--special-indices + echo "$i" + xcrun simctl boot "$i" + #uid=$(echo "$(fvm flutter devices)" | sed -n -r "s/$i \(mobile\) • (.*) • .* • .*\(simulator\)/\1/p") + #echo $uid + sh screenshots/generate_screenshots.sh "$i" +done + +killall 'Simulator'