#!/bin/bash # Test script for HereIAm.app # Verifies the built application works correctly set -e echo "๐Ÿงช Testing HereIAm.app..." echo "=========================" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' APP_PATH="../dist/HereIAm.app" # Check if app exists if [ ! -d "$APP_PATH" ]; then echo -e "${RED}โŒ Error: $APP_PATH not found!${NC}" echo "Please run '../build_app.sh' first." exit 1 fi echo -e "${BLUE}๐Ÿ“ฑ Testing app structure...${NC}" # Test executable exists if [ -f "$APP_PATH/Contents/MacOS/HereIAm" ]; then echo -e "${GREEN}โœ… Executable found${NC}" else echo -e "${RED}โŒ Executable missing${NC}" exit 1 fi # Test Info.plist exists if [ -f "$APP_PATH/Contents/Info.plist" ]; then echo -e "${GREEN}โœ… Info.plist found${NC}" # Check bundle identifier bundle_id=$(plutil -extract CFBundleIdentifier raw "$APP_PATH/Contents/Info.plist" 2>/dev/null || echo "") if [ "$bundle_id" = "net.tekop.hereiam" ]; then echo -e "${GREEN}โœ… Bundle identifier correct${NC}" else echo -e "${YELLOW}โš ๏ธ Bundle identifier: $bundle_id${NC}" fi # Check version version=$(plutil -extract CFBundleVersion raw "$APP_PATH/Contents/Info.plist" 2>/dev/null || echo "") echo -e "${BLUE}๐Ÿ“‹ Version: $version${NC}" else echo -e "${RED}โŒ Info.plist missing${NC}" exit 1 fi # Test assets are bundled if [ -d "$APP_PATH/Contents/Resources/assets" ]; then echo -e "${GREEN}โœ… Assets directory found${NC}" # Check for required icons for icon in "Enabled.icns" "Disabled-Light.icns" "Disabled-Dark.icns"; do if [ -f "$APP_PATH/Contents/Resources/assets/$icon" ]; then echo -e "${GREEN}โœ… $icon found${NC}" else echo -e "${RED}โŒ $icon missing${NC}" exit 1 fi done else echo -e "${RED}โŒ Assets directory missing${NC}" exit 1 fi # Test code signing (if signed) echo -e "${BLUE}๐Ÿ” Checking code signature...${NC}" if codesign -dv "$APP_PATH" 2>/dev/null; then echo -e "${GREEN}โœ… App is code signed${NC}" # Verify signature if codesign --verify --verbose "$APP_PATH" 2>/dev/null; then echo -e "${GREEN}โœ… Signature is valid${NC}" else echo -e "${YELLOW}โš ๏ธ Signature verification failed${NC}" fi else echo -e "${YELLOW}โš ๏ธ App is not code signed${NC}" echo -e "${YELLOW} (Users may see security warnings)${NC}" fi # Test Gatekeeper assessment (if signed) echo -e "${BLUE}๐Ÿ›ก๏ธ Checking Gatekeeper assessment...${NC}" if spctl --assess --verbose "$APP_PATH" 2>/dev/null; then echo -e "${GREEN}โœ… Gatekeeper will allow this app${NC}" else echo -e "${YELLOW}โš ๏ธ Gatekeeper may block this app${NC}" echo -e "${YELLOW} (Code signing and notarization recommended for distribution)${NC}" fi # Get app size app_size=$(du -sh "$APP_PATH" | cut -f1) echo -e "${BLUE}๐Ÿ“ฆ App bundle size: $app_size${NC}" # Basic launch test (background) echo -e "${BLUE}๐Ÿš€ Testing app launch...${NC}" "$APP_PATH/Contents/MacOS/HereIAm" & APP_PID=$! # Wait a moment for launch sleep 3 # Check if process is running if kill -0 $APP_PID 2>/dev/null; then echo -e "${GREEN}โœ… App launched successfully${NC}" # Clean shutdown kill $APP_PID 2>/dev/null || true sleep 1 # Force kill if still running kill -9 $APP_PID 2>/dev/null || true echo -e "${GREEN}โœ… App shutdown cleanly${NC}" else echo -e "${RED}โŒ App failed to launch or crashed${NC}" exit 1 fi echo "" echo -e "${GREEN}๐ŸŽ‰ All tests passed!${NC}" echo -e "${GREEN}๐Ÿ“ฑ HereIAm.app is ready for distribution${NC}" echo "" echo -e "${YELLOW}๐Ÿ“ Next steps:${NC}" echo "1. Test manually: open $APP_PATH" echo "2. Create DMG: ../create_dmg.sh" echo "3. For distribution: code sign and notarize" echo ""