Skip to content

Commit 525adb7

Browse files
authored
Add tests on litegraph search box triggering events (#97)
* Add test on litegraph canvas event * Update tests * Update litegraph
1 parent 2ae2e82 commit 525adb7

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

browser_tests/ComfyPage.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ export class ComfyPage {
144144
await this.nextFrame();
145145
}
146146

147+
async doubleClickCanvas() {
148+
await this.page.mouse.dblclick(10, 10);
149+
await this.nextFrame();
150+
}
151+
147152
async rightClickEmptyLatentNode() {
148153
await this.canvas.click({
149154
position: {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { expect } from "@playwright/test";
2+
import { comfyPageFixture as test } from "./ComfyPage";
3+
4+
function listenForEvent(): Promise<Event> {
5+
return new Promise<Event>((resolve) => {
6+
document.addEventListener("litegraph:canvas", (e) => resolve(e), { once: true });
7+
});
8+
}
9+
10+
test.describe("Canvas Event", () => {
11+
test("Emit litegraph:canvas empty-release", async ({ comfyPage }) => {
12+
const eventPromise = comfyPage.page.evaluate(listenForEvent);
13+
const disconnectPromise = comfyPage.disconnectEdge();
14+
const event = await eventPromise;
15+
await disconnectPromise;
16+
17+
expect(event).not.toBeNull();
18+
// No further check on event content as the content is dropped by
19+
// playwright for some reason.
20+
// See https://github.com/microsoft/playwright/issues/31580
21+
});
22+
23+
test("Emit litegraph:canvas empty-double-click", async ({ comfyPage }) => {
24+
const eventPromise = comfyPage.page.evaluate(listenForEvent);
25+
const doubleClickPromise = comfyPage.doubleClickCanvas();
26+
const event = await eventPromise;
27+
await doubleClickPromise;
28+
29+
expect(event).not.toBeNull();
30+
// No further check on event content as the content is dropped by
31+
// playwright for some reason.
32+
// See https://github.com/microsoft/playwright/issues/31580
33+
});
34+
});

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
@@ -40,7 +40,7 @@
4040
"zip-dir": "^2.0.0"
4141
},
4242
"dependencies": {
43-
"@comfyorg/litegraph": "^0.7.20",
43+
"@comfyorg/litegraph": "^0.7.23",
4444
"dotenv": "^16.4.5",
4545
"zod": "^3.23.8",
4646
"zod-validation-error": "^3.3.0"

0 commit comments

Comments
 (0)