Add responsive parity smoke matrix
This commit is contained in:
parent
51672e691e
commit
e61c2a58a7
14 changed files with 191 additions and 67 deletions
|
|
@ -3,7 +3,10 @@ param(
|
|||
[string] $ApkPath = "artifacts\android\eve-debug.apk",
|
||||
[string] $PackageName = "org.gamecult.eve",
|
||||
[string] $ActivityName = ".MainActivity",
|
||||
[int] $LaunchDelaySeconds = 3
|
||||
[int] $LaunchDelaySeconds = 3,
|
||||
[int] $Width = 0,
|
||||
[int] $Height = 0,
|
||||
[switch] $ForceInstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
@ -22,22 +25,39 @@ 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"
|
||||
}
|
||||
$overrideSize = $Width -gt 0 -and $Height -gt 0
|
||||
try {
|
||||
if ($overrideSize) {
|
||||
adb shell am force-stop $PackageName | Out-Host
|
||||
adb shell wm size "${Width}x${Height}" | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb wm size 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"
|
||||
}
|
||||
$installed = adb shell pm path $PackageName
|
||||
if ($ForceInstall -or -not $installed) {
|
||||
adb install -r $absoluteApk | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb install failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
}
|
||||
|
||||
Start-Sleep -Seconds $LaunchDelaySeconds
|
||||
adb shell am start -n "$PackageName/$ActivityName" | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb launch failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$cmdOutput = $absoluteOutput.Replace('\', '\\')
|
||||
cmd /c "adb exec-out screencap -p > `"$absoluteOutput`""
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb screencap failed with exit code $LASTEXITCODE"
|
||||
Start-Sleep -Seconds $LaunchDelaySeconds
|
||||
|
||||
cmd /c "adb exec-out screencap -p > `"$absoluteOutput`""
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "adb screencap failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
} finally {
|
||||
if ($overrideSize) {
|
||||
adb shell wm size reset | Out-Host
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $absoluteOutput) -or (Get-Item $absoluteOutput).Length -le 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue