diff --git a/browser_tests/graphCanvasMenu.spec.ts b/browser_tests/graphCanvasMenu.spec.ts new file mode 100644 index 0000000000..04ce0740b8 --- /dev/null +++ b/browser_tests/graphCanvasMenu.spec.ts @@ -0,0 +1,38 @@ +import { expect } from '@playwright/test' +import { comfyPageFixture as test } from './ComfyPage' + +test.describe('Graph Canvas Menu', () => { + test.beforeEach(async ({ comfyPage }) => { + // Set link render mode to spline to make sure it's not affected by other tests' + // side effects. + await comfyPage.setSetting('Comfy.LinkRenderMode', 2) + }) + + 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() + await expect(comfyPage.canvas).toHaveScreenshot( + 'canvas-with-hidden-links.png' + ) + const hiddenLinkRenderMode = await comfyPage.page.evaluate(() => { + return window['LiteGraph'].HIDDEN_LINK + }) + expect(await comfyPage.getSetting('Comfy.LinkRenderMode')).toBe( + hiddenLinkRenderMode + ) + + await button.click() + await comfyPage.nextFrame() + await expect(comfyPage.canvas).toHaveScreenshot( + 'canvas-with-visible-links.png' + ) + expect(await comfyPage.getSetting('Comfy.LinkRenderMode')).not.toBe( + hiddenLinkRenderMode + ) + }) +}) diff --git a/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-2x-linux.png b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-2x-linux.png new file mode 100644 index 0000000000..5ac1295548 Binary files /dev/null and b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-2x-linux.png differ diff --git a/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png new file mode 100644 index 0000000000..a83375473c Binary files /dev/null and b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-hidden-links-chromium-linux.png differ diff --git a/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-2x-linux.png b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-2x-linux.png new file mode 100644 index 0000000000..35e787c000 Binary files /dev/null and b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-2x-linux.png differ diff --git a/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png new file mode 100644 index 0000000000..f70d98f06f Binary files /dev/null and b/browser_tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.png differ diff --git a/package-lock.json b/package-lock.json index e98d6e0bd6..07418d8519 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.3.5", "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.2.1", - "@comfyorg/litegraph": "^0.7.83", + "@comfyorg/litegraph": "^0.7.84", "@primevue/themes": "^4.0.5", "@vitejs/plugin-vue": "^5.0.5", "@vueuse/core": "^11.0.0", @@ -1910,9 +1910,9 @@ "dev": true }, "node_modules/@comfyorg/litegraph": { - "version": "0.7.83", - "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.83.tgz", - "integrity": "sha512-YYw6SdOIxmfxow6rHU7L81JCUbO+7f/OdB8BrOUbTTUpy9R0bkVsXScRzxmHkWeWSy5mzDbLe/B2Zbx1Lpwp3A==", + "version": "0.7.84", + "resolved": "https://registry.npmjs.org/@comfyorg/litegraph/-/litegraph-0.7.84.tgz", + "integrity": "sha512-gataCzqlLsfw0G7VoJpaMrbBOY18pQ8nQGMOm0CJhiZy7Pp+IGTPhVi0d+tvBwW08ILkfYVqevxXs+rrwyzzAg==", "license": "MIT" }, "node_modules/@cspotcode/source-map-support": { diff --git a/package.json b/package.json index 001b19f4f2..1c1f49c3c3 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ }, "dependencies": { "@atlaskit/pragmatic-drag-and-drop": "^1.2.1", - "@comfyorg/litegraph": "^0.7.83", + "@comfyorg/litegraph": "^0.7.84", "@primevue/themes": "^4.0.5", "@vitejs/plugin-vue": "^5.0.5", "@vueuse/core": "^11.0.0", diff --git a/src/components/graph/GraphCanvasMenu.vue b/src/components/graph/GraphCanvasMenu.vue index cf8aeb682f..73ede6972d 100644 --- a/src/components/graph/GraphCanvasMenu.vue +++ b/src/components/graph/GraphCanvasMenu.vue @@ -38,6 +38,16 @@ +