diff --git a/maestro/play_store_flow.yml b/maestro/feature_graphic.yml similarity index 100% rename from maestro/play_store_flow.yml rename to maestro/feature_graphic.yml diff --git a/maestro/play_store_screenshots.yml b/maestro/play_store_screenshots.yml new file mode 100644 index 00000000..9bd3d85e --- /dev/null +++ b/maestro/play_store_screenshots.yml @@ -0,0 +1,3 @@ +appId: dev.msfjarvis.claw.android +--- +- runFlow: feature_graphic.yml diff --git a/scripts/refresh-feature-graphic.sh b/scripts/refresh-feature-graphic.sh index 0210aafa..e78a1a9f 100755 --- a/scripts/refresh-feature-graphic.sh +++ b/scripts/refresh-feature-graphic.sh @@ -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" diff --git a/scripts/run-maestro-flows.sh b/scripts/run-maestro-flows.sh index 4834db52..c658e466 100755 --- a/scripts/run-maestro-flows.sh +++ b/scripts/run-maestro-flows.sh @@ -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