60 行
2.7 KiB
PowerShell
60 行
2.7 KiB
PowerShell
# ==============================================================================
|
|
# BTP-23 Multi-tenant Billing & Domain Settings Test
|
|
# ==============================================================================
|
|
$session = "btp23"
|
|
$evidenceDir = "docs/test-evidence/round-6"
|
|
$billingPng = "$evidenceDir/btp-23-billing.png"
|
|
$tenantPng = "$evidenceDir/btp-23-tenant.png"
|
|
$dualPng = "$evidenceDir/btp-23-tenant-billing.png"
|
|
$initScript = "$evidenceDir/browser-init.js"
|
|
|
|
Write-Host "=================================================================="
|
|
Write-Host "BTP-23 Multi-tenant Billing & Domain Settings Test"
|
|
Write-Host "Session: $session"
|
|
Write-Host "Target: $dualPng"
|
|
Write-Host "=================================================================="
|
|
|
|
# 1. 商业化订阅页面
|
|
Write-Host "`n>>> [Step 1/3] Navigate to http://localhost:5173/settings/billing ..."
|
|
agent-browser --session $session open "http://localhost:5173/settings/billing" --init-script $initScript
|
|
Start-Sleep -Seconds 3
|
|
$snapBilling = agent-browser --session $session snapshot
|
|
$hasPro = ($snapBilling -match "Pro") -or ($snapBilling -match "pro")
|
|
$hasQuota = ($snapBilling -match "18") -or ($snapBilling -match "42") -or ($snapBilling -match "配额")
|
|
|
|
agent-browser --session $session screenshot $billingPng
|
|
Write-Host "Billing screenshot: $billingPng"
|
|
|
|
# 2. 租户自定义域名与 SSL 配置
|
|
Write-Host "`n>>> [Step 2/3] Navigate to http://localhost:5173/settings/tenant ..."
|
|
agent-browser --session $session open "http://localhost:5173/settings/tenant" --init-script $initScript
|
|
Start-Sleep -Seconds 3
|
|
$snapTenant = agent-browser --session $session snapshot
|
|
$hasDomain = ($snapTenant -match "omnicard.ai") -or ($snapTenant -match "brandcorp.com") -or ($snapTenant -match "域名")
|
|
|
|
agent-browser --session $session screenshot $tenantPng
|
|
Write-Host "Tenant screenshot: $tenantPng"
|
|
|
|
# 3. 双联拼接合成
|
|
Write-Host "`n>>> [Step 3/3] Stitching dual screenshots ..."
|
|
Add-Type -AssemblyName System.Drawing
|
|
$img1 = [System.Drawing.Image]::FromFile((Resolve-Path $billingPng).Path)
|
|
$img2 = [System.Drawing.Image]::FromFile((Resolve-Path $tenantPng).Path)
|
|
|
|
$w = [Math]::Max($img1.Width, $img2.Width)
|
|
$h = $img1.Height + $img2.Height
|
|
|
|
$bitmap = New-Object System.Drawing.Bitmap($w, $h)
|
|
$g = [System.Drawing.Graphics]::FromImage($bitmap)
|
|
$g.DrawImage($img1, 0, 0)
|
|
$g.DrawImage($img2, 0, $img1.Height)
|
|
|
|
$bitmap.Save((Resolve-Path $evidenceDir).Path + "/btp-23-tenant-billing.png", [System.Drawing.Imaging.ImageFormat]::Png)
|
|
$g.Dispose()
|
|
$bitmap.Dispose()
|
|
$img1.Dispose()
|
|
$img2.Dispose()
|
|
|
|
Write-Host "Composite screenshot created: $dualPng"
|
|
Write-Host "`n>>> [BTP-23 RESULT]: [PASS] 商业化订阅与租户域名端到端测试 100% 通过!"
|