mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 06:35:10 +00:00
- Add middleClickDrag helper to CanvasHelper for simple MMB drag - pan.spec.ts: use snapshot assertion + middleClickDrag helper - multilineStringWidget.spec.ts: use snapshots, remove getCanvasOffset helper - maskEditor.spec.ts: use dialog screenshot via expectScreenshot - Move slot auto-node test to dedicated slotAutoNode.spec.ts with type guards, beforeEach/afterEach, and getConnectionPos API
56 lines
1.7 KiB
TypeScript
56 lines
1.7 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Slot Auto Node', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', false)
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.MiddleClickRerouteNode',
|
|
true
|
|
)
|
|
await comfyPage.nextFrame()
|
|
})
|
|
|
|
test.afterEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.MiddleClickRerouteNode',
|
|
false
|
|
)
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
})
|
|
|
|
test('Middle-click on output slot should create default node', async ({
|
|
comfyPage
|
|
}) => {
|
|
const [nodeRef] =
|
|
await comfyPage.nodeOps.getNodeRefsByType('CLIPTextEncode')
|
|
expect(
|
|
nodeRef,
|
|
'Expected CLIPTextEncode node in default workflow'
|
|
).toBeTruthy()
|
|
|
|
if (!nodeRef)
|
|
throw new Error('Expected CLIPTextEncode node in default workflow')
|
|
|
|
const slotPos = await comfyPage.page.evaluate((targetNodeId) => {
|
|
const node = window.app!.graph!.getNodeById(targetNodeId)
|
|
if (!node) return null
|
|
const pos = node.getConnectionPos(false, 0)
|
|
return window.app!.canvasPosToClientPos(pos)
|
|
}, nodeRef.id)
|
|
if (!slotPos) throw new Error('Could not resolve output slot position')
|
|
|
|
const initialNodeCount = await comfyPage.nodeOps.getGraphNodesCount()
|
|
|
|
await comfyPage.page.mouse.click(slotPos[0], slotPos[1], {
|
|
button: 'middle'
|
|
})
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.nodeOps.getGraphNodesCount())
|
|
.toBeGreaterThan(initialNodeCount)
|
|
})
|
|
})
|