Add hard parity screenshot smoke
This commit is contained in:
parent
13b8e6e3e9
commit
51672e691e
109 changed files with 4358 additions and 9 deletions
47
scripts/capture-android-screenshot.ps1
Normal file
47
scripts/capture-android-screenshot.ps1
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
param(
|
||||
[string] $OutputPath = "artifacts\parity\android-periwinkle.png",
|
||||
[string] $ApkPath = "artifacts\android\eve-debug.apk",
|
||||
[string] $PackageName = "org.gamecult.eve",
|
||||
[string] $ActivityName = ".MainActivity",
|
||||
[int] $LaunchDelaySeconds = 3
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath }
|
||||
$absoluteApk = if ([System.IO.Path]::IsPathRooted($ApkPath)) { $ApkPath } else { Join-Path $projectRoot $ApkPath }
|
||||
New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null
|
||||
|
||||
$devices = adb devices | Select-String -Pattern "device$"
|
||||
if (-not $devices) {
|
||||
throw "No adb device is connected for Android parity capture."
|
||||
}
|
||||
|
||||
if (-not (Test-Path $absoluteApk)) {
|
||||
throw "Android APK not found: $absoluteApk"
|
||||
}
|
||||
|
||||
adb install -r $absoluteApk | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb install failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
adb shell am start -n "$PackageName/$ActivityName" | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb launch failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Start-Sleep -Seconds $LaunchDelaySeconds
|
||||
|
||||
$cmdOutput = $absoluteOutput.Replace('\', '\\')
|
||||
cmd /c "adb exec-out screencap -p > `"$absoluteOutput`""
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb screencap failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
if (-not (Test-Path $absoluteOutput) -or (Get-Item $absoluteOutput).Length -le 0) {
|
||||
throw "adb screencap did not produce a PNG: $absoluteOutput"
|
||||
}
|
||||
|
||||
Write-Host $absoluteOutput
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
param(
|
||||
[string] $Target = "eve",
|
||||
[string] $OutputDirectory = "artifacts\screenshots"
|
||||
[string] $OutputDirectory = "artifacts\screenshots",
|
||||
[string] $BundleId = "org.gamecult.evecanvas"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$outputRoot = Join-Path $projectRoot $OutputDirectory
|
||||
$outputRoot = if ([System.IO.Path]::IsPathRooted($OutputDirectory)) {
|
||||
$OutputDirectory
|
||||
} else {
|
||||
Join-Path $projectRoot $OutputDirectory
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null
|
||||
|
||||
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
|
|
@ -15,6 +20,8 @@ $remoteDir = "/var/mobile/Library/EveCanvas"
|
|||
$remotePath = "$remoteDir/latest-screenshot.png"
|
||||
$requestPath = "$remoteDir/capture-request"
|
||||
|
||||
ssh $Target "uiopen --bundleid '$BundleId' >/dev/null 2>&1 || true"
|
||||
Start-Sleep -Seconds 1
|
||||
ssh $Target "mkdir -p '$remoteDir' && chown mobile:mobile '$remoteDir' && rm -f '$remotePath' '$requestPath' && touch '$requestPath' && chown mobile:mobile '$requestPath' 2>/dev/null || true"
|
||||
|
||||
$deadline = (Get-Date).AddSeconds(10)
|
||||
|
|
|
|||
39
scripts/capture-flutter-parity.ps1
Normal file
39
scripts/capture-flutter-parity.ps1
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
param(
|
||||
[ValidateSet("windows", "linux")]
|
||||
[string] $Target = "windows",
|
||||
[string] $OutputPath = "artifacts\parity\flutter-windows-cultui-inspector.png"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$flutterRoot = Join-Path $projectRoot "flutter\eve_parity"
|
||||
$flutter = Join-Path $projectRoot "tools\deps\flutter\bin\flutter.bat"
|
||||
$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath }
|
||||
New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null
|
||||
|
||||
if (-not (Test-Path $flutter)) {
|
||||
throw "Flutter is not installed at $flutter"
|
||||
}
|
||||
|
||||
if ($Target -eq "linux" -and $env:OS -like "Windows*") {
|
||||
throw "Linux Flutter screenshot requires a Linux runner; this host is Windows."
|
||||
}
|
||||
|
||||
Push-Location $flutterRoot
|
||||
try {
|
||||
& $flutter test --update-goldens
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Flutter golden smoke failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$golden = Join-Path $flutterRoot "test\goldens\cultui-inspector.png"
|
||||
if (-not (Test-Path $golden) -or (Get-Item $golden).Length -le 0) {
|
||||
throw "Flutter golden did not produce a PNG: $golden"
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath $golden -Destination $absoluteOutput -Force
|
||||
Write-Host $absoluteOutput
|
||||
50
scripts/capture-web-reference.ps1
Normal file
50
scripts/capture-web-reference.ps1
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
param(
|
||||
[string] $ProviderId = "eve.cultui.inspector",
|
||||
[string] $OutputPath = "artifacts\parity\web-cultui-inspector.png",
|
||||
[int] $Port = 8891,
|
||||
[int] $Width = 1280,
|
||||
[int] $Height = 720
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$absoluteOutput = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path $projectRoot $OutputPath }
|
||||
New-Item -ItemType Directory -Force (Split-Path -Parent $absoluteOutput) | Out-Null
|
||||
|
||||
$chrome = @(
|
||||
"$env:ProgramFiles\Google\Chrome\Application\chrome.exe",
|
||||
"${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe"
|
||||
) | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
|
||||
if (-not $chrome) {
|
||||
throw "Chrome is required for web parity capture and was not found."
|
||||
}
|
||||
|
||||
try {
|
||||
$status = (Invoke-WebRequest -UseBasicParsing "http://127.0.0.1:$Port/" -TimeoutSec 2).StatusCode
|
||||
} catch {
|
||||
powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "start-browser-reference.ps1") -Port $Port | Out-Host
|
||||
}
|
||||
|
||||
$url = "http://127.0.0.1:$Port/?provider=$ProviderId"
|
||||
$arguments = @(
|
||||
"--headless=new",
|
||||
"--disable-gpu",
|
||||
"--hide-scrollbars",
|
||||
"--window-size=$Width,$Height",
|
||||
"--virtual-time-budget=2500",
|
||||
"--screenshot=$absoluteOutput",
|
||||
$url
|
||||
)
|
||||
|
||||
& $chrome @arguments | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Chrome screenshot capture failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
if (-not (Test-Path $absoluteOutput) -or (Get-Item $absoluteOutput).Length -le 0) {
|
||||
throw "Chrome screenshot capture did not produce a PNG: $absoluteOutput"
|
||||
}
|
||||
|
||||
Write-Host $absoluteOutput
|
||||
19
scripts/run-parity-harness.ps1
Normal file
19
scripts/run-parity-harness.ps1
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
param(
|
||||
[string] $OutputDirectory = "artifacts\parity"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$env:EVE_PARITY_OUTPUT = if ([System.IO.Path]::IsPathRooted($OutputDirectory)) {
|
||||
$OutputDirectory
|
||||
} else {
|
||||
Join-Path $projectRoot $OutputDirectory
|
||||
}
|
||||
|
||||
Push-Location $projectRoot
|
||||
try {
|
||||
node .\tools\parity\run-parity.mjs
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
116
scripts/run-parity-smoke.ps1
Normal file
116
scripts/run-parity-smoke.ps1
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
param(
|
||||
[string] $ProviderId = "eve.cultui.inspector",
|
||||
[string] $OutputDirectory = "artifacts\parity-smoke",
|
||||
[string] $IosSshTarget = "eve"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
|
||||
$runRoot = Join-Path $projectRoot (Join-Path $OutputDirectory $stamp)
|
||||
New-Item -ItemType Directory -Force $runRoot | Out-Null
|
||||
|
||||
$results = [ordered]@{
|
||||
schema = "gamecult.eve.parity_smoke.v1"
|
||||
generatedAt = (Get-Date).ToUniversalTime().ToString("o")
|
||||
providerId = $ProviderId
|
||||
outputDirectory = $runRoot
|
||||
targets = @()
|
||||
}
|
||||
|
||||
function Add-TargetResult {
|
||||
param(
|
||||
[string] $Id,
|
||||
[string] $Status,
|
||||
[string] $Screenshot = "",
|
||||
[string] $ErrorMessage = ""
|
||||
)
|
||||
|
||||
$results.targets += [ordered]@{
|
||||
id = $Id
|
||||
status = $Status
|
||||
screenshot = $Screenshot
|
||||
error = $ErrorMessage
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-Capture {
|
||||
param(
|
||||
[string] $Id,
|
||||
[scriptblock] $Capture
|
||||
)
|
||||
|
||||
try {
|
||||
$screenshot = & $Capture
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "capture command exited with code $LASTEXITCODE"
|
||||
}
|
||||
Add-TargetResult -Id $Id -Status "pass" -Screenshot ($screenshot | Select-Object -Last 1)
|
||||
} catch {
|
||||
Add-TargetResult -Id $Id -Status "fail" -ErrorMessage $_.Exception.Message
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location $projectRoot
|
||||
try {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\run-parity-harness.ps1 -OutputDirectory (Join-Path $runRoot "semantic") | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Semantic parity harness failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
Invoke-Capture "web" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-web-reference.ps1 `
|
||||
-ProviderId $ProviderId `
|
||||
-OutputPath (Join-Path $runRoot "web-$ProviderId.png")
|
||||
}
|
||||
|
||||
Invoke-Capture "ios" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-eve-screenshot.ps1 `
|
||||
-Target $IosSshTarget `
|
||||
-OutputDirectory $runRoot
|
||||
}
|
||||
|
||||
Invoke-Capture "android" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-android-screenshot.ps1 `
|
||||
-OutputPath (Join-Path $runRoot "android-periwinkle.png")
|
||||
}
|
||||
|
||||
Invoke-Capture "windows" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-flutter-parity.ps1 `
|
||||
-Target windows `
|
||||
-OutputPath (Join-Path $runRoot "windows-flutter-cultui-inspector.png")
|
||||
}
|
||||
|
||||
Invoke-Capture "linux" {
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\capture-flutter-parity.ps1 `
|
||||
-Target linux `
|
||||
-OutputPath (Join-Path $runRoot "linux-flutter-cultui-inspector.png")
|
||||
}
|
||||
|
||||
$jsonPath = Join-Path $runRoot "parity-smoke.json"
|
||||
$mdPath = Join-Path $runRoot "parity-smoke.md"
|
||||
$results | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $jsonPath -Encoding UTF8
|
||||
|
||||
$lines = @(
|
||||
"# Eve Parity Smoke",
|
||||
"",
|
||||
"Generated: $($results.generatedAt)",
|
||||
"Provider: $ProviderId",
|
||||
"",
|
||||
"| Target | Status | Screenshot | Error |",
|
||||
"| --- | --- | --- | --- |"
|
||||
)
|
||||
foreach ($target in $results.targets) {
|
||||
$lines += "| $($target.id) | $($target.status) | $($target.screenshot) | $($target.error) |"
|
||||
}
|
||||
$lines -join "`n" | Set-Content -LiteralPath $mdPath -Encoding UTF8
|
||||
|
||||
Write-Host "Parity smoke report: $mdPath"
|
||||
$failed = @($results.targets | Where-Object { $_.status -ne "pass" })
|
||||
if ($failed.Count -gt 0) {
|
||||
throw "$($failed.Count) parity smoke target(s) failed: $($failed.id -join ', ')"
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
Loading…
Reference in a new issue