mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
refactor: Extract comfyPageFixture to separate file
Fixes circular dependency between ComfyPage and LocalhostComfyPage. Changes: - Create browser_tests/fixtures/comfyPageFixture.ts with fixture - Remove fixture from ComfyPage.ts (keep abstract class only) - Re-export fixture from ComfyPage.ts for backward compatibility Now properly follows dependency hierarchy: - ComfyPage.ts (abstract) - no implementation imports - LocalhostComfyPage.ts → imports ComfyPage - comfyPageFixture.ts → imports both - Tests import from ComfyPage.ts (re-exported)
This commit is contained in:
56
browser_tests/fixtures/comfyPageFixture.ts
Normal file
56
browser_tests/fixtures/comfyPageFixture.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { test as base } from '@playwright/test'
|
||||
|
||||
import { NodeBadgeMode } from '../../src/types/nodeSource'
|
||||
import type { ComfyPage } from './ComfyPage'
|
||||
import { testComfySnapToGridGridSize } from './ComfyPage'
|
||||
import { ComfyMouse } from './ComfyMouse'
|
||||
import { LocalhostComfyPage } from './LocalhostComfyPage'
|
||||
|
||||
/**
|
||||
* Localhost fixture for ComfyPage.
|
||||
* Creates a test user and sets up default settings for stable testing.
|
||||
*/
|
||||
export const comfyPageFixture = base.extend<{
|
||||
comfyPage: ComfyPage
|
||||
comfyMouse: ComfyMouse
|
||||
}>({
|
||||
comfyPage: async ({ page, request }, use, testInfo) => {
|
||||
const comfyPage = new LocalhostComfyPage(page, request)
|
||||
|
||||
const { parallelIndex } = testInfo
|
||||
const username = `playwright-test-${parallelIndex}`
|
||||
const userId = await comfyPage.setupUser(username)
|
||||
if (userId) {
|
||||
comfyPage.userIds[parallelIndex] = userId
|
||||
}
|
||||
|
||||
try {
|
||||
await comfyPage.setupSettings({
|
||||
'Comfy.UseNewMenu': 'Top',
|
||||
// Hide canvas menu/info/selection toolbox by default.
|
||||
'Comfy.Graph.CanvasInfo': false,
|
||||
'Comfy.Graph.CanvasMenu': false,
|
||||
'Comfy.Canvas.SelectionToolbox': false,
|
||||
// Hide all badges by default.
|
||||
'Comfy.NodeBadge.NodeIdBadgeMode': NodeBadgeMode.None,
|
||||
'Comfy.NodeBadge.NodeSourceBadgeMode': NodeBadgeMode.None,
|
||||
// Disable tooltips by default to avoid flakiness.
|
||||
'Comfy.EnableTooltips': false,
|
||||
'Comfy.userId': userId,
|
||||
// Set tutorial completed to true to avoid loading the tutorial workflow.
|
||||
'Comfy.TutorialCompleted': true,
|
||||
'Comfy.SnapToGrid.GridSize': testComfySnapToGridGridSize,
|
||||
'Comfy.VueNodes.AutoScaleLayout': false
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
||||
await comfyPage.setup()
|
||||
await use(comfyPage)
|
||||
},
|
||||
comfyMouse: async ({ comfyPage }, use) => {
|
||||
const comfyMouse = new ComfyMouse(comfyPage)
|
||||
await use(comfyMouse)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user