Update viewport-test-helpers.ts with new selection properties and clickViewportAtRatio function

This commit is contained in:
2026-04-04 20:18:38 +02:00
parent 04e7c062ed
commit f71039966d

View File

@@ -23,7 +23,12 @@ interface EditorStoreSnapshot {
selection: {
kind: string;
ids?: string[];
brushId?: string;
faceId?: string;
edgeId?: string;
vertexId?: string;
};
whiteboxSelectionMode: string;
toolMode: string;
document: {
assets: Record<string, { id: string; kind: string; sourceName: string }>;
@@ -153,6 +158,22 @@ export async function clickViewport(page: Page, panelId: string = DEFAULT_VIEWPO
}
}
export async function clickViewportAtRatio(page: Page, panelId: string, xRatio: number, yRatio: number) {
const viewportCanvas = getViewportCanvas(page, panelId);
const box = await viewportCanvas.boundingBox();
if (box === null) {
throw new Error(`Missing viewport canvas for ${panelId}.`);
}
await viewportCanvas.click({
position: {
x: box.width * xRatio,
y: box.height * yRatio
}
});
}
export async function setSharedBoxCreationPreview(
page: Page,
panelId: ViewportPanelId,