From 62236836a8ad4e346b7f1932788237b48dc03252 Mon Sep 17 00:00:00 2001 From: Mariana Martinho Date: Wed, 11 Nov 2026 19:02:03 +0100 Subject: [PATCH 1/4] =?UTF-8?q?feat(ui):=20move=20tools=20into=20the=20?= =?UTF-8?q?=E2=98=B0=20menu=20and=20the=20=E2=98=B0=20to=20the=20right?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same change as #2007, now based on main instead of the closed #1981. Co-Authored-By: Claude Opus 5.5 --- e2e/chooser.test.ts | 9 ++++- e2e/lifecycle-first-use-skip.test.ts | 6 ++-- e2e/support/chooserHelpers.ts | 4 +-- e2e/whats-new-keeps-page.test.ts | 2 +- locales/en.json | 1 - locales/zh.json | 1 - src/main/popups/titlePopup.test.ts | 7 +++- src/main/popups/titlePopup.ts | 7 ++++ .../src/comfyTitleBar/TitleBarApp.test.ts | 16 ++++----- .../src/comfyTitleBar/TitleBarApp.vue | 24 +++++++------- src/renderer/src/comfyTitlePopup/MenuView.vue | 8 ++--- src/renderer/src/panel/AppSidebar.test.ts | 33 +++++++++---------- src/renderer/src/panel/AppSidebar.vue | 11 ++----- 13 files changed, 68 insertions(+), 61 deletions(-) diff --git a/e2e/chooser.test.ts b/e2e/chooser.test.ts index 468f9567b..17958d856 100644 --- a/e2e/chooser.test.ts +++ b/e2e/chooser.test.ts @@ -112,7 +112,14 @@ test('title popup opens, renders menu items, and closes via bridge @windows @mac .toBe(true) const popupItems = await readPopupMenuItems(ctx.app, 'comfyTitlePopup.html') - expect(popupItems).toEqual(['Open Dashboard', 'Desktop Settings', 'Close Window', 'Quit Desktop']) + expect(popupItems).toEqual([ + 'Open Dashboard', + 'Performance Tests', + 'Benchmarks', + 'Desktop Settings', + 'Close Window', + 'Quit Desktop' + ]) await evalWithRetry(() => ctx.app.evaluate(({ webContents }) => { diff --git a/e2e/lifecycle-first-use-skip.test.ts b/e2e/lifecycle-first-use-skip.test.ts index 04841e94b..21ef38da0 100644 --- a/e2e/lifecycle-first-use-skip.test.ts +++ b/e2e/lifecycle-first-use-skip.test.ts @@ -19,7 +19,7 @@ test('cold start lands on first-use start screen with the waffle menu hidden @li await ctx.panel.waitForVisible('.start-hero', { timeout: 15_000 }) await ctx.panel.waitForVisible('[data-testid="first-use-continue"]') - expect(await ctx.titleBar.exists('.title-menu-button')).toBe(false) + expect(await ctx.titleBar.exists('.title-menu-button[aria-haspopup="menu"]')).toBe(false) }) test('ToS + Local + Continue surfaces the waffle menu; Skip Onboarding reveals the chooser @lifecycle', async () => { @@ -45,10 +45,10 @@ test('ToS + Local + Continue surfaces the waffle menu; Skip Onboarding reveals t expect(await ctx.panel.click('[data-testid="first-use-continue"]')).toBe(true) - await ctx.titleBar.waitForVisible('.title-menu-button', { timeout: 15_000 }) + await ctx.titleBar.waitForVisible('.title-menu-button[aria-haspopup="menu"]', { timeout: 15_000 }) await resetIpcInvocations(ctx.app, 'comfy-window:set-first-use-mode') - expect(await ctx.titleBar.click('.title-menu-button')).toBe(true) + expect(await ctx.titleBar.click('.title-menu-button[aria-haspopup="menu"]')).toBe(true) await waitForWebContents(ctx.app, 'comfyTitlePopup.html') const popup = titlePopupPage(ctx.app) await popup.waitForVisible('li.item', { timeout: 10_000 }) diff --git a/e2e/support/chooserHelpers.ts b/e2e/support/chooserHelpers.ts index d7302812a..ce337af0c 100644 --- a/e2e/support/chooserHelpers.ts +++ b/e2e/support/chooserHelpers.ts @@ -60,8 +60,8 @@ export async function clickInstallTile( } export async function openTitleMenu(titleBar: WebContentsPage): Promise { - await titleBar.waitForVisible('.title-menu-button--icon') - const ok = await titleBar.click('.title-menu-button--icon') + await titleBar.waitForVisible('.title-menu-button--icon[aria-haspopup="menu"]') + const ok = await titleBar.click('.title-menu-button--icon[aria-haspopup="menu"]') expect(ok, 'Title menu button click dispatched').toBe(true) } diff --git a/e2e/whats-new-keeps-page.test.ts b/e2e/whats-new-keeps-page.test.ts index 97801cdd1..de0340f66 100644 --- a/e2e/whats-new-keeps-page.test.ts +++ b/e2e/whats-new-keeps-page.test.ts @@ -30,7 +30,7 @@ async function settleClose(): Promise { } test("closing What's New stays on the Performance Tests page @windows @macos @linux", async () => { - expect(await ctx.panel.click('[data-testid="app-sidebar-performance-test"]')).toBe(true) + await ctx.panel.evaluate(`window.api.navigatePanel('performance-test')`) await ctx.panel.waitForVisible(PERFORMANCE_TEST) await openWhatsNew() diff --git a/locales/en.json b/locales/en.json index 896dbac76..09367d63c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -19,7 +19,6 @@ "builds": "Builds", "navigation": "Navigation", "home": "Home", - "tools": "Tools", "collapse": "Collapse sidebar", "expand": "Expand sidebar", "signInTitle": "Log in to Comfy", diff --git a/locales/zh.json b/locales/zh.json index ac9e96a8c..05f16465c 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -19,7 +19,6 @@ "builds": "构建", "navigation": "导航", "home": "主页", - "tools": "工具", "collapse": "收起侧边栏", "expand": "展开侧边栏", "signInTitle": "登录 Comfy", diff --git a/src/main/popups/titlePopup.test.ts b/src/main/popups/titlePopup.test.ts index 0f9af4db1..e62f68459 100644 --- a/src/main/popups/titlePopup.test.ts +++ b/src/main/popups/titlePopup.test.ts @@ -135,12 +135,15 @@ describe('buildTitlePopupMenuItems', () => { }) it.each([null, 'inst-1'] as const)( - 'keeps settings and window actions without duplicate dashboard shortcuts on host %s', + 'lists the tools, settings and window actions on host %s', (installationId) => { const items = buildTitlePopupMenuItems(makeEntry({ installationId })) expect(items.map((item) => item.id ?? 'separator')).toEqual([ 'new-window', 'separator', + 'performance-test', + 'benchmarks', + 'separator', 'settings', 'separator', 'exit-window', @@ -154,6 +157,8 @@ describe('buildTitlePopupMenuItems', () => { const ids = items.map((i) => i.id ?? null).filter((id) => id !== null) expect(ids).toEqual([ 'new-window', + 'performance-test', + 'benchmarks', 'settings', 'reset-zoom', 'exit-window', diff --git a/src/main/popups/titlePopup.ts b/src/main/popups/titlePopup.ts index 7cd02f321..a0b126ff9 100644 --- a/src/main/popups/titlePopup.ts +++ b/src/main/popups/titlePopup.ts @@ -477,6 +477,13 @@ export function buildTitlePopupMenuItems(entry: ComfyWindowEntry): TitlePopupMen const items: TitlePopupMenuItem[] = [ { id: 'new-window', label: 'Open Dashboard', labelKey: 'fileMenu.newWindow' }, { kind: 'separator' }, + { + id: 'performance-test', + label: 'Performance Tests', + labelKey: 'fileMenu.performanceTest' + }, + { id: 'benchmarks', label: 'Benchmarks', labelKey: 'fileMenu.benchmarks' }, + { kind: 'separator' }, { id: 'settings', label: 'Desktop Settings', diff --git a/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts b/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts index c256af797..cd90aa7ee 100644 --- a/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts +++ b/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts @@ -270,7 +270,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() - const fileBtn = wrapper.find('.title-menu-button') + const fileBtn = wrapper.find('.title-menu-button[aria-haspopup="menu"]') expect(fileBtn.exists()).toBe(true) expect(fileBtn.attributes('aria-label')).toBe('Menu') expect(fileBtn.classes()).toContain('title-menu-button--icon') @@ -307,7 +307,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) await flushPromises() - await wrapper.find('.title-menu-button').trigger('click') + await wrapper.find('.title-menu-button[aria-haspopup="menu"]').trigger('click') expect(bridgeState.fileMenuAnchors.length).toBe(1) const anchor = bridgeState.fileMenuAnchors[0]! expect(typeof anchor.x).toBe('number') @@ -393,13 +393,13 @@ describe('TitleBarApp', () => { const wrapper = mount(TitleBarApp, { attachTo: document.body }) await flushPromises() - await wrapper.find('.title-menu-button').trigger('click') + await wrapper.find('.title-menu-button[aria-haspopup="menu"]').trigger('click') expect(bridgeState.fileMenuAnchors.length).toBe(1) bridgeState.menuClosedCallbacks.forEach((cb) => cb({ menu: 'menu' })) await flushPromises() - await wrapper.find('.title-menu-button').trigger('click') + await wrapper.find('.title-menu-button[aria-haspopup="menu"]').trigger('click') expect(bridgeState.fileMenuAnchors.length).toBe(1) wrapper.unmount() @@ -1005,7 +1005,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) await flushPromises() - const btn = wrapper.find('.title-menu-button').element as HTMLElement + const btn = wrapper.find('.title-menu-button[aria-haspopup="menu"]').element as HTMLElement btn.dispatchEvent(new PointerEvent('pointermove', { bubbles: true })) vi.advanceTimersByTime(1000) await flushPromises() @@ -1023,7 +1023,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() - const btn = wrapper.find('.title-menu-button') + const btn = wrapper.find('.title-menu-button[aria-haspopup="menu"]') expect(btn.attributes('aria-label')).toBe('Menu') expect(btn.attributes('data-title-tooltip')).toBe('Menu') expect(btn.attributes('title')).toBeUndefined() @@ -1035,7 +1035,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() - const btn = wrapper.find('.title-menu-button') + const btn = wrapper.find('.title-menu-button[aria-haspopup="menu"]') expect(btn.attributes('aria-label')).toBe('Menu') expect(btn.attributes('title')).toBe('Menu') expect(btn.attributes('data-title-tooltip')).toBeUndefined() @@ -1051,7 +1051,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) await flushPromises() - const btn = wrapper.find('.title-menu-button').element as HTMLElement + const btn = wrapper.find('.title-menu-button[aria-haspopup="menu"]').element as HTMLElement btn.getBoundingClientRect = () => ({ left: 20, top: 6, right: 50, bottom: 30, width: 30, height: 24, x: 20, y: 6 }) as DOMRect btn.dispatchEvent(new PointerEvent('pointermove', { bubbles: true })) diff --git a/src/renderer/src/comfyTitleBar/TitleBarApp.vue b/src/renderer/src/comfyTitleBar/TitleBarApp.vue index 2deec2a31..f56d2229e 100644 --- a/src/renderer/src/comfyTitleBar/TitleBarApp.vue +++ b/src/renderer/src/comfyTitleBar/TitleBarApp.vue @@ -579,18 +579,6 @@ onUnmounted(() => {
- +
diff --git a/src/renderer/src/comfyTitlePopup/MenuView.vue b/src/renderer/src/comfyTitlePopup/MenuView.vue index 2f1bb0542..7a3936095 100644 --- a/src/renderer/src/comfyTitlePopup/MenuView.vue +++ b/src/renderer/src/comfyTitlePopup/MenuView.vue @@ -37,20 +37,18 @@ function handleClick(item: MenuItem): void { diff --git a/src/renderer/src/panel/AppSidebar.test.ts b/src/renderer/src/panel/AppSidebar.test.ts index a93bf1057..4e386dd8b 100644 --- a/src/renderer/src/panel/AppSidebar.test.ts +++ b/src/renderer/src/panel/AppSidebar.test.ts @@ -32,30 +32,27 @@ async function mountSidebar(activePage: DashboardPage = 'chooser') { } describe('AppSidebar', () => { - it('lists Home, Builds, Performance Tests, then Benchmarks', async () => { + it('lists Home then Builds, with the tools left to the menu', async () => { const wrapper = await mountSidebar() - expect(wrapper.findAll('nav button').map((row) => row.text())).toEqual([ - 'Home', - 'Builds', - 'Performance Tests', - 'Benchmarks' - ]) + expect(wrapper.findAll('nav button').map((row) => row.text())).toEqual(['Home', 'Builds']) }) it('marks only the current page', async () => { + const wrapper = await mountSidebar('chooser') + + expect(wrapper.findAll('[aria-current="page"]').map((row) => row.text())).toEqual(['Builds']) + }) + + it('marks no row while a tool page from the menu is open', async () => { const wrapper = await mountSidebar('benchmarks') - expect(wrapper.findAll('[aria-current="page"]').map((row) => row.text())).toEqual([ - 'Benchmarks' - ]) + expect(wrapper.findAll('[aria-current="page"]')).toHaveLength(0) }) it.each<[string, DashboardPage]>([ ['app-sidebar-home', 'home'], - ['app-sidebar-chooser', 'chooser'], - ['app-sidebar-benchmarks', 'benchmarks'], - ['app-sidebar-performance-test', 'performance-test'] + ['app-sidebar-chooser', 'chooser'] ])('navigates from %s', async (testId, page) => { const wrapper = await mountSidebar() @@ -74,15 +71,15 @@ describe('AppSidebar', () => { it('collapses to icons with tooltips and stays collapsed when reopened', async () => { const wrapper = await mountSidebar() - const benchmarks = wrapper.get('[data-testid="app-sidebar-benchmarks"]') - expect(benchmarks.text()).toBe('Benchmarks') - expect(benchmarks.attributes('title')).toBeUndefined() + const builds = wrapper.get('[data-testid="app-sidebar-chooser"]') + expect(builds.text()).toBe('Builds') + expect(builds.attributes('title')).toBeUndefined() await wrapper.get('[data-testid="app-sidebar-toggle"]').trigger('click') await flushPromises() - expect(benchmarks.text()).toBe('') - expect(benchmarks.attributes('title')).toBe('Benchmarks') + expect(builds.text()).toBe('') + expect(builds.attributes('title')).toBe('Builds') expect(wrapper.get('[data-testid="app-sidebar-toggle"]').attributes('aria-expanded')).toBe( 'false' ) diff --git a/src/renderer/src/panel/AppSidebar.vue b/src/renderer/src/panel/AppSidebar.vue index ce039d4f9..eef929093 100644 --- a/src/renderer/src/panel/AppSidebar.vue +++ b/src/renderer/src/panel/AppSidebar.vue @@ -2,7 +2,7 @@ import { computed } from 'vue' import { useI18n } from 'vue-i18n' import { useLocalStorage } from '@vueuse/core' -import { ChartColumn, Gauge, House, Server } from 'lucide-vue-next' +import { House, Server } from 'lucide-vue-next' import type { Component } from 'vue' import Button from '@comfyorg/design-system/button/Button' import ComfyCLogo from '../components/icons/ComfyCLogo.vue' @@ -34,13 +34,8 @@ const mainRows = computed(() => [ { page: 'home', label: t('sidebar.home'), icon: House }, { page: 'chooser', label: t('sidebar.builds'), icon: Server } ]) -const toolRows = computed(() => [ - { page: 'performance-test', label: t('fileMenu.performanceTest'), icon: Gauge }, - { page: 'benchmarks', label: t('fileMenu.benchmarks'), icon: ChartColumn } -]) -const groups = computed(() => [ - { key: 'main', rows: mainRows.value }, - { key: 'tools', title: t('sidebar.tools'), rows: toolRows.value } +const groups = computed<{ key: string; title?: string; rows: SidebarRow[] }[]>(() => [ + { key: 'main', rows: mainRows.value } ]) function navigate(page: DashboardPage): void { From 3c2bf68437f854b75bbe85221ce98b3326bc0a79 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Wed, 11 Nov 2026 12:12:10 -0800 Subject: [PATCH 2/4] fix(ui): prevent compact title-bar controls overlapping the center pill Allow the leading spacer to shrink in icons-only mode while keeping a 200px center track and a 16px gap before the trailing controls. Preserve the existing centered layout whenever there is enough room. Validated formatting, targeted lint, renderer typecheck, 206 targeted tests, and 20 Chromium layout cases covering 800-1280px widths with and without zoom reset. --- src/renderer/src/comfyTitleBar/TitleBarApp.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/comfyTitleBar/TitleBarApp.vue b/src/renderer/src/comfyTitleBar/TitleBarApp.vue index f56d2229e..32338b2a8 100644 --- a/src/renderer/src/comfyTitleBar/TitleBarApp.vue +++ b/src/renderer/src/comfyTitleBar/TitleBarApp.vue @@ -558,7 +558,7 @@ onUnmounted(() => { From dbc733b965e1891498ed423720ecd0e85316ad32 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Thu, 12 Nov 2026 09:05:49 -0800 Subject: [PATCH 4/4] fix(ui): open Performance Tests and Benchmarks in place on the dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ☰ items opened a new dashboard window on every click, even from the dashboard itself, while the sidebar rows they replace switched the page in place. On the dashboard they now switch the page; from a build window they still open a dashboard window on that tool. Opening a tool from the dashboard emits comfy.desktop.view.opened again, as the sidebar did. Drop the install-flow routing in the ☰ handler (new-install, track, load-snapshot, quick-install): no menu has produced those ids since #767. The new chooser e2e opens both tools through the real ☰ popup and checks that no second window appears; it fails against the previous routing with 2 windows. The What's New spec reaches Performance Tests through the menu instead of calling navigatePanel. --- e2e/chooser.test.ts | 40 ++++++++++++++------- e2e/support/chooserHelpers.ts | 17 +++++++++ e2e/whats-new-keeps-page.test.ts | 4 +-- src/main/popups/titlePopup.test.ts | 56 +++++++----------------------- src/main/popups/titlePopup.ts | 40 ++++----------------- 5 files changed, 65 insertions(+), 92 deletions(-) diff --git a/e2e/chooser.test.ts b/e2e/chooser.test.ts index 0cf0d3276..f018c825e 100644 --- a/e2e/chooser.test.ts +++ b/e2e/chooser.test.ts @@ -4,7 +4,9 @@ import { clickNewInstallTile, openTitleMenu, expectChooserVisible, - expectTakeoverOpen + expectTakeoverOpen, + pickFromTitleMenu, + showBuildsPage } from './support/chooserHelpers' import { findWebContentsId, @@ -74,12 +76,7 @@ test('Builds dropdown opens both import flows and restores focus on Escape @wind }) test('activate hook focuses the existing chooser host instead of spawning a duplicate @windows @macos @linux', async () => { - const before = await evalWithRetry(() => - ctx.app.evaluate( - ({ BrowserWindow }) => BrowserWindow.getAllWindows().filter((w) => !w.isDestroyed()).length - ) - ) - expect(before).toBe(1) + expect(await openWindowCount()).toBe(1) await evalWithRetry(() => ctx.app.evaluate(({ app }) => { @@ -88,12 +85,7 @@ test('activate hook focuses the existing chooser host instead of spawning a dupl ) await new Promise((r) => setTimeout(r, 200)) - const after = await evalWithRetry(() => - ctx.app.evaluate( - ({ BrowserWindow }) => BrowserWindow.getAllWindows().filter((w) => !w.isDestroyed()).length - ) - ) - expect(after).toBe(1) + expect(await openWindowCount()).toBe(1) }) test('title popup + system modal webContents are pre-warmed on the chooser host @windows @macos @linux', async () => { @@ -137,6 +129,20 @@ test('title popup opens, renders menu items, and closes via bridge @windows @mac .toBe(false) }) +test('the ☰ menu opens Performance Tests and Benchmarks in the dashboard window itself @windows @macos @linux', async () => { + for (const [label, page] of [ + ['Performance Tests', '[data-testid="performance-test"]'], + ['Benchmarks', '[data-testid="benchmarks"]'] + ] as const) { + await new Promise((resolve) => setTimeout(resolve, TITLE_REOPEN_SUPPRESSION_MS)) + await pickFromTitleMenu(ctx.app, ctx.titleBar, label) + await ctx.panel.waitForVisible(page) + expect(await openWindowCount(), `${label} opened without a second window`).toBe(1) + } + + await showBuildsPage(ctx.panel) +}) + test('title popup reopens after a blur dismiss (menu-closed IPC clears the reopen guard) @windows @macos @linux', async () => { await new Promise((resolve) => setTimeout(resolve, TITLE_REOPEN_SUPPRESSION_MS)) @@ -216,6 +222,14 @@ test('title-bar tooltip popup is created on demand and hides cleanly @windows @m .toBe(false) }) +async function openWindowCount(): Promise { + return evalWithRetry(() => + ctx.app.evaluate( + ({ BrowserWindow }) => BrowserWindow.getAllWindows().filter((w) => !w.isDestroyed()).length + ) + ) +} + async function readPopupMenuItems(app: ElectronApplication, marker: string): Promise { return evalWithRetry(() => app.evaluate(({ webContents }, m) => { diff --git a/e2e/support/chooserHelpers.ts b/e2e/support/chooserHelpers.ts index ce337af0c..cb620cbe6 100644 --- a/e2e/support/chooserHelpers.ts +++ b/e2e/support/chooserHelpers.ts @@ -65,6 +65,23 @@ export async function openTitleMenu(titleBar: WebContentsPage): Promise { expect(ok, 'Title menu button click dispatched').toBe(true) } +export async function pickFromTitleMenu( + app: ElectronApplication, + titleBar: WebContentsPage, + label: string +): Promise { + await waitForWebContents(app, 'comfyTitlePopup.html', 10_000) + await openTitleMenu(titleBar) + await expect + .poll(() => isPopupVisible(app, 'comfyTitlePopup.html'), { + timeout: 5_000, + intervals: [100, 200] + }) + .toBe(true) + const picked = await titlePopupPage(app).clickByText('li.item', label) + expect(picked, `${label} picked from the title menu`).toBe(true) +} + export async function openDownloadsTray(titleBar: WebContentsPage): Promise { await titleBar.waitForVisible('.title-downloads-tray') const ok = await titleBar.click('.title-downloads-tray') diff --git a/e2e/whats-new-keeps-page.test.ts b/e2e/whats-new-keeps-page.test.ts index de0340f66..8f545ef69 100644 --- a/e2e/whats-new-keeps-page.test.ts +++ b/e2e/whats-new-keeps-page.test.ts @@ -1,6 +1,6 @@ import { test, expect } from '@playwright/test' import { launchApp, type AppContext } from './launchApp' -import { expectChooserVisible } from './support/chooserHelpers' +import { expectChooserVisible, pickFromTitleMenu } from './support/chooserHelpers' const BELL = '.title-announcement-button' const WHATS_NEW_CLOSE = '[data-testid="announcement-close"]' @@ -30,7 +30,7 @@ async function settleClose(): Promise { } test("closing What's New stays on the Performance Tests page @windows @macos @linux", async () => { - await ctx.panel.evaluate(`window.api.navigatePanel('performance-test')`) + await pickFromTitleMenu(ctx.app, ctx.titleBar, 'Performance Tests') await ctx.panel.waitForVisible(PERFORMANCE_TEST) await openWhatsNew() diff --git a/src/main/popups/titlePopup.test.ts b/src/main/popups/titlePopup.test.ts index 963960da1..d5057efb8 100644 --- a/src/main/popups/titlePopup.test.ts +++ b/src/main/popups/titlePopup.test.ts @@ -32,13 +32,10 @@ import { scopeInstancePicker, buildTitlePopupMenuItems, computePopupHeight, - decideFlowMenuItemTarget, - isFlowMenuItemId, parseGlobalSettingsTarget, registerTitlePopupIpc, requiresPerOpenConfigSync, syncTitlePopupConfig, - type FlowMenuItemId, type InstancePickerInstall, type TitlePopupEntry, type TitlePopupHostBindings @@ -221,36 +218,36 @@ describe('activateTitlePopupMenuItem', () => { } as unknown as Parameters[0] } - it.each([null, 'inst-1'] as const)( - 'opens Performance Test in a new host when installationId is %s', - (installationId) => { - const host = makeEntry({ installationId }) + it.each(['performance-test', 'benchmarks'] as const)( + 'switches the dashboard window to %s in place', + (tool) => { + const host = makeEntry({ installationId: null }) comfyWindows.set(host.windowKey, host) const bindings = { openChooserHostWindow: vi.fn(), setActivePanel: vi.fn() } as unknown as TitlePopupHostBindings - activateTitlePopupMenuItem(makePopupEntry(host.windowKey), 'performance-test', bindings) + activateTitlePopupMenuItem(makePopupEntry(host.windowKey), tool, bindings) - expect(bindings.openChooserHostWindow).toHaveBeenCalledExactlyOnceWith('performance-test') - expect(bindings.setActivePanel).not.toHaveBeenCalled() + expect(bindings.setActivePanel).toHaveBeenCalledExactlyOnceWith(host.windowKey, tool) + expect(bindings.openChooserHostWindow).not.toHaveBeenCalled() } ) - it.each([null, 'inst-1'] as const)( - 'opens Benchmarks in a new host when installationId is %s', - (installationId) => { - const host = makeEntry({ installationId }) + it.each(['performance-test', 'benchmarks'] as const)( + 'opens %s in a dashboard window from a build window', + (tool) => { + const host = makeEntry({ installationId: 'inst-1' }) comfyWindows.set(host.windowKey, host) const bindings = { openChooserHostWindow: vi.fn(), setActivePanel: vi.fn() } as unknown as TitlePopupHostBindings - activateTitlePopupMenuItem(makePopupEntry(host.windowKey), 'benchmarks', bindings) + activateTitlePopupMenuItem(makePopupEntry(host.windowKey), tool, bindings) - expect(bindings.openChooserHostWindow).toHaveBeenCalledExactlyOnceWith('benchmarks') + expect(bindings.openChooserHostWindow).toHaveBeenCalledExactlyOnceWith(tool) expect(bindings.setActivePanel).not.toHaveBeenCalled() } ) @@ -276,33 +273,6 @@ describe('activateTitlePopupMenuItem', () => { }) }) -describe('decideFlowMenuItemTarget', () => { - const flowIds: FlowMenuItemId[] = ['new-install', 'track', 'load-snapshot', 'quick-install'] - - it.each(flowIds)('dashboard host routes %s to in-place takeover', (id) => { - const target = decideFlowMenuItemTarget(makeEntry({ installationId: null }), id) - expect(target).toEqual({ kind: 'set-active-panel', panel: id }) - }) - - it.each(flowIds)('install host routes %s to a fresh chooser window', (id) => { - const target = decideFlowMenuItemTarget(makeEntry({ installationId: 'inst-1' }), id) - expect(target).toEqual({ kind: 'open-chooser-host', panel: id }) - }) -}) - -describe('isFlowMenuItemId', () => { - it('accepts the four flow ids and rejects everything else', () => { - expect(isFlowMenuItemId('new-install')).toBe(true) - expect(isFlowMenuItemId('track')).toBe(true) - expect(isFlowMenuItemId('load-snapshot')).toBe(true) - expect(isFlowMenuItemId('quick-install')).toBe(true) - expect(isFlowMenuItemId('new-window')).toBe(false) - expect(isFlowMenuItemId('settings')).toBe(false) - expect(isFlowMenuItemId('feedback')).toBe(false) - expect(isFlowMenuItemId('')).toBe(false) - }) -}) - describe('requiresPerOpenConfigSync', () => { it('forces a config re-send for a global-settings open with a requested tab', () => { expect( diff --git a/src/main/popups/titlePopup.ts b/src/main/popups/titlePopup.ts index 093d21cff..5bb9e2893 100644 --- a/src/main/popups/titlePopup.ts +++ b/src/main/popups/titlePopup.ts @@ -1196,28 +1196,6 @@ function showInstancePickerForHost( })() } -export type FlowMenuItemId = 'new-install' | 'track' | 'load-snapshot' | 'quick-install' - -const FLOW_MENU_ITEM_IDS: ReadonlySet = new Set([ - 'new-install', - 'track', - 'load-snapshot', - 'quick-install' -]) - -export function isFlowMenuItemId(id: string): id is FlowMenuItemId { - return FLOW_MENU_ITEM_IDS.has(id) -} - -export function decideFlowMenuItemTarget( - entry: ComfyWindowEntry, - id: FlowMenuItemId -): { kind: 'set-active-panel' | 'open-chooser-host'; panel: ComfyPanelKey } { - return isChooserHost(entry) - ? { kind: 'set-active-panel', panel: id } - : { kind: 'open-chooser-host', panel: id } -} - export function activateTitlePopupMenuItem( entry: TitlePopupEntry, id: string, @@ -1234,8 +1212,12 @@ export function activateTitlePopupMenuItem( bindings.openChooserHostWindow() releaseFocusToParent = false } else if (id === 'performance-test' || id === 'benchmarks') { - bindings.openChooserHostWindow(id) - releaseFocusToParent = false + if (parentEntry && isChooserHost(parentEntry)) { + bindings.setActivePanel(entry.parentEntryId, id) + } else { + bindings.openChooserHostWindow(id) + releaseFocusToParent = false + } } else if (id === 'return-to-dashboard') { void bindings.returnToDashboard(entry.parentEntryId) } else if (id === 'exit-window') { @@ -1266,16 +1248,6 @@ export function activateTitlePopupMenuItem( if (parentEntry != null && parentEntry.installationId !== null) { bindings.resetComfyZoom(parentEntry.installationId) } - } else if (isFlowMenuItemId(id)) { - if (parentEntry) { - const target = decideFlowMenuItemTarget(parentEntry, id) - if (target.kind === 'set-active-panel') { - bindings.setActivePanel(entry.parentEntryId, target.panel) - } else { - bindings.openChooserHostWindow(target.panel) - releaseFocusToParent = false - } - } } hideTitlePopup(entry, { releaseFocusToParent }) }