mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-21 23:09:39 +00:00
test: make Preview3D camera restore deterministic
Set a non-default Load3D camera state through real canvas interaction before queueing so Preview3D receives camera info consistently in CI.
This commit is contained in:
@@ -29,6 +29,34 @@ async function seedLoad3dWithCubeObj(
|
||||
await comfyPage.nextFrame()
|
||||
}
|
||||
|
||||
async function setNonDefaultLoad3dCameraState(
|
||||
pipeline: Preview3DPipelineContext
|
||||
): Promise<void> {
|
||||
const { comfyPage, load3d } = pipeline
|
||||
const box = await load3d.canvas.boundingBox()
|
||||
expect(box, 'Load3D canvas bounding box should exist').not.toBeNull()
|
||||
|
||||
const startX = box!.x + box!.width * 0.5
|
||||
const startY = box!.y + box!.height * 0.5
|
||||
await comfyPage.page.mouse.move(startX, startY)
|
||||
await comfyPage.page.mouse.down()
|
||||
await comfyPage.page.mouse.move(startX + 80, startY + 20, {
|
||||
steps: 10
|
||||
})
|
||||
await comfyPage.page.mouse.up()
|
||||
await comfyPage.nextFrame()
|
||||
|
||||
await expect
|
||||
.poll(
|
||||
() =>
|
||||
pipeline.getCameraStateFromProperties(
|
||||
Preview3DPipelineContext.loadNodeId
|
||||
),
|
||||
{ timeout: 10_000 }
|
||||
)
|
||||
.not.toBeNull()
|
||||
}
|
||||
|
||||
async function alignPreview3dWorkflowUiSettings(
|
||||
pipeline: Preview3DPipelineContext
|
||||
): Promise<void> {
|
||||
@@ -91,6 +119,7 @@ test.describe('Preview3D execution flow', { tag: ['@node', '@slow'] }, () => {
|
||||
test.setTimeout(180_000)
|
||||
|
||||
await seedLoad3dWithCubeObj(pipeline)
|
||||
await setNonDefaultLoad3dCameraState(pipeline)
|
||||
|
||||
await pipeline.comfyPage.command.executeCommand('Comfy.QueuePrompt')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user