mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Simplifies test setup for common settings ## Changes - **What**: - add vue-nodes tag to auto enable nodes 2.0 - remove UseNewMenu Top as this is default ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11184-test-Simplify-vue-node-menu-test-setup-3416d73d3650815487e0c357d28761fe) by [Unito](https://www.unito.io)
95 lines
3.0 KiB
TypeScript
95 lines
3.0 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
import { TestIds } from '@e2e/fixtures/selectors'
|
|
import { getPseudoPreviewWidgets } from '@e2e/helpers/promotedWidgets'
|
|
|
|
const domPreviewSelector = '.image-preview'
|
|
|
|
test.describe('Subgraph Lifecycle', { tag: ['@subgraph'] }, () => {
|
|
test.describe('Cleanup Behavior After Promoted Source Removal', () => {
|
|
test('Deleting the promoted source removes the exterior DOM widget', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'subgraphs/subgraph-with-promoted-text-widget'
|
|
)
|
|
await comfyPage.nextFrame()
|
|
|
|
const textarea = comfyPage.page.getByTestId(
|
|
TestIds.widgets.domWidgetTextarea
|
|
)
|
|
await expect(textarea).toBeVisible()
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('11')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
const clipNode = await comfyPage.nodeOps.getNodeRefById('10')
|
|
await clipNode.delete()
|
|
|
|
await comfyPage.subgraph.exitViaBreadcrumb()
|
|
|
|
await expect(
|
|
comfyPage.page.getByTestId(TestIds.widgets.domWidgetTextarea)
|
|
).toHaveCount(0)
|
|
})
|
|
})
|
|
|
|
test.describe('Unpack/Remove Cleanup for Pseudo-Preview Targets', () => {
|
|
test('Unpacking the preview subgraph clears promoted preview state and DOM', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'subgraphs/subgraph-with-preview-node'
|
|
)
|
|
|
|
await expect
|
|
.poll(async () => {
|
|
const widgets = await getPseudoPreviewWidgets(comfyPage, '5')
|
|
return widgets.length
|
|
})
|
|
.toBeGreaterThan(0)
|
|
|
|
await comfyPage.page.evaluate(() => {
|
|
const graph = window.app!.graph!
|
|
const subgraphNode = graph.getNodeById('5')
|
|
if (!subgraphNode || !subgraphNode.isSubgraphNode()) return
|
|
graph.unpackSubgraph(subgraphNode)
|
|
})
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(async () => comfyPage.subgraph.countGraphPseudoPreviewEntries())
|
|
.toBe(0)
|
|
await expect(comfyPage.page.locator(domPreviewSelector)).toHaveCount(0)
|
|
})
|
|
|
|
test('Removing the preview subgraph clears promoted preview state and DOM', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'subgraphs/subgraph-with-preview-node'
|
|
)
|
|
|
|
await expect
|
|
.poll(async () => {
|
|
const widgets = await getPseudoPreviewWidgets(comfyPage, '5')
|
|
return widgets.length
|
|
})
|
|
.toBeGreaterThan(0)
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('5')
|
|
await expect.poll(() => subgraphNode.exists()).toBe(true)
|
|
|
|
await subgraphNode.delete()
|
|
|
|
await expect.poll(() => subgraphNode.exists()).toBe(false)
|
|
|
|
await expect
|
|
.poll(async () => comfyPage.subgraph.countGraphPseudoPreviewEntries())
|
|
.toBe(0)
|
|
await expect(comfyPage.page.locator(domPreviewSelector)).toHaveCount(0)
|
|
})
|
|
})
|
|
})
|