From 8c4c5d463178f9fce3af7e7a8735a0a201185da8 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 13:13:28 -0700 Subject: [PATCH 01/42] test: add undo/redo e2e coverage for the ECS migration QA plan --- browser_tests/tests/ecsUndoRedo.spec.ts | 185 ++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 browser_tests/tests/ecsUndoRedo.spec.ts diff --git a/browser_tests/tests/ecsUndoRedo.spec.ts b/browser_tests/tests/ecsUndoRedo.spec.ts new file mode 100644 index 00000000000..46aa88ab876 --- /dev/null +++ b/browser_tests/tests/ecsUndoRedo.spec.ts @@ -0,0 +1,185 @@ +import { + comfyExpect as expect, + comfyPageFixture as test +} from '@e2e/fixtures/ComfyPage' +import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers' +import { toNodeId } from '@/types/nodeId' + +test.describe( + 'ECS migration: undo/redo', + { tag: ['@canvas', '@workflow'] }, + () => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top') + await comfyPage.settings.setSetting( + 'Comfy.Workflow.WorkflowTabsPosition', + 'Topbar' + ) + await comfyPage.workflow.loadWorkflow('default') + }) + + test.afterEach(async ({ comfyPage }) => { + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) + await comfyPage.canvasOps.resetView() + }) + + test('moving a node can be undone and a second redo is a no-op', async ({ + comfyPage + }) => { + const node = await comfyPage.nodeOps.getNodeRefById('3') + const initialPosition = await node.getBounding() + + await node.dragBy({ x: 120, y: 80 }) + await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) + const movedPosition = await node.getBounding() + + await comfyPage.keyboard.undo() + await expect.poll(() => node.getBounding()).toEqual(initialPosition) + + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await expect(comfyPage.toast.toastErrors).toHaveCount(0) + }) + + test('moving a group by its title can be undone', async ({ + comfyPage, + comfyMouse + }) => { + await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') + const initialPosition = await comfyPage.canvasOps.getGroupPosition('Pair') + const titlePosition = await getGroupTitlePosition(comfyPage, 'Pair') + + await comfyMouse.dragAndDrop(titlePosition, { + x: titlePosition.x + 100, + y: titlePosition.y + 60 + }) + await expect + .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) + .not.toEqual(initialPosition) + + await comfyPage.keyboard.undo() + await expect + .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) + .toEqual(initialPosition) + }) + + test('changing a widget value can be undone and redone', async ({ + comfyPage + }) => { + const node = await comfyPage.nodeOps.getNodeRefById('3') + const steps = await node.getWidget(2) + const initialValue = await steps.getValue() + + await steps.dragHorizontal(80) + await expect.poll(() => steps.getValue()).not.toBe(initialValue) + const changedValue = await steps.getValue() + + await comfyPage.keyboard.undo() + await expect.poll(() => steps.getValue()).toBe(initialValue) + + await comfyPage.keyboard.redo() + await expect.poll(() => steps.getValue()).toBe(changedValue) + }) + + test('three mixed Vue Nodes edits can be undone and redone in order', async ({ + comfyPage, + comfyMouse + }) => { + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) + await comfyPage.vueNodes.waitForNodes() + const node = await comfyPage.nodeOps.getNodeRefById('3') + const initialPosition = await node.getBounding() + const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') + + await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) + await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) + const movedPosition = await node.getBounding() + + const stepsWidget = comfyPage.vueNodes.getWidgetByName( + 'KSampler', + 'steps' + ) + const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) + const initialSteps = await input.inputValue() + await input.fill('31') + await input.press('Enter') + await expect(input).toHaveValue('31') + + const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() + await comfyPage.searchBoxV2.addNode('Note') + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(initialNodeCount + 1) + + await comfyPage.keyboard.undo() + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(initialNodeCount) + await comfyPage.keyboard.undo() + await expect(input).toHaveValue(initialSteps) + await comfyPage.keyboard.undo() + await expect.poll(() => node.getBounding()).toEqual(initialPosition) + + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await comfyPage.keyboard.redo() + await expect(input).toHaveValue('31') + await comfyPage.keyboard.redo() + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(initialNodeCount + 1) + }) + + test('undo remains scoped to the edited workflow after switching tabs', async ({ + comfyPage + }) => { + await comfyPage.workflow.setupWorkflowsDirectory({}) + await comfyPage.menu.topbar.saveWorkflow('Undo Tab A') + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + const node = await comfyPage.nodeOps.getNodeRefById('3') + const initialPosition = await comfyPage.page.evaluate( + (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], + toNodeId('3') + ) + + await node.dragBy({ x: 100, y: 50 }) + await expect + .poll(() => + comfyPage.page.evaluate( + (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], + toNodeId('3') + ) + ) + .not.toEqual(initialPosition) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + + const tabsBeforeNew = await comfyPage.menu.topbar.getTabNames() + await comfyPage.menu.topbar.triggerTopbarCommand(['New']) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() + const tabBName = tabsAfterNew.find( + (name) => !tabsBeforeNew.includes(name) + )! + const tabB = comfyPage.menu.topbar.getWorkflowTab(tabBName) + await expect(tabB).toBeVisible() + + await comfyPage.menu.topbar.getWorkflowTab('Undo Tab A').click() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + await comfyPage.menu.topbar.triggerTopbarCommand(['Edit', 'Undo']) + await expect + .poll(() => + comfyPage.page.evaluate( + (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], + toNodeId('3') + ) + ) + .toEqual(initialPosition) + + await tabB.click() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + }) + } +) From f5eed598460edb82486fe2bcd0898c638615b519 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 13:50:36 -0700 Subject: [PATCH 02/42] test: assert undo is a no-op in fresh tab and Tab A history survives switch --- browser_tests/tests/ecsUndoRedo.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/browser_tests/tests/ecsUndoRedo.spec.ts b/browser_tests/tests/ecsUndoRedo.spec.ts index 46aa88ab876..5546cec8b81 100644 --- a/browser_tests/tests/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/ecsUndoRedo.spec.ts @@ -165,9 +165,23 @@ test.describe( const tabB = comfyPage.menu.topbar.getWorkflowTab(tabBName) await expect(tabB).toBeVisible() + // Undo in the fresh tab must be a no-op: its queue is empty and it must + // not reach back into Tab A's history. + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + await comfyPage.keyboard.undo() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + await comfyPage.menu.topbar.getWorkflowTab('Undo Tab A').click() await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + await expect + .poll(() => + comfyPage.page.evaluate( + (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], + toNodeId('3') + ) + ) + .not.toEqual(initialPosition) await comfyPage.menu.topbar.triggerTopbarCommand(['Edit', 'Undo']) await expect .poll(() => From 6e5e70eb1c966234f62f996fc51347580b7af771 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:54:34 -0700 Subject: [PATCH 03/42] test: move undo coverage under workflow ownership Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389330 --- .../tests/{ => workflow/changeTracking}/ecsUndoRedo.spec.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename browser_tests/tests/{ => workflow/changeTracking}/ecsUndoRedo.spec.ts (100%) diff --git a/browser_tests/tests/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts similarity index 100% rename from browser_tests/tests/ecsUndoRedo.spec.ts rename to browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts From f962d15549d367e4f071916dc5d73d1d21e2549c Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:55:07 -0700 Subject: [PATCH 04/42] test: assert every mixed edit after each history step Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389322 --- .../changeTracking/ecsUndoRedo.spec.ts | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 5546cec8b81..a6abd695224 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -113,23 +113,31 @@ test.describe( .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(initialNodeCount + 1) + const expectState = async ( + position: typeof initialPosition, + steps: string, + nodeCount: number + ) => { + await expect.poll(() => node.getBounding()).toEqual(position) + await expect(input).toHaveValue(steps) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(nodeCount) + } + await comfyPage.keyboard.undo() - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(initialNodeCount) + await expectState(movedPosition, '31', initialNodeCount) await comfyPage.keyboard.undo() - await expect(input).toHaveValue(initialSteps) + await expectState(movedPosition, initialSteps, initialNodeCount) await comfyPage.keyboard.undo() - await expect.poll(() => node.getBounding()).toEqual(initialPosition) + await expectState(initialPosition, initialSteps, initialNodeCount) await comfyPage.keyboard.redo() - await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await expectState(movedPosition, initialSteps, initialNodeCount) await comfyPage.keyboard.redo() - await expect(input).toHaveValue('31') + await expectState(movedPosition, '31', initialNodeCount) await comfyPage.keyboard.redo() - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(initialNodeCount + 1) + await expectState(movedPosition, '31', initialNodeCount + 1) }) test('undo remains scoped to the edited workflow after switching tabs', async ({ From 6377430aae61aa86ab83741b4f4cc76199c0f1f8 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:55:37 -0700 Subject: [PATCH 05/42] test: clean saved workflows after undo scenarios Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389334 --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index a6abd695224..59344787437 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -19,6 +19,7 @@ test.describe( }) test.afterEach(async ({ comfyPage }) => { + await comfyPage.workflow.setupWorkflowsDirectory({}) await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) await comfyPage.canvasOps.resetView() }) From c4e4c281602b7b26df2879f733df3b86e22e39e2 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:56:11 -0700 Subject: [PATCH 06/42] test: read tab undo positions through node reference Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389342 --- .../changeTracking/ecsUndoRedo.spec.ts | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 59344787437..e21ae100a83 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -3,7 +3,6 @@ import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage' import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers' -import { toNodeId } from '@/types/nodeId' test.describe( 'ECS migration: undo/redo', @@ -148,19 +147,11 @@ test.describe( await comfyPage.menu.topbar.saveWorkflow('Undo Tab A') await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) const node = await comfyPage.nodeOps.getNodeRefById('3') - const initialPosition = await comfyPage.page.evaluate( - (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], - toNodeId('3') - ) + const initialPosition = await node.getProperty<[number, number]>('pos') await node.dragBy({ x: 100, y: 50 }) await expect - .poll(() => - comfyPage.page.evaluate( - (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], - toNodeId('3') - ) - ) + .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) @@ -184,21 +175,11 @@ test.describe( await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) await expect - .poll(() => - comfyPage.page.evaluate( - (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], - toNodeId('3') - ) - ) + .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) await comfyPage.menu.topbar.triggerTopbarCommand(['Edit', 'Undo']) await expect - .poll(() => - comfyPage.page.evaluate( - (nodeId) => [...window.app!.graph.getNodeById(nodeId)!.pos], - toNodeId('3') - ) - ) + .poll(() => node.getProperty<[number, number]>('pos')) .toEqual(initialPosition) await tabB.click() From 0bf64b60e48b0b045b3955e33fe04bc70ea679c8 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:56:47 -0700 Subject: [PATCH 07/42] test: narrow newly created workflow tab explicitly Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389352 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index e21ae100a83..58f7b47079c 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -159,9 +159,14 @@ test.describe( await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() - const tabBName = tabsAfterNew.find( + const newTabs = tabsAfterNew.filter( (name) => !tabsBeforeNew.includes(name) - )! + ) + expect(newTabs, 'New must create exactly one workflow tab').toHaveLength( + 1 + ) + if (newTabs.length !== 1) throw new Error('Expected one new workflow tab') + const [tabBName] = newTabs const tabB = comfyPage.menu.topbar.getWorkflowTab(tabBName) await expect(tabB).toBeVisible() From 4da6c67802b45048c0886366d2e3030bb1458a48 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:57:18 -0700 Subject: [PATCH 08/42] test: load only each undo scenario fixture Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389363 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 58f7b47079c..2e01662fc30 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -14,7 +14,6 @@ test.describe( 'Comfy.Workflow.WorkflowTabsPosition', 'Topbar' ) - await comfyPage.workflow.loadWorkflow('default') }) test.afterEach(async ({ comfyPage }) => { @@ -26,6 +25,7 @@ test.describe( test('moving a node can be undone and a second redo is a no-op', async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('default') const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getBounding() @@ -68,6 +68,7 @@ test.describe( test('changing a widget value can be undone and redone', async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('default') const node = await comfyPage.nodeOps.getNodeRefById('3') const steps = await node.getWidget(2) const initialValue = await steps.getValue() @@ -87,6 +88,7 @@ test.describe( comfyPage, comfyMouse }) => { + await comfyPage.workflow.loadWorkflow('default') await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) await comfyPage.vueNodes.waitForNodes() const node = await comfyPage.nodeOps.getNodeRefById('3') @@ -143,6 +145,7 @@ test.describe( test('undo remains scoped to the edited workflow after switching tabs', async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('default') await comfyPage.workflow.setupWorkflowsDirectory({}) await comfyPage.menu.topbar.saveWorkflow('Undo Tab A') await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) From 2cd52cfe53a859861f4e3111d3f90237df147b55 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 15:57:49 -0700 Subject: [PATCH 09/42] test: tag widget and Vue undo scenarios Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3993389368 --- .../changeTracking/ecsUndoRedo.spec.ts | 151 +++++++++--------- 1 file changed, 78 insertions(+), 73 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 2e01662fc30..b4c63fd7d58 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -65,82 +65,87 @@ test.describe( .toEqual(initialPosition) }) - test('changing a widget value can be undone and redone', async ({ - comfyPage - }) => { - await comfyPage.workflow.loadWorkflow('default') - const node = await comfyPage.nodeOps.getNodeRefById('3') - const steps = await node.getWidget(2) - const initialValue = await steps.getValue() - - await steps.dragHorizontal(80) - await expect.poll(() => steps.getValue()).not.toBe(initialValue) - const changedValue = await steps.getValue() - - await comfyPage.keyboard.undo() - await expect.poll(() => steps.getValue()).toBe(initialValue) - - await comfyPage.keyboard.redo() - await expect.poll(() => steps.getValue()).toBe(changedValue) - }) - - test('three mixed Vue Nodes edits can be undone and redone in order', async ({ - comfyPage, - comfyMouse - }) => { - await comfyPage.workflow.loadWorkflow('default') - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) - await comfyPage.vueNodes.waitForNodes() - const node = await comfyPage.nodeOps.getNodeRefById('3') - const initialPosition = await node.getBounding() - const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') - - await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) - await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) - const movedPosition = await node.getBounding() - - const stepsWidget = comfyPage.vueNodes.getWidgetByName( - 'KSampler', - 'steps' - ) - const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) - const initialSteps = await input.inputValue() - await input.fill('31') - await input.press('Enter') - await expect(input).toHaveValue('31') - - const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() - await comfyPage.searchBoxV2.addNode('Note') - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(initialNodeCount + 1) - - const expectState = async ( - position: typeof initialPosition, - steps: string, - nodeCount: number - ) => { - await expect.poll(() => node.getBounding()).toEqual(position) - await expect(input).toHaveValue(steps) + test( + 'changing a widget value can be undone and redone', + { tag: ['@widget'] }, + async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('default') + const node = await comfyPage.nodeOps.getNodeRefById('3') + const steps = await node.getWidget(2) + const initialValue = await steps.getValue() + + await steps.dragHorizontal(80) + await expect.poll(() => steps.getValue()).not.toBe(initialValue) + const changedValue = await steps.getValue() + + await comfyPage.keyboard.undo() + await expect.poll(() => steps.getValue()).toBe(initialValue) + + await comfyPage.keyboard.redo() + await expect.poll(() => steps.getValue()).toBe(changedValue) + } + ) + + test( + 'three mixed Vue Nodes edits can be undone and redone in order', + { + tag: ['@vue-nodes', '@widget'] + }, + async ({ comfyPage, comfyMouse }) => { + await comfyPage.workflow.loadWorkflow('default') + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) + await comfyPage.vueNodes.waitForNodes() + const node = await comfyPage.nodeOps.getNodeRefById('3') + const initialPosition = await node.getBounding() + const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') + + await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) + await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) + const movedPosition = await node.getBounding() + + const stepsWidget = comfyPage.vueNodes.getWidgetByName( + 'KSampler', + 'steps' + ) + const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) + const initialSteps = await input.inputValue() + await input.fill('31') + await input.press('Enter') + await expect(input).toHaveValue('31') + + const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() + await comfyPage.searchBoxV2.addNode('Note') await expect .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(nodeCount) + .toBe(initialNodeCount + 1) + + const expectState = async ( + position: typeof initialPosition, + steps: string, + nodeCount: number + ) => { + await expect.poll(() => node.getBounding()).toEqual(position) + await expect(input).toHaveValue(steps) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(nodeCount) + } + + await comfyPage.keyboard.undo() + await expectState(movedPosition, '31', initialNodeCount) + await comfyPage.keyboard.undo() + await expectState(movedPosition, initialSteps, initialNodeCount) + await comfyPage.keyboard.undo() + await expectState(initialPosition, initialSteps, initialNodeCount) + + await comfyPage.keyboard.redo() + await expectState(movedPosition, initialSteps, initialNodeCount) + await comfyPage.keyboard.redo() + await expectState(movedPosition, '31', initialNodeCount) + await comfyPage.keyboard.redo() + await expectState(movedPosition, '31', initialNodeCount + 1) } - - await comfyPage.keyboard.undo() - await expectState(movedPosition, '31', initialNodeCount) - await comfyPage.keyboard.undo() - await expectState(movedPosition, initialSteps, initialNodeCount) - await comfyPage.keyboard.undo() - await expectState(initialPosition, initialSteps, initialNodeCount) - - await comfyPage.keyboard.redo() - await expectState(movedPosition, initialSteps, initialNodeCount) - await comfyPage.keyboard.redo() - await expectState(movedPosition, '31', initialNodeCount) - await comfyPage.keyboard.redo() - await expectState(movedPosition, '31', initialNodeCount + 1) - }) + ) test('undo remains scoped to the edited workflow after switching tabs', async ({ comfyPage From dd27386b57afbf5e44ba68f16bd13224157e2598 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 18:07:56 -0700 Subject: [PATCH 10/42] test: let Vue fixture own mixed history setup Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3994259188 --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index b4c63fd7d58..1bac9bf2df5 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -93,8 +93,6 @@ test.describe( }, async ({ comfyPage, comfyMouse }) => { await comfyPage.workflow.loadWorkflow('default') - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) - await comfyPage.vueNodes.waitForNodes() const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getBounding() const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') From f375d781263569470b1e3f4e87910f61290d4ab5 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 18:25:28 -0700 Subject: [PATCH 11/42] test: enter the numeric editor before recording mixed undo history Use real editor entry and exit interactions, wait for the graph value, and assert each history boundary before starting the next edit. Follow-up to https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3994259188 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 1bac9bf2df5..27710571f0d 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -93,12 +93,14 @@ test.describe( }, async ({ comfyPage, comfyMouse }) => { await comfyPage.workflow.loadWorkflow('default') + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getBounding() const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) const movedPosition = await node.getBounding() const stepsWidget = comfyPage.vueNodes.getWidgetByName( @@ -107,15 +109,23 @@ test.describe( ) const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) const initialSteps = await input.inputValue() + await stepsWidget.click() await input.fill('31') await input.press('Enter') await expect(input).toHaveValue('31') + await expect + .poll(async () => (await node.getWidget(2)).getValue()) + .toBe(31) + // Leave the editor through a real pointer event before the next edit. + await ksampler.title.click() + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(2) const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() await comfyPage.searchBoxV2.addNode('Note') await expect .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(initialNodeCount + 1) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(3) const expectState = async ( position: typeof initialPosition, From 38e7e5b3c854e7a7c5548d0e4c4f04af1835542e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 20:02:09 -0700 Subject: [PATCH 12/42] test: complete renderer and tab history coverage --- .../changeTracking/ecsUndoRedo.spec.ts | 126 +++++++++++++----- 1 file changed, 92 insertions(+), 34 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 27710571f0d..6aba2f921f9 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -22,26 +22,33 @@ test.describe( await comfyPage.canvasOps.resetView() }) - test('moving a node can be undone and a second redo is a no-op', async ({ - comfyPage - }) => { - await comfyPage.workflow.loadWorkflow('default') - const node = await comfyPage.nodeOps.getNodeRefById('3') - const initialPosition = await node.getBounding() + for (const vueNodesEnabled of [false, true]) { + test(`moving a node can be undone and a second redo is a no-op (${vueNodesEnabled ? 'Vue' : 'LiteGraph'})`, async ({ + comfyPage + }) => { + await comfyPage.settings.setSetting( + 'Comfy.VueNodes.Enabled', + vueNodesEnabled + ) + await comfyPage.workflow.loadWorkflow('default') + if (vueNodesEnabled) await comfyPage.vueNodes.waitForNodes() + const node = await comfyPage.nodeOps.getNodeRefById('3') + const initialPosition = await node.getBounding() - await node.dragBy({ x: 120, y: 80 }) - await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) - const movedPosition = await node.getBounding() + await node.dragBy({ x: 120, y: 80 }) + await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) + const movedPosition = await node.getBounding() - await comfyPage.keyboard.undo() - await expect.poll(() => node.getBounding()).toEqual(initialPosition) + await comfyPage.keyboard.undo() + await expect.poll(() => node.getBounding()).toEqual(initialPosition) - await comfyPage.keyboard.redo() - await expect.poll(() => node.getBounding()).toEqual(movedPosition) - await comfyPage.keyboard.redo() - await expect.poll(() => node.getBounding()).toEqual(movedPosition) - await expect(comfyPage.toast.toastErrors).toHaveCount(0) - }) + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + await expect(comfyPage.toast.toastErrors).toHaveCount(0) + }) + } test('moving a group by its title can be undone', async ({ comfyPage, @@ -65,26 +72,47 @@ test.describe( .toEqual(initialPosition) }) - test( - 'changing a widget value can be undone and redone', - { tag: ['@widget'] }, - async ({ comfyPage }) => { - await comfyPage.workflow.loadWorkflow('default') - const node = await comfyPage.nodeOps.getNodeRefById('3') - const steps = await node.getWidget(2) - const initialValue = await steps.getValue() + for (const vueNodesEnabled of [false, true]) { + test( + `changing a widget value can be undone and redone (${vueNodesEnabled ? 'Vue' : 'LiteGraph'})`, + { tag: ['@widget'] }, + async ({ comfyPage }) => { + await comfyPage.settings.setSetting( + 'Comfy.VueNodes.Enabled', + vueNodesEnabled + ) + await comfyPage.workflow.loadWorkflow('default') + if (vueNodesEnabled) await comfyPage.vueNodes.waitForNodes() + const node = await comfyPage.nodeOps.getNodeRefById('3') + const steps = await node.getWidget(2) + const initialValue = await steps.getValue() - await steps.dragHorizontal(80) - await expect.poll(() => steps.getValue()).not.toBe(initialValue) - const changedValue = await steps.getValue() + if (vueNodesEnabled) { + const widget = comfyPage.vueNodes.getWidgetByName( + 'KSampler', + 'steps' + ) + const { input } = comfyPage.vueNodes.getInputNumberControls(widget) + await widget.click() + await input.fill('31') + await input.press('Enter') + await ( + await comfyPage.vueNodes.getFixtureByTitle('KSampler') + ).title.click() + } else { + await steps.dragHorizontal(80) + } + await expect.poll(() => steps.getValue()).not.toBe(initialValue) + const changedValue = await steps.getValue() - await comfyPage.keyboard.undo() - await expect.poll(() => steps.getValue()).toBe(initialValue) + await comfyPage.keyboard.undo() + await expect.poll(() => steps.getValue()).toBe(initialValue) - await comfyPage.keyboard.redo() - await expect.poll(() => steps.getValue()).toBe(changedValue) - } - ) + await comfyPage.keyboard.redo() + await expect.poll(() => steps.getValue()).toBe(changedValue) + } + ) + } test( 'three mixed Vue Nodes edits can be undone and redone in order', @@ -170,10 +198,23 @@ test.describe( .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + const tabAState = await comfyPage.page.evaluate(() => + window + .app!.graph.nodes.map((graphNode) => ({ + id: String(graphNode.id), + bounds: [...graphNode.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + ) const tabsBeforeNew = await comfyPage.menu.topbar.getTabNames() await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + expect( + await comfyPage.page.evaluate(() => + window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) + ) + ).toEqual([]) const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() const newTabs = tabsAfterNew.filter( (name) => !tabsBeforeNew.includes(name) @@ -194,6 +235,18 @@ test.describe( await comfyPage.menu.topbar.getWorkflowTab('Undo Tab A').click() await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) + await expect + .poll(() => + comfyPage.page.evaluate(() => + window + .app!.graph.nodes.map((graphNode) => ({ + id: String(graphNode.id), + bounds: [...graphNode.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + ) + ) + .toEqual(tabAState) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) await expect .poll(() => node.getProperty<[number, number]>('pos')) @@ -205,6 +258,11 @@ test.describe( await tabB.click() await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + expect( + await comfyPage.page.evaluate(() => + window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) + ) + ).toEqual([]) }) } ) From bf171a00d0bc7d1b7d28ed641669e5d36167b62a Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 20:51:35 -0700 Subject: [PATCH 13/42] test: cover compound ECS undo history --- .../changeTracking/ecsUndoRedo.spec.ts | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 6aba2f921f9..2393adf7c23 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -183,6 +183,139 @@ test.describe( } ) + test( + 'undoes and redoes the complete compound graph edit chain', + { tag: ['@vue-nodes', '@widget'] }, + async ({ comfyPage }) => { + test.slow() + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) + await comfyPage.settings.setSetting( + 'Comfy.LinkRelease.Action', + 'no action' + ) + await comfyPage.menu.topbar.triggerTopbarCommand(['New']) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + + const getSnapshot = () => + comfyPage.page.evaluate(() => ({ + nodes: window + .app!.graph.nodes.map((node) => ({ + id: String(node.id), + type: node.type, + position: [...node.pos], + widgets: (node.widgets ?? []).map(({ name, value }) => ({ + name, + value: value ?? null + })) + })) + .sort((left, right) => left.id.localeCompare(right.id)), + links: [...window.app!.graph.links.values()] + .map((link) => ({ + originId: String(link.origin_id), + originSlot: link.origin_slot, + targetId: String(link.target_id), + targetSlot: link.target_slot + })) + .sort((left, right) => + JSON.stringify(left).localeCompare(JSON.stringify(right)) + ) + })) + const snapshots = [await getSnapshot()] + const checkpoint = async () => { + for (let frame = 0; frame < 4; frame++) await comfyPage.nextFrame() + snapshots.push(await getSnapshot()) + await expect + .poll(() => comfyPage.workflow.getUndoQueueSize()) + .toBe(snapshots.length - 1) + } + + await comfyPage.searchBoxV2.addNode('Load Checkpoint', { + position: { x: 250, y: 250 } + }) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1) + await checkpoint() + const loader = await comfyPage.nodeOps.getNodeRefByType( + 'CheckpointLoaderSimple' + ) + + await comfyPage.searchBoxV2.addNode('KSampler', { + position: { x: 650, y: 250 } + }) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(2) + await checkpoint() + const sampler = await comfyPage.nodeOps.getNodeRefByType('KSampler') + + const output = await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await expect + .poll(async () => (await sampler.getInput(0)).getLink()) + .not.toBeNull() + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + + await loader.dragBy({ x: 90, y: 60 }) + await checkpoint() + await sampler.dragBy({ x: -70, y: 100 }) + await checkpoint() + + const samplerFixture = + await comfyPage.vueNodes.getFixtureByTitle('KSampler') + const editNumber = async (name: string, value: string) => { + const widget = comfyPage.vueNodes.getWidgetByName('KSampler', name) + const { input } = comfyPage.vueNodes.getInputNumberControls(widget) + await widget.click() + await input.fill(value) + await input.press('Enter') + await samplerFixture.title.click() + await expect(input).toHaveValue(value) + } + await editNumber('steps', '31') + await expect + .poll(async () => (await sampler.getWidgetByName('steps')).getValue()) + .toBe(31) + await checkpoint() + await editNumber('cfg', '9.5') + await expect + .poll(async () => (await sampler.getWidgetByName('cfg')).getValue()) + .toBe(9.5) + await checkpoint() + + const samplerInput = await sampler.getInput(0) + await comfyPage.canvasOps.dragAndDrop( + await samplerInput.getPosition(), + { x: 900, y: 650 } + ) + await expect.poll(() => samplerInput.getLink()).toBeNull() + await output.expectLinkCount(0) + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + + await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await expect.poll(() => samplerInput.getLink()).not.toBeNull() + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + + await sampler.delete() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1) + await output.expectLinkCount(0) + await checkpoint() + const finalSnapshot = snapshots.at(-1)! + + for (let index = snapshots.length - 2; index >= 0; index--) { + await comfyPage.keyboard.undo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + for (let index = 1; index < snapshots.length; index++) { + await comfyPage.keyboard.redo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + expect(await getSnapshot()).toEqual(finalSnapshot) + await expect(comfyPage.toast.toastErrors).toHaveCount(0) + } + ) + test('undo remains scoped to the edited workflow after switching tabs', async ({ comfyPage }) => { From 84f229e8016d7455eea0a57557048834a33a9193 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 21:47:42 -0700 Subject: [PATCH 14/42] test: keep undo redo link targets separated --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 2393adf7c23..1ce1d670b77 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -256,7 +256,7 @@ test.describe( await loader.dragBy({ x: 90, y: 60 }) await checkpoint() - await sampler.dragBy({ x: -70, y: 100 }) + await sampler.dragBy({ x: 70, y: 100 }) await checkpoint() const samplerFixture = @@ -291,6 +291,15 @@ test.describe( await comfyPage.page.mouse.click(600, 650) await checkpoint() + await expect + .poll(async () => { + const [source, target] = await Promise.all([ + output.getPosition(), + samplerInput.getPosition() + ]) + return target.x - source.x + }) + .toBeGreaterThan(100) await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) await expect.poll(() => samplerInput.getLink()).not.toBeNull() From 94fd4cc607d561f56a4620675dfb2f98d9e6a66e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:38:35 -0700 Subject: [PATCH 15/42] test: assert contained node group movement Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536025 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 1ce1d670b77..e8fa29489c8 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -56,6 +56,8 @@ test.describe( }) => { await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') const initialPosition = await comfyPage.canvasOps.getGroupPosition('Pair') + const containedNode = await comfyPage.nodeOps.getNodeRefById('2') + const initialNodePosition = await containedNode.getBounding() const titlePosition = await getGroupTitlePosition(comfyPage, 'Pair') await comfyMouse.dragAndDrop(titlePosition, { @@ -65,11 +67,17 @@ test.describe( await expect .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) .not.toEqual(initialPosition) + await expect + .poll(() => containedNode.getBounding()) + .not.toEqual(initialNodePosition) await comfyPage.keyboard.undo() await expect .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) .toEqual(initialPosition) + await expect + .poll(() => containedNode.getBounding()) + .toEqual(initialNodePosition) }) for (const vueNodesEnabled of [false, true]) { From b57b5e5a99d4f34958b7925435371d0e646ee71f Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:39:04 -0700 Subject: [PATCH 16/42] test: await history before snapshots Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536026 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index e8fa29489c8..eb218536768 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -231,11 +231,10 @@ test.describe( })) const snapshots = [await getSnapshot()] const checkpoint = async () => { - for (let frame = 0; frame < 4; frame++) await comfyPage.nextFrame() - snapshots.push(await getSnapshot()) await expect .poll(() => comfyPage.workflow.getUndoQueueSize()) - .toBe(snapshots.length - 1) + .toBe(snapshots.length) + snapshots.push(await getSnapshot()) } await comfyPage.searchBoxV2.addNode('Load Checkpoint', { From c0b38b01d806b39ad69112c9ef86d521997db3a8 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:39:31 -0700 Subject: [PATCH 17/42] test: await workflow tab switches Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536027 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index eb218536768..ae7c7f65d8a 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -382,7 +382,7 @@ test.describe( await comfyPage.keyboard.undo() await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - await comfyPage.menu.topbar.getWorkflowTab('Undo Tab A').click() + await comfyPage.workflow.switchToTab('Undo Tab A') await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) await expect .poll(() => @@ -405,7 +405,7 @@ test.describe( .poll(() => node.getProperty<[number, number]>('pos')) .toEqual(initialPosition) - await tabB.click() + await comfyPage.workflow.switchToTab(tabBName) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) expect( await comfyPage.page.evaluate(() => From 2211d9cc1f7338ebc66276f796315bf389d4a6e3 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:39:59 -0700 Subject: [PATCH 18/42] test: use group drag action Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536028 --- .../workflow/changeTracking/ecsUndoRedo.spec.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index ae7c7f65d8a..b23b21a4f7b 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -2,7 +2,6 @@ import { comfyExpect as expect, comfyPageFixture as test } from '@e2e/fixtures/ComfyPage' -import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers' test.describe( 'ECS migration: undo/redo', @@ -50,19 +49,15 @@ test.describe( }) } - test('moving a group by its title can be undone', async ({ - comfyPage, - comfyMouse - }) => { + test('moving a group by its title can be undone', async ({ comfyPage }) => { await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') const initialPosition = await comfyPage.canvasOps.getGroupPosition('Pair') const containedNode = await comfyPage.nodeOps.getNodeRefById('2') const initialNodePosition = await containedNode.getBounding() - const titlePosition = await getGroupTitlePosition(comfyPage, 'Pair') - - await comfyMouse.dragAndDrop(titlePosition, { - x: titlePosition.x + 100, - y: titlePosition.y + 60 + await comfyPage.canvasOps.dragGroup({ + name: 'Pair', + deltaX: 100, + deltaY: 60 }) await expect .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) From ee53aa20a98c59cc9ac2a78e21706ff4a34eb3d6 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:40:41 -0700 Subject: [PATCH 19/42] test: share Vue number commit action Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536029 --- browser_tests/fixtures/VueNodeHelpers.ts | 16 +++++++++ .../changeTracking/ecsUndoRedo.spec.ts | 34 ++++--------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/browser_tests/fixtures/VueNodeHelpers.ts b/browser_tests/fixtures/VueNodeHelpers.ts index 47b109a43cb..67faa0b63c7 100644 --- a/browser_tests/fixtures/VueNodeHelpers.ts +++ b/browser_tests/fixtures/VueNodeHelpers.ts @@ -281,6 +281,22 @@ export class VueNodeHelpers { } } + async editAndCommitNumber( + nodeTitle: string, + widgetName: string, + value: string + ): Promise { + const widget = this.getWidgetByName(nodeTitle, widgetName) + const { input } = this.getInputNumberControls(widget) + const fixture = await this.getFixtureByTitle(nodeTitle) + await widget.click() + await input.fill(value) + await input.press('Enter') + await this.page.evaluate(() => new Promise(requestAnimationFrame)) + await fixture.title.click() + await expect(input).toHaveValue(value) + } + /** * Locator for the Enter Subgraph footer button. */ diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index b23b21a4f7b..144494da5fc 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -91,17 +91,11 @@ test.describe( const initialValue = await steps.getValue() if (vueNodesEnabled) { - const widget = comfyPage.vueNodes.getWidgetByName( + await comfyPage.vueNodes.editAndCommitNumber( 'KSampler', - 'steps' + 'steps', + '31' ) - const { input } = comfyPage.vueNodes.getInputNumberControls(widget) - await widget.click() - await input.fill('31') - await input.press('Enter') - await ( - await comfyPage.vueNodes.getFixtureByTitle('KSampler') - ).title.click() } else { await steps.dragHorizontal(80) } @@ -140,15 +134,10 @@ test.describe( ) const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) const initialSteps = await input.inputValue() - await stepsWidget.click() - await input.fill('31') - await input.press('Enter') - await expect(input).toHaveValue('31') + await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'steps', '31') await expect .poll(async () => (await node.getWidget(2)).getValue()) .toBe(31) - // Leave the editor through a real pointer event before the next edit. - await ksampler.title.click() await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(2) const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() @@ -261,23 +250,12 @@ test.describe( await sampler.dragBy({ x: 70, y: 100 }) await checkpoint() - const samplerFixture = - await comfyPage.vueNodes.getFixtureByTitle('KSampler') - const editNumber = async (name: string, value: string) => { - const widget = comfyPage.vueNodes.getWidgetByName('KSampler', name) - const { input } = comfyPage.vueNodes.getInputNumberControls(widget) - await widget.click() - await input.fill(value) - await input.press('Enter') - await samplerFixture.title.click() - await expect(input).toHaveValue(value) - } - await editNumber('steps', '31') + await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'steps', '31') await expect .poll(async () => (await sampler.getWidgetByName('steps')).getValue()) .toBe(31) await checkpoint() - await editNumber('cfg', '9.5') + await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'cfg', '9.5') await expect .poll(async () => (await sampler.getWidgetByName('cfg')).getValue()) .toBe(9.5) From 90a1aa38a7ceee93ebbdecc6f3b135c578f3ee38 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:41:32 -0700 Subject: [PATCH 20/42] test: seed workflow settings at startup Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536031 --- .../changeTracking/ecsUndoRedo.spec.ts | 274 ++++++++++-------- 1 file changed, 147 insertions(+), 127 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 144494da5fc..af7ce833d9a 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -7,17 +7,18 @@ test.describe( 'ECS migration: undo/redo', { tag: ['@canvas', '@workflow'] }, () => { + test.use({ + initialSettings: { + 'Comfy.Workflow.WorkflowTabsPosition': 'Topbar' + } + }) + test.beforeEach(async ({ comfyPage }) => { await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top') - await comfyPage.settings.setSetting( - 'Comfy.Workflow.WorkflowTabsPosition', - 'Topbar' - ) }) test.afterEach(async ({ comfyPage }) => { await comfyPage.workflow.setupWorkflowsDirectory({}) - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) await comfyPage.canvasOps.resetView() }) @@ -175,135 +176,154 @@ test.describe( } ) - test( - 'undoes and redoes the complete compound graph edit chain', - { tag: ['@vue-nodes', '@widget'] }, - async ({ comfyPage }) => { - test.slow() - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) - await comfyPage.settings.setSetting( - 'Comfy.LinkRelease.Action', - 'no action' - ) - await comfyPage.menu.topbar.triggerTopbarCommand(['New']) - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) - - const getSnapshot = () => - comfyPage.page.evaluate(() => ({ - nodes: window - .app!.graph.nodes.map((node) => ({ - id: String(node.id), - type: node.type, - position: [...node.pos], - widgets: (node.widgets ?? []).map(({ name, value }) => ({ - name, - value: value ?? null - })) - })) - .sort((left, right) => left.id.localeCompare(right.id)), - links: [...window.app!.graph.links.values()] - .map((link) => ({ - originId: String(link.origin_id), - originSlot: link.origin_slot, - targetId: String(link.target_id), - targetSlot: link.target_slot - })) - .sort((left, right) => - JSON.stringify(left).localeCompare(JSON.stringify(right)) - ) - })) - const snapshots = [await getSnapshot()] - const checkpoint = async () => { - await expect - .poll(() => comfyPage.workflow.getUndoQueueSize()) - .toBe(snapshots.length) - snapshots.push(await getSnapshot()) + test.describe('compound graph history', () => { + test.use({ + initialSettings: { + 'Comfy.Workflow.WorkflowTabsPosition': 'Topbar', + 'Comfy.LinkRelease.Action': 'no action' } + }) - await comfyPage.searchBoxV2.addNode('Load Checkpoint', { - position: { x: 250, y: 250 } - }) - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1) - await checkpoint() - const loader = await comfyPage.nodeOps.getNodeRefByType( - 'CheckpointLoaderSimple' - ) - - await comfyPage.searchBoxV2.addNode('KSampler', { - position: { x: 650, y: 250 } - }) - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(2) - await checkpoint() - const sampler = await comfyPage.nodeOps.getNodeRefByType('KSampler') + test( + 'undoes and redoes the complete compound graph edit chain', + { tag: ['@vue-nodes', '@widget'] }, + async ({ comfyPage }) => { + test.slow() + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) + await comfyPage.menu.topbar.triggerTopbarCommand(['New']) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(0) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + + const getSnapshot = () => + comfyPage.page.evaluate(() => ({ + nodes: window + .app!.graph.nodes.map((node) => ({ + id: String(node.id), + type: node.type, + position: [...node.pos], + widgets: (node.widgets ?? []).map(({ name, value }) => ({ + name, + value: value ?? null + })) + })) + .sort((left, right) => left.id.localeCompare(right.id)), + links: [...window.app!.graph.links.values()] + .map((link) => ({ + originId: String(link.origin_id), + originSlot: link.origin_slot, + targetId: String(link.target_id), + targetSlot: link.target_slot + })) + .sort((left, right) => + JSON.stringify(left).localeCompare(JSON.stringify(right)) + ) + })) + const snapshots = [await getSnapshot()] + const checkpoint = async () => { + await expect + .poll(() => comfyPage.workflow.getUndoQueueSize()) + .toBe(snapshots.length) + snapshots.push(await getSnapshot()) + } - const output = await loader.connectOutput(0, sampler, 0) - await output.expectLinkCount(1) - await expect - .poll(async () => (await sampler.getInput(0)).getLink()) - .not.toBeNull() - await comfyPage.page.mouse.click(600, 650) - await checkpoint() + await comfyPage.searchBoxV2.addNode('Load Checkpoint', { + position: { x: 250, y: 250 } + }) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(1) + await checkpoint() + const loader = await comfyPage.nodeOps.getNodeRefByType( + 'CheckpointLoaderSimple' + ) - await loader.dragBy({ x: 90, y: 60 }) - await checkpoint() - await sampler.dragBy({ x: 70, y: 100 }) - await checkpoint() + await comfyPage.searchBoxV2.addNode('KSampler', { + position: { x: 650, y: 250 } + }) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(2) + await checkpoint() + const sampler = await comfyPage.nodeOps.getNodeRefByType('KSampler') - await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'steps', '31') - await expect - .poll(async () => (await sampler.getWidgetByName('steps')).getValue()) - .toBe(31) - await checkpoint() - await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'cfg', '9.5') - await expect - .poll(async () => (await sampler.getWidgetByName('cfg')).getValue()) - .toBe(9.5) - await checkpoint() - - const samplerInput = await sampler.getInput(0) - await comfyPage.canvasOps.dragAndDrop( - await samplerInput.getPosition(), - { x: 900, y: 650 } - ) - await expect.poll(() => samplerInput.getLink()).toBeNull() - await output.expectLinkCount(0) - await comfyPage.page.mouse.click(600, 650) - await checkpoint() + const output = await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await expect + .poll(async () => (await sampler.getInput(0)).getLink()) + .not.toBeNull() + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + + await loader.dragBy({ x: 90, y: 60 }) + await checkpoint() + await sampler.dragBy({ x: 70, y: 100 }) + await checkpoint() + + await comfyPage.vueNodes.editAndCommitNumber( + 'KSampler', + 'steps', + '31' + ) + await expect + .poll(async () => + (await sampler.getWidgetByName('steps')).getValue() + ) + .toBe(31) + await checkpoint() + await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'cfg', '9.5') + await expect + .poll(async () => (await sampler.getWidgetByName('cfg')).getValue()) + .toBe(9.5) + await checkpoint() + + const samplerInput = await sampler.getInput(0) + await comfyPage.canvasOps.dragAndDrop( + await samplerInput.getPosition(), + { x: 900, y: 650 } + ) + await expect.poll(() => samplerInput.getLink()).toBeNull() + await output.expectLinkCount(0) + await comfyPage.page.mouse.click(600, 650) + await checkpoint() - await expect - .poll(async () => { - const [source, target] = await Promise.all([ - output.getPosition(), - samplerInput.getPosition() - ]) - return target.x - source.x - }) - .toBeGreaterThan(100) - await loader.connectOutput(0, sampler, 0) - await output.expectLinkCount(1) - await expect.poll(() => samplerInput.getLink()).not.toBeNull() - await comfyPage.page.mouse.click(600, 650) - await checkpoint() - - await sampler.delete() - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1) - await output.expectLinkCount(0) - await checkpoint() - const finalSnapshot = snapshots.at(-1)! - - for (let index = snapshots.length - 2; index >= 0; index--) { - await comfyPage.keyboard.undo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) - } - for (let index = 1; index < snapshots.length; index++) { - await comfyPage.keyboard.redo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) + await expect + .poll(async () => { + const [source, target] = await Promise.all([ + output.getPosition(), + samplerInput.getPosition() + ]) + return target.x - source.x + }) + .toBeGreaterThan(100) + await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await expect.poll(() => samplerInput.getLink()).not.toBeNull() + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + + await sampler.delete() + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(1) + await output.expectLinkCount(0) + await checkpoint() + const finalSnapshot = snapshots.at(-1)! + + for (let index = snapshots.length - 2; index >= 0; index--) { + await comfyPage.keyboard.undo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + for (let index = 1; index < snapshots.length; index++) { + await comfyPage.keyboard.redo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + expect(await getSnapshot()).toEqual(finalSnapshot) + await expect(comfyPage.toast.toastErrors).toHaveCount(0) } - expect(await getSnapshot()).toEqual(finalSnapshot) - await expect(comfyPage.toast.toastErrors).toHaveCount(0) - } - ) + ) + }) test('undo remains scoped to the edited workflow after switching tabs', async ({ comfyPage From f9b063b72fadb5cd93f71367e323a733ac316472 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:42:31 -0700 Subject: [PATCH 21/42] test: name undo scenario phases Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536032 --- .../changeTracking/ecsUndoRedo.spec.ts | 129 ++++++++++-------- 1 file changed, 74 insertions(+), 55 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index af7ce833d9a..471d2182cd0 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -160,19 +160,23 @@ test.describe( .toBe(nodeCount) } - await comfyPage.keyboard.undo() - await expectState(movedPosition, '31', initialNodeCount) - await comfyPage.keyboard.undo() - await expectState(movedPosition, initialSteps, initialNodeCount) - await comfyPage.keyboard.undo() - await expectState(initialPosition, initialSteps, initialNodeCount) + await test.step('Undo each mixed edit in order', async () => { + await comfyPage.keyboard.undo() + await expectState(movedPosition, '31', initialNodeCount) + await comfyPage.keyboard.undo() + await expectState(movedPosition, initialSteps, initialNodeCount) + await comfyPage.keyboard.undo() + await expectState(initialPosition, initialSteps, initialNodeCount) + }) - await comfyPage.keyboard.redo() - await expectState(movedPosition, initialSteps, initialNodeCount) - await comfyPage.keyboard.redo() - await expectState(movedPosition, '31', initialNodeCount) - await comfyPage.keyboard.redo() - await expectState(movedPosition, '31', initialNodeCount + 1) + await test.step('Redo each mixed edit in order', async () => { + await comfyPage.keyboard.redo() + await expectState(movedPosition, initialSteps, initialNodeCount) + await comfyPage.keyboard.redo() + await expectState(movedPosition, '31', initialNodeCount) + await comfyPage.keyboard.redo() + await expectState(movedPosition, '31', initialNodeCount + 1) + }) } ) @@ -256,10 +260,12 @@ test.describe( await comfyPage.page.mouse.click(600, 650) await checkpoint() - await loader.dragBy({ x: 90, y: 60 }) - await checkpoint() - await sampler.dragBy({ x: 70, y: 100 }) - await checkpoint() + await test.step('Move both nodes', async () => { + await loader.dragBy({ x: 90, y: 60 }) + await checkpoint() + await sampler.dragBy({ x: 70, y: 100 }) + await checkpoint() + }) await comfyPage.vueNodes.editAndCommitNumber( 'KSampler', @@ -311,14 +317,20 @@ test.describe( await checkpoint() const finalSnapshot = snapshots.at(-1)! - for (let index = snapshots.length - 2; index >= 0; index--) { - await comfyPage.keyboard.undo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) - } - for (let index = 1; index < snapshots.length; index++) { - await comfyPage.keyboard.redo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) - } + await test.step('Undo the complete edit chain', async () => { + for (let index = snapshots.length - 2; index >= 0; index--) { + await comfyPage.keyboard.undo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + }) + + await test.step('Redo the complete edit chain', async () => { + for (let index = 1; index < snapshots.length; index++) { + await comfyPage.keyboard.redo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + } + }) + expect(await getSnapshot()).toEqual(finalSnapshot) await expect(comfyPage.toast.toastErrors).toHaveCount(0) } @@ -371,40 +383,47 @@ test.describe( // Undo in the fresh tab must be a no-op: its queue is empty and it must // not reach back into Tab A's history. - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) - await comfyPage.keyboard.undo() - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + await test.step('Undo is isolated in the fresh tab', async () => { + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + await comfyPage.keyboard.undo() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + }) - await comfyPage.workflow.switchToTab('Undo Tab A') - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) - await expect - .poll(() => - comfyPage.page.evaluate(() => - window - .app!.graph.nodes.map((graphNode) => ({ - id: String(graphNode.id), - bounds: [...graphNode.getBounding()] - })) - .sort((left, right) => left.id.localeCompare(right.id)) + await test.step('Undo the edit after returning to Tab A', async () => { + await comfyPage.workflow.switchToTab('Undo Tab A') + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) + await expect + .poll(() => + comfyPage.page.evaluate(() => + window + .app!.graph.nodes.map((graphNode) => ({ + id: String(graphNode.id), + bounds: [...graphNode.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + ) ) - ) - .toEqual(tabAState) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) - await expect - .poll(() => node.getProperty<[number, number]>('pos')) - .not.toEqual(initialPosition) - await comfyPage.menu.topbar.triggerTopbarCommand(['Edit', 'Undo']) - await expect - .poll(() => node.getProperty<[number, number]>('pos')) - .toEqual(initialPosition) + .toEqual(tabAState) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + await expect + .poll(() => node.getProperty<[number, number]>('pos')) + .not.toEqual(initialPosition) + await comfyPage.page.mouse.click(600, 650) + await comfyPage.keyboard.undo() + await expect + .poll(() => node.getProperty<[number, number]>('pos')) + .toEqual(initialPosition) + }) - await comfyPage.workflow.switchToTab(tabBName) - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - expect( - await comfyPage.page.evaluate(() => - window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) - ) - ).toEqual([]) + await test.step('Tab B remains empty after Tab A undo', async () => { + await comfyPage.workflow.switchToTab(tabBName) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + expect( + await comfyPage.page.evaluate(() => + window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) + ) + ).toEqual([]) + }) }) } ) From bdea1713dca75c31c927ba8a0bbe306c9109f89d Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:42:57 -0700 Subject: [PATCH 22/42] test: rely on Vue node fixture settings Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995541974 --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 471d2182cd0..89a1e33a206 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -193,7 +193,6 @@ test.describe( { tag: ['@vue-nodes', '@widget'] }, async ({ comfyPage }) => { test.slow() - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true) await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect .poll(() => comfyPage.nodeOps.getGraphNodesCount()) From 5385a8caafd2a3eb264b3fd1c146f788ad3b99e2 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:43:26 -0700 Subject: [PATCH 23/42] test: use input link count assertions Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995541978 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 89a1e33a206..786d91218e7 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -253,9 +253,8 @@ test.describe( const output = await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) - await expect - .poll(async () => (await sampler.getInput(0)).getLink()) - .not.toBeNull() + const samplerInput = await sampler.getInput(0) + await samplerInput.expectLinkCount(1) await comfyPage.page.mouse.click(600, 650) await checkpoint() @@ -283,12 +282,11 @@ test.describe( .toBe(9.5) await checkpoint() - const samplerInput = await sampler.getInput(0) await comfyPage.canvasOps.dragAndDrop( await samplerInput.getPosition(), { x: 900, y: 650 } ) - await expect.poll(() => samplerInput.getLink()).toBeNull() + await samplerInput.expectLinkCount(0) await output.expectLinkCount(0) await comfyPage.page.mouse.click(600, 650) await checkpoint() @@ -304,7 +302,7 @@ test.describe( .toBeGreaterThan(100) await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) - await expect.poll(() => samplerInput.getLink()).not.toBeNull() + await samplerInput.expectLinkCount(1) await comfyPage.page.mouse.click(600, 650) await checkpoint() From 7cfae9539c86e11741a59bcaf3cf6c6160488107 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:43:57 -0700 Subject: [PATCH 24/42] test: remove duplicate final snapshot check Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995541982 --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 786d91218e7..c8074d9bbe6 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -312,7 +312,6 @@ test.describe( .toBe(1) await output.expectLinkCount(0) await checkpoint() - const finalSnapshot = snapshots.at(-1)! await test.step('Undo the complete edit chain', async () => { for (let index = snapshots.length - 2; index >= 0; index--) { @@ -328,7 +327,6 @@ test.describe( } }) - expect(await getSnapshot()).toEqual(finalSnapshot) await expect(comfyPage.toast.toastErrors).toHaveCount(0) } ) From 69b6f9b574a2c7cb0c022aa6d1683030c00c8fa5 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:44:27 -0700 Subject: [PATCH 25/42] test: remove duplicate tab graph snapshots Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995541983 --- .../changeTracking/ecsUndoRedo.spec.ts | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index c8074d9bbe6..91369145b00 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -347,23 +347,10 @@ test.describe( .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) - const tabAState = await comfyPage.page.evaluate(() => - window - .app!.graph.nodes.map((graphNode) => ({ - id: String(graphNode.id), - bounds: [...graphNode.getBounding()] - })) - .sort((left, right) => left.id.localeCompare(right.id)) - ) const tabsBeforeNew = await comfyPage.menu.topbar.getTabNames() await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - expect( - await comfyPage.page.evaluate(() => - window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) - ) - ).toEqual([]) const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() const newTabs = tabsAfterNew.filter( (name) => !tabsBeforeNew.includes(name) @@ -387,18 +374,6 @@ test.describe( await test.step('Undo the edit after returning to Tab A', async () => { await comfyPage.workflow.switchToTab('Undo Tab A') await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) - await expect - .poll(() => - comfyPage.page.evaluate(() => - window - .app!.graph.nodes.map((graphNode) => ({ - id: String(graphNode.id), - bounds: [...graphNode.getBounding()] - })) - .sort((left, right) => left.id.localeCompare(right.id)) - ) - ) - .toEqual(tabAState) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) await expect .poll(() => node.getProperty<[number, number]>('pos')) @@ -413,11 +388,6 @@ test.describe( await test.step('Tab B remains empty after Tab A undo', async () => { await comfyPage.workflow.switchToTab(tabBName) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) - expect( - await comfyPage.page.evaluate(() => - window.app!.graph.nodes.map((graphNode) => String(graphNode.id)) - ) - ).toEqual([]) }) }) } From 76ea038ac8b169ada7f50a85bc0575334d159f7a Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:56:40 -0700 Subject: [PATCH 26/42] fixup! test: share Vue number commit action --- browser_tests/fixtures/VueNodeHelpers.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/browser_tests/fixtures/VueNodeHelpers.ts b/browser_tests/fixtures/VueNodeHelpers.ts index 67faa0b63c7..6b6e8c7b6fe 100644 --- a/browser_tests/fixtures/VueNodeHelpers.ts +++ b/browser_tests/fixtures/VueNodeHelpers.ts @@ -5,6 +5,7 @@ import type { Locator, Page } from '@playwright/test' import { TestIds } from '@e2e/fixtures/selectors' import { comfyExpect as expect } from '@e2e/fixtures/utils/customMatchers' +import { nextFrame } from '@e2e/fixtures/utils/timing' import { getSlotKey } from '@/renderer/core/layout/slots/slotIdentifier' import { toNodeId } from '@/types/nodeId' import { VueNodeFixture } from '@e2e/fixtures/utils/vueNodeFixtures' @@ -289,10 +290,21 @@ export class VueNodeHelpers { const widget = this.getWidgetByName(nodeTitle, widgetName) const { input } = this.getInputNumberControls(widget) const fixture = await this.getFixtureByTitle(nodeTitle) + await nextFrame(this.page) await widget.click() await input.fill(value) await input.press('Enter') - await this.page.evaluate(() => new Promise(requestAnimationFrame)) + await expect + .poll(() => + this.page.evaluate( + ({ nodeTitle, widgetName }) => + window + .app!.graph.nodes.find((node) => node.title === nodeTitle) + ?.widgets?.find((widget) => widget.name === widgetName)?.value, + { nodeTitle, widgetName } + ) + ) + .toBe(Number(value)) await fixture.title.click() await expect(input).toHaveValue(value) } From 3e964ff7902f42343301809313ab46e550f276ce Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:56:57 -0700 Subject: [PATCH 27/42] fixup! test: await history before snapshots --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 91369145b00..0bd4e381e2c 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -228,6 +228,7 @@ test.describe( await expect .poll(() => comfyPage.workflow.getUndoQueueSize()) .toBe(snapshots.length) + await comfyPage.nextFrame() snapshots.push(await getSnapshot()) } From 6c413d38e080047d872a100941197bf8fe09036e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:57:26 -0700 Subject: [PATCH 28/42] fixup! test: name undo scenario phases --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 0bd4e381e2c..0e73073d49b 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -379,8 +379,9 @@ test.describe( await expect .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) - await comfyPage.page.mouse.click(600, 650) - await comfyPage.keyboard.undo() + await expect(async () => { + await comfyPage.menu.topbar.triggerTopbarCommand(['Edit', 'Undo']) + }).toPass({ timeout: 5000 }) await expect .poll(() => node.getProperty<[number, number]>('pos')) .toEqual(initialPosition) From 29f644581e1768b395514e8f382580a002989002 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 01:59:17 -0700 Subject: [PATCH 29/42] fixup! test: await history before snapshots --- .../workflow/changeTracking/ecsUndoRedo.spec.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 0e73073d49b..1e4d2e090cf 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -228,8 +228,20 @@ test.describe( await expect .poll(() => comfyPage.workflow.getUndoQueueSize()) .toBe(snapshots.length) - await comfyPage.nextFrame() - snapshots.push(await getSnapshot()) + let snapshot: Awaited> | undefined + await expect + .poll(async () => { + const current = await getSnapshot() + const isStable = + snapshot !== undefined && + JSON.stringify(current) === JSON.stringify(snapshot) + snapshot = current + return isStable + }) + .toBe(true) + if (snapshot === undefined) + throw new Error('Snapshot was not captured') + snapshots.push(snapshot) } await comfyPage.searchBoxV2.addNode('Load Checkpoint', { From 00e3bfdc1e1c7574caf22943c74dffefc831ab82 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 02:00:41 -0700 Subject: [PATCH 30/42] fixup! test: await history before snapshots --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 1e4d2e090cf..8bf75428462 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -198,6 +198,7 @@ test.describe( .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(0) await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) + await comfyPage.nextFrame() const getSnapshot = () => comfyPage.page.evaluate(() => ({ From e1573063bad57cf8535087cc3683d460810cc599 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 03:17:11 -0700 Subject: [PATCH 31/42] fixup! test: share Vue number commit action Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995730303 --- browser_tests/fixtures/VueNodeHelpers.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/browser_tests/fixtures/VueNodeHelpers.ts b/browser_tests/fixtures/VueNodeHelpers.ts index 6b6e8c7b6fe..8150ec63896 100644 --- a/browser_tests/fixtures/VueNodeHelpers.ts +++ b/browser_tests/fixtures/VueNodeHelpers.ts @@ -287,9 +287,11 @@ export class VueNodeHelpers { widgetName: string, value: string ): Promise { - const widget = this.getWidgetByName(nodeTitle, widgetName) + const nodeId = await this.getNodeIdByTitle(nodeTitle) + const node = this.getNodeLocator(nodeId) + const widget = node.getByLabel(widgetName, { exact: true }) const { input } = this.getInputNumberControls(widget) - const fixture = await this.getFixtureByTitle(nodeTitle) + const fixture = new VueNodeFixture(node) await nextFrame(this.page) await widget.click() await input.fill(value) @@ -297,11 +299,11 @@ export class VueNodeHelpers { await expect .poll(() => this.page.evaluate( - ({ nodeTitle, widgetName }) => + ({ nodeId, widgetName }) => window - .app!.graph.nodes.find((node) => node.title === nodeTitle) + .app!.graph.getNodeById(nodeId) ?.widgets?.find((widget) => widget.name === widgetName)?.value, - { nodeTitle, widgetName } + { nodeId: toNodeId(nodeId), widgetName } ) ) .toBe(Number(value)) From 06473e2a63ae4914891f1488b6132d05251fa68f Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 03:17:33 -0700 Subject: [PATCH 32/42] fixup! test: name undo scenario phases Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3995536032 --- .../changeTracking/ecsUndoRedo.spec.ts | 154 +++++++++++------- 1 file changed, 92 insertions(+), 62 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 8bf75428462..74689c55781 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -245,87 +245,117 @@ test.describe( snapshots.push(snapshot) } - await comfyPage.searchBoxV2.addNode('Load Checkpoint', { - position: { x: 250, y: 250 } + await test.step('Create a checkpoint loader', async () => { + await comfyPage.searchBoxV2.addNode('Load Checkpoint', { + position: { x: 250, y: 250 } + }) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(1) + await checkpoint() }) - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(1) - await checkpoint() + const loader = await comfyPage.nodeOps.getNodeRefByType( 'CheckpointLoaderSimple' ) - await comfyPage.searchBoxV2.addNode('KSampler', { - position: { x: 650, y: 250 } + await test.step('Create a KSampler', async () => { + await comfyPage.searchBoxV2.addNode('KSampler', { + position: { x: 650, y: 250 } + }) + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(2) + await checkpoint() }) - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(2) - await checkpoint() + const sampler = await comfyPage.nodeOps.getNodeRefByType('KSampler') - const output = await loader.connectOutput(0, sampler, 0) - await output.expectLinkCount(1) + const output = await loader.getOutput(0) const samplerInput = await sampler.getInput(0) - await samplerInput.expectLinkCount(1) - await comfyPage.page.mouse.click(600, 650) - await checkpoint() - await test.step('Move both nodes', async () => { + await test.step('Connect the loader to the sampler', async () => { + await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await samplerInput.expectLinkCount(1) + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + }) + + await test.step('Move the checkpoint loader', async () => { await loader.dragBy({ x: 90, y: 60 }) await checkpoint() + }) + + await test.step('Move the KSampler', async () => { await sampler.dragBy({ x: 70, y: 100 }) await checkpoint() }) - await comfyPage.vueNodes.editAndCommitNumber( - 'KSampler', - 'steps', - '31' - ) - await expect - .poll(async () => - (await sampler.getWidgetByName('steps')).getValue() + await test.step('Change the KSampler steps value', async () => { + await comfyPage.vueNodes.editAndCommitNumber( + 'KSampler', + 'steps', + '31' ) - .toBe(31) - await checkpoint() - await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'cfg', '9.5') - await expect - .poll(async () => (await sampler.getWidgetByName('cfg')).getValue()) - .toBe(9.5) - await checkpoint() + await expect + .poll(async () => + (await sampler.getWidgetByName('steps')).getValue() + ) + .toBe(31) + await checkpoint() + }) - await comfyPage.canvasOps.dragAndDrop( - await samplerInput.getPosition(), - { x: 900, y: 650 } - ) - await samplerInput.expectLinkCount(0) - await output.expectLinkCount(0) - await comfyPage.page.mouse.click(600, 650) - await checkpoint() + await test.step('Change the KSampler CFG value', async () => { + await comfyPage.vueNodes.editAndCommitNumber( + 'KSampler', + 'cfg', + '9.5' + ) + await expect + .poll(async () => + (await sampler.getWidgetByName('cfg')).getValue() + ) + .toBe(9.5) + await checkpoint() + }) - await expect - .poll(async () => { - const [source, target] = await Promise.all([ - output.getPosition(), - samplerInput.getPosition() - ]) - return target.x - source.x - }) - .toBeGreaterThan(100) - await loader.connectOutput(0, sampler, 0) - await output.expectLinkCount(1) - await samplerInput.expectLinkCount(1) - await comfyPage.page.mouse.click(600, 650) - await checkpoint() - - await sampler.delete() - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(1) - await output.expectLinkCount(0) - await checkpoint() + await test.step('Disconnect the loader from the sampler', async () => { + await comfyPage.canvasOps.dragAndDrop( + await samplerInput.getPosition(), + { x: 900, y: 650 } + ) + await samplerInput.expectLinkCount(0) + await output.expectLinkCount(0) + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + }) + + await test.step('Reconnect the loader to the sampler', async () => { + await expect + .poll(async () => { + const [source, target] = await Promise.all([ + output.getPosition(), + samplerInput.getPosition() + ]) + return target.x - source.x + }) + .toBeGreaterThan(100) + await loader.connectOutput(0, sampler, 0) + await output.expectLinkCount(1) + await samplerInput.expectLinkCount(1) + await comfyPage.page.mouse.click(600, 650) + await checkpoint() + }) + + await test.step('Delete the KSampler', async () => { + await sampler.delete() + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(1) + await output.expectLinkCount(0) + await checkpoint() + }) await test.step('Undo the complete edit chain', async () => { for (let index = snapshots.length - 2; index >= 0; index--) { From fce69eb938bf5a89ea06b8a3eaaa890123281c46 Mon Sep 17 00:00:00 2001 From: Amp Date: Sun, 13 Sep 2026 05:09:58 +0000 Subject: [PATCH 33/42] test: finish undo redo scenario phases Amp-Thread-ID: https://ampcode.com/threads/T-01a09234-3b5a-73dd-886d-3811ddf25628 --- .../changeTracking/ecsUndoRedo.spec.ts | 81 ++++++++++++------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 74689c55781..6fc10e1a351 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -9,14 +9,11 @@ test.describe( () => { test.use({ initialSettings: { + 'Comfy.UseNewMenu': 'Top', 'Comfy.Workflow.WorkflowTabsPosition': 'Topbar' } }) - test.beforeEach(async ({ comfyPage }) => { - await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top') - }) - test.afterEach(async ({ comfyPage }) => { await comfyPage.workflow.setupWorkflowsDirectory({}) await comfyPage.canvasOps.resetView() @@ -124,10 +121,17 @@ test.describe( const initialPosition = await node.getBounding() const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') - await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) - await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) - const movedPosition = await node.getBounding() + const movedPosition = + await test.step('Move the KSampler node', async () => { + await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) + await expect + .poll(() => node.getBounding()) + .not.toEqual(initialPosition) + await expect + .poll(() => comfyPage.workflow.getUndoQueueSize()) + .toBe(1) + return node.getBounding() + }) const stepsWidget = comfyPage.vueNodes.getWidgetByName( 'KSampler', @@ -135,18 +139,28 @@ test.describe( ) const { input } = comfyPage.vueNodes.getInputNumberControls(stepsWidget) const initialSteps = await input.inputValue() - await comfyPage.vueNodes.editAndCommitNumber('KSampler', 'steps', '31') - await expect - .poll(async () => (await node.getWidget(2)).getValue()) - .toBe(31) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(2) + + await test.step('Change the KSampler steps value', async () => { + await comfyPage.vueNodes.editAndCommitNumber( + 'KSampler', + 'steps', + '31' + ) + await expect + .poll(async () => (await node.getWidget(2)).getValue()) + .toBe(31) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(2) + }) const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount() - await comfyPage.searchBoxV2.addNode('Note') - await expect - .poll(() => comfyPage.nodeOps.getGraphNodesCount()) - .toBe(initialNodeCount + 1) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(3) + + await test.step('Add a Note node', async () => { + await comfyPage.searchBoxV2.addNode('Note') + await expect + .poll(() => comfyPage.nodeOps.getGraphNodesCount()) + .toBe(initialNodeCount + 1) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(3) + }) const expectState = async ( position: typeof initialPosition, @@ -160,20 +174,28 @@ test.describe( .toBe(nodeCount) } - await test.step('Undo each mixed edit in order', async () => { + await test.step('Undo removes only the Note node', async () => { await comfyPage.keyboard.undo() await expectState(movedPosition, '31', initialNodeCount) + }) + await test.step('Undo restores only the steps value', async () => { await comfyPage.keyboard.undo() await expectState(movedPosition, initialSteps, initialNodeCount) + }) + await test.step('Undo restores only the node position', async () => { await comfyPage.keyboard.undo() await expectState(initialPosition, initialSteps, initialNodeCount) }) - await test.step('Redo each mixed edit in order', async () => { + await test.step('Redo reapplies only the node move', async () => { await comfyPage.keyboard.redo() await expectState(movedPosition, initialSteps, initialNodeCount) + }) + await test.step('Redo reapplies only the steps value', async () => { await comfyPage.keyboard.redo() await expectState(movedPosition, '31', initialNodeCount) + }) + await test.step('Redo restores only the Note node', async () => { await comfyPage.keyboard.redo() await expectState(movedPosition, '31', initialNodeCount + 1) }) @@ -183,6 +205,7 @@ test.describe( test.describe('compound graph history', () => { test.use({ initialSettings: { + 'Comfy.UseNewMenu': 'Top', 'Comfy.Workflow.WorkflowTabsPosition': 'Topbar', 'Comfy.LinkRelease.Action': 'no action' } @@ -386,15 +409,19 @@ test.describe( const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getProperty<[number, number]>('pos') - await node.dragBy({ x: 100, y: 50 }) - await expect - .poll(() => node.getProperty<[number, number]>('pos')) - .not.toEqual(initialPosition) - await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + await test.step('Move a node in Tab A', async () => { + await node.dragBy({ x: 100, y: 50 }) + await expect + .poll(() => node.getProperty<[number, number]>('pos')) + .not.toEqual(initialPosition) + await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(1) + }) const tabsBeforeNew = await comfyPage.menu.topbar.getTabNames() - await comfyPage.menu.topbar.triggerTopbarCommand(['New']) - await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + await test.step('Open a fresh Tab B', async () => { + await comfyPage.menu.topbar.triggerTopbarCommand(['New']) + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + }) const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() const newTabs = tabsAfterNew.filter( (name) => !tabsBeforeNew.includes(name) From b6c9092b21c2a653c77d37023370731c8a8ee916 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 13 Sep 2026 05:16:32 +0000 Subject: [PATCH 34/42] [automated] Apply ESLint and Oxfmt fixes --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 6fc10e1a351..c788cb5c539 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -178,10 +178,12 @@ test.describe( await comfyPage.keyboard.undo() await expectState(movedPosition, '31', initialNodeCount) }) + await test.step('Undo restores only the steps value', async () => { await comfyPage.keyboard.undo() await expectState(movedPosition, initialSteps, initialNodeCount) }) + await test.step('Undo restores only the node position', async () => { await comfyPage.keyboard.undo() await expectState(initialPosition, initialSteps, initialNodeCount) @@ -191,10 +193,12 @@ test.describe( await comfyPage.keyboard.redo() await expectState(movedPosition, initialSteps, initialNodeCount) }) + await test.step('Redo reapplies only the steps value', async () => { await comfyPage.keyboard.redo() await expectState(movedPosition, '31', initialNodeCount) }) + await test.step('Redo restores only the Note node', async () => { await comfyPage.keyboard.redo() await expectState(movedPosition, '31', initialNodeCount + 1) @@ -418,10 +422,12 @@ test.describe( }) const tabsBeforeNew = await comfyPage.menu.topbar.getTabNames() + await test.step('Open a fresh Tab B', async () => { await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) }) + const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() const newTabs = tabsAfterNew.filter( (name) => !tabsBeforeNew.includes(name) From 84a9079738c05386740c9a213e687a7fd82512ce Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 23:18:39 -0700 Subject: [PATCH 35/42] test: add semantic undo and redo steps Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3998827663 --- .../changeTracking/ecsUndoRedo.spec.ts | 144 +++++++++++------- 1 file changed, 87 insertions(+), 57 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index c788cb5c539..4c5e1b2d7df 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -32,17 +32,29 @@ test.describe( const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getBounding() - await node.dragBy({ x: 120, y: 80 }) - await expect.poll(() => node.getBounding()).not.toEqual(initialPosition) - const movedPosition = await node.getBounding() + const movedPosition = await test.step('Move the node', async () => { + await node.dragBy({ x: 120, y: 80 }) + await expect + .poll(() => node.getBounding()) + .not.toEqual(initialPosition) + return node.getBounding() + }) - await comfyPage.keyboard.undo() - await expect.poll(() => node.getBounding()).toEqual(initialPosition) + await test.step('Undo the node move', async () => { + await comfyPage.keyboard.undo() + await expect.poll(() => node.getBounding()).toEqual(initialPosition) + }) + + await test.step('Redo the node move', async () => { + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + }) + + await test.step('A second redo leaves the node unchanged', async () => { + await comfyPage.keyboard.redo() + await expect.poll(() => node.getBounding()).toEqual(movedPosition) + }) - await comfyPage.keyboard.redo() - await expect.poll(() => node.getBounding()).toEqual(movedPosition) - await comfyPage.keyboard.redo() - await expect.poll(() => node.getBounding()).toEqual(movedPosition) await expect(comfyPage.toast.toastErrors).toHaveCount(0) }) } @@ -52,25 +64,30 @@ test.describe( const initialPosition = await comfyPage.canvasOps.getGroupPosition('Pair') const containedNode = await comfyPage.nodeOps.getNodeRefById('2') const initialNodePosition = await containedNode.getBounding() - await comfyPage.canvasOps.dragGroup({ - name: 'Pair', - deltaX: 100, - deltaY: 60 + + await test.step('Move the group', async () => { + await comfyPage.canvasOps.dragGroup({ + name: 'Pair', + deltaX: 100, + deltaY: 60 + }) + await expect + .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) + .not.toEqual(initialPosition) + await expect + .poll(() => containedNode.getBounding()) + .not.toEqual(initialNodePosition) + }) + + await test.step('Undo the group move', async () => { + await comfyPage.keyboard.undo() + await expect + .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) + .toEqual(initialPosition) + await expect + .poll(() => containedNode.getBounding()) + .toEqual(initialNodePosition) }) - await expect - .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) - .not.toEqual(initialPosition) - await expect - .poll(() => containedNode.getBounding()) - .not.toEqual(initialNodePosition) - - await comfyPage.keyboard.undo() - await expect - .poll(() => comfyPage.canvasOps.getGroupPosition('Pair')) - .toEqual(initialPosition) - await expect - .poll(() => containedNode.getBounding()) - .toEqual(initialNodePosition) }) for (const vueNodesEnabled of [false, true]) { @@ -88,23 +105,30 @@ test.describe( const steps = await node.getWidget(2) const initialValue = await steps.getValue() - if (vueNodesEnabled) { - await comfyPage.vueNodes.editAndCommitNumber( - 'KSampler', - 'steps', - '31' - ) - } else { - await steps.dragHorizontal(80) - } - await expect.poll(() => steps.getValue()).not.toBe(initialValue) - const changedValue = await steps.getValue() + const changedValue = + await test.step('Change the widget value', async () => { + if (vueNodesEnabled) { + await comfyPage.vueNodes.editAndCommitNumber( + 'KSampler', + 'steps', + '31' + ) + } else { + await steps.dragHorizontal(80) + } + await expect.poll(() => steps.getValue()).not.toBe(initialValue) + return steps.getValue() + }) - await comfyPage.keyboard.undo() - await expect.poll(() => steps.getValue()).toBe(initialValue) + await test.step('Undo the widget change', async () => { + await comfyPage.keyboard.undo() + await expect.poll(() => steps.getValue()).toBe(initialValue) + }) - await comfyPage.keyboard.redo() - await expect.poll(() => steps.getValue()).toBe(changedValue) + await test.step('Redo the widget change', async () => { + await comfyPage.keyboard.redo() + await expect.poll(() => steps.getValue()).toBe(changedValue) + }) } ) } @@ -252,7 +276,8 @@ test.describe( ) })) const snapshots = [await getSnapshot()] - const checkpoint = async () => { + const checkpointNames = ['empty graph'] + const checkpoint = async (name: string) => { await expect .poll(() => comfyPage.workflow.getUndoQueueSize()) .toBe(snapshots.length) @@ -270,6 +295,7 @@ test.describe( if (snapshot === undefined) throw new Error('Snapshot was not captured') snapshots.push(snapshot) + checkpointNames.push(name) } await test.step('Create a checkpoint loader', async () => { @@ -279,7 +305,7 @@ test.describe( await expect .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(1) - await checkpoint() + await checkpoint('checkpoint loader created') }) const loader = await comfyPage.nodeOps.getNodeRefByType( @@ -293,7 +319,7 @@ test.describe( await expect .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(2) - await checkpoint() + await checkpoint('KSampler created') }) const sampler = await comfyPage.nodeOps.getNodeRefByType('KSampler') @@ -306,17 +332,17 @@ test.describe( await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) await comfyPage.page.mouse.click(600, 650) - await checkpoint() + await checkpoint('nodes connected') }) await test.step('Move the checkpoint loader', async () => { await loader.dragBy({ x: 90, y: 60 }) - await checkpoint() + await checkpoint('checkpoint loader moved') }) await test.step('Move the KSampler', async () => { await sampler.dragBy({ x: 70, y: 100 }) - await checkpoint() + await checkpoint('KSampler moved') }) await test.step('Change the KSampler steps value', async () => { @@ -330,7 +356,7 @@ test.describe( (await sampler.getWidgetByName('steps')).getValue() ) .toBe(31) - await checkpoint() + await checkpoint('steps value changed') }) await test.step('Change the KSampler CFG value', async () => { @@ -344,7 +370,7 @@ test.describe( (await sampler.getWidgetByName('cfg')).getValue() ) .toBe(9.5) - await checkpoint() + await checkpoint('CFG value changed') }) await test.step('Disconnect the loader from the sampler', async () => { @@ -355,7 +381,7 @@ test.describe( await samplerInput.expectLinkCount(0) await output.expectLinkCount(0) await comfyPage.page.mouse.click(600, 650) - await checkpoint() + await checkpoint('nodes disconnected') }) await test.step('Reconnect the loader to the sampler', async () => { @@ -372,7 +398,7 @@ test.describe( await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) await comfyPage.page.mouse.click(600, 650) - await checkpoint() + await checkpoint('nodes reconnected') }) await test.step('Delete the KSampler', async () => { @@ -381,20 +407,24 @@ test.describe( .poll(() => comfyPage.nodeOps.getGraphNodesCount()) .toBe(1) await output.expectLinkCount(0) - await checkpoint() + await checkpoint('KSampler deleted') }) await test.step('Undo the complete edit chain', async () => { for (let index = snapshots.length - 2; index >= 0; index--) { - await comfyPage.keyboard.undo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) + await test.step(`Undo to ${checkpointNames[index]}`, async () => { + await comfyPage.keyboard.undo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + }) } }) await test.step('Redo the complete edit chain', async () => { for (let index = 1; index < snapshots.length; index++) { - await comfyPage.keyboard.redo() - await expect.poll(getSnapshot).toEqual(snapshots[index]) + await test.step(`Redo to ${checkpointNames[index]}`, async () => { + await comfyPage.keyboard.redo() + await expect.poll(getSnapshot).toEqual(snapshots[index]) + }) } }) From a1e2bfe098cff44f2f2970e013ee68c12381fe4e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 23:19:11 -0700 Subject: [PATCH 36/42] test: use maintained empty canvas helper Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3998827668 --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 4c5e1b2d7df..ea68eb5ec76 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -331,7 +331,7 @@ test.describe( await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) - await comfyPage.page.mouse.click(600, 650) + await comfyPage.canvasOps.clickEmptySpace() await checkpoint('nodes connected') }) @@ -380,7 +380,7 @@ test.describe( ) await samplerInput.expectLinkCount(0) await output.expectLinkCount(0) - await comfyPage.page.mouse.click(600, 650) + await comfyPage.canvasOps.clickEmptySpace() await checkpoint('nodes disconnected') }) @@ -397,7 +397,7 @@ test.describe( await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) - await comfyPage.page.mouse.click(600, 650) + await comfyPage.canvasOps.clickEmptySpace() await checkpoint('nodes reconnected') }) From 1be80b84bd4c9354f6972f2a7280711859fcb72f Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 23:19:40 -0700 Subject: [PATCH 37/42] test: remove premature widget frame wait Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3998827670 --- browser_tests/fixtures/VueNodeHelpers.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/browser_tests/fixtures/VueNodeHelpers.ts b/browser_tests/fixtures/VueNodeHelpers.ts index 8150ec63896..e1282b03ca3 100644 --- a/browser_tests/fixtures/VueNodeHelpers.ts +++ b/browser_tests/fixtures/VueNodeHelpers.ts @@ -5,7 +5,6 @@ import type { Locator, Page } from '@playwright/test' import { TestIds } from '@e2e/fixtures/selectors' import { comfyExpect as expect } from '@e2e/fixtures/utils/customMatchers' -import { nextFrame } from '@e2e/fixtures/utils/timing' import { getSlotKey } from '@/renderer/core/layout/slots/slotIdentifier' import { toNodeId } from '@/types/nodeId' import { VueNodeFixture } from '@e2e/fixtures/utils/vueNodeFixtures' @@ -292,7 +291,6 @@ export class VueNodeHelpers { const widget = node.getByLabel(widgetName, { exact: true }) const { input } = this.getInputNumberControls(widget) const fixture = new VueNodeFixture(node) - await nextFrame(this.page) await widget.click() await input.fill(value) await input.press('Enter') From 5bb2f57d5ed0d5cb36b61bf504e09ba1f3282f0f Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 12 Sep 2026 23:20:25 -0700 Subject: [PATCH 38/42] test: remove redundant fresh-tab comment Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17455#discussion_r3998827673 --- browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index ea68eb5ec76..a9befaa2b64 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -470,8 +470,6 @@ test.describe( const tabB = comfyPage.menu.topbar.getWorkflowTab(tabBName) await expect(tabB).toBeVisible() - // Undo in the fresh tab must be a no-op: its queue is empty and it must - // not reach back into Tab A's history. await test.step('Undo is isolated in the fresh tab', async () => { await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) await comfyPage.keyboard.undo() From 3490d0e3add1926b64c1cb1e7225af4124d4b3d1 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Sep 2026 01:19:58 -0700 Subject: [PATCH 39/42] test: keep empty canvas click clear of overlays --- browser_tests/fixtures/constants/defaultGraphPositions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser_tests/fixtures/constants/defaultGraphPositions.ts b/browser_tests/fixtures/constants/defaultGraphPositions.ts index d99d64dabd6..a6e686f84ea 100644 --- a/browser_tests/fixtures/constants/defaultGraphPositions.ts +++ b/browser_tests/fixtures/constants/defaultGraphPositions.ts @@ -9,7 +9,7 @@ export const DefaultGraphPositions = { textEncodeNode1: { x: 618, y: 191 }, textEncodeNode2: { x: 622, y: 400 }, textEncodeNodeToggler: { x: 430, y: 171 }, - emptySpaceClick: { x: 35, y: 31 }, + emptySpaceClick: { x: 600, y: 650 }, emptyCanvasClick: { x: 50, y: 500 }, // Slot positions From ea360f3a50472bee2fdb72197a088d934fa3b1cb Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Sep 2026 01:27:07 -0700 Subject: [PATCH 40/42] test: scope undo click coordinates to scenario --- .../constants/defaultGraphPositions.ts | 2 +- .../fixtures/helpers/CanvasHelper.ts | 6 ++++-- .../changeTracking/ecsUndoRedo.spec.ts | 19 ++++++++----------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/browser_tests/fixtures/constants/defaultGraphPositions.ts b/browser_tests/fixtures/constants/defaultGraphPositions.ts index a6e686f84ea..d99d64dabd6 100644 --- a/browser_tests/fixtures/constants/defaultGraphPositions.ts +++ b/browser_tests/fixtures/constants/defaultGraphPositions.ts @@ -9,7 +9,7 @@ export const DefaultGraphPositions = { textEncodeNode1: { x: 618, y: 191 }, textEncodeNode2: { x: 622, y: 400 }, textEncodeNodeToggler: { x: 430, y: 171 }, - emptySpaceClick: { x: 600, y: 650 }, + emptySpaceClick: { x: 35, y: 31 }, emptyCanvasClick: { x: 50, y: 500 }, // Slot positions diff --git a/browser_tests/fixtures/helpers/CanvasHelper.ts b/browser_tests/fixtures/helpers/CanvasHelper.ts index c85f22e8493..5b8eed5e459 100644 --- a/browser_tests/fixtures/helpers/CanvasHelper.ts +++ b/browser_tests/fixtures/helpers/CanvasHelper.ts @@ -139,8 +139,10 @@ export class CanvasHelper { await nextFrame(this.page) } - async clickEmptySpace(): Promise { - await this.canvas.click({ position: DefaultGraphPositions.emptySpaceClick }) + async clickEmptySpace( + position: Position = DefaultGraphPositions.emptySpaceClick + ): Promise { + await this.canvas.click({ position }) await nextFrame(this.page) } diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index a9befaa2b64..869b0ccacea 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -331,7 +331,7 @@ test.describe( await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) - await comfyPage.canvasOps.clickEmptySpace() + await comfyPage.canvasOps.clickEmptySpace({ x: 600, y: 650 }) await checkpoint('nodes connected') }) @@ -380,7 +380,7 @@ test.describe( ) await samplerInput.expectLinkCount(0) await output.expectLinkCount(0) - await comfyPage.canvasOps.clickEmptySpace() + await comfyPage.canvasOps.clickEmptySpace({ x: 600, y: 650 }) await checkpoint('nodes disconnected') }) @@ -397,7 +397,7 @@ test.describe( await loader.connectOutput(0, sampler, 0) await output.expectLinkCount(1) await samplerInput.expectLinkCount(1) - await comfyPage.canvasOps.clickEmptySpace() + await comfyPage.canvasOps.clickEmptySpace({ x: 600, y: 650 }) await checkpoint('nodes reconnected') }) @@ -456,17 +456,14 @@ test.describe( await test.step('Open a fresh Tab B', async () => { await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) + await comfyPage.menu.topbar.saveWorkflow('Undo Tab B') }) + const tabBName = 'Undo Tab B' const tabsAfterNew = await comfyPage.menu.topbar.getTabNames() - const newTabs = tabsAfterNew.filter( - (name) => !tabsBeforeNew.includes(name) - ) - expect(newTabs, 'New must create exactly one workflow tab').toHaveLength( - 1 - ) - if (newTabs.length !== 1) throw new Error('Expected one new workflow tab') - const [tabBName] = newTabs + expect( + tabsAfterNew.filter((name) => !tabsBeforeNew.includes(name)) + ).toEqual([tabBName]) const tabB = comfyPage.menu.topbar.getWorkflowTab(tabBName) await expect(tabB).toBeVisible() From 843933742e75faf96fba748af777324373f86789 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Sep 2026 03:24:25 -0700 Subject: [PATCH 41/42] test: stabilize undo renderer interactions --- browser_tests/fixtures/components/Topbar.ts | 2 +- .../workflow/changeTracking/ecsUndoRedo.spec.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/browser_tests/fixtures/components/Topbar.ts b/browser_tests/fixtures/components/Topbar.ts index 608a262f075..dab30cfcc8b 100644 --- a/browser_tests/fixtures/components/Topbar.ts +++ b/browser_tests/fixtures/components/Topbar.ts @@ -233,7 +233,7 @@ export class Topbar { await this.menuLocator.waitFor({ state: 'visible' }) // Re-hover on top-level menu to trigger submenu await topLevelMenu.hover() - await submenu.waitFor({ state: 'visible', timeout: 1000 }) + await submenu.waitFor({ state: 'visible' }) } let currentMenu = topLevelMenu diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index 869b0ccacea..a68707c48e0 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -434,7 +434,8 @@ test.describe( }) test('undo remains scoped to the edited workflow after switching tabs', async ({ - comfyPage + comfyPage, + comfyMouse }) => { await comfyPage.workflow.loadWorkflow('default') await comfyPage.workflow.setupWorkflowsDirectory({}) @@ -444,7 +445,14 @@ test.describe( const initialPosition = await node.getProperty<[number, number]>('pos') await test.step('Move a node in Tab A', async () => { - await node.dragBy({ x: 100, y: 50 }) + const vueNode = comfyPage.vueNodes.getNodeByTitle('KSampler') + if (await vueNode.isVisible()) { + const ksampler = + await comfyPage.vueNodes.getFixtureByTitle('KSampler') + await comfyMouse.dragElementBy(ksampler.title, { x: 100, y: 50 }) + } else { + await node.dragBy({ x: 100, y: 50 }) + } await expect .poll(() => node.getProperty<[number, number]>('pos')) .not.toEqual(initialPosition) From 7c073fe1d95f7c47631ddf3ab8325daa98a42e45 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sun, 13 Sep 2026 05:21:53 -0700 Subject: [PATCH 42/42] test: handle repeated undo workflow saves --- .../tests/workflow/changeTracking/ecsUndoRedo.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts index a68707c48e0..69dae86e4d6 100644 --- a/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts +++ b/browser_tests/tests/workflow/changeTracking/ecsUndoRedo.spec.ts @@ -440,6 +440,9 @@ test.describe( await comfyPage.workflow.loadWorkflow('default') await comfyPage.workflow.setupWorkflowsDirectory({}) await comfyPage.menu.topbar.saveWorkflow('Undo Tab A') + if (await comfyPage.confirmDialog.overwrite.isVisible()) { + await comfyPage.confirmDialog.click('overwrite') + } await expect.poll(() => comfyPage.workflow.getUndoQueueSize()).toBe(0) const node = await comfyPage.nodeOps.getNodeRefById('3') const initialPosition = await node.getProperty<[number, number]>('pos') @@ -465,6 +468,9 @@ test.describe( await comfyPage.menu.topbar.triggerTopbarCommand(['New']) await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0) await comfyPage.menu.topbar.saveWorkflow('Undo Tab B') + if (await comfyPage.confirmDialog.overwrite.isVisible()) { + await comfyPage.confirmDialog.click('overwrite') + } }) const tabBName = 'Undo Tab B'