diff --git a/browser_tests/ComfyPage.ts b/browser_tests/ComfyPage.ts index 3a2e14a652..5317c37a06 100644 --- a/browser_tests/ComfyPage.ts +++ b/browser_tests/ComfyPage.ts @@ -185,6 +185,12 @@ export class ComfyPage { ) } + async getSetting(settingId: string) { + return await this.page.evaluate(async (id) => { + return await window['app'].ui.settings.getSettingValue(id) + }, settingId) + } + async reload() { await this.page.reload({ timeout: 15000 }) await this.setup() @@ -201,7 +207,7 @@ export class ComfyPage { } async delay(ms: number) { - return new Promise(resolve => setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)) } async loadWorkflow(workflowName: string) { diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index a06475e8a4..123ff78be8 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -113,6 +113,23 @@ test.describe('Node Interaction', () => { 'text-encode-toggled-back-open.png' ) }) + + test('Can close prompt dialog with canvas click', async ({ comfyPage }) => { + await comfyPage.canvas.click({ + position: { + x: 724, + y: 645 + } + }) + await expect(comfyPage.canvas).toHaveScreenshot('prompt-dialog-opened.png') + await comfyPage.canvas.click({ + position: { + x: 10, + y: 10 + } + }) + await expect(comfyPage.canvas).toHaveScreenshot('prompt-dialog-closed.png') + }) }) test.describe('Canvas Interaction', () => { @@ -147,6 +164,36 @@ test.describe('Canvas Interaction', () => { await comfyPage.page.keyboard.up('Shift') }) + test('Can zoom in/out after decreasing canvas zoom speed setting', async ({ + comfyPage + }) => { + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.05) + await comfyPage.zoom(-100, 4) + await expect(comfyPage.canvas).toHaveScreenshot( + 'zoomed-in-low-zoom-speed.png' + ) + await comfyPage.zoom(100, 8) + await expect(comfyPage.canvas).toHaveScreenshot( + 'zoomed-out-low-zoom-speed.png' + ) + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.1) + }) + + test('Can zoom in/out after increasing canvas zoom speed', async ({ + comfyPage + }) => { + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.5) + await comfyPage.zoom(-100, 4) + await expect(comfyPage.canvas).toHaveScreenshot( + 'zoomed-in-high-zoom-speed.png' + ) + await comfyPage.zoom(100, 8) + await expect(comfyPage.canvas).toHaveScreenshot( + 'zoomed-out-high-zoom-speed.png' + ) + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', 1.1) + }) + test('Can pan', async ({ comfyPage }) => { await comfyPage.pan({ x: 200, y: 200 }) await expect(comfyPage.canvas).toHaveScreenshot('panned.png') diff --git a/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-closed-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-closed-chromium-linux.png new file mode 100644 index 0000000000..f6d7b35400 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-closed-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-opened-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-opened-chromium-linux.png new file mode 100644 index 0000000000..65eee0a30b Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/prompt-dialog-opened-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-in-high-zoom-speed-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-high-zoom-speed-chromium-linux.png new file mode 100644 index 0000000000..1c22405e63 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-high-zoom-speed-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-in-low-zoom-speed-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-low-zoom-speed-chromium-linux.png new file mode 100644 index 0000000000..b3e4482e2c Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-in-low-zoom-speed-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-out-high-zoom-speed-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-high-zoom-speed-chromium-linux.png new file mode 100644 index 0000000000..d85e98d137 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-high-zoom-speed-chromium-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/zoomed-out-low-zoom-speed-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-low-zoom-speed-chromium-linux.png new file mode 100644 index 0000000000..d9ce0489c3 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/zoomed-out-low-zoom-speed-chromium-linux.png differ diff --git a/browser_tests/menu.spec.ts b/browser_tests/menu.spec.ts index 35bc21cf70..b4fb985cb5 100644 --- a/browser_tests/menu.spec.ts +++ b/browser_tests/menu.spec.ts @@ -92,4 +92,17 @@ test.describe('Menu', () => { // Verify the node is added to the canvas expect(await comfyPage.getGraphNodesCount()).toBe(count + 1) }) + + test('Can change canvas zoom speed setting', async ({ comfyPage }) => { + const [defaultSpeed, maxSpeed] = [1.1, 2.5] + expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe( + defaultSpeed + ) + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', maxSpeed) + expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe(maxSpeed) + await comfyPage.page.reload() + await comfyPage.setup() + expect(await comfyPage.getSetting('Comfy.Graph.ZoomSpeed')).toBe(maxSpeed) + await comfyPage.setSetting('Comfy.Graph.ZoomSpeed', defaultSpeed) + }) })