Skip to content

The agent that grows with you

test(e2e): close app-update relaunch before smoke

ethernet8db6f6265d7b
diff --git a/tests/install/e2e-assets/desktop-smoke-windows.ps1 b/tests/install/e2e-assets/desktop-smoke-windows.ps1
index e04d7254e57..caf3e2d9c8b 100644
--- a/tests/install/e2e-assets/desktop-smoke-windows.ps1
+++ b/tests/install/e2e-assets/desktop-smoke-windows.ps1
@@ -24,14 +24,18 @@ function Start-DesktopJourneyMock([string]$Node, [string]$Assets, [string]$Work,
}
}
-function Close-VerifiedDesktop([string]$Exe, [int]$ProcessId = 0) {
+function Get-VerifiedDesktopWindows([string]$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 })
+ return @($rows | ForEach-Object { Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue } | Where-Object { $_.MainWindowHandle -ne 0 })
+}
+
+function Close-VerifiedDesktop([string]$Exe, [int]$ProcessId = 0) {
+ $windows = @(Get-VerifiedDesktopWindows $Exe)
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' }
$window = $windows[0]
diff --git a/tests/install/windows-e2e.ps1 b/tests/install/windows-e2e.ps1
index e71d8c11171..3fa6820b936 100644
--- a/tests/install/windows-e2e.ps1
+++ b/tests/install/windows-e2e.ps1
@@ -556,6 +556,20 @@ function Invoke-HermesDesktopAppUpdate([string]$TargetSha) {
return
}
Assert-True ($driveExit -eq 0) "app driven via captured hermes desktop spec; update completed"
+
+ # The production updater relaunches Hermes. Close that verified window
+ # normally so the test-owned checkpoint starts and owns its own backend.
+ $desktopExe = Get-DesktopExe
+ $deadline = (Get-Date).AddMinutes(5)
+ $windows = @()
+ while ((Get-Date) -lt $deadline) {
+ $windows = @(Get-VerifiedDesktopWindows $desktopExe)
+ if ($windows.Count -eq 1) { break }
+ Start-Sleep -Seconds 2
+ }
+ Assert-True ($windows.Count -eq 1) "updated desktop relaunched exactly one verified window"
+ $script:ChatFailure = $true
+ Close-VerifiedDesktop $desktopExe $windows[0].Id
}
function Save-DesktopScreenshot([string]$OutFile) {