mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-11 16:30:57 +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>
96 lines
3.2 KiB
TypeScript
96 lines
3.2 KiB
TypeScript
import {
|
|
comfyExpect as expect,
|
|
comfyPageFixture as test
|
|
} from '@e2e/fixtures/ComfyPage'
|
|
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
})
|
|
|
|
test.describe('Vue Node Selection', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
|
await comfyPage.vueNodes.waitForNodes()
|
|
})
|
|
|
|
const modifiers = [
|
|
{ key: 'Control', name: 'ctrl' },
|
|
{ key: 'Shift', name: 'shift' },
|
|
{ key: 'Meta', name: 'meta' }
|
|
] as const
|
|
|
|
for (const { key: modifier, name } of modifiers) {
|
|
test(`should allow selecting multiple nodes with ${name}+click`, async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.getByText('Load Checkpoint').click()
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
|
|
|
await comfyPage.page.getByText('Empty Latent Image').click({
|
|
modifiers: [modifier]
|
|
})
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(2)
|
|
|
|
await comfyPage.page.getByText('KSampler').click({
|
|
modifiers: [modifier]
|
|
})
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(3)
|
|
})
|
|
|
|
test(`should allow de-selecting nodes with ${name}+click`, async ({
|
|
comfyPage
|
|
}) => {
|
|
await comfyPage.page.getByText('Load Checkpoint').click()
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
|
|
|
await comfyPage.page.getByText('Load Checkpoint').click({
|
|
modifiers: [modifier]
|
|
})
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(0)
|
|
})
|
|
}
|
|
|
|
test('should select all nodes with ctrl+a', async ({ comfyPage }) => {
|
|
await expect
|
|
.poll(() => comfyPage.vueNodes.getNodeCount())
|
|
.toBeGreaterThan(0)
|
|
const initialCount = await comfyPage.vueNodes.getNodeCount()
|
|
|
|
await comfyPage.canvas.press('Control+a')
|
|
|
|
await expect
|
|
.poll(() => comfyPage.vueNodes.getSelectedNodeCount())
|
|
.toBe(initialCount)
|
|
})
|
|
|
|
test('should select pinned node without dragging', async ({ comfyPage }) => {
|
|
const PIN_HOTKEY = 'p'
|
|
const PIN_INDICATOR = '[data-testid="node-pin-indicator"]'
|
|
|
|
const checkpointNodeHeader = comfyPage.page.getByText('Load Checkpoint')
|
|
await checkpointNodeHeader.click()
|
|
|
|
await comfyPage.page.keyboard.press(PIN_HOTKEY)
|
|
|
|
const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
|
|
const pinIndicator = checkpointNode.locator(PIN_INDICATOR)
|
|
await expect(pinIndicator).toBeVisible()
|
|
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
|
|
|
const initialPos = await checkpointNodeHeader.boundingBox()
|
|
if (!initialPos) throw new Error('Failed to get header position')
|
|
|
|
await comfyPage.canvasOps.dragAndDrop(
|
|
{ x: initialPos.x + 10, y: initialPos.y + 10 },
|
|
{ x: initialPos.x + 100, y: initialPos.y + 100 }
|
|
)
|
|
|
|
const finalPos = await checkpointNodeHeader.boundingBox()
|
|
if (!finalPos) throw new Error('Failed to get header position after drag')
|
|
expect(finalPos).toEqual(initialPos)
|
|
|
|
await expect.poll(() => comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
|
})
|
|
})
|