AI_UIAutomation/scripts/run-aihub-tests.sh

64 lines
1.9 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Run AIHub failed tests with WDA restart between each file
WDA_PATH="/Users/woan/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent"
UDID="00008110-001A34303AE9801E"
TEAM_ID="XZX5843YW7"
restart_wda() {
echo "=== Restarting WDA ==="
pkill -f "xcodebuild" 2>/dev/null
pkill -f "iproxy" 2>/dev/null
sleep 3
xcodebuild test-without-building \
-project "$WDA_PATH/WebDriverAgent.xcodeproj" \
-scheme WebDriverAgentRunner \
-destination "id=$UDID" \
-allowProvisioningUpdates \
DEVELOPMENT_TEAM=$TEAM_ID \
> /tmp/wda_output.log 2>&1 &
iproxy 8100 8100 -u $UDID > /tmp/iproxy.log 2>&1 &
for i in $(seq 1 20); do
sleep 2
if curl -s --connect-timeout 3 http://localhost:8100/status | grep -q '"ready"'; then
echo "WDA ready after $((i*2))s"
return 0
fi
done
echo "ERROR: WDA failed to start"
return 1
}
echo "============================================"
echo " AIHub Tests - $(date)"
echo "============================================"
# Test 1: camera_bind
echo ""
echo ">>> [1/3] aihub_camera_bind.test.ts"
restart_wda
npx vitest run tests/aihub/aihub_camera_bind.test.ts --reporter=verbose 2>&1 | tee /tmp/aihub_bind.log
echo ""
# Test 2: aicam (function page) - only failed tests 4.1+
echo ">>> [2/3] aihub_aicam.test.ts (4.1+)"
restart_wda
npx vitest run tests/aihub/aihub_aicam.test.ts -t "4\.|5\.|6\.|7\." --reporter=verbose 2>&1 | tee /tmp/aihub_aicam.log
echo ""
# Test 3: setting
echo ">>> [3/3] aihub_setting.test.ts"
restart_wda
npx vitest run tests/aihub/aihub_setting.test.ts --reporter=verbose 2>&1 | tee /tmp/aihub_setting.log
echo ""
echo "============================================"
echo " All AIHub tests complete - $(date)"
echo "============================================"
echo ""
echo "Results summary:"
grep -E "✓|×|Tests.*passed|Tests.*failed" /tmp/aihub_bind.log /tmp/aihub_aicam.log /tmp/aihub_setting.log 2>/dev/null | grep -v "stdout"