Files
ComfyUI_frontend/browser_tests/tests/subgraphZeroUuid.spec.ts
pythongosssss 63654470b7 [backport core/1.42] fix: Ensure zero uuid root graphs get assigned a valid id (#10962)
Backport of #10825 to core/1.42.

Fixes an issue where handlers would be leaked causing Vue node rendering
to be corrupted due to the 00000000-0000-0000-0000-000000000000 ID being
used on the root graph.

## Conflict resolution

- `browser_tests/tests/subgraphZeroUuid.spec.ts`: adjusted import path
from `../../fixtures/ComfyPage` to `../fixtures/ComfyPage` since
core/1.42 has flat test directory (no `subgraph/` subdirectory).

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10962-backport-core-1-42-fix-Ensure-zero-uuid-root-graphs-get-assigned-a-valid-id-33c6d73d36508123829ed5d5c0087e2f)
by [Unito](https://www.unito.io)
2026-04-08 10:51:26 -07:00

50 lines
1.7 KiB
TypeScript

import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
test.describe(
'Zero UUID workflow: subgraph undo rendering',
{ tag: ['@workflow', '@subgraph'] },
() => {
test.beforeEach(async ({ comfyPage }) => {
test.setTimeout(30000) // Extend timeout as we need to reload the page an additional time
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
await comfyPage.page.reload() // Reload page as we need to enter in Vue mode
await comfyPage.page.waitForFunction(() => !!window.app?.graph)
})
test('Undo after subgraph enter/exit renders all nodes when workflow starts with zero UUID', async ({
comfyPage
}) => {
await comfyPage.workflow.loadWorkflow(
'subgraphs/basic-subgraph-zero-uuid'
)
await comfyPage.vueNodes.waitForNodes()
const assertInSubgraph = async (inSubgraph: boolean) => {
await expect
.poll(() => comfyPage.subgraph.isInSubgraph())
.toBe(inSubgraph)
}
// Root graph has 1 subgraph node, rendered in the DOM
await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1)
await expect.poll(() => comfyPage.vueNodes.getNodeCount()).toBe(1)
await comfyPage.vueNodes.enterSubgraph()
await assertInSubgraph(true)
await comfyPage.subgraph.exitViaBreadcrumb()
await assertInSubgraph(false)
await comfyPage.canvas.focus()
await comfyPage.keyboard.undo()
await comfyPage.nextFrame()
// After undo, the subgraph node is still visible and rendered
await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1)
await expect.poll(() => comfyPage.vueNodes.getNodeCount()).toBe(1)
})
}
)