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

Function shoot

e2e/scripts/record-connect-card.ts:74–98  ·  view source on GitHub ↗
(label: string, javaScriptEnabled: boolean, outPath: string)

Source from the content-addressed store, hash-verified

72const browser = await chromium.launch();
73
74const shoot = async (label: string, javaScriptEnabled: boolean, outPath: string): Promise<void> => {
75 const context = await browser.newContext({
76 colorScheme: "dark",
77 viewport: { width: 1280, height: 800 },
78 baseURL: baseUrl,
79 javaScriptEnabled,
80 });
81 await context.addCookies([{ name: cookieName!, value: cookieValue!, url: baseUrl }]);
82 const page = await context.newPage();
83 // Always wait for the stylesheet to land (networkidle) before shooting: it's
84 // render-blocking, so a real first paint already has `color-scheme: light
85 // dark` applied and shiki's light-dark() syntax colors resolve to the dark
86 // palette. Screenshotting at `commit` (pre-stylesheet) would instead capture
87 // the light palette — an artifact no user sees. JS stays disabled for the
88 // SSR shot only to freeze the pre-hydration origin (no client correction),
89 // not to skip CSS.
90 await visit(page, "/");
91 // The install command is the thing that flashes; screenshot just its block.
92 const command = page.locator('pre:has-text("add-mcp")').first();
93 await command.waitFor({ state: "visible", timeout: 15_000 });
94 const text = (await command.innerText()).replace(/\s+/g, " ").trim();
95 console.log(`${label}: ${text}`);
96 await command.screenshot({ path: outPath });
97 await context.close();
98};
99
100await shoot("ssr (first paint)", false, `${outPrefix}-ssr.png`);
101await shoot("hydrated", true, `${outPrefix}-hydrated.png`);

Callers 1

Calls 4

visitFunction · 0.90
logMethod · 0.80
replaceMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected