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>
139 lines
4.2 KiB
TypeScript
139 lines
4.2 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
import { TestIds } from '../fixtures/selectors'
|
|
|
|
test.describe('Zoom Controls', { tag: '@canvas' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.Graph.CanvasMenu', true)
|
|
await comfyPage.workflow.loadWorkflow('default')
|
|
await comfyPage.page.waitForFunction(() => window.app && window.app.canvas)
|
|
})
|
|
|
|
test('Default zoom is 100% and node has a size', async ({ comfyPage }) => {
|
|
const nodeSize = await comfyPage.page.evaluate(
|
|
() => window.app!.graph.nodes[0].size
|
|
)
|
|
expect(nodeSize[0]).toBeGreaterThan(0)
|
|
expect(nodeSize[1]).toBeGreaterThan(0)
|
|
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await expect(zoomButton).toContainText('100%')
|
|
|
|
const scale = await comfyPage.canvasOps.getScale()
|
|
expect(scale).toBeCloseTo(1.0, 1)
|
|
})
|
|
|
|
test('Zoom to fit reduces percentage', async ({ comfyPage }) => {
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const zoomToFit = comfyPage.page.getByTestId(TestIds.canvas.zoomToFitAction)
|
|
await expect(zoomToFit).toBeVisible()
|
|
await zoomToFit.click()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.canvasOps.getScale(), { timeout: 2000 })
|
|
.toBeLessThan(1.0)
|
|
|
|
await expect(zoomButton).not.toContainText('100%')
|
|
})
|
|
|
|
test('Zoom out reduces percentage', async ({ comfyPage }) => {
|
|
const initialScale = await comfyPage.canvasOps.getScale()
|
|
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const zoomOut = comfyPage.page.getByTestId(TestIds.canvas.zoomOutAction)
|
|
await zoomOut.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const newScale = await comfyPage.canvasOps.getScale()
|
|
expect(newScale).toBeLessThan(initialScale)
|
|
})
|
|
|
|
test('Zoom out clamps at 10% minimum', async ({ comfyPage }) => {
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const zoomOut = comfyPage.page.getByTestId(TestIds.canvas.zoomOutAction)
|
|
for (let i = 0; i < 30; i++) {
|
|
await zoomOut.click()
|
|
}
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.canvasOps.getScale(), { timeout: 2000 })
|
|
.toBeCloseTo(0.1, 1)
|
|
|
|
await expect(zoomButton).toContainText('10%')
|
|
})
|
|
|
|
test('Manual percentage entry allows zoom in and zoom out', async ({
|
|
comfyPage
|
|
}) => {
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const input = comfyPage.page
|
|
.getByTestId(TestIds.canvas.zoomPercentageInput)
|
|
.locator('input')
|
|
await input.focus()
|
|
await comfyPage.page.keyboard.press('Control+a')
|
|
await input.pressSequentially('100')
|
|
await input.press('Enter')
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect
|
|
.poll(() => comfyPage.canvasOps.getScale(), { timeout: 5000 })
|
|
.toBeCloseTo(1.0, 1)
|
|
|
|
const zoomIn = comfyPage.page.getByTestId(TestIds.canvas.zoomInAction)
|
|
await zoomIn.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const scaleAfterZoomIn = await comfyPage.canvasOps.getScale()
|
|
expect(scaleAfterZoomIn).toBeGreaterThan(1.0)
|
|
|
|
const zoomOut = comfyPage.page.getByTestId(TestIds.canvas.zoomOutAction)
|
|
await zoomOut.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const scaleAfterZoomOut = await comfyPage.canvasOps.getScale()
|
|
expect(scaleAfterZoomOut).toBeLessThan(scaleAfterZoomIn)
|
|
})
|
|
|
|
test('Clicking zoom button toggles zoom controls visibility', async ({
|
|
comfyPage
|
|
}) => {
|
|
const zoomButton = comfyPage.page.getByTestId(
|
|
TestIds.canvas.zoomControlsButton
|
|
)
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
const zoomToFit = comfyPage.page.getByTestId(TestIds.canvas.zoomToFitAction)
|
|
await expect(zoomToFit).toBeVisible()
|
|
|
|
await zoomButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(zoomToFit).not.toBeVisible()
|
|
})
|
|
})
|