refactor(scripts): rework how Maestro flows are run
This commit is contained in:
parent
24898cf9fb
commit
6e291a8df1
|
@ -0,0 +1,3 @@
|
|||
appId: dev.msfjarvis.claw.android
|
||||
---
|
||||
- runFlow: feature_graphic.yml
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p imagemagick libwebp
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
@ -7,13 +9,13 @@ SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
|
|||
SCREENSHOT_DIR="${SCRIPT_DIR}"/../screenshots
|
||||
|
||||
# Run the Maestro flow to generate the screenshots
|
||||
source "${SCRIPT_DIR}"/run-maestro-flows.sh
|
||||
"${SCRIPT_DIR}"/run-maestro-flows.sh feature_graphic.yml
|
||||
|
||||
# Use imagemagick to stitch the screenshots horizontally
|
||||
nix-shell -p imagemagick --run "convert +append ${SCREENSHOT_DIR}/HottestPosts.png ${SCREENSHOT_DIR}/CommentsPage.png ${SCREENSHOT_DIR}/SavedPosts.png ${SCRIPT_DIR}/../.github/readme_feature.png"
|
||||
convert +append "${SCREENSHOT_DIR}"/HottestPosts.png "${SCREENSHOT_DIR}"/CommentsPage.png "${SCREENSHOT_DIR}"/SavedPosts.png "${SCRIPT_DIR}"/../.github/readme_feature.png
|
||||
|
||||
# Convert the resulting PNG to WebP
|
||||
nix-shell -p libwebp --run "cwebp .github/readme_feature.png -o .github/readme_feature.webp"
|
||||
cwebp .github/readme_feature.png -o .github/readme_feature.webp
|
||||
|
||||
# Remove the now-useless PNG
|
||||
rm ".github/readme_feature.png"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue