[iOS] implemented screenshots generator for all target devices

This commit is contained in:
Vadim 2023-12-27 21:09:07 +01:00
parent 26f34977c1
commit be2aa45afc
5 changed files with 42 additions and 6 deletions

View file

@ -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)

View file

@ -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();
}
}

View file

@ -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 \

22
screenshots/ios/README.md Normal file
View file

@ -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)

View file

@ -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'