mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Reorganize the subgraph test suite so browser tests are thin representative user journeys while lower-level Vitest suites own combinatorics, migration edge cases, and data-shape semantics. ## Changes - **What**: Migrate 17 flat subgraph browser specs into 10 domain-organized specs under `browser_tests/tests/subgraph/`, move redundant semantic coverage down to 8 Vitest owner suites, delete all legacy flat files - **Browser specs** (54 tests): `subgraphSlots`, `subgraphPromotion`, `subgraphPromotionDom`, `subgraphSerialization`, `subgraphNavigation`, `subgraphNested`, `subgraphLifecycle`, `subgraphCrud`, `subgraphSearch`, `subgraphOperations` - **Vitest owners** (230 tests): `SubgraphNode.test.ts` (rename/label propagation), `subgraphNodePromotion.test.ts`, `promotedWidgetView.test.ts`, `SubgraphSerialization.test.ts` (duplicate-ID remap), `SubgraphWidgetPromotion.test.ts` (legacy hydration), `subgraphNavigationStore*.test.ts` (viewport cache, workflow-switch), `subgraphStore.test.ts` (search aliases, description) - **Net effect**: browser suite shrinks from ~96 scattered tests to 54 focused journeys ## Review Focus - Coverage ownership split: each browser test has a unique UI-only failure mode; semantic coverage lives in Vitest - `subgraphPromotionDom.spec.ts` forces LiteGraph mode and uses `canvas.openSubgraph()` instead of `navigateIntoSubgraph()` to avoid a wrapper-specific DOM overlay duplication issue — entry-affordance coverage lives in `subgraphNavigation.spec.ts` - No product code changes — test-only migration ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10759-test-reorganize-subgraph-test-suite-into-composable-domain-specs-3336d73d365081b0a56bcbf809b1f584) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
93 lines
3.0 KiB
TypeScript
93 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.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
})
|
|
|
|
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 comfyPage.nextFrame()
|
|
|
|
const beforePseudo = await getPseudoPreviewWidgets(comfyPage, '5')
|
|
expect(beforePseudo.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 comfyPage.nextFrame()
|
|
|
|
const beforePseudo = await getPseudoPreviewWidgets(comfyPage, '5')
|
|
expect(beforePseudo.length).toBeGreaterThan(0)
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('5')
|
|
expect(await subgraphNode.exists()).toBe(true)
|
|
|
|
await subgraphNode.delete()
|
|
|
|
expect(await subgraphNode.exists()).toBe(false)
|
|
|
|
await expect
|
|
.poll(async () => comfyPage.subgraph.countGraphPseudoPreviewEntries())
|
|
.toBe(0)
|
|
await expect(comfyPage.page.locator(domPreviewSelector)).toHaveCount(0)
|
|
})
|
|
})
|
|
})
|