import { test, expect } from "@playwright/test"; import fs from "node:fs"; import path from "node:path"; import { exposeWebTools } from "../fixtures/native-ui-workflow"; const root = path.resolve(import.meta.dirname, "../../.."); const receiptDir = path.join(root, "tests/golden/WBV2-P1425-001/verification"); fs.mkdirSync(receiptDir, { recursive: true }); test("Add menu creates Monkey through the native operator channel", async ({ page }) => { test.setTimeout(120_000); await page.goto("/"); await page.getByTestId("blend-file-input").setInputFiles(path.join(root, "tests/files/web/basic_scene.blend")); await expect(page.getByTestId("engine-status")).toContainText(/SceneIR r\d+/, { timeout: 60_000 }); await exposeWebTools(page); await page.getByRole("button", { name: "添加", exact: true }).click(); await page.getByRole("menuitem", { name: "网格", exact: true }).click(); await page.getByRole("menuitem", { name: "猴头", exact: true }).click(); await expect(page.getByTestId("engine-status")).toContainText(/mesh\.primitive_monkey_add/, { timeout: 60_000 }); await expect(page.getByRole("treeitem").filter({ hasText: /Suzanne|Monkey/ }).first()).toBeVisible({ timeout: 60_000 }); fs.writeFileSync(path.join(receiptDir, "add-menu-native-production.json"), JSON.stringify({ schemaVersion: 1, browser: "chromium", scope: "Web Add menu -> desktop_operator(mesh.primitive_monkey_add) -> Main/SceneIR", status: "PASS", evidence: ["engine-status reported mesh.primitive_monkey_add", "Outliner exposed the new Suzanne/Monkey object"], }, null, 2)); });