#!/usr/bin/env bash # End-to-end driver for the basic-sanity scenario. # # 1. create fixtures + enable flash + rebuild caches # 2. run the user-side Maestro flow (regular order + flash order) # 3. package orders, disable flash, suspend combo, mark 1kg OOS, rebuild # 4. run the post-admin Maestro assertions # # Usage: # ./tests/e2e/run-basic-sanity.sh # # Optional: # DEVICE=... Maestro device id (defaults to the only connected device) # RUN_ID=... fixture name suffix set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$ROOT" ENV_FILE="$ROOT/tests/e2e/.basic-sanity.env" MAESTRO="${MAESTRO:-$HOME/.maestro/bin/maestro}" if [[ ! -x "$MAESTRO" ]]; then echo "Maestro not found at $MAESTRO (set MAESTRO=/path/to/maestro)" >&2 exit 1 fi "$ROOT/tests/e2e/basic-sanity-setup.sh" # shellcheck disable=SC1090 source "$ENV_FILE" DEVICE_ARGS=() if [[ -n "${DEVICE:-}" ]]; then DEVICE_ARGS=(--device "$DEVICE") fi ADDRESS_ID="${ADDRESS_ID:-899}" echo echo "Running user flow (regular + flash orders)..." "$MAESTRO" test "${DEVICE_ARGS[@]}" \ -e PRODUCT_NAME="$PRODUCT_NAME" \ -e COMBO_NAME="$COMBO_NAME" \ -e SKU_500G="$SKU_500G" \ -e SKU_1KG="$SKU_1KG" \ -e SKU_COMBO="$SKU_COMBO" \ -e TAG_ID="$TAG_ID" \ -e SLOT_ID="$SLOT_ID" \ -e ADDRESS_ID="$ADDRESS_ID" \ "$ROOT/tests/e2e/basic-sanity.yaml" echo echo "Applying admin-side changes..." "$ROOT/tests/e2e/basic-sanity-admin-update.sh" # The app refreshes essentialConsts on relaunch. The post-admin flow stops and # relaunches Expo Go, so a short settle is enough. sleep 5 echo echo "Running post-admin assertions..." "$MAESTRO" test "${DEVICE_ARGS[@]}" \ -e PRODUCT_NAME="$PRODUCT_NAME" \ -e COMBO_NAME="$COMBO_NAME" \ -e SKU_1KG="$SKU_1KG" \ -e SKU_COMBO="$SKU_COMBO" \ -e ADDRESS_ID="$ADDRESS_ID" \ "$ROOT/tests/e2e/basic-sanity-after-admin.yaml" echo echo "basic-sanity passed."