From 403d4b31b05c0bd752f2c9f3aa0017a7eded7051 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 19:44:46 -0700 Subject: [PATCH 1/6] test: cover ECS history and clipboard regression cases --- .../ecsMigration/historyClipboard.spec.ts | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 browser_tests/tests/ecsMigration/historyClipboard.spec.ts diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts new file mode 100644 index 00000000000..902c16b61be --- /dev/null +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -0,0 +1,258 @@ +import { + comfyExpect as expect, + comfyPageFixture as test +} from '@e2e/fixtures/ComfyPage' + +import type { ComfyPage } from '@e2e/fixtures/ComfyPage' + +type GraphSnapshot = { + nodes: Array<{ + id: string + position: [number, number] + widgets: unknown[] + }> + links: Array<{ + originId: string + originSlot: number + targetId: string + targetSlot: number + }> +} + +async function getGraphSnapshot(comfyPage: ComfyPage): Promise { + return comfyPage.page.evaluate(() => ({ + nodes: window + .app!.graph.nodes.map((node) => ({ + id: String(node.id), + position: [node.pos[0], node.pos[1]] as [number, number], + widgets: (node.widgets ?? []).map((widget) => widget.value) + })) + .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) => + `${left.originId}:${left.originSlot}:${left.targetId}:${left.targetSlot}`.localeCompare( + `${right.originId}:${right.originSlot}:${right.targetId}:${right.targetSlot}` + ) + ) + })) +} + +async function marqueeNodes(comfyPage: ComfyPage, nodeIds: string[]) { + const { from, to } = await comfyPage.page.evaluate((ids) => { + const bounds = ids.map((id) => { + const node = window.app!.graph.nodes.find( + (candidate) => String(candidate.id) === id + )! + const [x, y, width, height] = node.getBounding() + const start = window.app!.canvasPosToClientPos([x, y]) + const end = window.app!.canvasPosToClientPos([x + width, y + height]) + return { + left: Math.min(start[0], end[0]), + top: Math.min(start[1], end[1]), + right: Math.max(start[0], end[0]), + bottom: Math.max(start[1], end[1]) + } + }) + return { + from: { + x: Math.min(...bounds.map(({ left }) => left)) - 20, + y: Math.min(...bounds.map(({ top }) => top)) - 20 + }, + to: { + x: Math.max(...bounds.map(({ right }) => right)) + 20, + y: Math.max(...bounds.map(({ bottom }) => bottom)) + 20 + } + } + }, nodeIds) + await comfyPage.canvasOps.dragAndDrop(from, to) +} + +test.describe( + 'ECS migration: history and clipboard regression sanity', + { tag: ['@canvas', '@workflow'] }, + () => { + test.beforeEach(async ({ comfyPage }) => { + await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled') + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) + await comfyPage.settings.setSetting( + 'Comfy.Canvas.LeftMouseClickBehavior', + 'select' + ) + await comfyPage.workflow.loadWorkflow('default') + }) + + test.afterEach(async ({ comfyPage }) => { + await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) + await comfyPage.canvasOps.resetView() + }) + + test('undoes and redoes a move, then deletes only the pasted duplicate', async ({ + comfyPage + }) => { + const original = await comfyPage.nodeOps.getNodeRefById(3) + const initialPosition = + await original.getProperty<[number, number]>('pos') + + await original.dragBy({ x: 137, y: 83 }) + const movedPosition = await original.getProperty<[number, number]>('pos') + expect(movedPosition).not.toEqual(initialPosition) + + await comfyPage.keyboard.undo() + await expect + .poll(() => original.getProperty<[number, number]>('pos')) + .toEqual(initialPosition) + await comfyPage.keyboard.redo() + await expect + .poll(() => original.getProperty<[number, number]>('pos')) + .toEqual(movedPosition) + + await comfyPage.page.evaluate(() => { + const node = window.app!.graph.nodes.find( + (candidate) => String(candidate.id) === '3' + )! + window.app!.canvas.selectNodes([node]) + }) + await expect + .poll(() => comfyPage.nodeOps.getSelectedNodeIds()) + .toEqual(['3']) + await comfyPage.clipboard.copy() + await comfyPage.page.mouse.move(10, 10) + await comfyPage.clipboard.paste() + + const pastedIds = await comfyPage.page.evaluate(() => + window + .app!.graph.nodes.filter( + (node) => node.type === 'KSampler' && String(node.id) !== '3' + ) + .map((node) => String(node.id)) + ) + expect(pastedIds).toHaveLength(1) + expect(await comfyPage.nodeOps.getSelectedNodeIds()).toEqual(pastedIds) + + await comfyPage.keyboard.delete() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(7) + await expect.poll(() => original.exists()).toBe(true) + await expect + .poll(() => + comfyPage.page.evaluate( + (id) => + window.app!.graph.nodes.some((node) => String(node.id) === id), + pastedIds[0] + ) + ) + .toBe(false) + }) + + test('copies two connected nodes with their internal link and widget values', async ({ + comfyPage + }) => { + const sourceIds = ['3', '8'] + const sourceSnapshot = await getGraphSnapshot(comfyPage) + const sourceNodes = sourceSnapshot.nodes.filter(({ id }) => + sourceIds.includes(id) + ) + const sourceLink = sourceSnapshot.links.find( + ({ originId, targetId }) => originId === '3' && targetId === '8' + ) + expect(sourceNodes).toHaveLength(2) + expect(sourceLink).toEqual({ + originId: '3', + originSlot: 0, + targetId: '8', + targetSlot: 0 + }) + + await marqueeNodes(comfyPage, sourceIds) + await expect + .poll(() => comfyPage.nodeOps.getSelectedNodeIds()) + .toEqual(sourceIds) + await comfyPage.clipboard.copy() + await comfyPage.page.mouse.move(350, 650) + await comfyPage.clipboard.paste() + + const pastedIds = (await comfyPage.nodeOps.getSelectedNodeIds()).map( + String + ) + expect(pastedIds).toHaveLength(2) + expect(pastedIds.every((id) => !sourceIds.includes(id))).toBe(true) + const pastedSnapshot = await getGraphSnapshot(comfyPage) + const pastedNodes = pastedSnapshot.nodes.filter(({ id }) => + pastedIds.includes(id) + ) + expect(pastedNodes.map(({ widgets }) => widgets)).toEqual( + sourceNodes.map(({ widgets }) => widgets) + ) + expect( + pastedSnapshot.links.filter( + ({ originId, targetId }) => + pastedIds.includes(originId) && pastedIds.includes(targetId) + ) + ).toEqual([ + { + originId: pastedIds[0], + originSlot: sourceLink!.originSlot, + targetId: pastedIds[1], + targetSlot: sourceLink!.targetSlot + } + ]) + }) + + for (const vueNodesEnabled of [false, true]) { + test(`box-select drag and delete undo restores three linked nodes (${vueNodesEnabled ? 'Vue' : 'LiteGraph'})`, async ({ + comfyPage + }) => { + await comfyPage.settings.setSetting( + 'Comfy.VueNodes.Enabled', + vueNodesEnabled + ) + if (vueNodesEnabled) await comfyPage.vueNodes.waitForNodes() + const ids = ['3', '8', '9'] + const before = await getGraphSnapshot(comfyPage) + await marqueeNodes(comfyPage, ids) + await expect + .poll(async () => + (await comfyPage.nodeOps.getSelectedNodeIds()).map(String).sort() + ) + .toEqual(ids) + + await ( + await comfyPage.nodeOps.getNodeRefById(3) + ).dragBy({ x: 91, y: 67 }) + const moved = await getGraphSnapshot(comfyPage) + const firstInitial = before.nodes.find((node) => node.id === ids[0])! + const firstTranslated = moved.nodes.find((node) => node.id === ids[0])! + const translation = [ + firstTranslated.position[0] - firstInitial.position[0], + firstTranslated.position[1] - firstInitial.position[1] + ] + expect(translation[0]).not.toBe(0) + expect(translation[1]).not.toBe(0) + for (const id of ids) { + const initial = before.nodes.find((node) => node.id === id)! + const translated = moved.nodes.find((node) => node.id === id)! + expect(translated.position[0] - initial.position[0]).toBeCloseTo( + translation[0], + 5 + ) + expect(translated.position[1] - initial.position[1]).toBeCloseTo( + translation[1], + 5 + ) + } + + await comfyPage.keyboard.delete() + await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(4) + await comfyPage.keyboard.undo() + await expect.poll(() => getGraphSnapshot(comfyPage)).toEqual(moved) + await comfyPage.keyboard.undo() + await expect.poll(() => getGraphSnapshot(comfyPage)).toEqual(before) + }) + } + } +) From 0e2a117c22b5ceb484e4b58cec0b62d1d949eadd Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 20:01:36 -0700 Subject: [PATCH 2/6] test: cover search and linked selection continuity --- .../ecsMigration/historyClipboard.spec.ts | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts index 902c16b61be..4fa5d22cdf2 100644 --- a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -203,6 +203,108 @@ test.describe( ]) }) + test('partial-name search places the selected node on Enter', async ({ + comfyPage + }) => { + const initialIds = await comfyPage.page.evaluate(() => + window.app!.graph.nodes.map((node) => String(node.id)) + ) + const position = { x: 640, y: 420 } + + await comfyPage.searchBoxV2.setup() + await comfyPage.page.mouse.move(position.x, position.y) + await comfyPage.searchBoxV2.open() + await comfyPage.searchBoxV2.input.fill('KSamp') + await expect(comfyPage.searchBoxV2.results.first()).toContainText( + 'KSampler' + ) + await comfyPage.page.keyboard.press('Enter') + await expect(comfyPage.searchBoxV2.dialog).toBeHidden() + + const added = await comfyPage.page.evaluate((ids) => { + const node = window.app!.graph.nodes.find( + (candidate) => !ids.includes(String(candidate.id)) + ) + return node + ? { id: String(node.id), type: node.type, position: [...node.pos] } + : null + }, initialIds) + expect(added).not.toBeNull() + expect(added?.type).toBe('KSampler') + expect(added?.position).toEqual([position.x - 135, position.y + 10]) + }) + + test('pan, zoom and linked-node drag preserve exact link endpoints', async ({ + comfyPage + }) => { + const ids = ['3', '8'] + const before = await getGraphSnapshot(comfyPage) + const beforeView = await comfyPage.page.evaluate(() => ({ + scale: window.app!.canvas.ds.scale, + offset: [...window.app!.canvas.ds.offset] + })) + + await comfyPage.settings.setSetting( + 'Comfy.Canvas.LeftMouseClickBehavior', + 'panning' + ) + await comfyPage.canvasOps.pan({ x: 73, y: 41 }) + const pannedView = await comfyPage.page.evaluate(() => ({ + scale: window.app!.canvas.ds.scale, + offset: [...window.app!.canvas.ds.offset] + })) + expect(pannedView.offset).not.toEqual(beforeView.offset) + await comfyPage.canvasOps.zoom(100, 2) + const zoomedView = await comfyPage.page.evaluate(() => ({ + scale: window.app!.canvas.ds.scale, + offset: [...window.app!.canvas.ds.offset] + })) + expect(zoomedView.scale).not.toBe(pannedView.scale) + + await comfyPage.settings.setSetting( + 'Comfy.Canvas.LeftMouseClickBehavior', + 'select' + ) + await marqueeNodes(comfyPage, ids) + await expect + .poll(async () => + (await comfyPage.nodeOps.getSelectedNodeIds()).map(String).sort() + ) + .toEqual(ids) + await ( + await comfyPage.nodeOps.getNodeRefById('3') + ).dragBy({ x: 111, y: 69 }) + + const moved = await getGraphSnapshot(comfyPage) + const firstBefore = before.nodes.find(({ id }) => id === '3')! + const firstMoved = moved.nodes.find(({ id }) => id === '3')! + const delta = [ + firstMoved.position[0] - firstBefore.position[0], + firstMoved.position[1] - firstBefore.position[1] + ] + expect(delta[0]).not.toBe(0) + expect(delta[1]).not.toBe(0) + for (const id of ids) { + const nodeBefore = before.nodes.find((node) => node.id === id)! + const nodeMoved = moved.nodes.find((node) => node.id === id)! + expect(nodeMoved.position[0] - nodeBefore.position[0]).toBeCloseTo( + delta[0], + 8 + ) + expect(nodeMoved.position[1] - nodeBefore.position[1]).toBeCloseTo( + delta[1], + 8 + ) + } + expect(moved.links).toEqual(before.links) + expect(moved.links).toContainEqual({ + originId: '3', + originSlot: 0, + targetId: '8', + targetSlot: 0 + }) + }) + for (const vueNodesEnabled of [false, true]) { test(`box-select drag and delete undo restores three linked nodes (${vueNodesEnabled ? 'Vue' : 'LiteGraph'})`, async ({ comfyPage From ea3fa395404198980579010e29b1812a005fcf90 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Fri, 11 Sep 2026 20:22:43 -0700 Subject: [PATCH 3/6] test: complete group history regression coverage --- .../ecsMigration/historyClipboard.spec.ts | 56 +++++++++++ .../tests/vueNodes/groups/groups.spec.ts | 92 +++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts index 4fa5d22cdf2..cd9f078e2c2 100644 --- a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -43,6 +43,23 @@ async function getGraphSnapshot(comfyPage: ComfyPage): Promise { })) } +async function getPairGroupSnapshot(comfyPage: ComfyPage) { + return comfyPage.page.evaluate(() => { + const group = window.app!.graph.groups.find(({ title }) => title === 'Pair') + if (!group) throw new Error('Expected Pair group') + return { + group: [...group.pos, ...group.size], + members: window + .app!.graph.nodes.filter((node) => ['2', '3'].includes(String(node.id))) + .map((node) => ({ + id: String(node.id), + bounds: [...node.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + } + }) +} + async function marqueeNodes(comfyPage: ComfyPage, nodeIds: string[]) { const { from, to } = await comfyPage.page.evaluate((ids) => { const bounds = ids.map((id) => { @@ -92,6 +109,45 @@ test.describe( await comfyPage.canvasOps.resetView() }) + for (const vueNodesEnabled of [false, true]) { + test(`undo restores a dragged group and every member (${vueNodesEnabled ? 'Vue' : 'LiteGraph'})`, async ({ + comfyPage + }) => { + await comfyPage.settings.setSetting( + 'Comfy.VueNodes.Enabled', + vueNodesEnabled + ) + await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') + if (vueNodesEnabled) await comfyPage.vueNodes.waitForNodes(3) + const initial = await getPairGroupSnapshot(comfyPage) + + await comfyPage.canvasOps.dragGroup({ + name: 'Pair', + deltaX: 120, + deltaY: 90 + }) + await expect + .poll(() => getPairGroupSnapshot(comfyPage)) + .not.toEqual(initial) + const moved = await getPairGroupSnapshot(comfyPage) + expect( + moved.group.map((value, index) => value - initial.group[index]) + ).toEqual([120, 90, 0, 0]) + for (let index = 0; index < initial.members.length; index++) { + expect( + moved.members[index].bounds.map( + (value, axis) => value - initial.members[index].bounds[axis] + ) + ).toEqual([120, 90, 0, 0]) + } + + await comfyPage.keyboard.undo() + await expect + .poll(() => getPairGroupSnapshot(comfyPage)) + .toEqual(initial) + }) + } + test('undoes and redoes a move, then deletes only the pasted duplicate', async ({ comfyPage }) => { diff --git a/browser_tests/tests/vueNodes/groups/groups.spec.ts b/browser_tests/tests/vueNodes/groups/groups.spec.ts index d25abdc1473..894c9ea356b 100644 --- a/browser_tests/tests/vueNodes/groups/groups.spec.ts +++ b/browser_tests/tests/vueNodes/groups/groups.spec.ts @@ -5,6 +5,7 @@ import { import type { ComfyPage } from '@e2e/fixtures/ComfyPage' import { TestIds } from '@e2e/fixtures/selectors' import { getGroupTitlePosition } from '@e2e/fixtures/utils/groupHelpers' +import { openMoreOptions } from '@e2e/fixtures/utils/selectionToolbox' const CREATE_GROUP_HOTKEY = 'Control+g' @@ -42,6 +43,23 @@ function expectWithinBaseline( expect(Math.abs(actual - baseline)).toBeLessThan(tolerance) } +async function getPairSnapshot(comfyPage: ComfyPage) { + return comfyPage.page.evaluate(() => { + const group = window.app!.graph.groups.find(({ title }) => title === 'Pair') + if (!group) throw new Error('Expected Pair group') + return { + group: [...group.pos, ...group.size], + members: window + .app!.graph.nodes.filter((node) => ['2', '3'].includes(String(node.id))) + .map((node) => ({ + id: String(node.id), + bounds: [...node.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + } + }) +} + async function getNodeGroupCenteringErrors( comfyPage: ComfyPage ): Promise { @@ -340,6 +358,80 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { await toggleBypass() await expect.poll(bypassCount, "won't toggle double selected node").toBe(7) }) + + test('visible controls update group title and color before both members drag', async ({ + comfyPage + }) => { + await comfyPage.settings.setSetting('Comfy.Canvas.SelectionToolbox', true) + await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') + await comfyPage.vueNodes.waitForNodes(3) + const initial = await getPairSnapshot(comfyPage) + const groupTitle = await getGroupTitlePosition(comfyPage, 'Pair') + await comfyPage.page.mouse.click(groupTitle.x, groupTitle.y) + + const menu = await openMoreOptions(comfyPage) + await menu.getByText('Rename', { exact: true }).click() + await comfyPage.nodeOps.promptDialogInput.fill('Renamed Pair') + await comfyPage.nodeOps.promptDialogInput.press('Enter') + await expect + .poll(() => + comfyPage.page.evaluate(() => + window.app!.graph.groups.some(({ title }) => title === 'Renamed Pair') + ) + ) + .toBe(true) + + const renamedTitle = await getGroupTitlePosition(comfyPage, 'Renamed Pair') + await comfyPage.page.mouse.click(renamedTitle.x, renamedTitle.y, { + button: 'right' + }) + await expect(comfyPage.contextMenu.primeVueMenu).toBeVisible() + await comfyPage.page.getByText('Color', { exact: true }).click() + await comfyPage.page.getByTitle('Red').first().click() + await expect + .poll(() => + comfyPage.page.evaluate( + () => + window.app!.graph.groups.find( + ({ title }) => title === 'Renamed Pair' + )?.color + ) + ) + .toBe('#A88') + + await comfyPage.canvasOps.dragGroup({ + name: 'Renamed Pair', + deltaX: 110, + deltaY: 70 + }) + const moved = await comfyPage.page.evaluate(() => { + const group = window.app!.graph.groups.find( + ({ title }) => title === 'Renamed Pair' + )! + return { + group: [...group.pos, ...group.size], + members: window + .app!.graph.nodes.filter((node) => + ['2', '3'].includes(String(node.id)) + ) + .map((node) => ({ + id: String(node.id), + bounds: [...node.getBounding()] + })) + .sort((left, right) => left.id.localeCompare(right.id)) + } + }) + expect( + moved.group.map((value, index) => value - initial.group[index]) + ).toEqual([110, 70, 0, 0]) + for (let index = 0; index < initial.members.length; index++) { + expect( + moved.members[index].bounds.map( + (value, axis) => value - initial.members[index].bounds[axis] + ) + ).toEqual([110, 70, 0, 0]) + } + }) }) test.describe( From ca53af0e07b6bce5517cee9b4e2bbb9f102a2b76 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Tue, 15 Sep 2026 13:57:57 -0700 Subject: [PATCH 4/6] test: realign history and group specs with main Startup settings move into test.use({ initialSettings }) and the settings-only teardown goes, per comfy(prefer-initial-settings). waitForNodes no longer takes a count, so the three-node expectations become explicit toHaveCount assertions. searchBoxV2.setup() is gone; it only wrote values that are already defaults, and this test opens the search box directly rather than through a link release. All three landed on main after this branch's checks last ran, so the branch was green on its own PR and failed inside the merge group, ejecting an unrelated PR grouped with it. --- .../ecsMigration/historyClipboard.spec.ts | 21 +++++++++++-------- .../tests/vueNodes/groups/groups.spec.ts | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts index cd9f078e2c2..9d2a2d186c1 100644 --- a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -94,18 +94,19 @@ test.describe( 'ECS migration: history and clipboard regression sanity', { tag: ['@canvas', '@workflow'] }, () => { + test.use({ + initialSettings: { + 'Comfy.UseNewMenu': 'Disabled', + 'Comfy.VueNodes.Enabled': false, + 'Comfy.Canvas.LeftMouseClickBehavior': 'select' + } + }) + test.beforeEach(async ({ comfyPage }) => { - await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled') - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) - await comfyPage.settings.setSetting( - 'Comfy.Canvas.LeftMouseClickBehavior', - 'select' - ) await comfyPage.workflow.loadWorkflow('default') }) test.afterEach(async ({ comfyPage }) => { - await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false) await comfyPage.canvasOps.resetView() }) @@ -118,7 +119,10 @@ test.describe( vueNodesEnabled ) await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') - if (vueNodesEnabled) await comfyPage.vueNodes.waitForNodes(3) + if (vueNodesEnabled) { + await comfyPage.vueNodes.waitForNodes() + await expect(comfyPage.vueNodes.nodes).toHaveCount(3) + } const initial = await getPairGroupSnapshot(comfyPage) await comfyPage.canvasOps.dragGroup({ @@ -267,7 +271,6 @@ test.describe( ) const position = { x: 640, y: 420 } - await comfyPage.searchBoxV2.setup() await comfyPage.page.mouse.move(position.x, position.y) await comfyPage.searchBoxV2.open() await comfyPage.searchBoxV2.input.fill('KSamp') diff --git a/browser_tests/tests/vueNodes/groups/groups.spec.ts b/browser_tests/tests/vueNodes/groups/groups.spec.ts index 894c9ea356b..aa8a0878c95 100644 --- a/browser_tests/tests/vueNodes/groups/groups.spec.ts +++ b/browser_tests/tests/vueNodes/groups/groups.spec.ts @@ -364,7 +364,8 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { }) => { await comfyPage.settings.setSetting('Comfy.Canvas.SelectionToolbox', true) await comfyPage.workflow.loadWorkflow('selection/three-nodes-and-group') - await comfyPage.vueNodes.waitForNodes(3) + await comfyPage.vueNodes.waitForNodes() + await expect(comfyPage.vueNodes.nodes).toHaveCount(3) const initial = await getPairSnapshot(comfyPage) const groupTitle = await getGroupTitlePosition(comfyPage, 'Pair') await comfyPage.page.mouse.click(groupTitle.x, groupTitle.y) From e5f77b625c49ad332a710497f4b5fda6ef42fdec Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Tue, 15 Sep 2026 15:11:06 -0700 Subject: [PATCH 5/6] test: require both group members in movement assertions Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17512#discussion_r4020210921 --- .../tests/ecsMigration/historyClipboard.spec.ts | 14 +++++++++----- browser_tests/tests/vueNodes/groups/groups.spec.ts | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts index 9d2a2d186c1..1a0f7bd2f42 100644 --- a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -124,6 +124,7 @@ test.describe( await expect(comfyPage.vueNodes.nodes).toHaveCount(3) } const initial = await getPairGroupSnapshot(comfyPage) + expect(initial.members).toHaveLength(2) await comfyPage.canvasOps.dragGroup({ name: 'Pair', @@ -137,13 +138,16 @@ test.describe( expect( moved.group.map((value, index) => value - initial.group[index]) ).toEqual([120, 90, 0, 0]) - for (let index = 0; index < initial.members.length; index++) { - expect( - moved.members[index].bounds.map( + expect( + moved.members.map((member, index) => + member.bounds.map( (value, axis) => value - initial.members[index].bounds[axis] ) - ).toEqual([120, 90, 0, 0]) - } + ) + ).toEqual([ + [120, 90, 0, 0], + [120, 90, 0, 0] + ]) await comfyPage.keyboard.undo() await expect diff --git a/browser_tests/tests/vueNodes/groups/groups.spec.ts b/browser_tests/tests/vueNodes/groups/groups.spec.ts index aa8a0878c95..e6629ee7cef 100644 --- a/browser_tests/tests/vueNodes/groups/groups.spec.ts +++ b/browser_tests/tests/vueNodes/groups/groups.spec.ts @@ -367,6 +367,7 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { await comfyPage.vueNodes.waitForNodes() await expect(comfyPage.vueNodes.nodes).toHaveCount(3) const initial = await getPairSnapshot(comfyPage) + expect(initial.members).toHaveLength(2) const groupTitle = await getGroupTitlePosition(comfyPage, 'Pair') await comfyPage.page.mouse.click(groupTitle.x, groupTitle.y) @@ -425,13 +426,16 @@ test.describe('Vue Node Groups', { tag: ['@screenshot', '@vue-nodes'] }, () => { expect( moved.group.map((value, index) => value - initial.group[index]) ).toEqual([110, 70, 0, 0]) - for (let index = 0; index < initial.members.length; index++) { - expect( - moved.members[index].bounds.map( + expect( + moved.members.map((member, index) => + member.bounds.map( (value, axis) => value - initial.members[index].bounds[axis] ) - ).toEqual([110, 70, 0, 0]) - } + ) + ).toEqual([ + [110, 70, 0, 0], + [110, 70, 0, 0] + ]) }) }) From cb913bb2bff6d4298f6c8458056dbd6a2400c63e Mon Sep 17 00:00:00 2001 From: christian-byrne Date: Tue, 15 Sep 2026 15:27:17 -0700 Subject: [PATCH 6/6] test: match pasted nodes by source type Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/17512#discussion_r4020210928 --- .../ecsMigration/historyClipboard.spec.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts index 1a0f7bd2f42..fd1bc4d84bd 100644 --- a/browser_tests/tests/ecsMigration/historyClipboard.spec.ts +++ b/browser_tests/tests/ecsMigration/historyClipboard.spec.ts @@ -8,6 +8,7 @@ import type { ComfyPage } from '@e2e/fixtures/ComfyPage' type GraphSnapshot = { nodes: Array<{ id: string + type: string position: [number, number] widgets: unknown[] }> @@ -24,6 +25,7 @@ async function getGraphSnapshot(comfyPage: ComfyPage): Promise { nodes: window .app!.graph.nodes.map((node) => ({ id: String(node.id), + type: node.type, position: [node.pos[0], node.pos[1]] as [number, number], widgets: (node.widgets ?? []).map((widget) => widget.value) })) @@ -224,7 +226,10 @@ test.describe( const sourceLink = sourceSnapshot.links.find( ({ originId, targetId }) => originId === '3' && targetId === '8' ) - expect(sourceNodes).toHaveLength(2) + expect(sourceNodes.map(({ type }) => type)).toEqual([ + 'KSampler', + 'VAEDecode' + ]) expect(sourceLink).toEqual({ originId: '3', originSlot: 0, @@ -249,8 +254,16 @@ test.describe( const pastedNodes = pastedSnapshot.nodes.filter(({ id }) => pastedIds.includes(id) ) - expect(pastedNodes.map(({ widgets }) => widgets)).toEqual( - sourceNodes.map(({ widgets }) => widgets) + const pastedBySourceId = new Map( + sourceNodes.map((source) => [ + source.id, + pastedNodes.find(({ type }) => type === source.type) + ]) + ) + expect([...pastedBySourceId.values()]).toEqual( + sourceNodes.map(({ type, widgets }) => + expect.objectContaining({ type, widgets }) + ) ) expect( pastedSnapshot.links.filter( @@ -259,9 +272,9 @@ test.describe( ) ).toEqual([ { - originId: pastedIds[0], + originId: pastedBySourceId.get(sourceLink!.originId)!.id, originSlot: sourceLink!.originSlot, - targetId: pastedIds[1], + targetId: pastedBySourceId.get(sourceLink!.targetId)!.id, targetSlot: sourceLink!.targetSlot } ])