Skip to content

The agent that grows with you

style(e2e/desktop): eslint --fix on the update suite

teknium1db2e88cc0aed
diff --git a/apps/desktop/e2e/update/app-update.spec.ts b/apps/desktop/e2e/update/app-update.spec.ts
index 432640b24b9..95049be23f7 100644
--- a/apps/desktop/e2e/update/app-update.spec.ts
+++ b/apps/desktop/e2e/update/app-update.spec.ts
@@ -24,6 +24,7 @@ import { recordWebSockets, send, waitForInteractive } from '../core/harness'
import {
backendServeProcesses,
clickUpdateNowAndExpectHandoff,
+ closeQuietly,
currentAs,
desktopLog,
desktopMainProcesses,
@@ -36,8 +37,7 @@ import {
publishUpstream,
startInstallSession,
waitFor,
- waitForUpdateOffer,
- closeQuietly
+ waitForUpdateOffer
} from './harness'
const RUN = Date.now().toString(36)
@@ -82,6 +82,7 @@ test('clicking Update now moves the backend to the new commit, relaunches the ap
expect(git(facts.checkout, 'rev-parse', 'HEAD'), 'the backend checkout is on the new upstream commit').toBe(
target
)
+
// The updater's progress window can be the same Electron binary (--app=http://127.0.0.1:...): not a relaunch.
const relaunched = await waitFor(
'the app to relaunch itself',
@@ -91,6 +92,7 @@ test('clicking Update now moves the backend to the new commit, relaunches the ap
),
{ timeout: 3 * 60_000, interval: 1_000, explain: () => explain(`handoff log:\n${handoffLog(facts)}`) }
)
+
await waitFor(
'the relaunched app to log the update result',
() => /\[updates\] detached update (finished|FAILED)/.test(desktopLog(facts)),
diff --git a/apps/desktop/e2e/update/build-fail.spec.ts b/apps/desktop/e2e/update/build-fail.spec.ts
index 9bb9a291876..0817489b065 100644
--- a/apps/desktop/e2e/update/build-fail.spec.ts
+++ b/apps/desktop/e2e/update/build-fail.spec.ts
@@ -58,10 +58,12 @@ test('a Desktop build failure during Update now is reported to the user as a fai
() => /\[updates\] detached update (finished|FAILED)/.test(desktopLog(facts)),
{ timeout: 12 * 60_000, interval: 2_000, explain }
)
+
const outcome = desktopLog(facts)
.split('\n')
.filter(line => /\[updates\] detached update/.test(line))
.join('\n')
+
expect(outcome, `the update is reported as FAILED, not finished\n${explain()}`).toMatch(/detached update FAILED/)
expect(outcome).not.toMatch(/detached update finished OK/)
expect(
diff --git a/apps/desktop/e2e/update/first-run.spec.ts b/apps/desktop/e2e/update/first-run.spec.ts
index fef9ef69286..05c82c17160 100644
--- a/apps/desktop/e2e/update/first-run.spec.ts
+++ b/apps/desktop/e2e/update/first-run.spec.ts
@@ -23,14 +23,14 @@ import { recordWebSockets, send, waitForInteractive } from '../core/harness'
import {
backendServeProcesses,
+ closeQuietly,
diagnostics,
firstRunScreensSeen,
type InstallFacts,
installFirstRunSampler,
installProcesses,
launchInstalledApp,
- startInstallSession,
- closeQuietly
+ startInstallSession
} from './harness'
const RUN = Date.now().toString(36)
diff --git a/apps/desktop/e2e/update/github-edge.ts b/apps/desktop/e2e/update/github-edge.ts
index 954ab445615..6dee01806db 100644
--- a/apps/desktop/e2e/update/github-edge.ts
+++ b/apps/desktop/e2e/update/github-edge.ts
@@ -110,6 +110,7 @@ function apiHandler(origin: string, hits: string[]) {
return (req: http.IncomingMessage, res: http.ServerResponse) => {
const url = new URL(req.url ?? '/', 'https://api.github.com')
hits.push(`${req.method} ${url.pathname}`)
+
const send = (status: number, body: string, type = 'application/json') => {
res.writeHead(status, { 'content-type': type })
res.end(body)
@@ -140,6 +141,7 @@ function apiHandler(origin: string, hits: string[]) {
}
const behind = gitIn(origin, ['rev-list', '--count', `${head}..${base}`])
+
const commits = log.out
? log.out.split('\n').map(line => {
const [sha, author, date, message] = line.split('\x1f')
diff --git a/apps/desktop/e2e/update/harness.ts b/apps/desktop/e2e/update/harness.ts
index d93ab1c9876..337f0be17e3 100644
--- a/apps/desktop/e2e/update/harness.ts
+++ b/apps/desktop/e2e/update/harness.ts
@@ -19,7 +19,7 @@ import * as path from 'node:path'
import { _electron, type ElectronApplication, expect, type Page } from '@playwright/test'
-import { type CoreSandbox, providerConfigYaml, sandboxProcesses, type ProcInfo } from '../core/harness'
+import { type CoreSandbox, type ProcInfo, providerConfigYaml, sandboxProcesses } from '../core/harness'
import { type ScriptedProvider, startScriptedProvider } from '../core/provider'
import { gatedOn, KNOWN } from './gates'
diff --git a/apps/desktop/e2e/update/update-concurrency.spec.ts b/apps/desktop/e2e/update/update-concurrency.spec.ts
index 381632667b7..c6b33b5b383 100644
--- a/apps/desktop/e2e/update/update-concurrency.spec.ts
+++ b/apps/desktop/e2e/update/update-concurrency.spec.ts
@@ -25,17 +25,17 @@ import {
backendServeProcesses,
closeQuietly,
currentAs,
+ desktopLog,
diagnostics,
- isAlive,
git,
installProcesses,
+ isAlive,
launchInstalledApp,
openAbout,
publishUpstream,
readText,
startInstallSession,
updateLogLines,
- desktopLog,
waitFor,
waitForUpdateOffer
} from './harness'
@@ -61,6 +61,7 @@ test('Update now while a terminal update runs is refused, and the panel is truth
app.process().once('exit', () => {
appExited = true
})
+
const explain = (extra = '') =>
diagnostics(
facts,
@@ -78,11 +79,13 @@ test('Update now while a terminal update runs is refused, and the panel is truth
await test.step('a terminal `hermes update` is running', async () => {
const out = fs.openSync(cliLog, 'w')
+
const cli = spawn(facts.hermes, ['update', '--yes'], {
cwd: facts.home,
env: { ...env, TERM: 'dumb' },
stdio: ['ignore', out, out]
})
+
cli.once('exit', code => {
cliExit = code ?? -1
})
@@ -130,12 +133,14 @@ test('Update now while a terminal update runs is refused, and the panel is truth
if (!appExited) {
await closeQuietly(app)
}
+
await waitFor(
'the pre-update backend to be gone once its app is',
() => oldBackends.every(pid => !isAlive(pid)),
{ timeout: 60_000, explain }
)
const reopened = await launchInstalledApp(facts, env)
+
try {
const ws2 = recordWebSockets(reopened.page)
await waitForInteractive(reopened.app, reopened.page).catch(error => {