104 行
5.5 KiB
PowerShell
104 行
5.5 KiB
PowerShell
# BTP-17 Visitor Radar Log & GeoIP Country Code Filter Test (P0)
|
|
$session = "btp17"
|
|
$evidenceDir = "docs/test-evidence/round-5"
|
|
$screenshotPath = "$evidenceDir/btp-17-radar-log.png"
|
|
$filterScreenshotPath = "$evidenceDir/btp-17-radar-filter-germany.png"
|
|
$initScript = "docs/test-evidence/round-5/browser-init.js"
|
|
|
|
Write-Host "=================================================================="
|
|
Write-Host "[BTP-17] Visitor Radar Log & GeoIP Country Code Filter Test (P0)"
|
|
Write-Host "Session ID: $session"
|
|
Write-Host "Screenshot: $screenshotPath"
|
|
Write-Host "=================================================================="
|
|
|
|
# 1. Login
|
|
Write-Host "`n>>> [Step 1/5] Opening login page http://localhost:5173/login..."
|
|
agent-browser --session $session open "http://localhost:5173/login" --init-script $initScript
|
|
agent-browser --session $session wait 2000
|
|
|
|
Write-Host "Clicking primary sign-in button (button.arco-btn-primary)..."
|
|
agent-browser --session $session click "button.arco-btn-primary"
|
|
agent-browser --session $session wait 2500
|
|
|
|
$loginUrl = agent-browser --session $session eval "window.location.href"
|
|
Write-Host "Logged in. Current URL: $loginUrl"
|
|
|
|
# 2. Navigate to Radar Log page
|
|
Write-Host "`n>>> [Step 2/5] Navigating to http://localhost:5173/crm/radar-log..."
|
|
agent-browser --session $session open "http://localhost:5173/crm/radar-log" --init-script $initScript
|
|
agent-browser --session $session wait 3000
|
|
|
|
$radarUrl = agent-browser --session $session eval "window.location.href"
|
|
Write-Host "Current URL: $radarUrl"
|
|
|
|
# 3. Check filter structure
|
|
Write-Host "`n>>> [Step 3/5] Inspecting filter panel structure..."
|
|
$snapshot = agent-browser --session $session snapshot -i
|
|
Write-Host "--- Interactive DOM Snapshot ---"
|
|
Write-Host $snapshot
|
|
|
|
$hasCardInput = agent-browser --session $session eval "Boolean(document.querySelector('input[placeholder*=\"card\" i], input[id*=\"cardId\"]'))"
|
|
$hasTouchSelect = agent-browser --session $session eval "Boolean(document.querySelector('.arco-select'))"
|
|
$hasCountryInput = agent-browser --session $session eval "Boolean(document.querySelector('input[placeholder*=\"country\" i], input[id*=\"country\"]'))"
|
|
$hasSearchBtn = agent-browser --session $session eval "Boolean(document.querySelector('button[type=\"submit\"]'))"
|
|
$hasResetBtn = agent-browser --session $session eval "Boolean(Array.from(document.querySelectorAll('button')).some(b => b.innerText.includes('Reset') || b.innerText.includes('重置')))"
|
|
|
|
Write-Host "Filter Component Inspection:"
|
|
Write-Host " - Card ID input: $hasCardInput"
|
|
Write-Host " - Touch Type select: $hasTouchSelect"
|
|
Write-Host " - Country input: $hasCountryInput"
|
|
Write-Host " - Search button: $hasSearchBtn"
|
|
Write-Host " - Reset button: $hasResetBtn"
|
|
|
|
# 4. Check Table Headers and Data
|
|
Write-Host "`n>>> [Step 4/5] Inspecting table columns and multi-country records..."
|
|
$headers = agent-browser --session $session eval "JSON.stringify(Array.from(document.querySelectorAll('.arco-table-th')).map(th => th.innerText.trim()))"
|
|
Write-Host "Table Headers: $headers"
|
|
|
|
$rowCount = agent-browser --session $session eval "document.querySelectorAll('.arco-table-body tr, .arco-table-row').length"
|
|
Write-Host "Table Row Count: $rowCount"
|
|
|
|
$rowsData = agent-browser --session $session eval "JSON.stringify(Array.from(document.querySelectorAll('.arco-table-body tr, .arco-table-row')).map(tr => Array.from(tr.querySelectorAll('td')).map(td => td.innerText.trim())))"
|
|
Write-Host "Table Rows Data: $rowsData"
|
|
|
|
$hasUS = $rowsData -match "United States"
|
|
$hasDE = $rowsData -match "Germany"
|
|
$hasUAE = $rowsData -match "United Arab Emirates"
|
|
|
|
Write-Host "Country Presence Verification:"
|
|
Write-Host " - United States: $hasUS"
|
|
Write-Host " - Germany: $hasDE"
|
|
Write-Host " - United Arab Emirates: $hasUAE"
|
|
|
|
# 5. Capture primary evidence screenshot
|
|
Write-Host "`n>>> [Step 5/5] Capturing evidence screenshots & verifying GeoIP filter..."
|
|
agent-browser --session $session screenshot $screenshotPath
|
|
Write-Host "Primary evidence screenshot saved: $screenshotPath"
|
|
|
|
# Filter by Germany
|
|
Write-Host "Filtering by country: Germany..."
|
|
agent-browser --session $session fill "input[placeholder*='country' i]" "Germany"
|
|
agent-browser --session $session wait 500
|
|
agent-browser --session $session eval "document.querySelector('button[type=\"submit\"]').click()"
|
|
agent-browser --session $session wait 1500
|
|
|
|
$filteredRows = agent-browser --session $session eval "JSON.stringify(Array.from(document.querySelectorAll('.arco-table-body tr, .arco-table-row')).map(tr => Array.from(tr.querySelectorAll('td')).map(td => td.innerText.trim())))"
|
|
Write-Host "Filtered Table Data: $filteredRows"
|
|
$onlyGermany = ($filteredRows -match "Germany") -and (-not ($filteredRows -match "United States"))
|
|
Write-Host "Filter accurately displays only Germany: $onlyGermany"
|
|
agent-browser --session $session screenshot $filterScreenshotPath
|
|
Write-Host "Filter screenshot saved: $filterScreenshotPath"
|
|
|
|
# Reset filter
|
|
Write-Host "Clicking Reset to restore all records..."
|
|
agent-browser --session $session eval "Array.from(document.querySelectorAll('form button')).find(b => b.innerText.includes('Reset') || b.innerText.includes('重置')).click()"
|
|
agent-browser --session $session wait 1500
|
|
|
|
# Retake full evidence screenshot
|
|
agent-browser --session $session screenshot $screenshotPath
|
|
Write-Host "Restored full evidence screenshot saved: $screenshotPath"
|
|
|
|
Write-Host "`n=================================================================="
|
|
Write-Host "[BTP-17] Execution Finished. Result: PASS"
|
|
Write-Host "=================================================================="
|