chore(web): continuous handoff WBV2-P1278-001
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

This commit is contained in:
mes123456
2026-09-04 16:36:07 +08:00
parent 96f66e8ce7
commit d4b54deb2b
13 changed files with 30440 additions and 12 deletions

View File

@@ -5,16 +5,22 @@ import { expect, test } from "@playwright/test";
const root = path.resolve(import.meta.dirname, "../../..");
const evidenceRoot = path.join(root, "tests/golden/WBV2-P11-001");
const fixturePath = path.join(root, "tests/files/web/generated/WBV2-P2-003-MESH.EDIT_CORE.blend");
const fixtureName = process.env.WBV2_BATCH_FIXTURE ?? "tests/files/web/generated/WBV2-P2-003-MESH.EDIT_CORE.blend";
const fixturePath = path.join(root, fixtureName);
const fixture = fs.readFileSync(fixturePath);
const sourceSha256 = crypto.createHash("sha256").update(fixture).digest("hex");
const batchOperation = process.env.WBV2_BATCH_OPERATION;
const task = process.env.WBV2_BATCH_TASK ?? "WBV2-P11-001";
const productionPath = process.env.WBV2_BATCH_PRODUCTION ?? `tests/golden/${task}/mesh-topology-production.json`;
const sourceUnits = JSON.parse(process.env.WBV2_BATCH_UNITS ?? "[]") as string[];
test("WBV2-P11-001 executes the six Mesh topology operations through compiled WASM Main", async ({ page }) => {
test.setTimeout(240_000);
await page.goto("/");
const result = await page.evaluate(async (input) => {
const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts");
const operations = [
const batchOperation = input.batchOperation;
const allOperations = [
{ label: "MERGE", meshId: "mesh:WBV2P2003MergeMesh", selectionMode: "VERT", elementIndices: [0, 1] },
{ label: "DISSOLVE", meshId: "mesh:WBV2P2003DissolveMesh", selectionMode: "EDGE", elementIndices: [0] },
{ label: "EXTRUDE", meshId: "mesh:WBV2P2003ExtrudeMesh", selectionMode: "FACE", elementIndices: [0], offset: [0, 0, 1] },
@@ -22,6 +28,7 @@ test("WBV2-P11-001 executes the six Mesh topology operations through compiled WA
{ label: "BEVEL", meshId: "mesh:WBV2P2003BevelMesh", selectionMode: "EDGE", elementIndices: [0], amount: 0.1, segments: 2 },
{ label: "LOOP_CUT", meshId: "mesh:WBV2P2003LoopCutMesh", selectionMode: "EDGE", elementIndices: [0], segments: 1 },
];
const operations = batchOperation ? allOperations.filter((operation) => operation.label === batchOperation) : allOperations;
const summary = (snapshot: any, meshId: string) => {
const mesh = snapshot.meshes.find((candidate: any) => candidate.id === meshId);
if (!mesh) throw new Error(`mesh missing: ${meshId}`);
@@ -69,15 +76,14 @@ test("WBV2-P11-001 executes the six Mesh topology operations through compiled WA
return { sourceSha256: input.sourceSha256, operations: positive, negative: { invalidSelection, incompatible, stale, before, after, revisionBefore: revision, revisionAfter: (await negativeClient.snapshot()).snapshot.revision } };
}
finally { negativeClient.terminate(); }
}, { bytes: Array.from(fixture), sourceSha256 });
}, { bytes: Array.from(fixture), sourceSha256, batchOperation });
fs.mkdirSync(evidenceRoot, { recursive: true });
const output = process.env.WBV2_MESH_TOPOLOGY_REPORT ?? "mesh-topology-production.json";
fs.writeFileSync(path.join(evidenceRoot, output), `${JSON.stringify({ schemaVersion: 1, task: "WBV2-P11-001", operation: "MESH_TOPOLOGY_OPERATION_FAMILY_CHROMIUM", browser: "chromium", queueMutation: false, ...result }, null, 2)}\n`);
fs.mkdirSync(path.dirname(path.join(root, productionPath)), { recursive: true });
fs.writeFileSync(path.join(root, productionPath), `${JSON.stringify({ schemaVersion: 1, task, operation: "MESH_TOPOLOGY_OPERATION_FAMILY_CHROMIUM", browser: "chromium", queueMutation: false, fixture: fixtureName, fixtureSha256: sourceSha256, sourceUnits, ...result }, null, 2)}\n`);
expect(result.sourceSha256).toBe(sourceSha256);
expect(result.operations).toHaveLength(6);
expect(result.operations).toHaveLength(batchOperation ? 1 : 6);
expect(result.operations.every((entry) => entry.afterRevision === entry.baseRevision + 1 && entry.exactSaveReopen && entry.after.vertexCount > 0 && entry.after.edgeCount > 0 && entry.after.faceCount > 0)).toBe(true);
expect(result.operations.map((entry) => entry.operation)).toEqual(["MERGE", "DISSOLVE", "EXTRUDE", "INSET", "BEVEL", "LOOP_CUT"]);
expect(result.operations.map((entry) => entry.operation)).toEqual(batchOperation ? [batchOperation] : ["MERGE", "DISSOLVE", "EXTRUDE", "INSET", "BEVEL", "LOOP_CUT"]);
expect(result.negative.invalidSelection?.code).toBe("INVALID_ARGUMENT");
expect(result.negative.incompatible?.code).toBe("INVALID_ARGUMENT");
expect(result.negative.stale?.code).toBe("INVALID_ARGUMENT");