fix(web): armature edit-mode bones survive save and the coverage spec runs
The coverage spec could not start: the armature workbench renders only in the web workbench (?ui=web), the diagnostic-panel filter hid it there, and the spec's own WebEngineClient waited on the editor's exclusive native-files Web Lock. Give the client an ephemeral mode (marked by worker name, no OPFS store and no lock) and let the fixture load in web mode without the native overlay. Bone authoring in Edit mode was also discarded on save: the engine wrote object bones while the save flush rebuilds them from the edit-bone list (ED_editors_flush_edits -> ED_armature_from_edit). Mirror each edit into the edit bones and refresh arm_roll from the bone matrix so roll survives the round trip. armature-editor-coverage-ui-production: 6 passed (dev server, Chromium). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,9 @@ test("armature panel operates on the selected bone", async ({ page }, testInfo)
|
||||
page.setDefaultTimeout(8_000);
|
||||
await observeNative(page);
|
||||
const workflow = new NativeUIWorkflow(page, testInfo.outputPath("panel"));
|
||||
await page.goto("/");
|
||||
/* The armature workbench is the web workbench Properties editor; the desktop
|
||||
* mode renders the native properties mirror instead. */
|
||||
await page.goto("/?ui=web");
|
||||
await workflow.load(path.join(root, fixturePath), "PoseConstraintArmatureObject");
|
||||
const panel = page.getByTestId("armature-authoring-workbench");
|
||||
await workflow.save("before");
|
||||
@@ -80,7 +82,10 @@ for (const route of Object.keys(routes) as Route[]) {
|
||||
finally { timings.push({ stage: name, seconds: (performance.now() - start) / 1000 }); }
|
||||
};
|
||||
const create = () => {
|
||||
const client = new WebEngineClient({ timeoutMs: 10_000 });
|
||||
/* These engines never touch the shared OPFS native-files store: the page's
|
||||
* editor already holds its exclusive Web Lock, and the fixture round-trips
|
||||
* through saveBlend/openBlend bytes only. */
|
||||
const client = new WebEngineClient({ timeoutMs: 10_000, nativeFiles: false });
|
||||
clients.push(client);
|
||||
return client;
|
||||
};
|
||||
|
||||
29
web/tests/fixtures/native-ui-workflow.ts
vendored
29
web/tests/fixtures/native-ui-workflow.ts
vendored
@@ -122,8 +122,33 @@ export class NativeUIWorkflow {
|
||||
await this.command(() => this.page.getByTestId("blend-file-input").setInputFiles(file));
|
||||
await expect(this.page.getByTestId("open-progress")).not.toBeVisible();
|
||||
const nativeToggle = this.page.getByTestId("native-web-tools-toggle");
|
||||
if (await nativeToggle.count()) await nativeToggle.click({ force: true });
|
||||
const item = this.page.getByRole("treeitem").filter({ hasText: object });
|
||||
/* The tree repeats object names on data-block and modifier-target rows;
|
||||
* only the object row carries its object id, so match on that. */
|
||||
const item = this.page.locator(`[role="treeitem"][aria-label="${object}"]:has([data-node-id]:not([data-node-id=""]))`);
|
||||
/* The web workbench (`?ui=web`) renders the tree directly and has no native
|
||||
* overlay to switch off, so the toggle step only applies to the desktop mode. */
|
||||
if (await nativeToggle.count()) {
|
||||
/* The desktop overlay renders only after the opened snapshot is applied, so
|
||||
* sample the switch late instead of right after the open response. */
|
||||
await expect.poll(async () => (await item.isVisible()) || (await nativeToggle.isVisible()), { timeout: 30_000 }).toBe(true);
|
||||
/* `force` would dispatch into the topbar while the overlay still sits at
|
||||
* its initial offset; wait for the toggle to actually receive events. */
|
||||
if (!(await item.isVisible())) await nativeToggle.click({ timeout: 30_000 });
|
||||
}
|
||||
/* Native Outliner rows exist only under open tree-store elements, so a
|
||||
* nested object stays hidden behind a collapsed branch exactly as it does
|
||||
* in desktop Blender for the same saved tree store (TSE_CLOSED). Expand
|
||||
* branches until the row is reachable, which is the desktop interaction. */
|
||||
for (let round = 0; round < 4 && !(await item.isVisible()); round++) {
|
||||
const collapsed = await this.page.locator('button.tree-expand[aria-label^="展开"]')
|
||||
.evaluateAll((buttons) => [...new Set(buttons.map((button) => button.getAttribute("aria-label") ?? ""))]);
|
||||
if (!collapsed.length) break;
|
||||
for (const label of collapsed) {
|
||||
if (await item.isVisible()) break;
|
||||
await this.page.locator(`button.tree-expand[aria-label="${label}"]`).click({ timeout: 5_000 }).catch(() => {});
|
||||
}
|
||||
}
|
||||
await expect(item).toBeVisible({ timeout: 30_000 });
|
||||
await item.click();
|
||||
await expect(item).toHaveAttribute("aria-selected", "true");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user