#!/bin/bash # Define the path to the .env.test file ENV_FILE_PATH=".env.test" # Check if the .env.test file exists if [ ! -f $ENV_FILE_PATH ]; then echo "$ENV_FILE_PATH does not exist" exit 1 fi # Copy the .env.test file to .env cp $ENV_FILE_PATH .env echo "Copied $ENV_FILE_PATH to .env" # Verify .env file contains correct values source .env if [ -z "$BASE_HREF" ]; then echo "BASE_HREF value is empty" exit 1 fi if [ -z "$API_URL" ]; then echo "API_URL value is empty" exit 1 fi # Print loaded values for verification echo "Loaded BASE_HREF: $BASE_HREF" echo "Loaded API_URL: $API_URL" # Build the web app for the test environment with base href flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=test # Check if the build was successful if [ $? -ne 0 ]; then echo "Flutter test build failed" exit 1 fi echo "Flutter test build succeeded"