mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
## Summary From the primordial entropy of 17 scattered spec files — a formless sprawl of mixed concerns and inconsistent naming — emerges a clean, domain-organized hierarchy. Order triumphs over chaos. ## Changes - **What**: Reorganize all subgraph E2E tests from 17 flat files in `browser_tests/tests/` into 10 domain-grouped files under `browser_tests/tests/subgraph/`. | File | Tests | Domain | |------|-------|--------| | `subgraphSlots` | 16 | I/O slot CRUD, rename, alignment, promoted slot position | | `subgraphPromotion` | 22 | Auto-promote, visibility, reactivity, context menu, cleanup | | `subgraphSerialization` | 16 | Hydration, round-trip, legacy formats, ID remapping | | `subgraphNavigation` | 10 | Breadcrumb, viewport, hotkeys, progress state | | `subgraphNested` | 9 | Configure order, duplicate names, pack values, stale proxies | | `subgraphLifecycle` | 7 | Source removal cleanup, pseudo-preview lifecycle | | `subgraphPromotionDom` | 6 | DOM widget persistence, cleanup, positioning | | `subgraphCrud` | 5 | Create, delete, copy, unpack | | `subgraphSearch` | 3 | Search aliases, description, persistence | | `subgraphOperations` | 2 | Copy/paste inside, undo/redo inside | Where once the monolith `subgraph.spec.ts` (856 lines) mixed slot CRUD with hotkeys, DOM widgets with navigation, and copy/paste with undo/redo — now each behavioral domain has its sovereign territory. Where once `subgraph-rename-dialog.spec.ts`, `subgraphInputSlotRename.spec.ts`, and `subgraph-promoted-slot-position.spec.ts` scattered rename concerns across three kingdoms — now they answer to one crown: `subgraphSlots.spec.ts`. Where once `kebab-case` and `camelCase` warred for dominion — now a single convention reigns. All 96 test cases preserved. Zero test logic changes. Purely structural. ## Review Focus - Verify no tests were lost in the consolidation - Confirm import paths all resolve correctly at the new depth (`../../fixtures/`) - The `import.meta.dirname` asset path in `subgraphSlots.spec.ts` (slot alignment test) updated for new directory depth ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10695-test-reorganize-subgraph-E2E-tests-into-domain-organized-directory-3326d73d36508197939be8825b69ea88) 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 '../../fixtures/ComfyPage'
|
|
|
|
test.describe(
|
|
'Subgraph Internal Operations',
|
|
{ tag: ['@slow', '@subgraph'] },
|
|
() => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.NodeSearchBoxImpl',
|
|
'v1 (legacy)'
|
|
)
|
|
})
|
|
|
|
test('Can copy and paste nodes in 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 nodesInSubgraph = await comfyPage.page.evaluate(() => {
|
|
const nodes = window.app!.canvas.graph!.nodes
|
|
return nodes?.[0]?.id || null
|
|
})
|
|
|
|
expect(nodesInSubgraph).not.toBeNull()
|
|
|
|
const nodeToClone = await comfyPage.nodeOps.getNodeRefById(
|
|
String(nodesInSubgraph)
|
|
)
|
|
await nodeToClone.click('title')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.page.keyboard.press('Control+c')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.page.keyboard.press('Control+v')
|
|
await comfyPage.nextFrame()
|
|
|
|
const finalNodeCount = await comfyPage.subgraph.getNodeCount()
|
|
expect(finalNodeCount).toBe(initialNodeCount + 1)
|
|
})
|
|
|
|
test('Can undo and redo operations in subgraph', async ({ comfyPage }) => {
|
|
await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph')
|
|
|
|
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('2')
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
|
|
// Add a node
|
|
await comfyPage.canvasOps.doubleClick()
|
|
await comfyPage.searchBox.fillAndSelectFirstNode('Note')
|
|
await comfyPage.nextFrame()
|
|
|
|
// Get initial node count
|
|
const initialCount = await comfyPage.subgraph.getNodeCount()
|
|
|
|
// Undo
|
|
await comfyPage.keyboard.undo()
|
|
await comfyPage.nextFrame()
|
|
|
|
const afterUndoCount = await comfyPage.subgraph.getNodeCount()
|
|
expect(afterUndoCount).toBe(initialCount - 1)
|
|
|
|
// Redo
|
|
await comfyPage.keyboard.redo()
|
|
await comfyPage.nextFrame()
|
|
|
|
const afterRedoCount = await comfyPage.subgraph.getNodeCount()
|
|
expect(afterRedoCount).toBe(initialCount)
|
|
})
|
|
}
|
|
)
|