From ad5d3abc87e5e501c2860c0fcdc8ca0743f1af47 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Sat, 14 Nov 2026 15:53:05 -0800 Subject: [PATCH 1/2] test(e2e): close the remote connection's own window in the lifecycle cleanup "cleans up the remote connection" closed the dashboard window the wizard ran in and then waited for the remote session to end. Before launch-on-card (#2074) that dashboard window became the remote connection's window, so closing it ended the session. Now a build started from the dashboard opens in its own window, the dashboard window stays a dashboard, and the remote session kept running: the wait timed out on both passes of the nightly. The failure screenshots show the "Remote Loopback" window still open next to the local ComfyUI window. The test now closes the window that shows the remote connection, found by the webContents the previous test drove, as well as the dashboard window, and waits for both to be gone before it opens a dashboard from the local ComfyUI window. The dashboard window's id is renamed to say what it is. --- e2e/lifecycle.test.ts | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/e2e/lifecycle.test.ts b/e2e/lifecycle.test.ts index 07ebdcdba..1272b2105 100644 --- a/e2e/lifecycle.test.ts +++ b/e2e/lifecycle.test.ts @@ -2342,7 +2342,7 @@ test('cleans up the untracked kebab-copy on disk before the final Delete test ru let _remoteInstallId = '' let _remoteName = '' -let _remoteWindowId = 0 +let _remoteDashboardWindowId = 0 let _remoteWcId = 0 let _remoteOutputRoot = '' let _remoteExpectedFile = '' @@ -2437,7 +2437,7 @@ test('creates a Remote Connection record pointed at the running local server thr _remoteExpectedFile = path.join(_remoteOutputRoot, 'nested', 'output_00001_.png') expect(existsSync(_remoteOutputRoot), 'unique output root unexpectedly pre-exists').toBe(false) - _remoteWindowId = await openDashboardWindowViaPickerHome() + _remoteDashboardWindowId = await openDashboardWindowViaPickerHome() await clickNewInstallTile(ctx.panel) await expectNewBuildModalOpen(ctx.panel) await waitForConfigContinueEnabled( @@ -2656,13 +2656,36 @@ test('cleans up the remote connection: window closed, record untracked, local in `(() => { try { window.__e2eRemoteWs && window.__e2eRemoteWs.close() } catch {} return true })()` ).catch(() => false) } - expect(_remoteWindowId, 'no remote window id captured').toBeGreaterThan(0) + expect( + _remoteDashboardWindowId, + 'no id captured for the dashboard window the wizard ran in' + ).toBeGreaterThan(0) + expect(_remoteWcId, 'no webContents id captured for the remote connection').toBeGreaterThan(0) + const closing = { dashboardId: _remoteDashboardWindowId, remoteWcId: _remoteWcId } await evalWithRetry(() => - ctx.app.evaluate(({ BrowserWindow }, id) => { - const win = BrowserWindow.fromId(id) - if (win && !win.isDestroyed()) win.close() - }, _remoteWindowId) + ctx.app.evaluate(({ BrowserWindow, WebContentsView }, { dashboardId, remoteWcId }) => { + for (const win of BrowserWindow.getAllWindows()) { + if (win.isDestroyed()) continue + const showsRemoteConnection = win.contentView.children.some( + (view) => view instanceof WebContentsView && view.webContents.id === remoteWcId + ) + if (showsRemoteConnection || win.id === dashboardId) win.close() + } + }, closing) ) + await expect + .poll( + () => + evalWithRetry(() => + ctx.app.evaluate(({ BrowserWindow, webContents }, { dashboardId, remoteWcId }) => { + const dashboard = BrowserWindow.fromId(dashboardId) + const remote = webContents.fromId(remoteWcId) + return (!dashboard || dashboard.isDestroyed()) && (!remote || remote.isDestroyed()) + }, closing) + ), + { timeout: 15_000, intervals: [200, 500] } + ) + .toBe(true) await expect .poll(async () => (await getRunningSessionSnapshot(ctx.app, _remoteInstallId)) === null, { timeout: 30_000, From b7c7cddbabd64ec5af4d1bd1a5660c059e2db5de Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Sat, 14 Nov 2026 16:01:47 -0800 Subject: [PATCH 2/2] test(ui): measure the release-channel layout only after the dialog has stopped animating The Test check failed on this PR in releaseChannelSwitchLayout.test.ts, "keeps the dialog and every row in place from the click until the other channel has loaded". Every box in the baseline was 0.98 of its later size and 4px lower: the baseline was taken at the first keyframe of the setup dialog's pop-in animation (scale .98, translateY 4px, 160ms), and the layouts sampled afterwards were at rest. finishEntranceAnimations took one snapshot of document.getAnimations() and awaited those. An animation that starts after the snapshot, or one that is cancelled and restarted so its finished promise rejects, let the helper return while the dialog was still moving. It now waits frame by frame, awaits whatever finite animation is running, and returns only after three consecutive frames with none. --- .../views/releaseChannelSwitchLayout.test.ts | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/renderer/src/views/releaseChannelSwitchLayout.test.ts b/src/renderer/src/views/releaseChannelSwitchLayout.test.ts index 1f4429709..d2f0d99ac 100644 --- a/src/renderer/src/views/releaseChannelSwitchLayout.test.ts +++ b/src/renderer/src/views/releaseChannelSwitchLayout.test.ts @@ -147,11 +147,34 @@ function formLayout(): Box[] { ] } -async function finishEntranceAnimations(): Promise { - const finite = document +const QUIET_FRAMES_BEFORE_MEASURING = 3 + +function runningEntranceAnimations(): Animation[] { + return document .getAnimations() - .filter((animation) => Number.isFinite(Number(animation.effect?.getComputedTiming().endTime))) - await Promise.all(finite.map((animation) => animation.finished.catch(() => undefined))) + .filter( + (animation) => + animation.playState === 'running' && + Number.isFinite(Number(animation.effect?.getComputedTiming().endTime)) + ) +} + +function nextFrame(): Promise { + return new Promise((resolve) => requestAnimationFrame(() => resolve())) +} + +async function finishEntranceAnimations(): Promise { + let quietFrames = 0 + while (quietFrames < QUIET_FRAMES_BEFORE_MEASURING) { + await nextFrame() + const running = runningEntranceAnimations() + if (running.length === 0) { + quietFrames += 1 + continue + } + quietFrames = 0 + await Promise.all(running.map((animation) => animation.finished.catch(() => undefined))) + } } async function layoutsWhileLoading(gate: LoadGate): Promise {