refactor(browser): scope CDP sessions and harden stale target recovery

This commit is contained in:
Peter Steinberger
2026-03-08 19:52:23 +00:00
parent a6131438ea
commit a075baba84
15 changed files with 469 additions and 99 deletions

View File

@@ -112,7 +112,9 @@ describe("createProfileResetOps", () => {
});
expect(isHttpReachable).toHaveBeenCalledWith(300);
expect(stopRunningBrowser).toHaveBeenCalledTimes(1);
expect(pwAiMocks.closePlaywrightBrowserConnection).toHaveBeenCalledTimes(1);
expect(pwAiMocks.closePlaywrightBrowserConnection).toHaveBeenCalledWith({
cdpUrl: "http://127.0.0.1:18800",
});
expect(trashMocks.movePathToTrash).toHaveBeenCalledWith(profileDir);
});
@@ -132,5 +134,11 @@ describe("createProfileResetOps", () => {
await ops.resetProfile();
expect(stopRunningBrowser).not.toHaveBeenCalled();
expect(pwAiMocks.closePlaywrightBrowserConnection).toHaveBeenCalledTimes(2);
expect(pwAiMocks.closePlaywrightBrowserConnection).toHaveBeenNthCalledWith(1, {
cdpUrl: "http://127.0.0.1:18800",
});
expect(pwAiMocks.closePlaywrightBrowserConnection).toHaveBeenNthCalledWith(2, {
cdpUrl: "http://127.0.0.1:18800",
});
});
});