55 lines
1.9 KiB
TypeScript
55 lines
1.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve } from "node:path";
|
|
|
|
function readSource(path: string) {
|
|
return readFileSync(resolve(process.cwd(), path), "utf8");
|
|
}
|
|
|
|
test.describe("3D workspace and Style Pro regressions", () => {
|
|
test("opens World splats in first-person mode without the debug HUD", () => {
|
|
const page = readSource("app/canvas/[id]/model3d/page.tsx");
|
|
const viewer = readSource(
|
|
"components/canvas/world3d/World3DViewer.tsx"
|
|
);
|
|
|
|
expect(page).toContain(
|
|
'workspaceMode === "world" && worldViewportMode === "splat"'
|
|
);
|
|
expect(page).toContain("showInfoOverlay={false}");
|
|
expect(viewer).toContain("showInfoOverlay = !minimalFrame");
|
|
expect(viewer).toContain("showInfoOverlay={showInfoOverlay}");
|
|
});
|
|
|
|
test("keeps each GLB viewer material instance isolated and texture-aware", () => {
|
|
const viewer = readSource(
|
|
"components/canvas/model3d/Model3DViewer.tsx"
|
|
);
|
|
|
|
expect(viewer).toContain("cloneSceneWithIndependentMaterials");
|
|
expect(viewer).toContain("const clonedMaterial = material.clone()");
|
|
expect(viewer).toContain(
|
|
"configureMaterialTextures(clonedMaterial, node.geometry)"
|
|
);
|
|
});
|
|
|
|
test("uses the same hidden-model access rule in Style Pro as canvas", () => {
|
|
const route = readSource("app/api/style-pro/model-options/route.ts");
|
|
|
|
expect(route).toContain("getUserById");
|
|
expect(route).toContain('session.user.type === "admin"');
|
|
expect(route).toContain("Boolean(currentUser?.isHighVip)");
|
|
expect(route).toContain("includeHidden: allowHiddenModels");
|
|
});
|
|
|
|
test("opens the canvas conversation panel by default", () => {
|
|
const page = readSource(
|
|
"app/canvas/[id]/CanvasEditorLegacyPageClient.tsx"
|
|
);
|
|
|
|
expect(page).toContain(
|
|
"const [isPanelOpen, setIsPanelOpen] = useState(true)"
|
|
);
|
|
});
|
|
});
|