feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification * feat(native): add inspection primitives, dispatch traces and approved UI observation * test: prioritize real artifact E2E and captured golden regressions * fix(process): queue observed output before reactive rendering actions * test: prune redundant cases and strengthen boundary assertions * fix(cli): route native value tracing through shared workflows * test: replace synthetic success with real workflows and captured data * fix(catalog): separate portable metadata from native host availability
This commit is contained in:
@@ -189,28 +189,6 @@ class FakeSession implements BrowserScenarioSessionPort {
|
||||
}
|
||||
|
||||
describe("PlaywrightBrowserScenarioProvider", () => {
|
||||
it("captures initial and action steps and closes its launched session", async () => {
|
||||
const session = new FakeSession("launch");
|
||||
const provider = new PlaywrightBrowserScenarioProvider({
|
||||
open: () => Promise.resolve(session),
|
||||
});
|
||||
const result = await provider.captureScenario(scenario());
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.value.steps.map(({ step_index }) => step_index)).toEqual([
|
||||
0, 1,
|
||||
]);
|
||||
expect(result.value.browser).toMatchObject({
|
||||
process_ownership: "provider-owned",
|
||||
cleanup: "terminated-owned-process",
|
||||
});
|
||||
expect(result.value.completeness).toMatchObject({
|
||||
status: "complete",
|
||||
equality_eligible: true,
|
||||
});
|
||||
expect(session.closeCalls).toBe(1);
|
||||
});
|
||||
|
||||
it("returns an initial state and every step beyond the former action ceiling", async () => {
|
||||
const session = new FakeSession("launch");
|
||||
const provider = new PlaywrightBrowserScenarioProvider({
|
||||
|
||||
@@ -39,31 +39,3 @@ it("returns a complete requested text artifact beyond the former inline ceiling"
|
||||
value: { bytes: 16 * 1_024 * 1_024 + 1 },
|
||||
});
|
||||
});
|
||||
|
||||
it("wraps URL, history, and storage snapshots in the capture state contract", async () => {
|
||||
const page = {
|
||||
url: () => "https://app.example.test/path?token=secret",
|
||||
evaluate: async (expression: string) =>
|
||||
expression.includes("window.history.length")
|
||||
? {
|
||||
length: 2,
|
||||
navigation_entries: [
|
||||
{ type: "navigate", name: "https://app.example.test/path" },
|
||||
],
|
||||
}
|
||||
: { local_storage: [], session_storage: [] },
|
||||
} as unknown as Page;
|
||||
const context = { cookies: async () => [] } as unknown as BrowserContext;
|
||||
|
||||
const result = await capturePlaywrightStepArtifacts({
|
||||
context,
|
||||
page,
|
||||
scenario,
|
||||
secrets,
|
||||
requested: new Set(["url", "history", "storage"]),
|
||||
});
|
||||
|
||||
expect(result.url.state).toBe("captured");
|
||||
expect(result.history.state).toBe("captured");
|
||||
expect(result.storage.state).toBe("captured");
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { deflateSync } from "node:zlib";
|
||||
import { crc32, deflateSync } from "node:zlib";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
@@ -111,5 +111,9 @@ const chunk = (type: string, data: Buffer): Buffer => {
|
||||
result.writeUInt32BE(data.byteLength, 0);
|
||||
result.write(type, 4, 4, "ascii");
|
||||
data.copy(result, 8);
|
||||
result.writeUInt32BE(
|
||||
crc32(result.subarray(4, 8 + data.byteLength)),
|
||||
8 + data.byteLength,
|
||||
);
|
||||
return result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user