test: tighten browser snapshot cdp assertion

This commit is contained in:
Shakker
2026-05-10 22:31:12 +01:00
parent 50c1b8405f
commit 6bd6ff25be

View File

@@ -52,12 +52,12 @@ describe("pw-tools-core aria snapshot storage", () => {
expect(result).toEqual({ nodes: formattedNodes });
expect(getPageForTargetId).toHaveBeenCalledTimes(1);
expect(ensurePageState).toHaveBeenCalledWith(page);
expect(withPageScopedCdpClient).toHaveBeenCalledWith({
cdpUrl: "http://127.0.0.1:9222",
page,
targetId: "tab-1",
fn: expect.any(Function),
});
expect(withPageScopedCdpClient).toHaveBeenCalledTimes(1);
const scopedClientOptions = withPageScopedCdpClient.mock.calls[0]?.[0];
expect(scopedClientOptions?.cdpUrl).toBe("http://127.0.0.1:9222");
expect(scopedClientOptions?.page).toBe(page);
expect(scopedClientOptions?.targetId).toBe("tab-1");
expect(typeof scopedClientOptions?.fn).toBe("function");
expect(markBackendDomRefsOnPage).toHaveBeenCalledWith({
page,
refs: [{ ref: "ax1", backendDOMNodeId: 42 }],