-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathscreenshot.sh
executable file
·68 lines (61 loc) · 1.87 KB
/
screenshot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Runs screenshot_test on all devices.
RUN_IOS=true
RUN_MACOS=true
RUN_ANDROID=true
flutter_test() { # $1 = device name, $2 = device id, $3 = censor images (true by default)
echo "Running on $1"
flutter test \
--device-id="$2" \
--dart-define=device="$1" \
--dart-define=censorImages="${3:-true}" \
--dart-define=isScreenshotTest=true \
--update-goldens \
integration_test/screenshot_test.dart
}
# iOS
if [ $RUN_IOS = true ]; then
for device in "iPhone 16 Pro Max" "iPad Pro 13-inch (M4)"; do
xcrun simctl boot "$device"
flutter_test "$device" "$device"
done
# Get uncensored images for the landing page
xcrun simctl boot "iPhone 16 Pro"
flutter_test "iPhone 16 Pro" "iPhone 16 Pro" "false"
fi
# macOS
# macOS can't write to the Documents folder, so we have to put the screenshots
# in the Downloads folder and then move them.
SOURCE="$HOME/Downloads/macOS"
TARGET="$HOME/Documents/DartProjects/finale/screenshots/macOS"
if [ $RUN_MACOS = true ]; then
flutter_test "macOS" "macOS"
mkdir "$TARGET"
mv "$SOURCE"/* "$TARGET"
rm -r "$SOURCE"
(
cd "$TARGET" || exit
sips -c 1600 2560 ./*.png
)
fi
# Android
# Android can't write to the Documents folder, so we have to put the screenshots
# on the SD card and then pull them.
if [ $RUN_ANDROID = true ]; then
for device in "Pixel_8_API_35" "7_WSVGA_Tablet_API_34" "Medium_Tablet"; do
~/Library/Android/sdk/emulator/emulator -avd "$device" &
sleep 5
~/Library/Android/sdk/platform-tools/adb shell rm -rR "sdcard/Documents/$device"
sleep 5
flutter_test "$device" "emulator-5554"
sleep 5
(
cd screenshots || exit
~/Library/Android/sdk/platform-tools/adb pull "sdcard/Documents/$device"
)
sleep 5
~/Library/Android/sdk/platform-tools/adb shell rm -rR "sdcard/Documents/$device"
sleep 5
killall qemu-system-aarch64
sleep 5
done
fi