Skip to content

The agent that grows with you

test(e2e): follow legacy manual desktop updates

ethernete05b7576fa16
diff --git a/tests/install/e2e-assets/drive-update.cjs b/tests/install/e2e-assets/drive-update.cjs
index 33e4e85af02..f6ec7e69dba 100644
--- a/tests/install/e2e-assets/drive-update.cjs
+++ b/tests/install/e2e-assets/drive-update.cjs
@@ -21,7 +21,7 @@ const fs = require('node:fs')
const { _electron } = require('@playwright/test')
const { prepareWindowForInput } = require('./window-input.cjs')
const { observeProcessClose } = require('./process-close.cjs')
-const { pickAppWindow, openAbout, waitForUpdate } = require('./update-ui.cjs')
+const { pickAppWindow, openAbout, readManualUpdateCommand, waitForUpdate } = require('./update-ui.cjs')
const exePath = process.argv[2]
const proofDir = process.argv[3]
@@ -123,6 +123,18 @@ async function main() {
await new Promise(resolve => setTimeout(resolve, 1200))
await shot(page, '05-updating-overlay')
+ const manualCommand = await readManualUpdateCommand(page)
+ if (manualCommand) {
+ fs.writeFileSync(
+ path.join(proofDir, 'manual-update.json'),
+ `${JSON.stringify({ command: manualCommand, oldSha }, null, 2)}\n`,
+ )
+ log(`OLD requires the manual update path: ${manualCommand}`)
+ await app.close()
+ await waitForProcessClose()
+ return 42
+ }
+
// ── Wait for the hand-off to take over ────────────────────────────────
// Clicking Update now spawns the detached updater (desktop-update.ps1 or
// the staged binary), which claims HERMES_HOME/.hermes-update-in-progress
@@ -182,7 +194,7 @@ async function main() {
}
main()
- .then(() => process.exit(0))
+ .then(code => process.exit(code || 0))
.catch(err => {
console.error(`[drive-update] FAILED: ${err.message}`)
process.exit(1)
diff --git a/tests/install/e2e-assets/launch-from-spec.mjs b/tests/install/e2e-assets/launch-from-spec.mjs
index 460bc674a6f..301c2612873 100644
--- a/tests/install/e2e-assets/launch-from-spec.mjs
+++ b/tests/install/e2e-assets/launch-from-spec.mjs
@@ -30,7 +30,7 @@ import { execFileSync } from 'node:child_process';
import { parseArgs } from 'node:util';
import { _electron } from '@playwright/test';
import { prepareWindowForInput } from './window-input.cjs';
-import { pickAppWindow, openAbout, waitForUpdate } from './update-ui.cjs';
+import { pickAppWindow, openAbout, readManualUpdateCommand, waitForUpdate } from './update-ui.cjs';
import { observeSourceUpdate } from './source-update-observer.mjs';
import { runUpdateWindowChat } from './update-window-chat.mjs';
import { isolateUpdateWindowEnvironment, isolatedElectronArgs, updateWindowEnvironment } from './smoke-env.mjs';
@@ -221,6 +221,18 @@ async function main() {
phase('update-poll');
log('clicked Update now; polling for result file');
+ const manualCommand = await readManualUpdateCommand(window);
+ if (manualCommand) {
+ fs.mkdirSync(values['chat-out'], { recursive: true });
+ fs.writeFileSync(
+ path.join(values['chat-out'], 'manual-update.json'),
+ `${JSON.stringify({ command: manualCommand, oldSha: values['old-sha'] }, null, 2)}\n`,
+ );
+ log(`OLD requires the manual update path: ${manualCommand}`);
+ await app.close();
+ process.exit(42);
+ }
+
// The app may relaunch/exit during the update; completion signals are
// product state, not Playwright events.
const repoDir = values['repo-dir'];
diff --git a/tests/install/e2e-assets/update-ui.cjs b/tests/install/e2e-assets/update-ui.cjs
index 377aec65497..64962fabecd 100644
--- a/tests/install/e2e-assets/update-ui.cjs
+++ b/tests/install/e2e-assets/update-ui.cjs
@@ -104,4 +104,19 @@ async function waitForUpdate(page, { log, shot }) {
return update
}
-module.exports = { pickAppWindow, openAbout, waitForUpdate }
+async function readManualUpdateCommand(page) {
+ const title = page.getByText(/^Update from your terminal$/i).first()
+ try {
+ await title.waitFor({ state: 'visible', timeout: 5_000 })
+ } catch {
+ return null
+ }
+ const text = await page.locator('code').filter({ hasText: /hermes update/i }).first().textContent()
+ const command = (text || '').trim().replace(/^\$\s*/, '')
+ if (!/^hermes update(?:\s|$)/.test(command)) {
+ throw new Error('manual update card did not present a hermes update command')
+ }
+ return command
+}
+
+module.exports = { pickAppWindow, openAbout, readManualUpdateCommand, waitForUpdate }
diff --git a/tests/install/windows-e2e.ps1 b/tests/install/windows-e2e.ps1
index 675b3d43dfb..d25078e424b 100644
--- a/tests/install/windows-e2e.ps1
+++ b/tests/install/windows-e2e.ps1
@@ -492,6 +492,16 @@ function Invoke-HermesUpdate {
Assert-True ($updateExit -eq 0) "hermes update exited $updateExit (expected 0)"
}
+function Invoke-ManualCardUpdate([string]$ReceiptPath, [string]$TargetSha) {
+ Assert-True (Test-Path -LiteralPath $ReceiptPath) "manual update card produced a receipt"
+ $manual = Get-Content -LiteralPath $ReceiptPath -Raw | ConvertFrom-Json
+ Assert-True ($manual.command -match '^hermes update(?:\s|$)') "manual update card instructed hermes update"
+ Invoke-HermesUpdate
+ Assert-True ((Get-InstalledHead) -eq $TargetSha) "manual update landed on target commit"
+ Test-HermesRuns "post-manual-update"
+ Assert-True ($null -ne (Get-DesktopExe)) "Hermes.exe still present after manual update"
+}
+
function Invoke-HermesDesktopAppUpdate([string]$TargetSha) {
# The hermes-desktop launch surface: `hermes desktop` runs its whole
# real pipeline; the driver intercepts the product's final spawn
@@ -540,6 +550,11 @@ function Invoke-HermesDesktopAppUpdate([string]$TargetSha) {
$ErrorActionPreference = $prevEap
}
Confirm-OldChat $chatOut
+ $manualReceipt = Join-Path $chatOut 'manual-update.json'
+ if ($driveExit -eq 42) {
+ Invoke-ManualCardUpdate $manualReceipt $TargetSha
+ return
+ }
Assert-True ($driveExit -eq 0) "app driven via captured hermes desktop spec; update completed"
}
@@ -854,6 +869,12 @@ function Invoke-GuiUpdateDesktopRoute([string]$TargetSha) {
$ErrorActionPreference = $prevEap
}
Confirm-OldChat $proof
+ $manualReceipt = Join-Path $proof 'manual-update.json'
+ if ($driveExit -eq 42) {
+ Invoke-ManualCardUpdate $manualReceipt $TargetSha
+ Invoke-DesktopCheckpoint 'new' $TargetSha 'open-app-update-manual'
+ return
+ }
Assert-True ($driveExit -eq 0) "GUI driver clicked Update now and the app quit for hand-off"
# The detached updater (spawned by the app, NOT by us) now runs