Skip to content

The agent that grows with you

test(e2e): canonicalize relaunched desktop identity

etherneta1ea20c605e2
diff --git a/tests/install/e2e-assets/desktop-smoke-windows.ps1 b/tests/install/e2e-assets/desktop-smoke-windows.ps1
index 70209317926..e04d7254e57 100644
--- a/tests/install/e2e-assets/desktop-smoke-windows.ps1
+++ b/tests/install/e2e-assets/desktop-smoke-windows.ps1
@@ -25,7 +25,12 @@ function Start-DesktopJourneyMock([string]$Node, [string]$Assets, [string]$Work,
}
function Close-VerifiedDesktop([string]$Exe, [int]$ProcessId = 0) {
- $rows = @(Get-CimInstance Win32_Process | Where-Object { $_.ExecutablePath -and $_.ExecutablePath -ieq $Exe })
+ # The detached updater canonicalizes the WorkRoot path while the driver can
+ # retain ``..`` segments. Compare executable identity, not path spelling.
+ $expectedExe = [IO.Path]::GetFullPath($Exe)
+ $rows = @(Get-CimInstance Win32_Process | Where-Object {
+ $_.ExecutablePath -and [IO.Path]::GetFullPath($_.ExecutablePath) -ieq $expectedExe
+ })
$windows = @($rows | ForEach-Object { Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue } | Where-Object { $_.MainWindowHandle -ne 0 })
if ($ProcessId) { $windows = @($windows | Where-Object { $_.Id -eq $ProcessId }) }
if ($windows.Count -ne 1) { throw 'Cannot identify exactly one verified desktop window to close normally' }