Skip to content

Commit 69d95f6

Browse files
huchenleigithub-actions
andauthored
Update litegraph (Fix auto connect slot) (#208)
* Update litegraph * Update version again * Add browser test for litegraph change * Update test expectations [skip ci] --------- Co-authored-by: github-actions <[email protected]>
1 parent 609d3fe commit 69d95f6

File tree

9 files changed

+196
-6
lines changed

9 files changed

+196
-6
lines changed

browser_tests/ComfyPage.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export class ComfyPage {
4343
// Buttons
4444
public readonly resetViewButton: Locator;
4545

46+
// Inputs
47+
public readonly workflowUploadInput: Locator;
48+
4649
// Search box
4750
public readonly searchBox: ComfyNodeSearchBox;
4851

@@ -51,6 +54,7 @@ export class ComfyPage {
5154
this.canvas = page.locator("#graph-canvas");
5255
this.widgetTextBox = page.getByPlaceholder("text").nth(1);
5356
this.resetViewButton = page.getByRole("button", { name: "Reset View" });
57+
this.workflowUploadInput = page.locator('#comfy-file-input');
5458
this.searchBox = new ComfyNodeSearchBox(page);
5559
}
5660

@@ -64,6 +68,11 @@ export class ComfyPage {
6468
});
6569
}
6670

71+
async loadWorkflow(workflowName: string) {
72+
await this.workflowUploadInput.setInputFiles(`./browser_tests/assets/${workflowName}.json`);
73+
await this.nextFrame();
74+
}
75+
6776
async resetView() {
6877
await this.resetViewButton.click();
6978
// Avoid "Reset View" button highlight.
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
{
2+
"last_node_id": 5,
3+
"last_link_id": 5,
4+
"nodes": [
5+
{
6+
"id": 1,
7+
"type": "KSampler",
8+
"pos": [
9+
590,
10+
40
11+
],
12+
"size": {
13+
"0": 315,
14+
"1": 262
15+
},
16+
"flags": {},
17+
"order": 2,
18+
"mode": 0,
19+
"inputs": [
20+
{
21+
"name": "model",
22+
"type": "MODEL",
23+
"link": null,
24+
"slot_index": 0
25+
},
26+
{
27+
"name": "positive",
28+
"type": "CONDITIONING",
29+
"link": 3,
30+
"slot_index": 1
31+
},
32+
{
33+
"name": "negative",
34+
"type": "CONDITIONING",
35+
"link": null,
36+
"slot_index": 2
37+
},
38+
{
39+
"name": "latent_image",
40+
"type": "LATENT",
41+
"link": null,
42+
"slot_index": 3
43+
}
44+
],
45+
"outputs": [
46+
{
47+
"name": "LATENT",
48+
"type": "LATENT",
49+
"links": null,
50+
"shape": 3
51+
}
52+
],
53+
"properties": {
54+
"Node name for S&R": "KSampler"
55+
},
56+
"widgets_values": [
57+
0,
58+
"randomize",
59+
20,
60+
8,
61+
"euler",
62+
"normal",
63+
1
64+
]
65+
},
66+
{
67+
"id": 4,
68+
"type": "CLIPTextEncode",
69+
"pos": [
70+
20,
71+
50
72+
],
73+
"size": {
74+
"0": 400,
75+
"1": 200
76+
},
77+
"flags": {},
78+
"order": 0,
79+
"mode": 0,
80+
"inputs": [
81+
{
82+
"name": "clip",
83+
"type": "CLIP",
84+
"link": null
85+
}
86+
],
87+
"outputs": [
88+
{
89+
"name": "CONDITIONING",
90+
"type": "CONDITIONING",
91+
"links": [
92+
3
93+
],
94+
"shape": 3
95+
}
96+
],
97+
"properties": {
98+
"Node name for S&R": "CLIPTextEncode"
99+
},
100+
"widgets_values": [
101+
""
102+
]
103+
},
104+
{
105+
"id": 5,
106+
"type": "CLIPTextEncode",
107+
"pos": [
108+
20,
109+
320
110+
],
111+
"size": {
112+
"0": 400,
113+
"1": 200
114+
},
115+
"flags": {},
116+
"order": 1,
117+
"mode": 0,
118+
"inputs": [
119+
{
120+
"name": "clip",
121+
"type": "CLIP",
122+
"link": null
123+
}
124+
],
125+
"outputs": [
126+
{
127+
"name": "CONDITIONING",
128+
"type": "CONDITIONING",
129+
"links": [],
130+
"shape": 3,
131+
"slot_index": 0
132+
}
133+
],
134+
"properties": {
135+
"Node name for S&R": "CLIPTextEncode"
136+
},
137+
"widgets_values": [
138+
""
139+
]
140+
}
141+
],
142+
"links": [
143+
[
144+
3,
145+
4,
146+
0,
147+
1,
148+
1,
149+
"CONDITIONING"
150+
]
151+
],
152+
"groups": [],
153+
"config": {},
154+
"extra": {
155+
"ds": {
156+
"scale": 1,
157+
"offset": [
158+
0,
159+
0
160+
]
161+
}
162+
},
163+
"version": 0.4
164+
}

browser_tests/interaction.spec.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@playwright/test';
2-
import { comfyPageFixture as test } from './ComfyPage';
2+
import { ComfyPage, comfyPageFixture as test } from './ComfyPage';
33

44
test.describe('Node Interaction', () => {
55
test('Can enter prompt', async ({ comfyPage }) => {
@@ -37,6 +37,23 @@ test.describe('Node Interaction', () => {
3737
await comfyPage.adjustWidgetValue();
3838
await expect(comfyPage.canvas).toHaveScreenshot('adjusted-widget-value.png');
3939
});
40+
41+
test('Link snap to slot', async ({comfyPage}) => {
42+
await comfyPage.loadWorkflow("snap_to_slot");
43+
await expect(comfyPage.canvas).toHaveScreenshot('snap_to_slot.png');
44+
45+
const outputSlotPos = {
46+
x: 406,
47+
y: 333
48+
};
49+
const samplerNodeCenterPos = {
50+
x: 748,
51+
y: 77
52+
};
53+
await comfyPage.dragAndDrop(outputSlotPos, samplerNodeCenterPos);
54+
55+
await expect(comfyPage.canvas).toHaveScreenshot('snap_to_slot_linked.png');
56+
});
4057
});
4158

4259
test.describe('Canvas Interaction', () => {
68 KB
Loading
63.7 KB
Loading
74.4 KB
Loading
70.3 KB
Loading

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
@@ -46,7 +46,7 @@
4646
"zip-dir": "^2.0.0"
4747
},
4848
"dependencies": {
49-
"@comfyorg/litegraph": "^0.7.26",
49+
"@comfyorg/litegraph": "^0.7.29",
5050
"@primevue/themes": "^4.0.0-rc.2",
5151
"@vitejs/plugin-vue": "^5.0.5",
5252
"class-transformer": "^0.5.1",

0 commit comments

Comments
 (0)