Files
workinf_Blender_Wasm/web/tests/e2e/modeling-modal-production.spec.ts
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer,
web workflow engine and protocol, tooling, docs and task records.
Large generated evidence, user-testing archives, build snapshots and
imported test assets remain untracked.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-11-10 11:18:01 +08:00

31 lines
1.9 KiB
TypeScript

import { expect, test } from "@playwright/test";
import fs from "node:fs";
import path from "node:path";
const fixture = path.resolve(import.meta.dirname, "../../..", "tests/files/web/basic_scene.blend");
test("Modeling case adds Cube, transforms, cancels, undoes and reopens", async ({ page }, testInfo) => {
await page.goto("/?ui=web");
await page.getByTestId("blend-file-input").setInputFiles(fixture);
await expect(page.getByTestId("engine-status")).toContainText("SceneIR");
const webTools = page.getByRole("button", { name: "Web 业务工具", exact: true });
if (await webTools.count()) await webTools.click();
await expect(page.getByTestId("scene-stats")).toContainText("Objects 3");
await page.getByRole("button", { name: "添加立方体", exact: true }).click();
await expect(page.getByTestId("scene-stats")).toContainText("Objects 4");
const beforeCancel = await page.getByTestId("object-location").textContent();
await page.locator(".status-bar").click({ position: { x: 700, y: 10 } });
await page.keyboard.press("g"); await page.keyboard.press("r"); await page.keyboard.press("s");
await expect(page.getByTestId("object-location")).not.toHaveText(beforeCancel ?? "");
const transformed = await page.getByTestId("object-location").textContent();
await page.keyboard.press("Escape");
await expect(page.getByTestId("object-location")).toHaveText(transformed ?? "");
await page.getByRole("button", { name: "撤销", exact: true }).click();
await page.getByRole("button", { name: "重做", exact: true }).click();
const download = page.waitForEvent("download"); await page.getByRole("button", { name: "保存项目", exact: true }).click();
const saved = testInfo.outputPath("b2-modeling.blend"); await (await download).saveAs(saved);
await page.setInputFiles("[data-testid=blend-file-input]", saved);
await expect(page.getByTestId("scene-stats")).toContainText("Objects 4");
expect(fs.statSync(saved).size).toBeGreaterThan(0);
});