fix(browser): limit retained action screenshots

This commit is contained in:
ZacharyZhang-NY committed 2026-05-15 02:21:16 -04:00
1 parent b5a6a1a9ea
commit 9d4af15d4b
4 files changed
+67 -6

No files matched your search

+27
View File
@@ -4,6 +4,7 @@ import {
assertAuthenticatedPage,
assertAuthenticatedSession,
} from "../../src/main/browser/browser-action-auth";
import { shouldCaptureSuccessScreenshot } from "../../src/main/browser/browser-screenshot-policy";
import { getPlatformSelectors } from "../../src/main/browser/platform-selectors";
function fakeSession(cookiesByOrigin: Record<string, unknown[]>): Pick<Session, "cookies"> {
@@ -62,4 +63,30 @@ describe("browser action runtime guards", () => {
expect(linkedin.composerOpen).toContain("button.share-box-feed-entry__trigger");
expect(linkedin.editor).toContain(".ql-editor[contenteditable='true']");
});
it("captures successful screenshots only for explicit screenshot requests", () => {
expect(shouldCaptureSuccessScreenshot({
id: "post-1",
socialAccountId: "social-1",
platform: "twitter",
actionType: "post",
payload: { content: "hello" },
})).toBe(false);
expect(shouldCaptureSuccessScreenshot({
id: "screenshot-1",
socialAccountId: "social-1",
platform: "twitter",
actionType: "screenshot",
payload: {},
})).toBe(true);
expect(shouldCaptureSuccessScreenshot({
id: "post-2",
socialAccountId: "social-1",
platform: "twitter",
actionType: "post",
payload: { content: "hello", captureSuccessScreenshot: true },
})).toBe(true);
});
});