mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-24 08:19:51 +00:00
## Summary Complete the @e2e/ path alias migration started in #10735 by converting all 354 remaining relative imports and adding a lint rule to prevent backsliding. ## Changes - **What**: Migrate all relative imports in browser_tests/ to use `@e2e/` (intra-directory) and `@/` (src/ imports) path aliases. Add `no-restricted-imports` ESLint rule banning `./` and `../` imports in `browser_tests/**/*.ts`. Suppress pre-existing oxlint `no-eval` and `no-console` warnings exposed by touching those files. ## Review Focus - ESLint flat-config merging: the `@playwright/test` ban and relative-import ban are in two separate blocks to avoid last-match-wins collision with the `useI18n`/`useVirtualList` blocks higher in the config. - The `['./**', '../**']` glob patterns (not `['./*', '../*']`) are needed to catch multi-level relative paths like `../../../src/foo`. Follows up on #10735 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10958-test-migrate-browser_tests-to-e2e-path-alias-and-add-lint-rule-33c6d73d365081649d1be771eac986fd) by [Unito](https://www.unito.io) Co-authored-by: Amp <amp@ampcode.com>
103 lines
3.3 KiB
TypeScript
103 lines
3.3 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.describe('Advanced Widget Visibility', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.AlwaysShowAdvancedWidgets',
|
|
false
|
|
)
|
|
|
|
// Add a ModelSamplingFlux node which has both advanced (max_shift,
|
|
// base_shift) and non-advanced (width, height) widgets.
|
|
await comfyPage.page.evaluate(() => {
|
|
const node = window.LiteGraph!.createNode('ModelSamplingFlux')!
|
|
node.pos = [500, 200]
|
|
window.app!.graph.add(node)
|
|
})
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
function getNode(
|
|
comfyPage: Parameters<Parameters<typeof test>[2]>[0]['comfyPage']
|
|
) {
|
|
return comfyPage.vueNodes.getNodeByTitle('ModelSamplingFlux')
|
|
}
|
|
|
|
function getWidgets(
|
|
comfyPage: Parameters<Parameters<typeof test>[2]>[0]['comfyPage']
|
|
) {
|
|
return getNode(comfyPage).locator('.lg-node-widget')
|
|
}
|
|
|
|
test('should hide advanced widgets by default', async ({ comfyPage }) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
// Non-advanced widgets (width, height) should be visible
|
|
await expect(widgets).toHaveCount(2)
|
|
await expect(node.getByLabel('width', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('height', { exact: true })).toBeVisible()
|
|
|
|
// Advanced widgets should not be rendered
|
|
await expect(
|
|
node.getByLabel('max_shift', { exact: true })
|
|
).not.toBeVisible()
|
|
await expect(
|
|
node.getByLabel('base_shift', { exact: true })
|
|
).not.toBeVisible()
|
|
|
|
// "Show advanced inputs" button should be present
|
|
await expect(node.getByText('Show advanced inputs')).toBeVisible()
|
|
})
|
|
|
|
test('should show advanced widgets when per-node toggle is clicked', async ({
|
|
comfyPage
|
|
}) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
await expect(widgets).toHaveCount(2)
|
|
|
|
// Click the toggle button to show advanced widgets
|
|
await node.getByText('Show advanced inputs').click()
|
|
|
|
await expect(widgets).toHaveCount(4)
|
|
await expect(node.getByLabel('max_shift', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('base_shift', { exact: true })).toBeVisible()
|
|
|
|
// Button text should change to "Hide advanced inputs"
|
|
await expect(node.getByText('Hide advanced inputs')).toBeVisible()
|
|
|
|
// Click again to hide
|
|
await node.getByText('Hide advanced inputs').click()
|
|
await expect(widgets).toHaveCount(2)
|
|
})
|
|
|
|
test('should show advanced widgets when global setting is enabled', async ({
|
|
comfyPage
|
|
}) => {
|
|
const node = getNode(comfyPage)
|
|
const widgets = getWidgets(comfyPage)
|
|
|
|
await expect(widgets).toHaveCount(2)
|
|
|
|
// Enable the global setting
|
|
await comfyPage.settings.setSetting(
|
|
'Comfy.Node.AlwaysShowAdvancedWidgets',
|
|
true
|
|
)
|
|
|
|
// All 4 widgets should now be visible
|
|
await expect(widgets).toHaveCount(4)
|
|
await expect(node.getByLabel('max_shift', { exact: true })).toBeVisible()
|
|
await expect(node.getByLabel('base_shift', { exact: true })).toBeVisible()
|
|
|
|
// The toggle button should not be shown when global setting is active
|
|
await expect(node.getByText('Show advanced inputs')).not.toBeVisible()
|
|
})
|
|
})
|