mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-02 06:19:58 +00:00
Migrate all test callers to use helper classes directly: - nodeOps: getGraphNodesCount, getNodeRefById, selectNodes, etc. - canvasOps: dragAndDrop, zoom, pan, resetView, etc. - subgraph: rightClickInputSlot, connectToOutput, etc. Reduces ComfyPage.ts from 1335 to 1085 lines (-250 lines). Amp-Thread-ID: https://ampcode.com/threads/T-019c1318-58b7-757f-801c-5b676f0d3421 Co-authored-by: Amp <amp@ampcode.com>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
function listenForEvent(): Promise<Event> {
|
|
return new Promise<Event>((resolve) => {
|
|
document.addEventListener('litegraph:canvas', (e) => resolve(e), {
|
|
once: true
|
|
})
|
|
})
|
|
}
|
|
|
|
test.describe('Canvas Event', { tag: '@canvas' }, () => {
|
|
test('Emit litegraph:canvas empty-release', async ({ comfyPage }) => {
|
|
const eventPromise = comfyPage.page.evaluate(listenForEvent)
|
|
const disconnectPromise = comfyPage.disconnectEdge()
|
|
const event = await eventPromise
|
|
await disconnectPromise
|
|
|
|
expect(event).not.toBeNull()
|
|
// No further check on event content as the content is dropped by
|
|
// playwright for some reason.
|
|
// See https://github.com/microsoft/playwright/issues/31580
|
|
})
|
|
|
|
test('Emit litegraph:canvas empty-double-click', async ({ comfyPage }) => {
|
|
const eventPromise = comfyPage.page.evaluate(listenForEvent)
|
|
const doubleClickPromise = comfyPage.canvasOps.doubleClick()
|
|
const event = await eventPromise
|
|
await doubleClickPromise
|
|
|
|
expect(event).not.toBeNull()
|
|
// No further check on event content as the content is dropped by
|
|
// playwright for some reason.
|
|
// See https://github.com/microsoft/playwright/issues/31580
|
|
})
|
|
})
|