Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions e2e/lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
31 changes: 27 additions & 4 deletions src/renderer/src/views/releaseChannelSwitchLayout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,34 @@ function formLayout(): Box[] {
]
}

async function finishEntranceAnimations(): Promise<void> {
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<void> {
return new Promise((resolve) => requestAnimationFrame(() => resolve()))
}

async function finishEntranceAnimations(): Promise<void> {
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<Box[][]> {
Expand Down
Loading