mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
test: rewrite E2E output preservation tests to use widget values
Replace drag-and-drop image preview tests (broken in CI per #8143) with execution-based widget value assertions using the partial_execution workflow. Tests the same changeTracker snapshot/restore path through PreviewAny widget values, which work reliably in CI.
This commit is contained in:
@@ -1,111 +1,74 @@
|
||||
import { expect } from '@playwright/test'
|
||||
|
||||
import type { ComfyPage } from '../../../../fixtures/ComfyPage'
|
||||
import { comfyPageFixture as test } from '../../../../fixtures/ComfyPage'
|
||||
|
||||
test.describe('Node Output Preservation', { tag: ['@widget', '@node'] }, () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
||||
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.Workflow.WorkflowTabsPosition',
|
||||
'Topbar'
|
||||
)
|
||||
await comfyPage.setup()
|
||||
})
|
||||
|
||||
async function loadImageOnNode(comfyPage: ComfyPage) {
|
||||
await comfyPage.workflow.loadWorkflow('widgets/load_image_widget')
|
||||
await comfyPage.vueNodes.waitForNodes()
|
||||
|
||||
const loadImageNode = (
|
||||
await comfyPage.nodeOps.getNodeRefsByType('LoadImage')
|
||||
)[0]
|
||||
const { x, y } = await loadImageNode.getPosition()
|
||||
|
||||
await comfyPage.dragDrop.dragAndDropFile('image64x64.webp', {
|
||||
dropPosition: { x, y }
|
||||
test.describe(
|
||||
'Node Output Preservation',
|
||||
{ tag: ['@widget', '@node'] },
|
||||
() => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.Workflow.WorkflowTabsPosition',
|
||||
'Topbar'
|
||||
)
|
||||
})
|
||||
|
||||
const imagePreview = comfyPage.page.locator('.image-preview')
|
||||
await expect(imagePreview).toBeVisible()
|
||||
await expect(imagePreview.locator('img')).toBeVisible()
|
||||
test('Execution output widget value survives tab switch', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.workflow.loadWorkflow('execution/partial_execution')
|
||||
|
||||
return { imagePreview }
|
||||
const outputNode = await comfyPage.nodeOps.getNodeRefById(1)
|
||||
expect(await (await outputNode.getWidget(0)).getValue()).toBe('')
|
||||
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
await expect(async () => {
|
||||
expect(await (await outputNode.getWidget(0)).getValue()).toBe('foo')
|
||||
}).toPass({ timeout: 5_000 })
|
||||
|
||||
await comfyPage.menu.topbar.triggerTopbarCommand(['New'])
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
const firstTab = comfyPage.menu.topbar.getWorkflowTab(
|
||||
'partial_execution'
|
||||
)
|
||||
await firstTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
await expect(async () => {
|
||||
expect(await (await outputNode.getWidget(0)).getValue()).toBe('foo')
|
||||
}).toPass({ timeout: 5_000 })
|
||||
})
|
||||
|
||||
test('Outputs on different tabs are independent', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.workflow.loadWorkflow('execution/partial_execution')
|
||||
|
||||
const outputNode1 = await comfyPage.nodeOps.getNodeRefById(1)
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
await expect(async () => {
|
||||
expect(await (await outputNode1.getWidget(0)).getValue()).toBe('foo')
|
||||
}).toPass({ timeout: 5_000 })
|
||||
|
||||
await comfyPage.menu.topbar.triggerTopbarCommand(['New'])
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
const newOutputCount = await comfyPage.page.evaluate(
|
||||
() => Object.keys(window.app!.nodeOutputs).length
|
||||
)
|
||||
expect(newOutputCount).toBe(0)
|
||||
|
||||
const firstTab = comfyPage.menu.topbar.getWorkflowTab(
|
||||
'partial_execution'
|
||||
)
|
||||
await firstTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
await expect(async () => {
|
||||
expect(await (await outputNode1.getWidget(0)).getValue()).toBe('foo')
|
||||
}).toPass({ timeout: 5_000 })
|
||||
})
|
||||
}
|
||||
|
||||
async function getTab(comfyPage: ComfyPage, index: number) {
|
||||
return comfyPage.page.locator('.workflow-tabs .p-togglebutton').nth(index)
|
||||
}
|
||||
|
||||
// TODO(#8143): Re-enable after image preview sync is working in CI
|
||||
test.fixme('LoadImage preview survives tab switch', async ({ comfyPage }) => {
|
||||
const { imagePreview } = await loadImageOnNode(comfyPage)
|
||||
|
||||
// Create a new tab (switches to it)
|
||||
await comfyPage.menu.topbar.triggerTopbarCommand(['New'])
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// Switch back to the first tab
|
||||
const firstTab = await getTab(comfyPage, 0)
|
||||
await firstTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// Image preview should still be visible
|
||||
await expect(imagePreview).toBeVisible()
|
||||
await expect(imagePreview.locator('img')).toBeVisible()
|
||||
})
|
||||
|
||||
// TODO(#8143): Re-enable after image preview sync is working in CI
|
||||
test.fixme('LoadImage preview survives execution + tab switch', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
const { imagePreview } = await loadImageOnNode(comfyPage)
|
||||
|
||||
// Queue a prompt and wait for execution to complete
|
||||
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// Create a new tab
|
||||
await comfyPage.menu.topbar.triggerTopbarCommand(['New'])
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// Switch back to the first tab
|
||||
const firstTab = await getTab(comfyPage, 0)
|
||||
await firstTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
// Image preview should still be visible
|
||||
await expect(imagePreview).toBeVisible()
|
||||
await expect(imagePreview.locator('img')).toBeVisible()
|
||||
})
|
||||
|
||||
// TODO(#8143): Re-enable after image preview sync is working in CI
|
||||
test.fixme('Multiple LoadImage nodes on different tabs preserve independently', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
// Tab 1: Load image on a LoadImage node
|
||||
await loadImageOnNode(comfyPage)
|
||||
const tab1Preview = comfyPage.page.locator('.image-preview img')
|
||||
await expect(tab1Preview).toBeVisible()
|
||||
|
||||
// Create Tab 2 and load a different workflow with LoadImage
|
||||
await comfyPage.menu.topbar.triggerTopbarCommand(['New'])
|
||||
await comfyPage.nextFrame()
|
||||
await loadImageOnNode(comfyPage)
|
||||
const tab2Preview = comfyPage.page.locator('.image-preview img')
|
||||
await expect(tab2Preview).toBeVisible()
|
||||
|
||||
// Switch to Tab 1 — its preview should be visible
|
||||
const firstTab = await getTab(comfyPage, 0)
|
||||
await firstTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
await expect(comfyPage.page.locator('.image-preview img')).toBeVisible()
|
||||
|
||||
// Switch to Tab 2 — its preview should be visible
|
||||
const secondTab = await getTab(comfyPage, 1)
|
||||
await secondTab.click()
|
||||
await comfyPage.nextFrame()
|
||||
await expect(comfyPage.page.locator('.image-preview img')).toBeVisible()
|
||||
})
|
||||
})
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user