mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
test: remove Preview3D camera unit test, fixture skip, and @e2e vite alias
This commit is contained in:
@@ -43,22 +43,6 @@ async function orbitDragFromCanvasCenter(
|
||||
await page.mouse.up()
|
||||
}
|
||||
|
||||
export async function backendHasPreview3DNodes(
|
||||
comfyPage: ComfyPage
|
||||
): Promise<boolean> {
|
||||
const resp = await comfyPage.request.get(`${comfyPage.url}/object_info`, {
|
||||
failOnStatusCode: false
|
||||
})
|
||||
if (!resp.ok()) return false
|
||||
const data: unknown = await resp.json()
|
||||
return (
|
||||
typeof data === 'object' &&
|
||||
data !== null &&
|
||||
'Load3D' in data &&
|
||||
'Preview3D' in data
|
||||
)
|
||||
}
|
||||
|
||||
export class Preview3DPipelineContext {
|
||||
/** Matches node ids in `browser_tests/assets/3d/preview3d_pipeline.json`. */
|
||||
static readonly loadNodeId = '1'
|
||||
@@ -271,7 +255,7 @@ export class Preview3DPipelineContext {
|
||||
),
|
||||
{
|
||||
timeout: 15_000,
|
||||
message: `Preview3D camera after reload should match saved state (axis max delta ≤ ${PREVIEW3D_CAMERA_AXIS_RESTORE_EPS}, zoom delta ≤ ${PREVIEW3D_CAMERA_ZOOM_RESTORE_EPS}; see src/utils/preview3dCameraState.test.ts)`
|
||||
message: `Preview3D camera after reload should match saved state (axis max delta ≤ ${PREVIEW3D_CAMERA_AXIS_RESTORE_EPS}, zoom delta ≤ ${PREVIEW3D_CAMERA_ZOOM_RESTORE_EPS}; see browser_tests/fixtures/utils/preview3dCameraState.ts)`
|
||||
}
|
||||
)
|
||||
.toBe(true)
|
||||
@@ -281,24 +265,13 @@ export class Preview3DPipelineContext {
|
||||
export const preview3dPipelineTest = comfyPageFixture.extend<{
|
||||
preview3dPipeline: Preview3DPipelineContext
|
||||
}>({
|
||||
preview3dPipeline: async ({ comfyPage }, use, testInfo) => {
|
||||
preview3dPipeline: async ({ comfyPage }, use) => {
|
||||
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
|
||||
await comfyPage.settings.setSetting(
|
||||
'Comfy.Workflow.WorkflowTabsPosition',
|
||||
'Sidebar'
|
||||
)
|
||||
|
||||
const hasPreview3dNodes = await backendHasPreview3DNodes(comfyPage)
|
||||
if (!hasPreview3dNodes) {
|
||||
testInfo.skip(
|
||||
true,
|
||||
'Requires ComfyUI backend with Load3D and Preview3D nodes (object_info)'
|
||||
)
|
||||
await use(new Preview3DPipelineContext(comfyPage))
|
||||
await comfyPage.workflow.setupWorkflowsDirectory({})
|
||||
return
|
||||
}
|
||||
|
||||
await comfyPage.workflow.loadWorkflow('3d/preview3d_pipeline')
|
||||
await comfyPage.vueNodes.waitForNodes()
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
import {
|
||||
PREVIEW3D_CAMERA_AXIS_RESTORE_EPS,
|
||||
preview3dCameraStatesDiffer,
|
||||
preview3dRestoreCameraStatesMatch
|
||||
} from '@e2e/fixtures/utils/preview3dCameraState'
|
||||
|
||||
const base = {
|
||||
cameraType: 'perspective',
|
||||
position: { x: 1, y: 2, z: 3 },
|
||||
target: { x: 0, y: 0, z: 0 },
|
||||
zoom: 1
|
||||
}
|
||||
|
||||
describe('preview3dRestoreCameraStatesMatch', () => {
|
||||
it('returns true for identical states', () => {
|
||||
expect(preview3dRestoreCameraStatesMatch(base, { ...base })).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false for invalid payloads', () => {
|
||||
expect(preview3dRestoreCameraStatesMatch(null, base)).toBe(false)
|
||||
expect(preview3dRestoreCameraStatesMatch(base, { position: 'nope' })).toBe(
|
||||
false
|
||||
)
|
||||
})
|
||||
|
||||
it('returns false when cameraType differs', () => {
|
||||
expect(
|
||||
preview3dRestoreCameraStatesMatch(base, { ...base, cameraType: 'ortho' })
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts axis drift within PREVIEW3D_CAMERA_AXIS_RESTORE_EPS', () => {
|
||||
const drifted = {
|
||||
...base,
|
||||
position: {
|
||||
x: base.position.x + PREVIEW3D_CAMERA_AXIS_RESTORE_EPS * 0.9,
|
||||
y: base.position.y,
|
||||
z: base.position.z
|
||||
}
|
||||
}
|
||||
expect(preview3dRestoreCameraStatesMatch(base, drifted)).toBe(true)
|
||||
})
|
||||
|
||||
it('rejects axis drift beyond PREVIEW3D_CAMERA_AXIS_RESTORE_EPS', () => {
|
||||
const drifted = {
|
||||
...base,
|
||||
position: {
|
||||
x: base.position.x + PREVIEW3D_CAMERA_AXIS_RESTORE_EPS * 1.1,
|
||||
y: base.position.y,
|
||||
z: base.position.z
|
||||
}
|
||||
}
|
||||
expect(preview3dRestoreCameraStatesMatch(base, drifted)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('preview3dCameraStatesDiffer', () => {
|
||||
it('treats missing typed state as different', () => {
|
||||
expect(preview3dCameraStatesDiffer(null, base, 1e-4)).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false when states are equal within eps', () => {
|
||||
expect(preview3dCameraStatesDiffer(base, { ...base }, 1e-4)).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -2,8 +2,6 @@ import { sentryVitePlugin } from '@sentry/vite-plugin'
|
||||
import tailwindcss from '@tailwindcss/vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { execSync } from 'child_process'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { config as dotenvConfig } from 'dotenv'
|
||||
import type { IncomingMessage, ServerResponse } from 'http'
|
||||
import { Readable } from 'stream'
|
||||
@@ -23,8 +21,6 @@ import { comfyAPIPlugin } from './build/plugins'
|
||||
|
||||
dotenvConfig()
|
||||
|
||||
const __viteConfigDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV === 'development'
|
||||
const SHOULD_MINIFY = process.env.ENABLE_MINIFY === 'true'
|
||||
const ANALYZE_BUNDLE = process.env.ANALYZE_BUNDLE === 'true'
|
||||
@@ -638,8 +634,7 @@ export default defineConfig({
|
||||
'@/utils/formatUtil': '/packages/shared-frontend-utils/src/formatUtil.ts',
|
||||
'@/utils/networkUtil':
|
||||
'/packages/shared-frontend-utils/src/networkUtil.ts',
|
||||
'@': '/src',
|
||||
'@e2e': path.resolve(__viteConfigDir, 'browser_tests')
|
||||
'@': '/src'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user