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:
Kelly Yang
2026-04-10 00:30:05 -07:00
parent ea3c289a07
commit e0986db81a

View File

@@ -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')