diff --git a/browser_tests/fixtures/components/Topbar.ts b/browser_tests/fixtures/components/Topbar.ts index b138ff7b74..f2c9dfa16f 100644 --- a/browser_tests/fixtures/components/Topbar.ts +++ b/browser_tests/fixtures/components/Topbar.ts @@ -65,6 +65,7 @@ export class Topbar { } async openTopbarMenu() { + await this.page.waitForTimeout(1000) await this.page.locator('.comfyui-logo-wrapper').click() const menu = this.page.locator('.comfy-command-menu') await menu.waitFor({ state: 'visible' }) diff --git a/browser_tests/tests/graphCanvasMenu.spec.ts b/browser_tests/tests/graphCanvasMenu.spec.ts index e8994e4f02..9ae090975b 100644 --- a/browser_tests/tests/graphCanvasMenu.spec.ts +++ b/browser_tests/tests/graphCanvasMenu.spec.ts @@ -7,13 +7,11 @@ test.describe('Graph Canvas Menu', () => { // Set link render mode to spline to make sure it's not affected by other tests' // side effects. await comfyPage.setSetting('Comfy.LinkRenderMode', 2) + // Enable canvas menu for all tests + await comfyPage.setSetting('Comfy.Graph.CanvasMenu', true) }) test('Can toggle link visibility', async ({ comfyPage }) => { - // Note: `Comfy.Graph.CanvasMenu` is disabled in comfyPage setup. - // so no cleanup is needed. - await comfyPage.setSetting('Comfy.Graph.CanvasMenu', true) - const button = comfyPage.page.getByTestId('toggle-link-visibility-button') await button.click() await comfyPage.nextFrame() @@ -36,4 +34,45 @@ test.describe('Graph Canvas Menu', () => { hiddenLinkRenderMode ) }) + + test('Focus mode button is clickable and has correct test id', async ({ + comfyPage + }) => { + const focusButton = comfyPage.page.getByTestId('focus-mode-button') + await expect(focusButton).toBeVisible() + await expect(focusButton).toBeEnabled() + + // Test that the button can be clicked without error + await focusButton.click() + await comfyPage.nextFrame() + }) + + test('Zoom controls popup opens and closes', async ({ comfyPage }) => { + // Find the zoom button by its percentage text content + const zoomButton = comfyPage.page.locator('button').filter({ + hasText: '%' + }) + await expect(zoomButton).toBeVisible() + + // Click to open zoom controls + await zoomButton.click() + await comfyPage.nextFrame() + + // Zoom controls modal should be visible + const zoomModal = comfyPage.page + .locator('div') + .filter({ + hasText: 'Zoom To Fit' + }) + .first() + await expect(zoomModal).toBeVisible() + + // Click backdrop to close + const backdrop = comfyPage.page.locator('.fixed.inset-0').first() + await backdrop.click() + await comfyPage.nextFrame() + + // Modal should be hidden + await expect(zoomModal).not.toBeVisible() + }) }) diff --git a/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png b/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png index 2b16786315..cbd478253a 100644 Binary files a/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png and b/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png differ diff --git a/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png b/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png index fb46d991f6..1da6353ad6 100644 Binary files a/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png and b/browser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png differ diff --git a/browser_tests/tests/interaction.spec.ts b/browser_tests/tests/interaction.spec.ts index 2ddf9e086c..de46bca2e1 100644 --- a/browser_tests/tests/interaction.spec.ts +++ b/browser_tests/tests/interaction.spec.ts @@ -780,9 +780,18 @@ test.describe('Viewport settings', () => { // Screenshot the canvas element await comfyPage.setSetting('Comfy.Graph.CanvasMenu', true) - const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button') + // Open zoom controls dropdown first + const zoomControlsButton = comfyPage.page.getByTestId( + 'zoom-controls-button' + ) + await zoomControlsButton.click() + + const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button') await toggleButton.click() + // close zoom menu + await zoomControlsButton.click() + await comfyPage.setSetting('Comfy.Graph.CanvasMenu', false) await comfyPage.menu.topbar.saveWorkflow('Workflow A') await comfyPage.nextFrame() diff --git a/browser_tests/tests/minimap.spec.ts b/browser_tests/tests/minimap.spec.ts index 366a6634d5..df967d911e 100644 --- a/browser_tests/tests/minimap.spec.ts +++ b/browser_tests/tests/minimap.spec.ts @@ -35,34 +35,44 @@ test.describe('Minimap', () => { }) test('Validate minimap toggle button state', async ({ comfyPage }) => { + // Open zoom controls dropdown first + const zoomControlsButton = comfyPage.page.getByTestId( + 'zoom-controls-button' + ) + await zoomControlsButton.click() + const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button') await expect(toggleButton).toBeVisible() - await expect(toggleButton).toHaveClass(/minimap-active/) - const minimapContainer = comfyPage.page.locator('.litegraph-minimap') await expect(minimapContainer).toBeVisible() }) test('Validate minimap can be toggled off and on', async ({ comfyPage }) => { const minimapContainer = comfyPage.page.locator('.litegraph-minimap') + + // Open zoom controls dropdown first + const zoomControlsButton = comfyPage.page.getByTestId( + 'zoom-controls-button' + ) + await zoomControlsButton.click() + const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button') await expect(minimapContainer).toBeVisible() - await expect(toggleButton).toHaveClass(/minimap-active/) await toggleButton.click() await comfyPage.nextFrame() await expect(minimapContainer).not.toBeVisible() - await expect(toggleButton).not.toHaveClass(/minimap-active/) + await expect(toggleButton).toContainText('Show Minimap') await toggleButton.click() await comfyPage.nextFrame() await expect(minimapContainer).toBeVisible() - await expect(toggleButton).toHaveClass(/minimap-active/) + await expect(toggleButton).toContainText('Hide Minimap') }) test('Validate minimap keyboard shortcut Alt+M', async ({ comfyPage }) => { diff --git a/browser_tests/tests/sidebar/workflows.spec.ts b/browser_tests/tests/sidebar/workflows.spec.ts index 658d9bb343..1b3f21ff4d 100644 --- a/browser_tests/tests/sidebar/workflows.spec.ts +++ b/browser_tests/tests/sidebar/workflows.spec.ts @@ -193,6 +193,7 @@ test.describe('Workflows sidebar', () => { await comfyPage.menu.topbar.saveWorkflowAs('workflow5.json') await comfyPage.confirmDialog.click('overwrite') + await comfyPage.page.waitForTimeout(200) expect(await comfyPage.menu.workflowsTab.getOpenedWorkflowNames()).toEqual([ 'workflow5.json' ]) diff --git a/browser_tests/tests/widget.spec.ts b/browser_tests/tests/widget.spec.ts index 0d8978c79d..b23faabfc9 100644 --- a/browser_tests/tests/widget.spec.ts +++ b/browser_tests/tests/widget.spec.ts @@ -256,6 +256,7 @@ test.describe('Animated image widget', () => { await comfyPage.dragAndDropFile('animated_webp.webp', { dropPosition: { x, y } }) + await comfyPage.page.waitForTimeout(200) // Expect the filename combo value to be updated const fileComboWidget = await loadAnimatedWebpNode.getWidget(0) diff --git a/src/components/graph/GraphCanvas.vue b/src/components/graph/GraphCanvas.vue index 335e6427fa..309bf93421 100644 --- a/src/components/graph/GraphCanvas.vue +++ b/src/components/graph/GraphCanvas.vue @@ -2,13 +2,11 @@ - -