refactor(scripts): rework how Maestro flows are run

This commit is contained in:
Harsh Shandilya 2023-06-07 18:07:18 +05:30
parent 24898cf9fb
commit 6e291a8df1
No known key found for this signature in database
4 changed files with 21 additions and 5 deletions

View file

@ -5,6 +5,17 @@ set -euo pipefail
# Get the absolute path to the script file
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
MAESTRO_FLOW="${1:-}"
if [[ -z "${MAESTRO_FLOW}" ]]; then
echo "No flow file was provided"
echo "Usage: run-maestro-flows.sh flow.yml"
exit 1
elif [[ ! -f "${SCRIPT_DIR}"/../maestro/"${MAESTRO_FLOW}" ]]; then
echo "Could not find flow ${MAESTRO_FLOW}"
echo "Make sure the flow file is in the maestro directory"
exit 1
fi
# Create a directory for generated screenshots since Maestro puts them iN $PWD
mkdir -p "${SCRIPT_DIR}"/../screenshots
pushd "${SCRIPT_DIR}"/../screenshots || exit 1
@ -23,7 +34,7 @@ adb shell am broadcast -a com.android.systemui.demo \
adb shell pm clear dev.msfjarvis.claw.android
# Run the Maestro Flows from $PROJECT_DIR/maestro
maestro test "${SCRIPT_DIR}"/../maestro/*.yml
maestro test "${SCRIPT_DIR}"/../maestro/"${MAESTRO_FLOW}"
# Turn off Demo Mode on the device
adb shell am broadcast -a com.android.systemui.demo -e command exit