feat: use Maestro to automatically generate Play Store screenshots

This commit is contained in:
Harsh Shandilya 2023-05-05 21:01:31 +05:30
parent a7c81a77f2
commit dd7a7d9977
No known key found for this signature in database
3 changed files with 51 additions and 0 deletions

32
scripts/run-maestro-flows.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
# Get the absolute path to the script file
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
# Create a directory for generated screenshots since Maestro puts them iN $PWD
mkdir -p "${SCRIPT_DIR}"/../screenshots
pushd "${SCRIPT_DIR}"/../screenshots || exit 1
# Delete any existing screenshots
rm -rf ./*.png
# Enable Demo Mode on the device with the following settings
# - Hide notification icons
# - Set clock to 1200 hrs
adb shell am broadcast -a com.android.systemui.demo \
-e command enter \
-e command notifications -e visible false \
-e command clock -e hhmm 1200
# Clear data for the app to make re-runs consistent
adb shell pm clear dev.msfjarvis.claw.android
# Run the Maestro Flows from $PROJECT_DIR/maestro
maestro test "${SCRIPT_DIR}"/../maestro/*.yml
# Turn off Demo Mode on the device
adb shell am broadcast -a com.android.systemui.demo -e command exit
# Return to the original $PWD
popd || exit 1