Compare commits

...

4 Commits

Author SHA1 Message Date
Christian Byrne
238d1ea3af Merge branch 'main' into test/sidebar-tab-switching 2026-04-19 18:39:41 -07:00
bymyself
2bc8a28dff fix: use nodeLibraryTabV2 in sidebar tab switching tests
NodeLibraryV2 is enabled by default. The old NodeLibrarySidebarTab.open()
waits for a 'node-library-tree' testId that doesn't exist in V2, causing
a 15s timeout. Switch to nodeLibraryTabV2 and assert on its searchInput
instead.
2026-04-13 23:19:03 +00:00
bymyself
2685a51d24 test: add E2E tests for sidebar tab switching 2026-04-13 22:56:35 +00:00
bymyself
5e391a63d2 test: add E2E tests for keyboard shortcut actions 2026-04-13 22:56:25 +00:00
2 changed files with 178 additions and 0 deletions

View File

@@ -0,0 +1,113 @@
import {
comfyExpect as expect,
comfyPageFixture as test
} from '@e2e/fixtures/ComfyPage'
test.describe('Keyboard shortcut actions', { tag: '@keyboard' }, () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
await comfyPage.settings.setSetting(
'Comfy.Workflow.WorkflowTabsPosition',
'Topbar'
)
await comfyPage.setup()
})
test('Ctrl+Z undoes the last graph change', async ({ comfyPage }) => {
const initialNodeCount = await comfyPage.nodeOps.getNodeCount()
await comfyPage.page.evaluate(() => {
const node = window.LiteGraph!.createNode('Note')
window.app!.graph!.add(node)
})
await comfyPage.nextFrame()
await expect
.poll(() => comfyPage.nodeOps.getNodeCount())
.toBe(initialNodeCount + 1)
await comfyPage.canvas.click()
await comfyPage.page.keyboard.press('ControlOrMeta+z')
await expect
.poll(() => comfyPage.nodeOps.getNodeCount())
.toBe(initialNodeCount)
})
test('Ctrl+Shift+Z redoes after undo', async ({ comfyPage }) => {
const initialNodeCount = await comfyPage.nodeOps.getNodeCount()
await comfyPage.page.evaluate(() => {
const node = window.LiteGraph!.createNode('Note')
window.app!.graph!.add(node)
})
await comfyPage.nextFrame()
await comfyPage.canvas.click()
await comfyPage.page.keyboard.press('ControlOrMeta+z')
await expect
.poll(() => comfyPage.nodeOps.getNodeCount())
.toBe(initialNodeCount)
await comfyPage.page.keyboard.press('ControlOrMeta+Shift+z')
await expect
.poll(() => comfyPage.nodeOps.getNodeCount())
.toBe(initialNodeCount + 1)
})
test('Ctrl+S opens save dialog', async ({ comfyPage }) => {
await comfyPage.canvas.click()
await comfyPage.page.keyboard.press('ControlOrMeta+s')
const saveDialog = comfyPage.menu.topbar.getSaveDialog()
await expect(saveDialog).toBeVisible()
})
test('Ctrl+, opens settings dialog', async ({ comfyPage }) => {
await comfyPage.page.keyboard.down('ControlOrMeta')
await comfyPage.page.keyboard.press(',')
await comfyPage.page.keyboard.up('ControlOrMeta')
const settingsDialog = comfyPage.page.getByTestId('settings-dialog')
await expect(settingsDialog).toBeVisible()
})
test('Escape closes settings dialog', async ({ comfyPage }) => {
await comfyPage.page.keyboard.down('ControlOrMeta')
await comfyPage.page.keyboard.press(',')
await comfyPage.page.keyboard.up('ControlOrMeta')
const settingsDialog = comfyPage.page.getByTestId('settings-dialog')
await expect(settingsDialog).toBeVisible()
await comfyPage.page.keyboard.press('Escape')
await expect(settingsDialog).toBeHidden()
})
test('Delete key removes selected nodes', async ({ comfyPage }) => {
const initialNodeCount = await comfyPage.nodeOps.getNodeCount()
expect(initialNodeCount, 'Default graph should have nodes').toBeGreaterThan(
0
)
await comfyPage.nodeOps.selectNodes(['KSampler'])
await comfyPage.page.keyboard.press('Delete')
await expect
.poll(() => comfyPage.nodeOps.getNodeCount())
.toBeLessThan(initialNodeCount)
})
test('Ctrl+A selects all nodes', async ({ comfyPage }) => {
await comfyPage.canvas.click()
await comfyPage.page.keyboard.press('ControlOrMeta+a')
const totalNodes = await comfyPage.nodeOps.getNodeCount()
const selectedNodes = await comfyPage.page.evaluate(() =>
window.app!.canvas?.selected_nodes
? Object.keys(window.app!.canvas.selected_nodes).length
: 0
)
expect(selectedNodes).toBe(totalNodes)
})
})

View File

@@ -0,0 +1,65 @@
import {
comfyExpect as expect,
comfyPageFixture as test
} from '@e2e/fixtures/ComfyPage'
test.describe('Sidebar tab switching', { tag: '@ui' }, () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
await comfyPage.setup()
})
test('Sidebar toolbar is visible', async ({ comfyPage }) => {
await expect(comfyPage.menu.sideToolbar).toBeVisible()
})
test('Sidebar has multiple tab buttons', async ({ comfyPage }) => {
await expect.poll(() => comfyPage.menu.buttons.count()).toBeGreaterThan(1)
})
test('Clicking node library tab opens it', async ({ comfyPage }) => {
const tab = comfyPage.menu.nodeLibraryTabV2
await tab.open()
await expect(tab.selectedTabButton).toBeVisible()
})
test('Clicking workflows tab opens it', async ({ comfyPage }) => {
await comfyPage.menu.workflowsTab.open()
await expect(comfyPage.menu.workflowsTab.selectedTabButton).toBeVisible()
})
test('Switching from one tab to another deselects the first', async ({
comfyPage
}) => {
const nodeTab = comfyPage.menu.nodeLibraryTabV2
await nodeTab.open()
await expect(nodeTab.selectedTabButton).toBeVisible()
await comfyPage.menu.workflowsTab.open()
await expect(comfyPage.menu.workflowsTab.selectedTabButton).toBeVisible()
await expect(nodeTab.selectedTabButton).toBeHidden()
})
test('Clicking active tab closes the sidebar panel', async ({
comfyPage
}) => {
const tab = comfyPage.menu.nodeLibraryTabV2
await tab.open()
await expect(tab.selectedTabButton).toBeVisible()
await tab.close()
await expect(tab.selectedTabButton).toBeHidden()
})
test('Sidebar content area updates when switching tabs', async ({
comfyPage
}) => {
const nodeTab = comfyPage.menu.nodeLibraryTabV2
await nodeTab.open()
await expect(nodeTab.searchInput).toBeVisible()
await comfyPage.menu.workflowsTab.open()
await expect(comfyPage.menu.workflowsTab.root).toBeVisible()
await expect(nodeTab.searchInput).toBeHidden()
})
})