Skip to content

Commit e1cff4e

Browse files
committed
androidScreenshotTest now sets up the uiComparison AVD, if not present
The AVD setup was only done automatically when executing updateScreenshots.sh. The lines were copied from there, but long-term, the exact AVD configuration as well as emulator parameters should rather be stored somewhere shared. Signed-off-by: Philipp Hasper <[email protected]>
1 parent f822b49 commit e1cff4e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/androidScreenshotTest

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,20 @@ while read line ; do
9292
done < <(adb devices | cut -f1)
9393

9494
if [ "$emulatorIsRunning" == false ] ; then
95+
if [ -z "$(command -v emulator || true)" ]; then
96+
echo "emulator not found in PATH; typically located in Android/sdk/emulator" >&2
97+
exit 1
98+
fi
99+
if [ -z "$(command -v avdmanager || true)" ]; then
100+
echo "avdmanager not found in PATH; typically located in Android/sdk/cmdline-tools/latest/bin" >&2
101+
exit 1
102+
fi
103+
# If emulator of expected name doesn't exist, create it
104+
# TODO - this was copied from updateScreenshots.sh - move it to a common helper script
105+
if [[ $(emulator -list-avds | grep uiComparison -c) -eq 0 ]]; then
106+
(sleep 5; echo "no") | avdmanager create avd -n uiComparison -c 100M -k "system-images;android-28;google_apis;x86" --abi "google_apis/x86"
107+
fi
108+
95109
"$(command -v emulator)" -writable-system -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-audio -skin 500x833 &
96110
sleep 20
97111
fi

0 commit comments

Comments
 (0)