fix(android-qa): observe first home and production pause save
This commit is contained in:
@@ -46,7 +46,7 @@ function StartHome([string]$Name) {
|
|||||||
Adb @('shell','input','keyevent','224') | Out-Null
|
Adb @('shell','input','keyevent','224') | Out-Null
|
||||||
Adb @('shell','am','start','-W','-n',$activity) | Out-Null
|
Adb @('shell','am','start','-W','-n',$activity) | Out-Null
|
||||||
$observations=[Collections.Generic.List[object]]::new()
|
$observations=[Collections.Generic.List[object]]::new()
|
||||||
$ready=$false
|
$ready=$false; $pauseRequested=$false
|
||||||
Add-Type -AssemblyName System.Drawing
|
Add-Type -AssemblyName System.Drawing
|
||||||
for($attempt=0;$attempt-lt30;$attempt++) {
|
for($attempt=0;$attempt-lt30;$attempt++) {
|
||||||
$pidText=Adb @('shell','pidof',$package)
|
$pidText=Adb @('shell','pidof',$package)
|
||||||
@@ -64,10 +64,25 @@ function StartHome([string]$Name) {
|
|||||||
if($pixel.R-ge200-and$pixel.G-ge130-and$pixel.B-le120){$gold++}
|
if($pixel.R-ge200-and$pixel.G-ge130-and$pixel.B-le120){$gold++}
|
||||||
if($y-le6-and$pixel.R-lt110-and$pixel.G-lt110-and$pixel.B-lt110){$dark++}
|
if($y-le6-and$pixel.R-lt110-and$pixel.G-lt110-and$pixel.B-lt110){$dark++}
|
||||||
}}
|
}}
|
||||||
|
$dark=0
|
||||||
|
for ($y=[int]($image.Height*.17); $y -lt [int]($image.Height*.28); $y+=4) {
|
||||||
|
for ($x=[int]($image.Width*.39); $x -lt [int]($image.Width*.61); $x+=4) {
|
||||||
|
$pixel=$image.GetPixel($x,$y)
|
||||||
|
if ($pixel.R -lt 110 -and $pixel.G -lt 110 -and $pixel.B -lt 110) { $dark++ }
|
||||||
|
}
|
||||||
|
}
|
||||||
$homeButton=0; foreach($px in @(.36,.64)){foreach($py in @(.53,.61)){$p=$image.GetPixel([int]($image.Width*$px),[int]($image.Height*$py));if($p.R-ge200-and$p.G-ge130-and$p.B-le120){$homeButton++}}}
|
$homeButton=0; foreach($px in @(.36,.64)){foreach($py in @(.53,.61)){$p=$image.GetPixel([int]($image.Width*$px),[int]($image.Height*$py));if($p.R-ge200-and$p.G-ge130-and$p.B-le120){$homeButton++}}}
|
||||||
$ui=$image.Width-gt$image.Height-and$sky-ge200-and$gold-ge10-and$dark-ge2-and$homeButton-eq4
|
$ui=$image.Width-gt$image.Height-and$sky-ge200-and$gold-ge10-and$dark-ge20-and$homeButton-eq4
|
||||||
$observations.Add(@{attempt=$attempt;utc=[DateTime]::UtcNow.ToString('o');pid=$pidText;validAppSave=$validSave;landscape=($image.Width-gt$image.Height);skySamples=$sky;goldButtonSamples=$gold;titleDarkSamples=$dark;homeButtonSamples=$homeButton;readyUi=$ui;png=$png})
|
$observations.Add(@{attempt=$attempt;utc=[DateTime]::UtcNow.ToString('o');pid=$pidText;validAppSave=$validSave;landscape=($image.Width-gt$image.Height);skySamples=$sky;goldButtonSamples=$gold;titleDarkSamples=$dark;titleBoundsNormalized=@(.39,.17,.61,.28);titleStridePixels=4;homeButtonSamples=$homeButton;readyUi=$ui;png=$png})
|
||||||
} finally {$image.Dispose()}
|
} finally {$image.Dispose()}
|
||||||
|
if ($pidText -match '^\d+' -and $ui -and !$validSave -and !$pauseRequested) {
|
||||||
|
$observations[$observations.Count-1] | ConvertTo-Json -Depth 6 | Set-Content -LiteralPath (Join-Path $EvidenceDir "$Name-first-home-without-save.json") -Encoding utf8
|
||||||
|
Check "$Name-first-home-ui" $true 'Actual first Home title/button/PID observed before production pause creates save'
|
||||||
|
Adb @('shell','input','keyevent','3') | Out-Null
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
Adb @('shell','am','start','-W','-n',$activity) | Out-Null
|
||||||
|
$pauseRequested=$true
|
||||||
|
}
|
||||||
if($pidText-match'^\d+'-and$validSave-and$ui){$ready=$true;$saveText|Set-Content (Join-Path $EvidenceDir "$Name-ready-save.json") -Encoding utf8;break}
|
if($pidText-match'^\d+'-and$validSave-and$ui){$ready=$true;$saveText|Set-Content (Join-Path $EvidenceDir "$Name-ready-save.json") -Encoding utf8;break}
|
||||||
}
|
}
|
||||||
$observations.ToArray()|ConvertTo-Json -Depth 6|Set-Content (Join-Path $EvidenceDir "$Name-readiness.json") -Encoding utf8
|
$observations.ToArray()|ConvertTo-Json -Depth 6|Set-Content (Join-Path $EvidenceDir "$Name-readiness.json") -Encoding utf8
|
||||||
|
|||||||
Reference in New Issue
Block a user