#!/bin/bash # File header documentation # @file run-deeplink-tests.sh # @brief Automated deeplink testing script using generated JSON files and ADB # @author Matthew Raymer # @date $(date +%Y-%m-%d) # Color definitions BLUE='\033[0;34m' GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[1;33m' NC='\033[0m' # Parse command line arguments TIMEOUT=5 TEST_MODE="execute" # Default to execute mode while getopts "t:p" opt; do case $opt in t) TIMEOUT=$OPTARG ;; p) TEST_MODE="print" ;; \?) echo "Invalid option: -$OPTARG" >&2; exit 1 ;; esac done # Verify .generated directory exists if [ ! -d .generated ]; then echo -e "${RED}Error: .generated directory not found${NC}" echo "Please run the DID generation script first" exit 1 fi # Function to read and validate JSON files validate_json_files() { local required_files=("test-env.sh" "claim_details.json" "contacts.json") for file in "${required_files[@]}"; do if [ ! -f ".generated/$file" ]; then echo -e "${RED}Error: Missing required file .generated/$file${NC}" return 1 fi done return 0 } # Function to URL encode string urlencode() { local string="${1}" local strlen=${#string} local encoded="" local pos c o for (( pos=0 ; pos/dev/null 2>&1; then echo -e "${YELLOW}Warning: adb not found, switching to print mode${NC}" TEST_MODE="print" elif [ -z "$(adb devices | grep -v List | grep device)" ]; then echo -e "${YELLOW}Warning: no devices/emulators found, switching to print mode${NC}" TEST_MODE="print" fi fi # Execute main test sequence main