# ============================================================================== # BTP-21 NFC Device Ledger & Scene Mode Transition Test # ============================================================================== $session = "btp21" $evidenceDir = "docs/test-evidence/round-6" $screenshotPath = "$evidenceDir/btp-21-nfc-devices.png" $initScript = "$evidenceDir/browser-init.js" Write-Host "==================================================================" Write-Host "BTP-21 NFC Device Ledger & Scene Mode Transition Test" Write-Host "Session: $session" Write-Host "Screenshot: $screenshotPath" Write-Host "==================================================================" # 1. 导航至 NFC 设备台账页 Write-Host "`n>>> [Step 1/3] Navigate to http://localhost:5173/nfc/devices ..." agent-browser --session $session open "http://localhost:5173/nfc/devices" --init-script $initScript Start-Sleep -Seconds 3 # 2. 检查表格与筛选面板 Write-Host "`n>>> [Step 2/3] Inspect NFC device table & filter elements ..." $snapshot = agent-browser --session $session snapshot Write-Host "--- Snapshot Summary ---" Write-Host $snapshot.Substring(0, [Math]::Min(1500, $snapshot.Length)) $hasUS = $snapshot -match "NFC-2026-US-001" $hasEU = $snapshot -match "NFC-2026-EU-002" $hasAE = $snapshot -match "NFC-2026-AE-003" $hasJP = $snapshot -match "NFC-2026-JP-004" Write-Host "`n[Device UID Assertions]:" Write-Host "1. US Metal Card: $(if ($hasUS) { '[PASS]' } else { '[FAIL]' })" Write-Host "2. EU Wood Card: $(if ($hasEU) { '[PASS]' } else { '[FAIL]' })" Write-Host "3. AE PVC Card: $(if ($hasAE) { '[PASS]' } else { '[FAIL]' })" Write-Host "4. JP Card: $(if ($hasJP) { '[PASS]' } else { '[FAIL]' })" # 3. 截取完整证据凭证 Write-Host "`n>>> [Step 3/3] Capturing evidence screenshot ..." agent-browser --session $session screenshot $screenshotPath Write-Host "Screenshot saved: $screenshotPath" if ($hasUS -and $hasEU -and $hasAE) { Write-Host "`n>>> [BTP-21 RESULT]: [PASS] NFC 设备台账端到端测试 100% 通过!" } else { Write-Host "`n>>> [BTP-21 RESULT]: [FAIL] 未完全检测到预期卡片记录" }