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

Function stabilizeDocShot

test/e2e/doc-shots.test.ts:105–127  ·  view source on GitHub ↗
(
  page: Page,
  shot: {fixedText?: string; fixedTextSelector?: string},
)

Source from the content-addressed store, hash-verified

103};
104
105const stabilizeDocShot = async (
106 page: Page,
107 shot: {fixedText?: string; fixedTextSelector?: string},
108): Promise<void> => {
109 if (shot.fixedText == null || shot.fixedTextSelector == null) {
110 return;
111 }
112 const frame = await getFirstFrame(page);
113 await frame?.evaluate(
114 ({selector, text}) => {
115 const maxTimerId = window.setTimeout(() => {}, 0);
116 for (let id = 0; id <= maxTimerId; id++) {
117 clearInterval(id);
118 clearTimeout(id);
119 }
120 const element = document.querySelector<HTMLElement>(selector);
121 if (element != null) {
122 element.textContent = text;
123 }
124 },
125 {selector: shot.fixedTextSelector, text: shot.fixedText},
126 );
127};
128
129const waitForDocShotImages = async (
130 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…