mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-11 16:30:57 +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>
78 lines
2.4 KiB
TypeScript
78 lines
2.4 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Subgraph Operations', { tag: ['@slow', '@subgraph'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.NodeSearchBoxImpl',
|
|
'v1 (legacy)'
|
|
)
|
|
})
|
|
|
|
test.describe('Subgraph Clipboard Operations', () => {
|
|
test('Can copy and paste nodes inside a subgraph', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph')
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('2')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
const initialNodeCount = await comfyPage.subgraph.getNodeCount()
|
|
|
|
const nodeId = await comfyPage.page.evaluate(() => {
|
|
const nodes = window.app!.canvas.graph!.nodes
|
|
return nodes?.[0]?.id || null
|
|
})
|
|
expect(nodeId).not.toBeNull()
|
|
|
|
const nodeToClone = await comfyPage.nodeOps.getNodeRefById(String(nodeId))
|
|
await nodeToClone.click('title')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.page.keyboard.press('ControlOrMeta+c')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.page.keyboard.press('ControlOrMeta+v')
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialNodeCount + 1)
|
|
})
|
|
})
|
|
|
|
test.describe('Subgraph History Operations', () => {
|
|
test('Can undo and redo operations inside a subgraph', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph')
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('2')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
await comfyPage.canvasOps.doubleClick()
|
|
await comfyPage.searchBox.fillAndSelectFirstNode('Note')
|
|
await comfyPage.nextFrame()
|
|
|
|
const initialCount = await comfyPage.subgraph.getNodeCount()
|
|
|
|
await comfyPage.keyboard.undo()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialCount - 1)
|
|
|
|
await comfyPage.keyboard.redo()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.subgraph.getNodeCount())
|
|
.toBe(initialCount)
|
|
})
|
|
})
|
|
})
|