mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +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>
95 lines
2.3 KiB
TypeScript
95 lines
2.3 KiB
TypeScript
import {
|
|
comfyPageFixture as test,
|
|
comfyExpect as expect
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
/** One representative of each widget type from the default workflow. */
|
|
type WidgetType = 'textarea' | 'number' | 'select' | 'text'
|
|
|
|
const WIDGET_TEST_DATA: {
|
|
nodeId: string
|
|
widgetName: string
|
|
type: WidgetType
|
|
fill: string
|
|
expected: unknown
|
|
}[] = [
|
|
{
|
|
nodeId: '6',
|
|
widgetName: 'text',
|
|
type: 'textarea',
|
|
fill: 'test prompt',
|
|
expected: 'test prompt'
|
|
},
|
|
{
|
|
nodeId: '5',
|
|
widgetName: 'width',
|
|
type: 'number',
|
|
fill: '768',
|
|
expected: 768
|
|
},
|
|
{
|
|
nodeId: '3',
|
|
widgetName: 'cfg',
|
|
type: 'number',
|
|
fill: '3.5',
|
|
expected: 3.5
|
|
},
|
|
{
|
|
nodeId: '3',
|
|
widgetName: 'sampler_name',
|
|
type: 'select',
|
|
fill: 'uni_pc',
|
|
expected: 'uni_pc'
|
|
},
|
|
{
|
|
nodeId: '9',
|
|
widgetName: 'filename_prefix',
|
|
type: 'text',
|
|
fill: 'test_prefix',
|
|
expected: 'test_prefix'
|
|
}
|
|
]
|
|
|
|
test.describe('App mode widget values in prompt', { tag: '@ui' }, () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.appMode.enableLinearMode()
|
|
})
|
|
|
|
test('Widget values are sent correctly in prompt POST', async ({
|
|
comfyPage
|
|
}) => {
|
|
const { appMode } = comfyPage
|
|
const inputs: [string, string][] = WIDGET_TEST_DATA.map(
|
|
({ nodeId, widgetName }) => [nodeId, widgetName]
|
|
)
|
|
await appMode.enterAppModeWithInputs(inputs)
|
|
await expect(appMode.linearWidgets).toBeVisible({ timeout: 5000 })
|
|
|
|
for (const { nodeId, widgetName, type, fill } of WIDGET_TEST_DATA) {
|
|
const key = `${nodeId}:${widgetName}`
|
|
switch (type) {
|
|
case 'textarea':
|
|
await appMode.widgets.fillTextarea(key, fill)
|
|
break
|
|
case 'number':
|
|
await appMode.widgets.fillNumber(key, fill)
|
|
break
|
|
case 'select':
|
|
await appMode.widgets.selectOption(key, fill)
|
|
break
|
|
case 'text':
|
|
await appMode.widgets.fillText(key, fill)
|
|
break
|
|
default:
|
|
throw new Error(`Unknown widget type: ${type satisfies never}`)
|
|
}
|
|
}
|
|
|
|
const prompt = await appMode.widgets.runAndCapturePrompt()
|
|
|
|
for (const { nodeId, widgetName, expected } of WIDGET_TEST_DATA) {
|
|
expect(prompt[nodeId].inputs[widgetName]).toBe(expected)
|
|
}
|
|
})
|
|
})
|