// A FAKE BROWSER FOR "Refresh cookies" AND "Connect X account", for the // editor's e2e suite only // (E2E_FAKE_X_PROFILE_COOKIES_FILE, set per slot by editor/e2e/servers.ts). // refreshXCookies (xSessionBroker.ts) takes a `chromium`; under the test server // it is handed this one, whose persistent context hands back the cookies a // spec wrote into the file (after its `delayMs`, so a spec can watch the press // run and be refused a second time) and whose page loads nothing — no browser // starts and nothing is asked of X. Connect's "window" closes by itself after // `closeAfterMs` (the human closing it), and the cookies are exported as from // a login. Everything after the browser (the jar written, the login check, the // status) is the real code. // // INERT ON A REAL EDITOR, three ways: it answers null unless the process is the // e2e test server (E2E_TEST_ROUTES=1, which editor/playwright.config.ts sets on // its server and nothing else does), unless the variable names a file INSIDE // this process's transcriptsDir (a slot's test data), and unless that file // exists (a spec writes it). The file holds SYNTHETIC cookies only: // { "delayMs"?: number, "closeAfterMs"?: number, "fail"?: string, // "cookies": [{ name, value, domain, path?, expires? }], // "trending"?: { href?, load: [{url, status, body?, text?}], scrolls: [[…], …], // tabs?: { "