#!/bin/bash # MovieMapper iOS UI Test Runner # Usage: ./run-ui-tests.sh [test_target] set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$SCRIPT_DIR/MovieMapper-iOS" TEST_TARGET=${1:-"all"} # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color log_info() { echo -e "${GREEN}[INFO]${NC} $1" } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1" } log_error() { echo -e "${RED}[ERROR]${NC} $1" } # Check if Xcode is installed if ! xcodebuild -version > /dev/null 2>&1; then log_error "Xcode is not installed or not in PATH" exit 1 fi log_info "Xcode version:" xcodebuild -version # Check if project exists if [ ! -d "$PROJECT_DIR" ]; then log_error "Project directory not found: $PROJECT_DIR" exit 1 fi log_info "Starting UI tests..." # Build and test xcodebuild test \ -project "$PROJECT_DIR/MovieMapper-iOS.xcodeproj" \ -scheme "MovieMapper-iOS" \ -destination "platform=iOS Simulator,name=iPad Pro (12.9-inch) (17th generation),OS=17.0" \ -destination-timeout 60 \ -configuration Debug \ -derivedDataPath "$PROJECT_DIR/.build/derived" \ -resultBundlePath "$PROJECT_DIR/.build/test-results.xcresult" \ -testLauncherBundleIdentifier com.apple.testmanagerd.cuitest \ -only-testing:"MovieMapper-iOSTests/BrowseViewUITests" \ -only-testing:"MovieMapper-iOSTests/SearchViewUITests" \ -only-testing:"MovieMapper-iOSTests/FileListViewUITests" if [ $? -eq 0 ]; then log_info "All UI tests passed successfully!" exit 0 else log_error "UI tests failed" exit 1 fi