fix(native)!: preserve incomplete native UI captures (#991)
* fix(native): preserve unknown accessibility child counts * fix(native): align helper buffer with capture budget * fix(native): align Swift helper JSON wire size * fix(native): bound raw helper output to scenario budget
This commit is contained in:
@@ -111,6 +111,37 @@ describe("native UI screenshot validation", () => {
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("preserves an unknown AX child count and its truncation gap", async () => {
|
||||
const partial = {
|
||||
...snapshot,
|
||||
nodes: [
|
||||
{
|
||||
path: [],
|
||||
role: "AXWindow",
|
||||
title: "Fixture",
|
||||
value: null,
|
||||
actions: [],
|
||||
children_count: null,
|
||||
},
|
||||
],
|
||||
truncated: true,
|
||||
gaps: ["AX child count unavailable at path []: AXError -25204"],
|
||||
};
|
||||
const result = await observeNativeUi(
|
||||
target,
|
||||
"observe_native_ui",
|
||||
{ ...scope, accessibility: true },
|
||||
{ invoke: async () => ({ ok: true, result: partial }) },
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok)
|
||||
expect(result.value.initial).toMatchObject({
|
||||
truncated: true,
|
||||
gaps: ["AX child count unavailable at path []: AXError -25204"],
|
||||
nodes: [{ children_count: null }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("native UI capture selection and budgets", () => {
|
||||
@@ -205,6 +236,27 @@ describe("native UI capture selection and budgets", () => {
|
||||
outcome: "cancelled",
|
||||
});
|
||||
});
|
||||
it("reports aggregate output exhaustion after individually valid captures", async () => {
|
||||
const largeSnapshot = {
|
||||
...snapshot,
|
||||
window: { ...snapshot.window, title: "x".repeat(17 * 1024 * 1024) },
|
||||
};
|
||||
const result = await observeNativeUi(
|
||||
target,
|
||||
"capture_native_ui_scenario",
|
||||
{
|
||||
...scope,
|
||||
steps: [{ kind: "wait", milliseconds: 0 }],
|
||||
},
|
||||
{ invoke: async () => ({ ok: true, result: largeSnapshot }) },
|
||||
);
|
||||
expect(result.ok).toBe(true);
|
||||
if (result.ok)
|
||||
expect(result.value.steps[0]).toMatchObject({
|
||||
outcome: "failed",
|
||||
reason: expect.stringContaining("64 MiB output budget"),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("native UI target and cancellation failures", () => {
|
||||
|
||||
Reference in New Issue
Block a user