Skip to content
Closed
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
9 changes: 8 additions & 1 deletion e2e/chooser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 }) => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/lifecycle-first-use-skip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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 })
Expand Down
4 changes: 2 additions & 2 deletions e2e/support/chooserHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export async function clickInstallTile(
}

export async function openTitleMenu(titleBar: WebContentsPage): Promise<void> {
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)
}

Expand Down
2 changes: 1 addition & 1 deletion e2e/whats-new-keeps-page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function settleClose(): Promise<void> {
}

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()
Expand Down
1 change: 0 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"home": "Home",
"apps": "Apps",
"comingSoon": "Coming soon",
"tools": "Tools",
"collapse": "Collapse sidebar",
"expand": "Expand sidebar",
"signInTitle": "Log in to Comfy",
Expand Down
1 change: 0 additions & 1 deletion locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"home": "主页",
"apps": "应用",
"comingSoon": "即将推出",
"tools": "工具",
"collapse": "收起侧边栏",
"expand": "展开侧边栏",
"signInTitle": "登录 Comfy",
Expand Down
7 changes: 6 additions & 1 deletion src/main/popups/titlePopup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,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',
Expand All @@ -153,6 +156,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',
Expand Down
7 changes: 7 additions & 0 deletions src/main/popups/titlePopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 8 additions & 8 deletions src/renderer/src/comfyTitleBar/TitleBarApp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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 }))
Expand Down
24 changes: 12 additions & 12 deletions src/renderer/src/comfyTitleBar/TitleBarApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -579,18 +579,6 @@ onUnmounted(() => {
<div
class="title-cluster flex min-w-[var(--title-trailing-width,0px)] items-center gap-1 [.title-bar:not(.is-mac)_&]:min-w-[calc(var(--title-trailing-width,0px)_+_128px)]"
>
<button
v-if="!isConsentLockdown"
ref="fileBtn"
type="button"
class="title-menu-button title-menu-button--icon"
:class="titleMenuButtonClass"
aria-haspopup="menu"
v-bind="tooltipAttrs(t('titleBar.menu'))"
@click="handleFileMenu"
>
<MenuIcon :size="18" />
</button>
<button
v-if="showRefreshButton"
type="button"
Expand Down Expand Up @@ -802,6 +790,18 @@ onUnmounted(() => {
aria-hidden="true"
/>
</button>
<button
v-if="!isConsentLockdown"
ref="fileBtn"
type="button"
class="title-menu-button title-menu-button--icon"
:class="titleMenuButtonClass"
aria-haspopup="menu"
v-bind="tooltipAttrs(t('titleBar.menu'))"
@click="handleFileMenu"
>
<MenuIcon :size="18" />
</button>
</div>
</header>
</template>
Expand Down
8 changes: 3 additions & 5 deletions src/renderer/src/comfyTitlePopup/MenuView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ function handleClick(item: MenuItem): void {
<template v-for="(item, idx) in items" :key="idx">
<li
v-if="item.kind === 'separator'"
class="separator mx-1.5 my-1 h-px bg-border opacity-100"
class="separator mx-1 my-1 h-px bg-border opacity-100"
role="separator"
/>
<li
v-else
class="item box-border flex h-8 cursor-pointer items-center gap-2.5 rounded-control px-2.5 py-0 whitespace-nowrap transition-[background-color] duration-[80ms] ease-[ease] hover:bg-[oklch(1_0_0/0.07)]"
class="item box-border flex h-8 cursor-pointer items-center gap-2 rounded-md px-3 py-0 whitespace-nowrap transition-[background-color] duration-[80ms] ease-[ease] hover:bg-accent"
role="menuitem"
tabindex="-1"
@click="handleClick(item)"
>
<span class="check inline-flex size-3.5 shrink-0 items-center justify-center opacity-85">
<Check v-if="item.checked" :size="14" />
</span>
<span class="label flex-auto overflow-hidden text-ellipsis">{{ labelFor(item) }}</span>
<Check v-if="item.checked" class="check shrink-0" :size="15" aria-hidden="true" />
</li>
</template>
</ul>
Expand Down
43 changes: 22 additions & 21 deletions src/renderer/src/panel/AppSidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,37 +33,38 @@ async function mountSidebar(activePage: SidebarPage = 'chooser') {
}

describe('AppSidebar', () => {
it('lists Home, Apps, Builds, Performance Tests, then Benchmarks', async () => {
it('lists Home, Apps, 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',
'Apps',
'Builds',
'Performance Tests',
'Benchmarks'
'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-chooser', 'chooser'],
['app-sidebar-benchmarks', 'benchmarks'],
['app-sidebar-performance-test', 'performance-test']
])('navigates from %s', async (testId, page) => {
const wrapper = await mountSidebar()
it.each<[string, DashboardPage]>([['app-sidebar-chooser', 'chooser']])(
'navigates from %s',
async (testId, page) => {
const wrapper = await mountSidebar()

await wrapper.get(`[data-testid="${testId}"]`).trigger('click')
await wrapper.get(`[data-testid="${testId}"]`).trigger('click')

expect(navigatePanel).toHaveBeenCalledExactlyOnceWith(page)
})
expect(navigatePanel).toHaveBeenCalledExactlyOnceWith(page)
}
)

it.each<SidebarPage>(['home', 'apps'])(
'opens the %s section inside the dashboard',
Expand Down Expand Up @@ -93,15 +94,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'
)
Expand Down
11 changes: 3 additions & 8 deletions src/renderer/src/panel/AppSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import { useLocalStorage } from '@vueuse/core'
import { AppWindow, ChartColumn, Gauge, House, Server } from 'lucide-vue-next'
import { AppWindow, 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'
Expand Down Expand Up @@ -37,13 +37,8 @@ const mainRows = computed<SidebarRow[]>(() => [
{ page: 'apps', label: t('sidebar.apps'), icon: AppWindow },
{ page: 'chooser', label: t('sidebar.builds'), icon: Server }
])
const toolRows = computed<SidebarRow[]>(() => [
{ 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: SidebarPage): void {
Expand Down
Loading