mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +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>
102 lines
3.3 KiB
TypeScript
102 lines
3.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '../../fixtures/ComfyPage'
|
|
import { comfyPageFixture as test } from '../../fixtures/ComfyPage'
|
|
|
|
async function createSubgraphAndNavigateInto(comfyPage: ComfyPage) {
|
|
const subgraphNode =
|
|
await comfyPage.subgraph.convertDefaultKSamplerToSubgraph()
|
|
await subgraphNode.navigateIntoSubgraph()
|
|
return subgraphNode
|
|
}
|
|
|
|
async function exitSubgraphAndPublish(
|
|
comfyPage: ComfyPage,
|
|
subgraphNode: Awaited<ReturnType<typeof createSubgraphAndNavigateInto>>,
|
|
blueprintName: string
|
|
) {
|
|
await comfyPage.page.keyboard.press('Escape')
|
|
await comfyPage.nextFrame()
|
|
|
|
await subgraphNode.click('title')
|
|
await comfyPage.command.executeCommand('Comfy.PublishSubgraph', {
|
|
name: blueprintName
|
|
})
|
|
|
|
await expect(comfyPage.visibleToasts).toHaveCount(1, { timeout: 5000 })
|
|
await comfyPage.toast.closeToasts(1)
|
|
}
|
|
|
|
async function searchAndExpectResult(
|
|
comfyPage: ComfyPage,
|
|
searchTerm: string,
|
|
expectedResult: string
|
|
) {
|
|
await comfyPage.command.executeCommand('Workspace.SearchBox.Toggle')
|
|
await expect(comfyPage.searchBox.input).toHaveCount(1)
|
|
await comfyPage.searchBox.input.fill(searchTerm)
|
|
await expect(comfyPage.searchBox.findResult(expectedResult)).toBeVisible({
|
|
timeout: 10000
|
|
})
|
|
}
|
|
|
|
test.describe('Subgraph Search Aliases', { tag: ['@subgraph'] }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.NodeSearchBoxImpl',
|
|
'v1 (legacy)'
|
|
)
|
|
})
|
|
|
|
test('Can set search aliases on subgraph and find via search', async ({
|
|
comfyPage
|
|
}) => {
|
|
const subgraphNode = await createSubgraphAndNavigateInto(comfyPage)
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Subgraph.SetSearchAliases', {
|
|
aliases: 'qwerty,unicorn'
|
|
})
|
|
|
|
const blueprintName = `test-aliases-${Date.now()}`
|
|
await exitSubgraphAndPublish(comfyPage, subgraphNode, blueprintName)
|
|
await searchAndExpectResult(comfyPage, 'unicorn', blueprintName)
|
|
})
|
|
|
|
test('Can set description on subgraph', async ({ comfyPage }) => {
|
|
await createSubgraphAndNavigateInto(comfyPage)
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Subgraph.SetDescription', {
|
|
description: 'This is a test description'
|
|
})
|
|
// Verify the description was set on the subgraph's extra
|
|
const description = await comfyPage.page.evaluate(() => {
|
|
const subgraph = window['app']!.canvas.subgraph
|
|
return (subgraph?.extra as Record<string, unknown>)?.BlueprintDescription
|
|
})
|
|
expect(description).toBe('This is a test description')
|
|
})
|
|
|
|
test('Search aliases persist after publish and reload', async ({
|
|
comfyPage
|
|
}) => {
|
|
const subgraphNode = await createSubgraphAndNavigateInto(comfyPage)
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Subgraph.SetSearchAliases', {
|
|
aliases: 'dragon, fire breather'
|
|
})
|
|
|
|
const blueprintName = `test-persist-${Date.now()}`
|
|
await exitSubgraphAndPublish(comfyPage, subgraphNode, blueprintName)
|
|
|
|
// Reload the page to ensure aliases are persisted
|
|
await comfyPage.page.reload()
|
|
await comfyPage.page.waitForFunction(
|
|
() => window['app'] && window['app'].extensionManager
|
|
)
|
|
await comfyPage.nextFrame()
|
|
|
|
await searchAndExpectResult(comfyPage, 'dragon', blueprintName)
|
|
})
|
|
})
|