Skip to content

The agent that grows with you

fix(install-e2e): handle startup zoom restore and legacy Unicode output

ethernet7cfe82a2a7cc
diff --git a/apps/desktop/e2e/window-input.unit.test.ts b/apps/desktop/e2e/window-input.unit.test.ts
index a8870329c2a..d9da8da4663 100644
--- a/apps/desktop/e2e/window-input.unit.test.ts
+++ b/apps/desktop/e2e/window-input.unit.test.ts
@@ -6,6 +6,35 @@ const { prepareWindowForInput } = createRequire(import.meta.url)(
'../../../tests/install/e2e-assets/window-input.cjs',
)
+test('reapplies zoom when startup overwrites the first request', async () => {
+ let requests = 0
+ let factor = 0.9
+
+ const previous = (globalThis as any).hermesDesktop
+
+ ;(globalThis as any).hermesDesktop = { zoom: {
+ setPercent: () => { requests++;
+
+ if (requests > 1) {factor = 1} },
+ get: async () => ({ percent: factor * 100 }),
+ } }
+ const window = { evaluate: async (fn: any) => fn({ webContents: { getZoomFactor: () => factor } }) }
+
+ const page = {
+ evaluate: async (fn: any) => fn(),
+ waitForTimeout: async () => {
+ if (requests === 1) {throw new Error('startup overwrote zoom and the driver never reapplied it')}
+ },
+ }
+
+ try {
+ await prepareWindowForInput({ browserWindow: async () => window }, page)
+ expect(requests).toBeGreaterThan(1)
+ } finally {
+ ;(globalThis as any).hermesDesktop = previous
+ }
+})
+
test('awaits the zoom response instead of accepting a truthy Promise', async () => {
let reads = 0
let factor = 0.9
diff --git a/tests/install/e2e-assets/window-input.cjs b/tests/install/e2e-assets/window-input.cjs
index 8dccfa0ccda..a15dea187de 100644
--- a/tests/install/e2e-assets/window-input.cjs
+++ b/tests/install/e2e-assets/window-input.cjs
@@ -15,7 +15,12 @@ async function prepareWindowForInput(app, page) {
// truthy even when it resolves false. Await each IPC read on the driver.
const deadline = Date.now() + 15_000
for (;;) {
- const state = await page.evaluate(() => globalThis.hermesDesktop.zoom.get())
+ const state = await page.evaluate(() => {
+ // Cold-start restoration can overwrite the first preference write.
+ // Reapply through its owner until a subsequent read observes it.
+ globalThis.hermesDesktop.zoom.setPercent(100)
+ return globalThis.hermesDesktop.zoom.get()
+ })
if (state.percent === 100) break
if (Date.now() >= deadline) throw new Error('timed out waiting for 100% app window zoom')
await page.waitForTimeout(100)
diff --git a/tests/install/windows-e2e.ps1 b/tests/install/windows-e2e.ps1
index e9af0a9ec40..d88aec5de86 100644
--- a/tests/install/windows-e2e.ps1
+++ b/tests/install/windows-e2e.ps1
@@ -114,6 +114,11 @@ param(
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
+# Match an interactive Unicode console when Python output is piped into the
+# UTF-8 transcript. Old releases otherwise select cp1252 and crash on banners.
+$env:PYTHONIOENCODING = "utf-8"
+[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding $false
+$OutputEncoding = [Console]::OutputEncoding
if (-not $RepoRoot) {
$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot "..\..")).Path
@@ -380,7 +385,7 @@ function Invoke-HermesUpdate {
$ErrorActionPreference = $prevEap
}
Write-LogGroup "hermes update transcript" $log
- Assert-True ($updateExit -eq 0) "hermes update exited 0"
+ Assert-True ($updateExit -eq 0) "hermes update exited $updateExit (expected 0)"
}
function Invoke-HermesDesktopAppUpdate([string]$TargetSha) {