mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 13:59:28 +00:00
## Summary Simplifies test setup for common settings ## Changes - **What**: - add vue-nodes tag to auto enable nodes 2.0 - remove UseNewMenu Top as this is default ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-11184-test-Simplify-vue-node-menu-test-setup-3416d73d3650815487e0c357d28761fe) by [Unito](https://www.unito.io)
107 lines
3.6 KiB
TypeScript
107 lines
3.6 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Node Library Essentials Tab', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
// Enable the essentials feature flag via the reactive serverFeatureFlags ref.
|
|
// In production, this flag comes via WebSocket or remoteConfig (cloud only).
|
|
// The localhost test server has neither, so we set it directly.
|
|
await comfyPage.page.evaluate(() => {
|
|
window.app!.api.serverFeatureFlags.value = {
|
|
...window.app!.api.serverFeatureFlags.value,
|
|
node_library_essentials_enabled: true
|
|
}
|
|
})
|
|
|
|
// Register a mock essential node so the essentials tab has content.
|
|
await comfyPage.page.evaluate(() => {
|
|
return window.app!.registerNodeDef('TestEssentialNode', {
|
|
name: 'TestEssentialNode',
|
|
display_name: 'Test Essential Node',
|
|
category: 'essentials_test',
|
|
input: { required: {}, optional: {} },
|
|
output: ['IMAGE'],
|
|
output_name: ['image'],
|
|
output_is_list: [false],
|
|
output_node: false,
|
|
python_module: 'comfy_essentials.nodes',
|
|
description: 'Mock essential node for testing',
|
|
essentials_category: 'Image Generation'
|
|
})
|
|
})
|
|
})
|
|
|
|
test('Node library opens via sidebar', async ({ comfyPage }) => {
|
|
const tabButton = comfyPage.page.locator('.node-library-tab-button')
|
|
await tabButton.click()
|
|
|
|
const sidebarContent = comfyPage.page.locator(
|
|
'.comfy-vue-side-bar-container'
|
|
)
|
|
await expect(sidebarContent).toBeVisible()
|
|
})
|
|
|
|
test('Essentials tab is visible in node library', async ({ comfyPage }) => {
|
|
const tabButton = comfyPage.page.locator('.node-library-tab-button')
|
|
await tabButton.click()
|
|
|
|
const essentialsTab = comfyPage.page.getByRole('tab', {
|
|
name: /essentials/i
|
|
})
|
|
await expect(essentialsTab).toBeVisible()
|
|
})
|
|
|
|
test('Clicking essentials tab shows essential node cards', async ({
|
|
comfyPage
|
|
}) => {
|
|
const tabButton = comfyPage.page.locator('.node-library-tab-button')
|
|
await tabButton.click()
|
|
|
|
const essentialsTab = comfyPage.page.getByRole('tab', {
|
|
name: /essentials/i
|
|
})
|
|
await essentialsTab.click()
|
|
|
|
const essentialCards = comfyPage.page.locator('[data-node-name]')
|
|
await expect(essentialCards.first()).toBeVisible()
|
|
})
|
|
|
|
test('Essential node cards have node names', async ({ comfyPage }) => {
|
|
const tabButton = comfyPage.page.locator('.node-library-tab-button')
|
|
await tabButton.click()
|
|
|
|
const essentialsTab = comfyPage.page.getByRole('tab', {
|
|
name: /essentials/i
|
|
})
|
|
await essentialsTab.click()
|
|
|
|
const firstCard = comfyPage.page.locator('[data-node-name]').first()
|
|
await expect(firstCard).toBeVisible()
|
|
|
|
await expect(firstCard).toHaveAttribute('data-node-name', /.+/)
|
|
})
|
|
|
|
test('Node library can switch between all and essentials tabs', async ({
|
|
comfyPage
|
|
}) => {
|
|
const tabButton = comfyPage.page.locator('.node-library-tab-button')
|
|
await tabButton.click()
|
|
|
|
const essentialsTab = comfyPage.page.getByRole('tab', {
|
|
name: /essentials/i
|
|
})
|
|
const allNodesTab = comfyPage.page.getByRole('tab', { name: /^all$/i })
|
|
|
|
await essentialsTab.click()
|
|
await expect(essentialsTab).toHaveAttribute('aria-selected', 'true')
|
|
const essentialCards = comfyPage.page.locator('[data-node-name]')
|
|
await expect(essentialCards.first()).toBeVisible()
|
|
|
|
await allNodesTab.click()
|
|
await expect(allNodesTab).toHaveAttribute('aria-selected', 'true')
|
|
await expect(essentialsTab).toHaveAttribute('aria-selected', 'false')
|
|
})
|
|
})
|