Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): capture headed browser tabs while macOS is locked #27092

Closedmhodgson(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/27092/headopened View on GitHub

Showing 6 changed files with 101 additions and 2 deletions (loading 3).

x
0 of 6 viewed, 6 left
46 additions and 0 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -1,6 +1,7 @@
// @effect-diagnostics nodeBuiltinImport:off - Stands in for an Electron debugger.
import { describe, expect, it, vi } from "@effect/vitest";
import { DesktopBrowserEvent } from "@t3tools/contracts";
+import * as HostProcess from "@t3tools/shared/HostProcess";
import * as Effect from "effect/Effect";
import * as Fiber from "effect/Fiber";
import * as Queue from "effect/Queue";
@@ -73,6 +74,13 @@
getURL: () => "http://localhost/",
getTitle: () => "Page",
getUserAgent: () => "Electron",
+ capturePage: async () => {
+ await debuggee.sendCommand("Page.captureScreenshot");
+ return {
+ toPNG: () => Buffer.from("native png"),
+ toJPEG: () => Buffer.from("native jpeg"),
+ };
+ },
});
return {
tab: {
@@ -134,6 +142,44 @@
});
​
describe("DesktopBrowserHost", () => {
+ it.effect.each(["darwin", "linux"] as const)(
+ "uses native viewport capture only on macOS (%s)",
+ (platform) =>