MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / run

Function run

e2e/desktop-vm/console-renders.test.ts:30–61  ·  view source on GitHub ↗
(runDir: string)

Source from the content-addressed store, hash-verified

28 : "macos";
29
30const run = async (runDir: string) => {
31 const cdp = await CdpPage.connect(await pageWsUrl(Number(cdpPort)));
32 try {
33 await cdp.command("Runtime.enable");
34 await cdp.command("Page.enable");
35
36 // Film the console while we drive it (OS-aware capture lands a playable mp4).
37 const recording = recordGuestScreen(
38 guestIp as string,
39 recSeconds,
40 join(runDir, "session.mp4"),
41 os,
42 );
43
44 // Reaching the nav proves the packaged bundle booted and connected to its
45 // daemon on this OS.
46 await cdp.waitForText("Integrations", 60_000).catch(() => cdp.waitForText("Settings", 60_000));
47 writeFileSync(join(runDir, "01-console-rendered.png"), await cdp.screenshot());
48
49 const body = await cdp.command<{ result?: { value?: string } }>("Runtime.evaluate", {
50 expression: "document.body.innerText",
51 returnByValue: true,
52 });
53 expect(body.result?.value ?? "", "the packaged console rendered its nav").toContain(
54 "Integrations",
55 );
56
57 await recording;
58 } finally {
59 cdp.close();
60 }
61};
62
63if (!cdpPort || !guestIp) {
64 it.skip(`${NAME} (needs a desktop guest — set E2E_DESKTOP_VM_IP or run the desktop-<os> project)`, () => {});

Callers 1

Calls 4

pageWsUrlFunction · 0.90
recordGuestScreenFunction · 0.90
connectMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected