48 lines
2.6 KiB
PowerShell
48 lines
2.6 KiB
PowerShell
param([switch]$StartAtLogin)
|
|
$ErrorActionPreference='Stop'
|
|
$output='C:/projects/ft/CodexOutput/upserver'
|
|
function Record([string]$name,[string[]]$commandArgs){
|
|
$raw=& uloop @commandArgs --project-path C:/projects/ft/Client
|
|
if($LASTEXITCODE -ne 0){throw "CLI failed: $name"}
|
|
$raw|Set-Content -LiteralPath "$output/$name.json" -Encoding utf8
|
|
$data=($raw -join "`n")|ConvertFrom-Json
|
|
if($data.Success -eq $false){throw "Tool failed: $name"}
|
|
return $data
|
|
}
|
|
$ids=if($StartAtLogin){@('101','102','101')}else{@('102','101')}
|
|
$first=$true
|
|
foreach($id in $ids){
|
|
$prefix="acceptance-progress-$id"
|
|
if(-not ($StartAtLogin -and $first)){
|
|
$exitResult=Record "$prefix-exit" @('execute-dynamic-code','--code-file',"$output/uloop-exit-production-path.cs")
|
|
if(-not $exitResult.Result.Contains('OldHubConnected=False') -or -not $exitResult.Result.Contains('OldUserAuthorized=False')){throw 'Exit failed'}
|
|
}
|
|
$first=$false
|
|
$inputFile=if($id -eq '102'){'uloop-set-login-102.cs'}else{'uloop-set-login-id.cs'}
|
|
$ready=$false
|
|
for($i=0;$i -lt 20;$i++){
|
|
$r=Record "$prefix-input" @('execute-dynamic-code','--code-file',"$output/$inputFile")
|
|
if($r.Result -eq "Active login input set to $id; no submit"){$ready=$true;break}
|
|
Start-Sleep -Seconds 3
|
|
}
|
|
if(-not $ready){throw 'Login input not ready'}
|
|
$ui=Record "$prefix-ui" @('screenshot','--window-name','Game','--capture-mode','rendering','--annotate-elements','true','--elements-only','true')
|
|
$buttons=@($ui.Screenshots.AnnotatedElements|Where-Object Path -eq 'PFLoginAct(Clone)/CustomId/Dialog/OKButton')
|
|
if($buttons.Count -ne 1){throw 'Ambiguous login button'}
|
|
$null=Record "$prefix-click" @('simulate-mouse-ui','--action','Click','--x',"$($buttons[0].SimX)",'--y',"$($buttons[0].SimY)")
|
|
$ready=$false
|
|
for($i=0;$i -lt 20;$i++){
|
|
Start-Sleep -Seconds 3
|
|
$r=Record "$prefix-after" @('execute-dynamic-code','--code-file',"$output/acceptance-progress-read.cs")
|
|
if($r.Result.StartsWith("ApiPlayerId=$id;")){$ready=$true;break}
|
|
}
|
|
if(-not $ready){throw 'Authenticated progress not available'}
|
|
$errors=Record "$prefix-errors" @('get-logs','--log-type','Error','--max-count','100','--include-stack-trace','true')
|
|
if($errors.TotalCount -ne 0){throw 'New runtime errors'}
|
|
Write-Output "$id authenticated, snapshot saved, errors=0"
|
|
}
|
|
$before=Get-Content "$output/acceptance-progress-101-before.json" -Raw|ConvertFrom-Json
|
|
$after=Get-Content "$output/acceptance-progress-101-after.json" -Raw|ConvertFrom-Json
|
|
if($before.Result -ne $after.Result){throw '101 sampled progress changed; inspect snapshots'}
|
|
Write-Output '101 sampled identity/core progress unchanged after 101 -> 102 -> 101'
|