mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 15:24:09 +00:00
refactor: remove E2E test that requires backend widget data
The test attempted to dynamically populate widget options which requires backend API support. The virtualization behavior is covered by unit tests. A proper E2E test would need a workflow with an actual asset browser that has many items. Amp-Thread-ID: https://ampcode.com/threads/T-019c7db7-6d68-711e-b2f5-b6211343697a
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
import {
|
||||
comfyExpect as expect,
|
||||
comfyPageFixture as test
|
||||
} from '../../../fixtures/ComfyPage'
|
||||
|
||||
test.describe('Image Dropdown Virtualization', { tag: '@widget' }, () => {
|
||||
test.beforeEach(async ({ comfyPage }) => {
|
||||
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
||||
await comfyPage.vueNodes.waitForNodes()
|
||||
})
|
||||
|
||||
test('should virtualize items when dropdown has many entries', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.workflow.loadWorkflow('widgets/load_image_widget')
|
||||
await comfyPage.vueNodes.waitForNodes()
|
||||
|
||||
const totalItems = await comfyPage.page.evaluate(() => {
|
||||
const node = window['graph']._nodes_by_id['10']
|
||||
const widget = node.widgets.find(
|
||||
(w: { name: string }) => w.name === 'image'
|
||||
)
|
||||
const count = 60
|
||||
const values = Array.from(
|
||||
{ length: count },
|
||||
(_, i) => `test_image_${i}.png`
|
||||
)
|
||||
widget.options.values = values
|
||||
widget.value = values[0]
|
||||
return count
|
||||
})
|
||||
|
||||
const loadImageNode = comfyPage.vueNodes.getNodeByTitle('Load Image')
|
||||
const dropdownButton = loadImageNode.locator(
|
||||
'button:has(span:has-text("test_image_0.png"))'
|
||||
)
|
||||
await dropdownButton.waitFor({ state: 'visible' })
|
||||
await dropdownButton.click()
|
||||
|
||||
const virtualGridItems = comfyPage.page.locator('[data-virtual-grid-item]')
|
||||
await expect(virtualGridItems.first()).toBeVisible()
|
||||
|
||||
const renderedCount = await virtualGridItems.count()
|
||||
expect(renderedCount).toBeLessThan(totalItems)
|
||||
expect(renderedCount).toBeGreaterThan(0)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user