The desktop Outliner binds outliner.delete to X and Del and also carries it in the context/Data menu; the web data menu only offered rename and Remap Users. Both entries now run the existing deleteObject edit for the object row under the cursor or keyboard focus, so the deletion travels through the same native Main transaction as the viewport delete. The headed case [outliner-delete-web] deletes one object with X and one through the Data menu entry, checking the native row set shrinks and the labels disappear; receipt OUTLINER-HEADED-20261130-082221 (NOT_CLAIMED, 9/9). Collection rows still lack Delete Hierarchy, which stays queued. The armature panel regression keeps failing identically at HEAD and is tracked as pre-existing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
379 lines
23 KiB
TypeScript
379 lines
23 KiB
TypeScript
import { expect, test, type Page } from "@playwright/test";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
const BASIC_SCENE = path.resolve(HERE, "../../../tests/files/web/basic_scene.blend");
|
|
/* Desktop geometry measured from Blender's own Layout screen
|
|
* (tools/web/measure-outliner-desktop.py, blender 5.2.0 LTS, factory startup). */
|
|
const DESKTOP_METRICS = path.resolve(HERE, "../../../tests/golden/OUTLINER-DESKTOP-METRICS/outliner-metrics.json");
|
|
|
|
/* Shared entry for the web workbench: open the fixture through the product
|
|
* input, wait for the engine to own the project, and expose the native tools
|
|
* that the quick-action bar would otherwise cover. */
|
|
async function openWorkbench(page: Page) {
|
|
await page.goto("/?ui=web");
|
|
await page.locator('[data-testid="blend-file-input"]').setInputFiles(BASIC_SCENE);
|
|
await expect(page.locator(".blender-app")).toHaveAttribute("data-project-id", /.+/, { timeout: 60_000 });
|
|
await expect(page.getByText(/Engine: SceneIR/).first()).toBeVisible({ timeout: 60_000 });
|
|
const webTools = page.locator('[data-testid="native-web-tools-toggle"]');
|
|
if (await webTools.count()) await webTools.click();
|
|
await expect(page.locator(".outliner-tree").first()).toBeVisible({ timeout: 20_000 });
|
|
}
|
|
|
|
test.describe("Outliner headed baseline", () => {
|
|
test("[outliner-tree-baseline-web] renders tree semantics and keeps selection wired", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
await expect(page.getByRole("tree").first()).toBeVisible();
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(0);
|
|
|
|
const firstItem = items.first();
|
|
await expect(firstItem).toHaveAttribute("aria-level", /^\d+$/);
|
|
await expect(firstItem).toHaveAttribute("aria-label", /.+/);
|
|
|
|
await page.locator(".tree-node-name").last().click();
|
|
await expect.poll(async () => page.locator('[role="treeitem"][aria-selected="true"]').count(), { timeout: 15_000 }).toBeGreaterThan(0);
|
|
|
|
const expand = page.locator(".tree-expand").first();
|
|
if (await expand.count()) {
|
|
const before = await items.count();
|
|
const label = await expand.getAttribute("aria-label");
|
|
if (label?.startsWith("展开")) {
|
|
await expand.click();
|
|
await expect.poll(async () => items.count(), { timeout: 15_000 }).toBeGreaterThan(before);
|
|
}
|
|
}
|
|
});
|
|
|
|
test("[outliner-tools-baseline-web] searches, filters and toggles the eye without losing the tree", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(0);
|
|
const before = await items.count();
|
|
|
|
const search = page.locator('input[aria-label="搜索场景"]').first();
|
|
await expect(search).toBeVisible();
|
|
const target = await items.last().getAttribute("aria-label");
|
|
expect(target).toBeTruthy();
|
|
await search.fill(target!);
|
|
await expect.poll(async () => items.count(), { timeout: 15_000 }).toBeLessThan(before);
|
|
await expect(page.locator(`[role="treeitem"][aria-label="${target}"]`).first()).toBeVisible();
|
|
await page.locator('button[aria-label="清除大纲搜索"]').first().click();
|
|
await expect.poll(async () => items.count(), { timeout: 15_000 }).toBe(before);
|
|
|
|
await page.locator(".tree-node-name").last().click();
|
|
await expect.poll(async () => page.locator('[role="treeitem"][aria-selected="true"]').count(), { timeout: 15_000 }).toBeGreaterThan(0);
|
|
const filterToggle = page.locator('button[aria-label="筛选"]').first();
|
|
await filterToggle.click();
|
|
const filterMenu = page.locator(".outliner-filter-menu").first();
|
|
await expect(filterMenu).toBeVisible();
|
|
await filterMenu.locator('input[type="checkbox"]').nth(1).check();
|
|
await expect.poll(async () => items.count(), { timeout: 15_000 }).toBeLessThan(before);
|
|
await filterMenu.getByRole("button", { name: "清除筛选" }).click();
|
|
await expect.poll(async () => items.count(), { timeout: 15_000 }).toBe(before);
|
|
/* 清除筛选 only resets the checkboxes; its popover stays open and covers the
|
|
* row buttons, so close it through the same toggle before the eye round trip. */
|
|
await filterToggle.click();
|
|
await expect(page.locator(".outliner-filter-menu")).toHaveCount(0);
|
|
|
|
/* The eye row button is the only restriction column that exists today;
|
|
* toggling it must round-trip through the engine and come back. */
|
|
const eye = page.locator('.outliner-tree button[aria-label^="隐藏 "]').first();
|
|
await expect(eye).toBeVisible();
|
|
const eyeLabel = await eye.getAttribute("aria-label");
|
|
const name = eyeLabel!.replace(/^隐藏 /, "");
|
|
await eye.click();
|
|
await expect.poll(async () => page.locator(`.outliner-tree button[aria-label="显示 ${name}"]`).count(), { timeout: 15_000 }).toBe(1);
|
|
await page.locator(`.outliner-tree button[aria-label="显示 ${name}"]`).first().click();
|
|
await expect.poll(async () => page.locator(`.outliner-tree button[aria-label="隐藏 ${name}"]`).count(), { timeout: 15_000 }).toBe(1);
|
|
});
|
|
|
|
test("[outliner-metrics-web] the workbench Outliner matches the desktop Layout geometry", async ({ page }, testInfo) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
await expect.poll(async () => page.getByRole("treeitem").count(), { timeout: 20_000 }).toBeGreaterThan(1);
|
|
const golden = (JSON.parse(readFileSync(DESKTOP_METRICS, "utf8")) as { outliner: { width: number; height: number; headerHeight: number; rowHeight: number; indentPerLevel: number } }).outliner;
|
|
const measured = await page.evaluate(() => {
|
|
const rect = (element: Element | null) => {
|
|
if (!element) return null;
|
|
const box = element.getBoundingClientRect();
|
|
return { x: box.x, y: box.y, width: box.width, height: box.height };
|
|
};
|
|
const area = document.querySelector(".outliner-area");
|
|
const header = area?.querySelector(":scope > .editor-header") ?? null;
|
|
const rows = Array.from(document.querySelectorAll<HTMLElement>(".outliner-tree .tree-row"));
|
|
const paddingLevels = [...new Set(rows.map((row) => Math.round(parseFloat(getComputedStyle(row).paddingLeft))))].sort((a, b) => a - b);
|
|
const steps = paddingLevels.slice(1).map((value, index) => value - paddingLevels[index]);
|
|
return {
|
|
viewport: { width: window.innerWidth, height: window.innerHeight },
|
|
outliner: rect(area),
|
|
header: rect(header),
|
|
rowHeights: rows.map((row) => row.getBoundingClientRect().height),
|
|
paddingLevels,
|
|
indentPerLevel: steps.length ? Math.min(...steps) : null,
|
|
};
|
|
});
|
|
await testInfo.attach("outliner-metrics-web", { body: JSON.stringify({ golden, measured }, null, 2), contentType: "application/json" });
|
|
expect(measured.viewport).toEqual({ width: 1920, height: 1080 });
|
|
expect(measured.outliner).not.toBeNull();
|
|
expect(measured.header).not.toBeNull();
|
|
/* The desktop Layout at 1920x1080: Outliner area 339x189, header 26,
|
|
* row 20, indent 14 (UI_TREEVIEW_INDENT = 0.7 * UI_UNIT_X). */
|
|
expect(Math.abs(measured.outliner!.width - golden.width)).toBeLessThanOrEqual(1);
|
|
expect(Math.abs(measured.outliner!.height - golden.height)).toBeLessThanOrEqual(1);
|
|
expect(Math.abs(measured.header!.height - golden.headerHeight)).toBeLessThanOrEqual(1);
|
|
expect(measured.rowHeights.length).toBeGreaterThan(0);
|
|
for (const height of measured.rowHeights) expect(Math.abs(height - golden.rowHeight)).toBeLessThanOrEqual(1);
|
|
expect(measured.indentPerLevel).not.toBeNull();
|
|
expect(Math.abs(measured.indentPerLevel! - golden.indentPerLevel)).toBeLessThanOrEqual(1);
|
|
});
|
|
|
|
test("[outliner-display-mode-web] switches desktop display modes and restores the view layer", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(1);
|
|
const modeSelect = page.locator('select[aria-label="大纲显示模式"]').first();
|
|
await expect(modeSelect).toBeVisible();
|
|
await expect(modeSelect).toHaveValue("VIEW_LAYER");
|
|
const labels = () => items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("aria-label") ?? ""));
|
|
const viewLayerLabels = await labels();
|
|
expect(viewLayerLabels.length).toBeGreaterThan(1);
|
|
|
|
/* Data API (SO_DATA_API) lists low-level Blender data groups instead of
|
|
* the view-layer collection/object tree. */
|
|
await modeSelect.selectOption("DATA_API");
|
|
await expect(modeSelect).toHaveValue("DATA_API");
|
|
await expect.poll(labels, { timeout: 15_000 }).not.toEqual(viewLayerLabels);
|
|
expect((await labels()).length).toBeGreaterThan(0);
|
|
|
|
await modeSelect.selectOption("VIEW_LAYER");
|
|
await expect(modeSelect).toHaveValue("VIEW_LAYER");
|
|
await expect.poll(labels, { timeout: 15_000 }).toEqual(viewLayerLabels);
|
|
});
|
|
|
|
test("[outliner-filter-web] search and state filters run through the native Outliner filter", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(1);
|
|
const labels = () => items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("aria-label") ?? ""));
|
|
const all = await labels();
|
|
expect(all.some((label) => label.includes("Cube"))).toBe(true);
|
|
|
|
/* The snapshot's filter object drives the popover: 反转/同步选择 only render
|
|
* on the native path, so their presence proves filtering is engine-backed. */
|
|
const filterButton = page.locator('button[aria-label="筛选"]').first();
|
|
await filterButton.click();
|
|
const menu = page.locator(".outliner-filter-menu").first();
|
|
await expect(menu).toBeVisible();
|
|
const checkboxes = menu.locator('input[type="checkbox"]');
|
|
/* Four filter-state toggles plus the seven View Layer restriction toggles. */
|
|
await expect(checkboxes).toHaveCount(11);
|
|
await expect(menu.getByLabel("反转")).toHaveCount(1);
|
|
await expect(menu.getByLabel("同步选择")).toHaveCount(1);
|
|
await filterButton.click();
|
|
await expect(menu).toBeHidden();
|
|
|
|
/* Search writes SpaceOutliner.search_string; the engine trims the tree and
|
|
* clearing it restores exactly the previous rows. */
|
|
const search = page.locator('input[aria-label="搜索场景"]').first();
|
|
await search.fill("Cube");
|
|
await expect.poll(async () => (await labels()).length, { timeout: 15_000 }).toBeLessThan(all.length);
|
|
expect((await labels()).some((label) => label.includes("Cube"))).toBe(true);
|
|
await page.locator('button[aria-label="清除大纲搜索"]').first().click();
|
|
await expect.poll(labels, { timeout: 15_000 }).toEqual(all);
|
|
|
|
/* Filter state SELECTED keeps the selected object plus its ancestors
|
|
* (outliner_tree.cc filters children up to the matching branch). */
|
|
await page.locator(".tree-node-name").last().click();
|
|
const selectedLabel = await items.last().getAttribute("aria-label");
|
|
await filterButton.click();
|
|
await checkboxes.nth(1).check();
|
|
await expect.poll(async () => (await labels()).length, { timeout: 15_000 }).toBeLessThan(all.length);
|
|
const filtered = await labels();
|
|
expect(filtered).toContain(selectedLabel);
|
|
for (const label of filtered) expect(all).toContain(label);
|
|
/* The popover reflects the engine-side filter_state, not local UI state. */
|
|
await expect.poll(() => checkboxes.nth(1).isChecked(), { timeout: 15_000 }).toBe(true);
|
|
await menu.getByRole("button", { name: "清除筛选" }).click();
|
|
await expect.poll(labels, { timeout: 15_000 }).toEqual(all);
|
|
|
|
/* 同步选择 writes SO_SYNC_SELECT and round-trips through the snapshot. */
|
|
const sync = menu.getByLabel("同步选择");
|
|
await expect(sync).toBeChecked();
|
|
await sync.uncheck();
|
|
await expect.poll(() => sync.isChecked(), { timeout: 15_000 }).toBe(false);
|
|
await sync.check();
|
|
await expect.poll(() => sync.isChecked(), { timeout: 15_000 }).toBe(true);
|
|
});
|
|
|
|
test("[outliner-restrict-web] restriction columns write the native flags and round-trip", async ({ page }) => {
|
|
test.setTimeout(180_000);
|
|
await openWorkbench(page);
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(1);
|
|
const labels = () => items.evaluateAll((nodes) => nodes.map((node) => node.getAttribute("aria-label") ?? ""));
|
|
const shown = () => page.locator('.outliner-tree button[aria-label^="显示 "]').count();
|
|
|
|
/* Desktop default (space_outliner.cc): only enable, hide and render draw. */
|
|
await expect.poll(() => page.locator(".outliner-tree .tree-restrict-button").count(), { timeout: 15_000 }).toBeGreaterThan(2);
|
|
const filterButton = page.locator('button[aria-label="筛选"]').first();
|
|
await filterButton.click();
|
|
const menu = page.locator(".outliner-filter-menu").first();
|
|
await expect(menu).toBeVisible();
|
|
const group = menu.getByRole("group", { name: "限制列" });
|
|
await expect(group.locator('input[type="checkbox"]')).toHaveCount(7);
|
|
await expect(group.getByLabel("排除")).toBeChecked();
|
|
await expect(group.getByLabel("隐藏")).toBeChecked();
|
|
await expect(group.getByLabel("渲染")).toBeChecked();
|
|
await expect(group.getByLabel("可选")).not.toBeChecked();
|
|
await expect(group.getByLabel("视口")).not.toBeChecked();
|
|
|
|
/* A popover toggle writes SpaceOutliner.show_restrict_flags; the column set
|
|
* comes back from the snapshot, so the row buttons appear and disappear. */
|
|
await group.getByLabel("视口").check();
|
|
await expect.poll(() => page.locator('.outliner-tree button[aria-label^="在视口中禁用"]').count(), { timeout: 15_000 }).toBeGreaterThan(0);
|
|
await group.getByLabel("视口").uncheck();
|
|
await expect.poll(() => page.locator('.outliner-tree button[aria-label^="在视口中禁用"]').count(), { timeout: 15_000 }).toBe(0);
|
|
await filterButton.click();
|
|
await expect(menu).toBeHidden();
|
|
|
|
/* The hide column writes Base.hide_viewport; the engine-side VISIBLE filter
|
|
* then drops the row, which proves the native flag and not just a draft.
|
|
* Object rows are the ones carrying data-node-id; collection rows stay in
|
|
* the tree as ancestors even when everything below them is filtered out. */
|
|
const objectRow = page.locator('.outliner-tree .tree-row[data-node-id]:not([data-node-id=""])').first();
|
|
const hideButton = objectRow.locator('button[aria-label^="隐藏 "]').first();
|
|
const targetLabel = (await hideButton.getAttribute("aria-label"))!.replace(/^隐藏 /, "");
|
|
await hideButton.click();
|
|
await expect.poll(async () => page.locator(`.outliner-tree button[aria-label="显示 ${targetLabel}"]`).count(), { timeout: 15_000 }).toBe(1);
|
|
await filterButton.click();
|
|
await menu.getByLabel("只显示可见对象").check();
|
|
await expect.poll(labels, { timeout: 15_000 }).not.toContain(targetLabel);
|
|
await menu.getByLabel("只显示可见对象").uncheck();
|
|
await expect.poll(labels, { timeout: 15_000 }).toContain(targetLabel);
|
|
await filterButton.click();
|
|
await expect(menu).toBeHidden();
|
|
await page.locator(`.outliner-tree button[aria-label="显示 ${targetLabel}"]`).first().click();
|
|
await expect.poll(shown, { timeout: 15_000 }).toBe(0);
|
|
|
|
/* Shift recurses into the objects nested under a collection. The Scene
|
|
* Collection is the master row and draws no restriction buttons, so target
|
|
* the child collection the fixture ships. */
|
|
await expect(page.getByRole("treeitem", { name: "Collection", exact: true })).toBeVisible();
|
|
await page.locator('.outliner-tree button[aria-label="隐藏 Collection"]').click({ modifiers: ["Shift"] });
|
|
await expect.poll(shown, { timeout: 15_000 }).toBeGreaterThan(0);
|
|
await page.locator('.outliner-tree button[aria-label="显示 Collection"]').click({ modifiers: ["Shift"] });
|
|
await expect.poll(shown, { timeout: 15_000 }).toBe(0);
|
|
|
|
/* Ctrl isolates: the collection stays visible while everything outside it
|
|
* hides, and the second Ctrl-click restores the previous visibility set.
|
|
* Isolating needs a sibling collection, so add one through the product's
|
|
* own Object > Collection > New Collection entry. */
|
|
const beforeCreate = await labels();
|
|
await page.getByRole("button", { name: "物体", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "集合", exact: true }).click();
|
|
await page.getByRole("menuitem", { name: "新建集合", exact: true }).click();
|
|
/* The product names the collection from the current count, so take the
|
|
* label that appeared instead of guessing it. */
|
|
let createdCollection = "";
|
|
await expect.poll(async () => {
|
|
createdCollection = (await labels()).find((label) => !beforeCreate.includes(label) && label.startsWith("Collection")) ?? "";
|
|
return createdCollection;
|
|
}, { timeout: 20_000 }).not.toBe("");
|
|
await expect(page.getByRole("treeitem", { name: createdCollection, exact: true })).toBeVisible();
|
|
/* outliner_collection_isolate_flag hides every other collection and forces
|
|
* the clicked one visible, so the fixture's Collection flips to "显示" while
|
|
* the new collection keeps its "隐藏" button. */
|
|
await page.locator(`.outliner-tree button[aria-label="隐藏 ${createdCollection}"]`).click({ modifiers: ["Control"] });
|
|
await expect.poll(async () => page.locator('.outliner-tree button[aria-label="显示 Collection"]').count(), { timeout: 15_000 }).toBe(1);
|
|
await expect(page.locator(`.outliner-tree button[aria-label="隐藏 ${createdCollection}"]`)).toHaveCount(1);
|
|
/* The second Ctrl-click detects the isolated state and restores the default
|
|
* visibility set (outliner_collection_is_isolated). */
|
|
await page.locator(`.outliner-tree button[aria-label="隐藏 ${createdCollection}"]`).click({ modifiers: ["Control"] });
|
|
await expect.poll(shown, { timeout: 15_000 }).toBe(0);
|
|
});
|
|
|
|
test("[outliner-select-keys-web] bare A, Alt+A and Ctrl+I drive the native select-all", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
const objectRows = page.locator('.outliner-tree .tree-row[data-node-id]:not([data-node-id=""])');
|
|
await expect.poll(() => objectRows.count(), { timeout: 20_000 }).toBeGreaterThan(0);
|
|
const objectCount = await objectRows.count();
|
|
/* Selection is native state; count the object rows whose own treeitem is
|
|
* selected (collection ancestors may wrap selected descendants). */
|
|
const selectedObjects = () => page.locator('.outliner-tree [role="treeitem"][aria-selected="true"] > .tree-row[data-node-id]:not([data-node-id=""])').count();
|
|
await objectRows.first().locator('.tree-node-name').click();
|
|
await expect.poll(async () => page.locator('.outliner-tree [role="treeitem"]:focus').count(), { timeout: 15_000 }).toBe(1);
|
|
/* blender_default.py _template_items_select_actions: A selects all. */
|
|
await page.keyboard.press("a");
|
|
await expect.poll(selectedObjects, { timeout: 15_000 }).toBe(objectCount);
|
|
await page.keyboard.press("Alt+a");
|
|
await expect.poll(selectedObjects, { timeout: 15_000 }).toBe(0);
|
|
await page.keyboard.press("Control+i");
|
|
await expect.poll(selectedObjects, { timeout: 15_000 }).toBe(objectCount);
|
|
await page.keyboard.press("Control+i");
|
|
await expect.poll(selectedObjects, { timeout: 15_000 }).toBe(0);
|
|
});
|
|
|
|
test("[outliner-delete-web] X and the Data menu delete objects through the native Main", async ({ page }) => {
|
|
test.setTimeout(150_000);
|
|
await openWorkbench(page);
|
|
const objectRows = page.locator('.outliner-tree .tree-row[data-node-id]:not([data-node-id=""])');
|
|
await expect.poll(() => objectRows.count(), { timeout: 20_000 }).toBeGreaterThan(0);
|
|
const before = await objectRows.count();
|
|
|
|
/* Desktop keymap binds outliner.delete to X (and Del); the focused row is
|
|
* the deletion target. */
|
|
const lastRow = objectRows.last();
|
|
const label = (await lastRow.getAttribute("aria-label"))!;
|
|
await lastRow.locator('.tree-node-name').click();
|
|
await expect.poll(async () => page.locator('.outliner-tree [role="treeitem"]:focus').count(), { timeout: 15_000 }).toBe(1);
|
|
await page.keyboard.press("x");
|
|
await expect.poll(() => objectRows.count(), { timeout: 15_000 }).toBe(before - 1);
|
|
await expect(page.locator(`.outliner-tree [role="treeitem"][aria-label="${label}"]`)).toHaveCount(0);
|
|
|
|
/* The Data menu carries the same OUTLINER_OT_delete entry. */
|
|
const nextRow = objectRows.first();
|
|
const menuLabel = (await nextRow.getAttribute("aria-label"))!;
|
|
await nextRow.locator('.tree-node-name').click({ button: "right" });
|
|
await page.getByRole("menuitem", { name: "删除 (X)", exact: true }).click();
|
|
await expect.poll(() => objectRows.count(), { timeout: 15_000 }).toBe(before - 2);
|
|
await expect(page.locator(`.outliner-tree [role="treeitem"][aria-label="${menuLabel}"]`)).toHaveCount(0);
|
|
});
|
|
|
|
test("[outliner-mirror-baseline-web] the desktop mirror hands the Outliner to the DOM workspace", async ({ page }) => {
|
|
test.setTimeout(120_000);
|
|
await page.goto("/");
|
|
await expect(page.getByTestId("engine-status")).toContainText("ready, open a .blend file", { timeout: 20_000 });
|
|
await page.getByTestId("blend-file-input").setInputFiles(BASIC_SCENE);
|
|
await expect(page.locator("main.blender-app")).toHaveAttribute("data-editor-workflow-status", "AVAILABLE", { timeout: 60_000 });
|
|
|
|
/* While the native desktop canvas owns the screen the React area frames are
|
|
* deliberately unmounted (App.tsx:10395), so today the mirror baseline is the
|
|
* 浏览器业务工具 switched workspace, not a hidden DOM tree under the canvas. */
|
|
const desktop = page.locator('section[aria-label="Blender 桌面"]');
|
|
await expect(desktop).toHaveAttribute("data-native-canvas-open", "true", { timeout: 20_000 });
|
|
await expect(page.locator(".outliner-tree")).toHaveCount(0);
|
|
/* The floating overlay switch sits under the topbar's 下载 .blend button, so
|
|
* use the product's topbar segmented control, which is the reachable entry. */
|
|
await page.locator('[aria-label="工作区显示"]').getByRole("button", { name: "Web 业务工具" }).click();
|
|
await expect(desktop).toHaveAttribute("data-native-canvas-open", "false");
|
|
|
|
await expect(page.locator(".outliner-tree").first()).toBeVisible({ timeout: 20_000 });
|
|
const items = page.getByRole("treeitem");
|
|
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(1);
|
|
const firstItem = items.first();
|
|
await expect(firstItem).toHaveAttribute("aria-level", /^\d+$/);
|
|
await expect(firstItem).toHaveAttribute("aria-label", /.+/);
|
|
/* The 快捷操作栏 overlays the top of each area, so click a row below the header. */
|
|
await page.locator(".tree-node-name").nth(1).click();
|
|
await expect.poll(async () => page.locator('[role="treeitem"][aria-selected="true"]').count(), { timeout: 15_000 }).toBeGreaterThan(0);
|
|
});
|
|
});
|