Skip to content

Commit 40e34f1

Browse files
committed
Test register tab
1 parent 1ac494d commit 40e34f1

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

browser_tests/ComfyPage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ class ComfyNodeSearchBox {
3838
}
3939

4040
class ComfyMenu {
41+
public readonly sideToolBar: Locator
4142
public readonly themeToggleButton: Locator
4243

4344
constructor(public readonly page: Page) {
45+
this.sideToolBar = page.locator('.side-tool-bar-container')
4446
this.themeToggleButton = page.locator('.comfy-vue-theme-toggle')
4547
}
4648

browser_tests/menu.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,29 @@ test.describe('Menu', () => {
4242

4343
expect(await comfyPage.menu.getThemeId()).toBe('dark')
4444
})
45+
46+
test('Can register sidebar tab', async ({ comfyPage }) => {
47+
const initialChildrenCount = await comfyPage.menu.sideToolBar.evaluate(
48+
(el) => el.children.length
49+
)
50+
51+
await comfyPage.page.evaluate(async () => {
52+
window['app'].extensionManager.registerSidebarTab({
53+
id: 'search',
54+
icon: 'pi pi-search',
55+
title: 'search',
56+
tooltip: 'search',
57+
type: 'custom',
58+
render: (el) => {
59+
el.innerHTML = '<div>Custom search tab</div>'
60+
}
61+
})
62+
})
63+
await comfyPage.nextFrame()
64+
65+
const newChildrenCount = await comfyPage.menu.sideToolBar.evaluate(
66+
(el) => el.children.length
67+
)
68+
expect(newChildrenCount).toBe(initialChildrenCount + 1)
69+
})
4570
})

0 commit comments

Comments
 (0)