mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Audit all skipped/fixme tests: delete stale tests whose underlying features were removed, re-enable tests that pass with minimal fixes, and remove orphaned production code that only the deleted tests exercised. Net result: **−2,350 lines** across 50 files. ## Changes - **Pruned stale skipped tests** (entire files deleted): - `LGraph.configure.test.ts`, `LGraph.constructor.test.ts` — tested removed LGraph constructor paths - `LGraphCanvas.ghostAutoPan.test.ts`, `LGraphCanvas.linkDragAutoPan.test.ts`, `useAutoPan.test.ts`, `useSlotLinkInteraction.autoPan.test.ts` — tested removed auto-pan feature - `useNodePointerInteractions.test.ts` — single skipped test for removed callback - `ImageLightbox.test.ts` — component replaced by `MediaLightbox` - `appModeWidgetRename.spec.ts` (E2E) — feature removed; helper `AppModeHelper.ts` also deleted - `domWidget.spec.ts`, `widget.spec.ts` (E2E) — tested removed widget behavior - **Removed orphaned production code** surfaced by test pruning: - `useAutoPan.ts` — composable + 93 lines of auto-pan logic in `LGraphCanvas.ts` - `ImageLightbox.vue` — replaced by `MediaLightbox` - Auto-pan integration in `useSlotLinkInteraction.ts` and `useNodeDrag.ts` - Dead settings (`LinkSnapping.AutoPanSpeed`, `LinkSnapping.AutoPanMargin`) in `coreSettings.ts` and `useLitegraphSettings.ts` - Unused subgraph methods (`SubgraphNode.getExposedInput`, `SubgraphInput.getParentInput`) - Dead i18n key, dead API schema field, dead fixture exports (`dirtyTest`, `basicSerialisableGraph`) - Dead test utility `litegraphTestUtils.ts` - **Re-enabled skipped tests with minimal fixes**: - `useBrowserTabTitle.test.ts` — removed skip, test passes as-is - `eventUtils.test.ts` — replaced MSW dependency with direct `fetch` mock - `SubscriptionPanel.test.ts` — stabilized button selectors, timezone-safe date assertion - `LinkConnector.test.ts` — removed stale describe blocks, kept passing suite - `widgetUtil.test.ts` — removed skipped tests for deleted functionality - `comfyManagerStore.test.ts` — removed skipped `isPackInstalling` / `action buttons` / `loading states` blocks - **Re-enabled then re-skipped 3 flaky E2E tests** (fail in CI for pre-existing reasons): - `browserTabTitle.spec.ts` — canvas click timeout (element not visible) - `groupNode.spec.ts` — screenshot diff (stale golden image) - `nodeSearchBox.spec.ts` — `p-dialog-mask` intercepts pointer events - **Simplified production code** alongside test cleanup: - `useNodeDrag.ts` — removed auto-pan integration, simplified from 170→100 lines - `DropZone.vue` — refactored URL-drop handling, removed unused code path - `ToInputFromIoNodeLink.ts`, `SubgraphInputEventMap.ts` — removed dead subgraph wiring - **Dependencies**: none - **Breaking**: none (all removed code was internal/unused) ## Review Focus - Confirm deleted production code (`useAutoPan`, `ImageLightbox`, subgraph methods) has no remaining callers - Validate that simplified `useNodeDrag.ts` preserves drag behavior without auto-pan - Check that re-skipped E2E tests have clear skip reasons for future triage ## Screenshots (if applicable) N/A --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: github-actions <github-actions@github.com>
134 lines
4.5 KiB
TypeScript
134 lines
4.5 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import type { ComfyPage } from '../../../../fixtures/ComfyPage'
|
|
import { comfyPageFixture as test } from '../../../../fixtures/ComfyPage'
|
|
import {
|
|
getPromotedWidgetNames,
|
|
getPromotedWidgetCountByName
|
|
} from '../../../../helpers/promotedWidgets'
|
|
|
|
test.describe('Vue Nodes Image Preview', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
})
|
|
|
|
async function loadImageOnNode(comfyPage: ComfyPage) {
|
|
await comfyPage.workflow.loadWorkflow('widgets/load_image_widget')
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
|
|
const loadImageNode = (
|
|
await comfyPage.nodeOps.getNodeRefsByType('LoadImage')
|
|
)[0]
|
|
const { x, y } = await loadImageNode.getPosition()
|
|
|
|
await comfyPage.dragDrop.dragAndDropFile('image64x64.webp', {
|
|
dropPosition: { x, y }
|
|
})
|
|
|
|
const nodeId = String(loadImageNode.id)
|
|
const imagePreview = comfyPage.vueNodes
|
|
.getNodeLocator(nodeId)
|
|
.locator('.image-preview')
|
|
|
|
await expect(imagePreview).toBeVisible()
|
|
await expect(imagePreview.locator('img')).toBeVisible({ timeout: 30_000 })
|
|
await expect(imagePreview).toContainText('x')
|
|
|
|
return {
|
|
imagePreview,
|
|
nodeId
|
|
}
|
|
}
|
|
|
|
test('opens mask editor from image preview button', async ({ comfyPage }) => {
|
|
const { imagePreview } = await loadImageOnNode(comfyPage)
|
|
|
|
await imagePreview.getByRole('region').hover()
|
|
await comfyPage.page.getByLabel('Edit or mask image').click()
|
|
|
|
await expect(comfyPage.page.locator('.mask-editor-dialog')).toBeVisible()
|
|
})
|
|
|
|
test('shows image context menu options', async ({ comfyPage }) => {
|
|
const { nodeId } = await loadImageOnNode(comfyPage)
|
|
|
|
await comfyPage.vueNodes.selectNode(nodeId)
|
|
const nodeHeader = comfyPage.vueNodes
|
|
.getNodeLocator(nodeId)
|
|
.locator('.lg-node-header')
|
|
await nodeHeader.click({ button: 'right' })
|
|
|
|
const contextMenu = comfyPage.page.locator('.p-contextmenu')
|
|
await expect(contextMenu).toBeVisible()
|
|
await expect(contextMenu.getByText('Open Image')).toBeVisible()
|
|
await expect(contextMenu.getByText('Copy Image')).toBeVisible()
|
|
await expect(contextMenu.getByText('Save Image')).toBeVisible()
|
|
await expect(contextMenu.getByText('Open in Mask Editor')).toBeVisible()
|
|
})
|
|
|
|
test(
|
|
'renders promoted image previews for each subgraph node',
|
|
{ tag: '@screenshot' },
|
|
async ({ comfyPage }) => {
|
|
await comfyPage.workflow.loadWorkflow(
|
|
'subgraphs/subgraph-with-multiple-promoted-previews'
|
|
)
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
|
|
const firstSubgraphNode = comfyPage.vueNodes.getNodeLocator('7')
|
|
const secondSubgraphNode = comfyPage.vueNodes.getNodeLocator('8')
|
|
|
|
await expect(firstSubgraphNode).toBeVisible()
|
|
await expect(secondSubgraphNode).toBeVisible()
|
|
|
|
const firstPromotedWidgets = await getPromotedWidgetNames(comfyPage, '7')
|
|
const secondPromotedWidgets = await getPromotedWidgetNames(comfyPage, '8')
|
|
expect(firstPromotedWidgets).toEqual([
|
|
'$$canvas-image-preview',
|
|
'$$canvas-image-preview'
|
|
])
|
|
expect(secondPromotedWidgets).toEqual(['$$canvas-image-preview'])
|
|
|
|
expect(
|
|
await getPromotedWidgetCountByName(
|
|
comfyPage,
|
|
'7',
|
|
'$$canvas-image-preview'
|
|
)
|
|
).toBe(2)
|
|
expect(
|
|
await getPromotedWidgetCountByName(
|
|
comfyPage,
|
|
'8',
|
|
'$$canvas-image-preview'
|
|
)
|
|
).toBe(1)
|
|
|
|
await expect(
|
|
firstSubgraphNode.locator('.lg-node-widgets')
|
|
).not.toContainText('$$canvas-image-preview')
|
|
await expect(
|
|
secondSubgraphNode.locator('.lg-node-widgets')
|
|
).not.toContainText('$$canvas-image-preview')
|
|
|
|
await comfyPage.command.executeCommand('Comfy.Canvas.FitView')
|
|
await comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
|
|
|
const firstPreviewImages = firstSubgraphNode.locator('.image-preview img')
|
|
const secondPreviewImages =
|
|
secondSubgraphNode.locator('.image-preview img')
|
|
|
|
await expect(firstPreviewImages).toHaveCount(2, { timeout: 30_000 })
|
|
await expect(secondPreviewImages).toHaveCount(1, { timeout: 30_000 })
|
|
|
|
await expect(firstPreviewImages.first()).toBeVisible({ timeout: 30_000 })
|
|
await expect(firstPreviewImages.nth(1)).toBeVisible({ timeout: 30_000 })
|
|
await expect(secondPreviewImages.first()).toBeVisible({ timeout: 30_000 })
|
|
|
|
await expect(comfyPage.canvas).toHaveScreenshot(
|
|
'vue-node-multiple-promoted-previews.png'
|
|
)
|
|
}
|
|
)
|
|
})
|