[Bug] Register dom widget when only node is added to graph (#3732)

This commit is contained in:
Chenlei Hu
2025-05-02 12:49:19 -04:00
committed by GitHub
parent b618ebe36d
commit 197f33ffcd
3 changed files with 31 additions and 2 deletions

View File

@@ -924,6 +924,12 @@ export class ComfyPage {
return window['app'].canvas.ds.convertOffsetToCanvas(pos)
}, pos)
}
/** Get number of DOM widgets on the canvas. */
async getDOMWidgetCount() {
return await this.page.locator('.dom-widget').count()
}
async getNodeRefById(id: NodeId) {
return new NodeReference(id, this)
}

View File

@@ -31,4 +31,20 @@ test.describe('DOM Widget', () => {
await comfyPage.nextFrame()
await expect(comfyPage.canvas).toHaveScreenshot('focus-mode-on.png')
})
// No DOM widget should be created by creation of interim LGraphNode objects.
test('Copy node with DOM widget by dragging + alt', async ({ comfyPage }) => {
const initialCount = await comfyPage.getDOMWidgetCount()
// TextEncodeNode1
await comfyPage.page.mouse.move(618, 191)
await comfyPage.page.keyboard.down('Alt')
await comfyPage.page.mouse.down()
await comfyPage.page.mouse.move(100, 100)
await comfyPage.page.mouse.up()
await comfyPage.page.keyboard.up('Alt')
const finalCount = await comfyPage.getDOMWidgetCount()
expect(finalCount).toBe(initialCount + 1)
})
})