MCPcopy Index your code
hub / github.com/tinyplex/tinybase / prepareFirstFrame

Function prepareFirstFrame

test/e2e/doc-shots.test.ts:20–56  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

18};
19
20const prepareFirstFrame = async (page: Page): Promise<void> => {
21 const iframe = page.locator('iframe').first();
22 await expect(iframe).toBeVisible();
23 const frame = await getFirstFrame(page);
24 if (frame == null) {
25 return;
26 }
27 await frame.waitForLoadState();
28 const {height, width} = await frame.evaluate(() => {
29 const {documentElement, body} = document;
30 return {
31 height: Math.max(
32 documentElement.clientHeight,
33 documentElement.scrollHeight,
34 body?.scrollHeight ?? 0,
35 ),
36 width: Math.max(
37 documentElement.clientWidth,
38 documentElement.scrollWidth,
39 body?.scrollWidth ?? 0,
40 ),
41 };
42 });
43 await iframe.evaluate(
44 (element, {height, width}) => {
45 element.style.height = `${height}px`;
46 element.style.maxHeight = 'none';
47 element.style.width = `${width}px`;
48 element.style.maxWidth = 'none';
49 element.style.border = '0';
50 element.style.outline = '0';
51 element.style.boxShadow = 'none';
52 element.style.overflow = 'hidden';
53 },
54 {height: Math.max(height, FRAMED_DOC_SHOT_MIN_HEIGHT), width},
55 );
56};
57
58const applyDocShotStyle = async (
59 page: Page,

Callers 1

expectDocShotFunction · 0.85

Calls 1

getFirstFrameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…