Skip to content

Commit d0a4db5

Browse files
huchenleigithub-actions
andauthored
Update litegraph (Copy connection by shift drag from path) (#841)
* Add playwright tests * Update lg * nit * nit * Skip tests * Update test expectations [skip ci] --------- Co-authored-by: github-actions <github-actions@github.com>
1 parent 861eaa1 commit d0a4db5

File tree

6 files changed

+67
-15
lines changed

6 files changed

+67
-15
lines changed

browser_tests/ComfyPage.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,18 @@ export class ComfyPage {
371371
return { x: 427, y: 198 }
372372
}
373373

374+
get clipTextEncodeNode2InputSlot(): Position {
375+
return { x: 422, y: 402 }
376+
}
377+
378+
// A point on input edge.
379+
get clipTextEncodeNode2InputLinkPath(): Position {
380+
return {
381+
x: 395,
382+
y: 422
383+
}
384+
}
385+
374386
get loadCheckpointNodeClipOutputSlot(): Position {
375387
return { x: 332, y: 509 }
376388
}

browser_tests/interaction.spec.ts

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,56 @@ test.describe('Node Interaction', () => {
2424
await expect(comfyPage.canvas).toHaveScreenshot('dragged-node1.png')
2525
})
2626

27-
test('Can disconnect/connect edge', async ({ comfyPage }) => {
28-
await comfyPage.setSetting('Comfy.LinkRelease.Action', 'no action')
29-
await comfyPage.disconnectEdge()
30-
await expect(comfyPage.canvas).toHaveScreenshot(
31-
'disconnected-edge-with-menu.png'
32-
)
33-
await comfyPage.connectEdge()
34-
// Litegraph renders edge with a slight offset.
35-
await expect(comfyPage.canvas).toHaveScreenshot('default.png', {
36-
maxDiffPixels: 50
27+
test.describe('Edge Interaction', () => {
28+
test.beforeEach(async ({ comfyPage }) => {
29+
await comfyPage.setSetting('Comfy.LinkRelease.Action', 'no action')
30+
await comfyPage.setSetting('Comfy.LinkRelease.ActionShift', 'no action')
31+
})
32+
33+
test('Can disconnect/connect edge', async ({ comfyPage }) => {
34+
await comfyPage.disconnectEdge()
35+
await expect(comfyPage.canvas).toHaveScreenshot('disconnected-edge.png')
36+
await comfyPage.connectEdge()
37+
// Litegraph renders edge with a slight offset.
38+
await expect(comfyPage.canvas).toHaveScreenshot('default.png', {
39+
maxDiffPixels: 50
40+
})
41+
})
42+
43+
// Chromium 2x cannot move link.
44+
// See https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/10876381315/job/30176211513
45+
test.skip('Can move link', async ({ comfyPage }) => {
46+
await comfyPage.dragAndDrop(
47+
comfyPage.clipTextEncodeNode1InputSlot,
48+
comfyPage.emptySpace
49+
)
50+
await expect(comfyPage.canvas).toHaveScreenshot('disconnected-edge.png')
51+
await comfyPage.dragAndDrop(
52+
comfyPage.clipTextEncodeNode2InputSlot,
53+
comfyPage.clipTextEncodeNode1InputSlot
54+
)
55+
await expect(comfyPage.canvas).toHaveScreenshot('moved-link.png')
56+
})
57+
58+
// Copy link is not working on CI at all
59+
// Chromium 2x recognize it as dragging canvas.
60+
// Chromium triggers search box after link release. The link is indeed copied.
61+
// See https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/10876381315/job/30176211513
62+
test.skip('Can copy link by shift-drag existing link', async ({
63+
comfyPage
64+
}) => {
65+
await comfyPage.dragAndDrop(
66+
comfyPage.clipTextEncodeNode1InputSlot,
67+
comfyPage.emptySpace
68+
)
69+
await expect(comfyPage.canvas).toHaveScreenshot('disconnected-edge.png')
70+
await comfyPage.page.keyboard.down('Shift')
71+
await comfyPage.dragAndDrop(
72+
comfyPage.clipTextEncodeNode2InputLinkPath,
73+
comfyPage.clipTextEncodeNode1InputSlot
74+
)
75+
await comfyPage.page.keyboard.up('Shift')
76+
await expect(comfyPage.canvas).toHaveScreenshot('copied-link.png')
3777
})
3878
})
3979

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
},
6363
"dependencies": {
6464
"@atlaskit/pragmatic-drag-and-drop": "^1.2.1",
65-
"@comfyorg/litegraph": "^0.7.74",
65+
"@comfyorg/litegraph": "^0.7.75",
6666
"@primevue/themes": "^4.0.5",
6767
"@vitejs/plugin-vue": "^5.0.5",
6868
"@vueuse/core": "^11.0.0",

0 commit comments

Comments
 (0)