AI_UIAutomation/scripts/overnight-noadd.sh

62 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
# 过夜执行已调试好的非添加 P0 用例,结果合并进下午的添加报告。
# 机制:SOAK_MODE=1 → global-setup 不清空/不每轮出报告,结果累积到 reports/.results.json;
# 末尾 gen-combined 出一份合并报告。先回填下午添加的结果(已被后续调试清掉)。
# 用 nohup 跑,不经 Claude:无授权弹框、不烧 token。日志见 reports/overnight-noadd.log。
set -u
cd /Users/woan/Desktop/AI_UIAutomation
LOG=reports/overnight-noadd.log
export PLATFORM=android
export SOAK_MODE=1 # 累积结果、不每轮清空/出报告
export SKIP_PROTO_NET=1 # bot_card 跳过蓝牙/WiFi 协议切换(adb dump 偶发被杀)
{
echo "===== $(date '+%F %T') 过夜非添加用例开始 ====="
# 1. 回填下午添加报告结果(9 PASS + Hub Mini SKIP[已移 iOS])
cat > reports/.results.json <<'JSON'
{
"platform": "ANDROID",
"results": [
{"suite":"Bot_Connect","name":"[P0][ONES:15968] 添加Bot 14","status":"PASS","duration":31200,"detail":"Bot 14添加成功(下午)"},
{"suite":"Meter_Connect","name":"[P0][ONES:15965] 添加Meter设备","status":"PASS","duration":51400,"detail":"Meter 0B添加成功(下午)"},
{"suite":"MeterPlus_Connect","name":"[P0][ONES:15956] 添加Meter Plus设备","status":"PASS","duration":47900,"detail":"Meter Plus C9添加成功(下午)"},
{"suite":"OutdoorMeter_Connect","name":"添加Outdoor Meter设备(套件)","status":"PASS","duration":90900,"detail":"Outdoor Meter 6A添加成功(下午)"},
{"suite":"MotionSensor_Connect","name":"[P0][ONES:15963] 添加Motion Sensor设备","status":"PASS","duration":57100,"detail":"Motion Sensor A5添加成功(下午)"},
{"suite":"Remote_Connect","name":"添加Remote设备","status":"PASS","duration":48600,"detail":"Remote 63添加成功(下午)"},
{"suite":"Curtain_Connect","name":"[P0][ONES:15969] 添加窗帘设备","status":"PASS","duration":73200,"detail":"Curtain添加成功(下午)"},
{"suite":"WaterDetector_Connect","name":"添加水浸设备(BLE+WiFi)","status":"PASS","duration":98500,"detail":"Water Leak Detector 62添加成功(下午)"},
{"suite":"HubMiniMatter_Connect","name":"[P0][ONES:65336] 添加Hub Mini Matter","status":"PASS","duration":109100,"detail":"HubMiniMatter 0J添加成功(下午)"},
{"suite":"Hub_Connect","name":"[P0][ONES:21787] 添加Hub Mini设备","status":"SKIP","duration":5900,"detail":"Hub Mini 移至 iOS 执行"}
]
}
JSON
echo "已回填下午添加结果(10 条)"
# 2. 逐个串行跑非添加用例(分开调用保证顺序:设备/平台在前=保持 oap107 登录态,账号类在后)
TESTS=(
tests/meter/meter_control.test.ts
tests/bot/bot_card.test.ts
tests/platform/scene_operation.test.ts
tests/platform/create_room.test.ts
tests/platform/message_center.test.ts
tests/platform/feedback.test.ts
tests/auth/third_party_login.test.ts
tests/auth/eu_login.test.ts
tests/auth/register.test.ts
tests/auth/forgot_password.test.ts
tests/auth/delete_account.test.ts
tests/auth/login.test.ts
)
for t in "${TESTS[@]}"; do
echo "----- $(date '+%T')$t -----"
npx vitest run "$t" 2>&1 | grep -E '✓ tests|✗ tests|结果:|通过率|SKIP|PASS|FAIL' | tail -25 || true
done
# 3. 出合并报告(下午添加 + 今晚非添加)
echo "----- 生成合并报告 -----"
npx ts-node scripts/gen-combined.ts AIHub_Android_All
echo "===== $(date '+%F %T') 完成 ====="
} >> "$LOG" 2>&1