#requires -Version 7.0
param([string]$Package = (Join-Path $PSScriptRoot '../artifacts/package-fetch-fix-20261004'))
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
$taskPackage = [IO.Path]::GetFullPath($Package)
$taskRun = Join-Path $taskRoot 'artifacts/fetch-game-validation-20261004'
$taskOrigin = 'http://127.0.0.1:18444'
$taskGame = 'D:\Warframe'
$taskRuntime = Join-Path $taskRun 'runtime'
$taskInstaller = Join-Path $taskPackage 'Client/Installer/XFEWarframe.Installer.exe'
$taskServerExe = Join-Path $taskPackage 'Server/XFEWarframe.Server.exe'
if (Get-Process -Name Warframe.x64 -ErrorAction SilentlyContinue) { throw 'A game is already running. This test must use its own copied game.' }
foreach ($taskPort in @(18443,18444)) {
$taskProbe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback,$taskPort)
try { $taskProbe.Start() } finally { $taskProbe.Stop() }
}
New-Item -ItemType Directory -Path $taskRun -Force | Out-Null
$taskServer = Start-Process -FilePath $taskServerExe -WorkingDirectory (Split-Path $taskServerExe) -ArgumentList @('"--root=' + $taskRuntime + '"','--port=18444','--game-port=18443','--no-irc') -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $taskRun 'server-stdout.log') -RedirectStandardError (Join-Path $taskRun 'server-stderr.log')
$taskKeep = $false
try {
$taskReady = $false
for ($taskAttempt = 0; $taskAttempt -lt 80; $taskAttempt++) {
if ($taskServer.HasExited) { throw 'The isolated server exited.' }
try { $null = Invoke-RestMethod "$taskOrigin/health" -TimeoutSec 1; $taskReady = $true; break } catch { Start-Sleep -Milliseconds 250 }
}
if (-not $taskReady) { throw 'The isolated server did not become ready.' }
$taskConfig = Get-Content -LiteralPath (Join-Path $taskRuntime 'server.json') -Raw | ConvertFrom-Json
$taskHeaders = @{ Authorization = 'Bearer ' + $taskConfig.AdminToken }
function Send-TestBody($Url, $Body) {
Invoke-RestMethod $Url -Headers $taskHeaders -Method Post -ContentType 'application/json' -Body ([Text.Encoding]::UTF8.GetBytes(($Body | ConvertTo-Json -Depth 90 -Compress)))
}
# Same dedicated native-login test identity, in a separate Fetch-only server root.
$taskLogin = @{ email='multi-ability@example.invalid'; password='LocalAbilityCheck!2026' }
try { $null = Send-TestBody "$taskOrigin/control/v1/accounts" ($taskLogin + @{ displayName='FetchRangeCheck' }) }
catch { if ([int]$_.Exception.Response.StatusCode -ne 409) { throw } }
$taskSession = Invoke-RestMethod "$taskOrigin/player/v1/login" -Method Post -ContentType 'application/json' -Body ($taskLogin | ConvertTo-Json -Compress)
$taskAccount = $taskSession.profile.id
$taskAccountUrl = "$taskOrigin/control/v1/accounts/$taskAccount"
$null = Send-TestBody "$taskAccountUrl/kick" @{}
$null = Send-TestBody "$taskAccountUrl/tutorial" @{ skipTutorial=$true }
$taskPetType = '/Lotus/Types/Game/KubrowPet/RetrieverKubrowPetPowerSuit'
$taskFetchType = '/Lotus/Upgrades/XFEWarframe/FetchOverdrive'
$taskInventory = Invoke-RestMethod "$taskAccountUrl/export" -Headers $taskHeaders
foreach ($taskType in @($taskPetType, $taskFetchType)) {
if (-not (@($taskInventory.KubrowPets) + @($taskInventory.Upgrades) | Where-Object ItemType -EQ $taskType)) {
$null = Send-TestBody "$taskAccountUrl/item" @{type=$taskType;count=1}
}
}
$taskInventory = Invoke-RestMethod "$taskAccountUrl/export" -Headers $taskHeaders
$taskPet = @($taskInventory.KubrowPets | Where-Object ItemType -EQ $taskPetType)[0]
$taskFetch = @($taskInventory.Upgrades | Where-Object ItemType -EQ $taskFetchType)[0]
$taskSuit = @($taskInventory.Suits)[0]
$taskSuit.XP = 900000
$taskPet.XP = 900000
$taskPet.Details.Name = 'FetchRangeCheck'
$taskPet.Details.IsPuppy = $false
$taskPet.Details.HasCollar = $true
$taskPet.Details.Status = 'STATUS_AVAILABLE'
$taskPet.Details.HatchDate = @{ '$date'=@{ '$numberLong'='0' } }
$taskOriginalId = [Guid]::NewGuid().ToString('N').Substring(0,24)
$taskInventory.Upgrades += @{ItemId=@{'$oid'=$taskOriginalId};ItemType='/Lotus/Types/Sentinels/SentinelPrecepts/BeastUniversalVacuum';UpgradeFingerprint='{"lvl":5}'}
$taskPet | Add-Member -NotePropertyName Configs -NotePropertyValue @(
@{Name='A - 300m';Upgrades=@($taskFetch.ItemId.'$oid') + @('')*9},
@{Name='B - No Fetch';Upgrades=@('')*10},
@{Name='C - Original Fetch';Upgrades=@($taskOriginalId) + @('')*9}) -Force
if (@($taskInventory.LoadOutPresets.SENTINEL).Count -eq 0) {
$taskInventory.LoadOutPresets.SENTINEL = @(@{ItemId=@{'$oid'=[Guid]::NewGuid().ToString('N').Substring(0,24)};n='Fetch test';s=@{}})
}
foreach ($taskSelection in @(@{key='NORMAL';id=$taskSuit.ItemId.'$oid'},@{key='SENTINEL';id=$taskPet.ItemId.'$oid'})) {
$taskInventory.LoadOutPresets.($taskSelection.key)[0].s = @{ItemId=@{'$oid'=$taskSelection.id};mod=0;cus=0}
}
$taskInventory.CurrentLoadOutIds = @($taskInventory.LoadOutPresets.NORMAL[0].ItemId,$taskInventory.LoadOutPresets.SENTINEL[0].ItemId)
$null = Send-TestBody "$taskAccountUrl/import" @{inventory=$taskInventory}
$taskLaunch = & $taskInstaller launch --game $taskGame --language zh --server $taskOrigin --game-test-control 2>&1
$taskLaunch | Tee-Object -FilePath (Join-Path $taskRun 'launch.log')
if ($LASTEXITCODE -ne 0) { throw 'Starting the copied game failed.' }
$taskMatch = [regex]::Match(($taskLaunch -join "`n"), 'Game PID: (\d+)')
if (-not $taskMatch.Success) { throw 'The launcher did not return a game process.' }
@{serverPid=$taskServer.Id;gamePid=[int]$taskMatch.Groups[1].Value;origin=$taskOrigin;runtime=$taskRuntime;accountId=$taskAccount;suitId=$taskSuit.ItemId.'$oid';petId=$taskPet.ItemId.'$oid';fetchId=$taskFetch.ItemId.'$oid';originalFetchId=$taskOriginalId;package=$taskPackage} | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $taskRun 'session.json') -Encoding utf8
$taskKeep = $true
& (Join-Path $PSScriptRoot 'Test-MultiAbilityGame.ps1') -SessionFile (Join-Path $taskRun 'session.json') -CryptoAssembly (Join-Path $taskPackage 'Server/BouncyCastle.Cryptography.dll') -ReportDirectory (Join-Path $taskRun 'login-validation') -LoginOnly
Write-Output "Fetch test session: $taskRun/session.json"
} finally {
if (-not $taskKeep -and -not $taskServer.HasExited) { Stop-Process -Id $taskServer.Id }
$taskServer.Dispose()
}
#requires -Version 7.0
param([string]$Package = (Join-Path $PSScriptRoot '../artifacts/package-fetch-fix-20261004'))
$ErrorActionPreference = 'Stop'
$taskRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
$taskPackage = [IO.Path]::GetFullPath($Package)
$taskRun = Join-Path $taskRoot 'artifacts/fetch-game-validation-20261004'
$taskOrigin = 'http://127.0.0.1:18444'
$taskGame = 'D:\Warframe'
$taskRuntime = Join-Path $taskRun 'runtime'
$taskInstaller = Join-Path $taskPackage 'Client/Installer/XFEWarframe.Installer.exe'
$taskServerExe = Join-Path $taskPackage 'Server/XFEWarframe.Server.exe'
if (Get-Process -Name Warframe.x64 -ErrorAction SilentlyContinue) { throw 'A game is already running. This test must use its own copied game.' }
foreach ($taskPort in @(18443,18444)) {
$taskProbe = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback,$taskPort)
try { $taskProbe.Start() } finally { $taskProbe.Stop() }
}
New-Item -ItemType Directory -Path $taskRun -Force | Out-Null
$taskServer = Start-Process -FilePath $taskServerExe -WorkingDirectory (Split-Path $taskServerExe) -ArgumentList @('"--root=' + $taskRuntime + '"','--port=18444','--game-port=18443','--no-irc') -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $taskRun 'server-stdout.log') -RedirectStandardError (Join-Path $taskRun 'server-stderr.log')
$taskKeep = $false
try {
$taskReady = $false
for ($taskAttempt = 0; $taskAttempt -lt 80; $taskAttempt++) {
if ($taskServer.HasExited) { throw 'The isolated server exited.' }
try { $null = Invoke-RestMethod "$taskOrigin/health" -TimeoutSec 1; $taskReady = $true; break } catch { Start-Sleep -Milliseconds 250 }
}
if (-not $taskReady) { throw 'The isolated server did not become ready.' }
$taskConfig = Get-Content -LiteralPath (Join-Path $taskRuntime 'server.json') -Raw | ConvertFrom-Json
$taskHeaders = @{ Authorization = 'Bearer ' + $taskConfig.AdminToken }
function Send-TestBody($Url, $Body) {
Invoke-RestMethod $Url -Headers $taskHeaders -Method Post -ContentType 'application/json' -Body ([Text.Encoding]::UTF8.GetBytes(($Body | ConvertTo-Json -Depth 90 -Compress)))
}
# Same dedicated native-login test identity, in a separate Fetch-only server root.
$taskLogin = @{ email='multi-ability@example.invalid'; password='LocalAbilityCheck!2026' }
try { $null = Send-TestBody "$taskOrigin/control/v1/accounts" ($taskLogin + @{ displayName='FetchRangeCheck' }) }
catch { if ([int]$_.Exception.Response.StatusCode -ne 409) { throw } }
$taskSession = Invoke-RestMethod "$taskOrigin/player/v1/login" -Method Post -ContentType 'application/json' -Body ($taskLogin | ConvertTo-Json -Compress)
$taskAccount = $taskSession.profile.id
$taskAccountUrl = "$taskOrigin/control/v1/accounts/$taskAccount"
$null = Send-TestBody "$taskAccountUrl/kick" @{}
$null = Send-TestBody "$taskAccountUrl/tutorial" @{ skipTutorial=$true }
$taskPetType = '/Lotus/Types/Game/KubrowPet/RetrieverKubrowPetPowerSuit'
$taskFetchType = '/Lotus/Upgrades/XFEWarframe/FetchOverdrive'
$taskInventory = Invoke-RestMethod "$taskAccountUrl/export" -Headers $taskHeaders
foreach ($taskType in @($taskPetType, $taskFetchType)) {
if (-not (@($taskInventory.KubrowPets) + @($taskInventory.Upgrades) | Where-Object ItemType -EQ $taskType)) {
$null = Send-TestBody "$taskAccountUrl/item" @{type=$taskType;count=1}
}
}
$taskInventory = Invoke-RestMethod "$taskAccountUrl/export" -Headers $taskHeaders
$taskPet = @($taskInventory.KubrowPets | Where-Object ItemType -EQ $taskPetType)[0]
$taskFetch = @($taskInventory.Upgrades | Where-Object ItemType -EQ $taskFetchType)[0]
$taskSuit = @($taskInventory.Suits)[0]
$taskSuit.XP = 900000
$taskPet.XP = 900000
$taskPet.Details.Name = 'FetchRangeCheck'
$taskPet.Details.IsPuppy = $false
$taskPet.Details.HasCollar = $true
$taskPet.Details.Status = 'STATUS_AVAILABLE'
$taskPet.Details.HatchDate = @{ '$date'=@{ '$numberLong'='0' } }
$taskOriginalId = [Guid]::NewGuid().ToString('N').Substring(0,24)
$taskInventory.Upgrades += @{ItemId=@{'$oid'=$taskOriginalId};ItemType='/Lotus/Types/Sentinels/SentinelPrecepts/BeastUniversalVacuum';UpgradeFingerprint='{"lvl":5}'}
$taskPet | Add-Member -NotePropertyName Configs -NotePropertyValue @(
@{Name='A - 300m';Upgrades=@($taskFetch.ItemId.'$oid') + @('')*9},
@{Name='B - No Fetch';Upgrades=@('')*10},
@{Name='C - Original Fetch';Upgrades=@($taskOriginalId) + @('')*9}) -Force
if (@($taskInventory.LoadOutPresets.SENTINEL).Count -eq 0) {
$taskInventory.LoadOutPresets.SENTINEL = @(@{ItemId=@{'$oid'=[Guid]::NewGuid().ToString('N').Substring(0,24)};n='Fetch test';s=@{}})
}
foreach ($taskSelection in @(@{key='NORMAL';id=$taskSuit.ItemId.'$oid'},@{key='SENTINEL';id=$taskPet.ItemId.'$oid'})) {
$taskInventory.LoadOutPresets.($taskSelection.key)[0].s = @{ItemId=@{'$oid'=$taskSelection.id};mod=0;cus=0}
}
$taskInventory.CurrentLoadOutIds = @($taskInventory.LoadOutPresets.NORMAL[0].ItemId,$taskInventory.LoadOutPresets.SENTINEL[0].ItemId)
$null = Send-TestBody "$taskAccountUrl/import" @{inventory=$taskInventory}
$taskLaunch = & $taskInstaller launch --game $taskGame --language zh --server $taskOrigin --game-test-control 2>&1
$taskLaunch | Tee-Object -FilePath (Join-Path $taskRun 'launch.log')
if ($LASTEXITCODE -ne 0) { throw 'Starting the copied game failed.' }
$taskMatch = [regex]::Match(($taskLaunch -join "`n"), 'Game PID: (\d+)')
if (-not $taskMatch.Success) { throw 'The launcher did not return a game process.' }
@{serverPid=$taskServer.Id;gamePid=[int]$taskMatch.Groups[1].Value;origin=$taskOrigin;runtime=$taskRuntime;accountId=$taskAccount;suitId=$taskSuit.ItemId.'$oid';petId=$taskPet.ItemId.'$oid';fetchId=$taskFetch.ItemId.'$oid';originalFetchId=$taskOriginalId;package=$taskPackage} | ConvertTo-Json | Set-Content -LiteralPath (Join-Path $taskRun 'session.json') -Encoding utf8
$taskKeep = $true
& (Join-Path $PSScriptRoot 'Test-MultiAbilityGame.ps1') -SessionFile (Join-Path $taskRun 'session.json') -CryptoAssembly (Join-Path $taskPackage 'Server/BouncyCastle.Cryptography.dll') -ReportDirectory (Join-Path $taskRun 'login-validation') -LoginOnly
Write-Output "Fetch test session: $taskRun/session.json"
} finally {
if (-not $taskKeep -and -not $taskServer.HasExited) { Stop-Process -Id $taskServer.Id }
$taskServer.Dispose()
}