mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 15:54:09 +00:00
- Remove 27 deprecated/wrapper methods from ComfyPage - Migrate callers to use helper classes directly: - keyboard.selectAll/bypass/undo/redo/moveUp/moveDown - clipboard.copy/paste - settings.setSetting/getSetting - workflow.loadWorkflow/deleteWorkflow/setupWorkflowsDirectory - contextMenu.clickMenuItem/clickLitegraphMenuItem - nodeOps.resizeNode with DefaultGraphPositions - canvasOps.clickEmptySpace with DefaultGraphPositions - Replace deprecated node click methods with direct canvas clicks - Replace position getter properties with DefaultGraphPositions imports Amp-Thread-ID: https://ampcode.com/threads/T-019c15e7-2319-76ec-855e-098ec75ef18a Co-authored-by: Amp <amp@ampcode.com>
94 lines
3.1 KiB
TypeScript
94 lines
3.1 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '../../../fixtures/ComfyPage'
|
|
|
|
test.describe('Vue Node Collapse', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.Graph.CanvasMenu', false)
|
|
await comfyPage.settings.setSetting('Comfy.EnableTooltips', true)
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.setup()
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
test('should allow collapsing node with collapse icon', async ({
|
|
comfyPage
|
|
}) => {
|
|
const vueNode = await comfyPage.vueNodes.getFixtureByTitle('KSampler')
|
|
await expect(vueNode.root).toBeVisible()
|
|
|
|
// Initially should not be collapsed
|
|
const body = vueNode.body
|
|
await expect(body).toBeVisible()
|
|
const expandedBoundingBox = await vueNode.boundingBox()
|
|
if (!expandedBoundingBox)
|
|
throw new Error('Failed to get node bounding box before collapse')
|
|
|
|
// Collapse the node
|
|
await vueNode.toggleCollapse()
|
|
await comfyPage.nextFrame()
|
|
|
|
// Verify node content is hidden
|
|
await expect(body).not.toBeVisible()
|
|
const collapsedBoundingBox = await vueNode.boundingBox()
|
|
if (!collapsedBoundingBox)
|
|
throw new Error('Failed to get node bounding box after collapse')
|
|
expect(collapsedBoundingBox.height).toBeLessThan(expandedBoundingBox.height)
|
|
|
|
// Expand again
|
|
await vueNode.toggleCollapse()
|
|
await comfyPage.nextFrame()
|
|
await expect(body).toBeVisible()
|
|
|
|
// Size should be restored
|
|
const expandedBoundingBoxAfter = await vueNode.boundingBox()
|
|
if (!expandedBoundingBoxAfter)
|
|
throw new Error('Failed to get node bounding box after expand')
|
|
expect(expandedBoundingBoxAfter.height).toBeGreaterThanOrEqual(
|
|
collapsedBoundingBox.height
|
|
)
|
|
})
|
|
|
|
test('should show collapse/expand icon state', async ({ comfyPage }) => {
|
|
const vueNode = await comfyPage.vueNodes.getFixtureByTitle('KSampler')
|
|
await expect(vueNode.root).toBeVisible()
|
|
|
|
// Check initial expanded state icon
|
|
let iconClass = await vueNode.getCollapseIconClass()
|
|
expect(iconClass).not.toContain('-rotate-90')
|
|
|
|
// Collapse and check icon
|
|
await vueNode.toggleCollapse()
|
|
iconClass = await vueNode.getCollapseIconClass()
|
|
expect(iconClass).toContain('-rotate-90')
|
|
|
|
// Expand and check icon
|
|
await vueNode.toggleCollapse()
|
|
iconClass = await vueNode.getCollapseIconClass()
|
|
expect(iconClass).not.toContain('-rotate-90')
|
|
})
|
|
|
|
test('should preserve title when collapsing/expanding', async ({
|
|
comfyPage
|
|
}) => {
|
|
const vueNode = await comfyPage.vueNodes.getFixtureByTitle('KSampler')
|
|
await expect(vueNode.root).toBeVisible()
|
|
|
|
// Set custom title
|
|
await vueNode.setTitle('Test Sampler')
|
|
expect(await vueNode.getTitle()).toBe('Test Sampler')
|
|
|
|
// Collapse
|
|
await vueNode.toggleCollapse()
|
|
expect(await vueNode.getTitle()).toBe('Test Sampler')
|
|
|
|
// Expand
|
|
await vueNode.toggleCollapse()
|
|
expect(await vueNode.getTitle()).toBe('Test Sampler')
|
|
|
|
// Verify title is still displayed
|
|
await expect(vueNode.header).toContainText('Test Sampler')
|
|
})
|
|
})
|