mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 14:30:41 +00:00
## Summary Add 26 E2E tests across 5 spec files covering high-impact, frequently-used UI flows: toast notifications, error overlay navigation, selection toolbox actions, linear mode layout, and selection rectangle multi-select. ## Tests | Spec file | Tests | Coverage | |---|---|---| | `toastNotifications.spec.ts` | 5 | Toast lifecycle, dismiss, severity levels | | `errorOverlaySeeErrors.spec.ts` | 6 | Error overlay → errors panel navigation flow | | `selectionToolboxActions.spec.ts` | 4 | Delete, info, convert-to-subgraph, multi-delete | | `linearMode.spec.ts` | 5 | Linear layout toggle, widget rendering, persistence | | `selectionRectangle.spec.ts` | 6 | Vue node multi-selection via rectangle drag | ## Review Focus - Selection toolbox tests use `force: true` clicks due to CSS transform positioning — is this acceptable or should we find a more robust approach? - 2 additional toolbox tests (bypass, refresh) were split to draft PR #9768 due to flaky CI visibility issues with `useSelectionToolboxPosition`. ## Stack Depends on #9554 for FeatureFlagHelper/QueueHelper infrastructure. - #9554: Test infrastructure helpers - **→ This PR**: Toasts, error overlay, selection toolbox, linear mode, selection rectangle - #9556: Node search, bottom panel, focus mode, job history, side panel - #9557: Errors tab, node headers, queue notifications, settings sidebar - #9558: Minimap, widget copy, floating menus, node library essentials --------- Co-authored-by: GitHub Action <action@github.com>
102 lines
3.3 KiB
TypeScript
102 lines
3.3 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '../fixtures/ComfyPage'
|
|
import type { NodeReference } from '../fixtures/utils/litegraphUtils'
|
|
import type { ComfyPage } from '../fixtures/ComfyPage'
|
|
|
|
async function selectNodeWithPan(comfyPage: ComfyPage, nodeRef: NodeReference) {
|
|
const nodePos = await nodeRef.getPosition()
|
|
await comfyPage.page.evaluate((pos) => {
|
|
const canvas = window.app!.canvas
|
|
canvas.ds.offset[0] = -pos.x + canvas.canvas.width / 2
|
|
canvas.ds.offset[1] = -pos.y + canvas.canvas.height / 2 + 100
|
|
canvas.setDirty(true, true)
|
|
}, nodePos)
|
|
await comfyPage.nextFrame()
|
|
await nodeRef.click('title')
|
|
}
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
|
|
})
|
|
|
|
test.describe('Selection Toolbox - Button Actions', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.Canvas.SelectionToolbox', true)
|
|
await comfyPage.workflow.loadWorkflow('nodes/single_ksampler')
|
|
await comfyPage.nextFrame()
|
|
})
|
|
|
|
test('delete button removes selected node', async ({ comfyPage }) => {
|
|
const nodeRef = (await comfyPage.nodeOps.getNodeRefsByTitle('KSampler'))[0]
|
|
await selectNodeWithPan(comfyPage, nodeRef)
|
|
|
|
const initialCount = await comfyPage.page.evaluate(
|
|
() => window.app!.graph!._nodes.length
|
|
)
|
|
|
|
const deleteButton = comfyPage.page.locator('[data-testid="delete-button"]')
|
|
await expect(deleteButton).toBeVisible()
|
|
await deleteButton.click({ force: true })
|
|
await comfyPage.nextFrame()
|
|
|
|
const newCount = await comfyPage.page.evaluate(
|
|
() => window.app!.graph!._nodes.length
|
|
)
|
|
expect(newCount).toBe(initialCount - 1)
|
|
})
|
|
|
|
test('info button opens properties panel', async ({ comfyPage }) => {
|
|
const nodeRef = (await comfyPage.nodeOps.getNodeRefsByTitle('KSampler'))[0]
|
|
await selectNodeWithPan(comfyPage, nodeRef)
|
|
|
|
const infoButton = comfyPage.page.locator('[data-testid="info-button"]')
|
|
await expect(infoButton).toBeVisible()
|
|
await infoButton.click({ force: true })
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="properties-panel"]')
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('convert-to-subgraph button visible with multi-select', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('default')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.nodeOps.selectNodes(['KSampler', 'Empty Latent Image'])
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(
|
|
comfyPage.page.locator('[data-testid="convert-to-subgraph-button"]')
|
|
).toBeVisible()
|
|
})
|
|
|
|
test('delete button removes multiple selected nodes', async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.workflow.loadWorkflow('default')
|
|
await comfyPage.nextFrame()
|
|
|
|
await comfyPage.nodeOps.selectNodes(['KSampler', 'Empty Latent Image'])
|
|
await comfyPage.nextFrame()
|
|
|
|
const initialCount = await comfyPage.page.evaluate(
|
|
() => window.app!.graph!._nodes.length
|
|
)
|
|
|
|
const deleteButton = comfyPage.page.locator('[data-testid="delete-button"]')
|
|
await expect(deleteButton).toBeVisible()
|
|
await deleteButton.click({ force: true })
|
|
await comfyPage.nextFrame()
|
|
|
|
const newCount = await comfyPage.page.evaluate(
|
|
() => window.app!.graph!._nodes.length
|
|
)
|
|
expect(newCount).toBe(initialCount - 2)
|
|
})
|
|
})
|