MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / collectLayoutIssues

Function collectLayoutIssues

packages/cli/src/commands/layout.ts:323–346  ·  view source on GitHub ↗
(
  page: import("puppeteer-core").Page,
  samples: number[],
  tolerance: number,
)

Source from the content-addressed store, hash-verified

321}
322
323async function collectLayoutIssues(
324 page: import("puppeteer-core").Page,
325 samples: number[],
326 tolerance: number,
327): Promise<LayoutIssue[]> {
328 if (samples.length === 0) return [];
329 await page.addScriptTag({ content: loadLayoutAuditScript() });
330
331 const issues: LayoutIssue[] = [];
332 for (const time of samples) {
333 await seekTo(page, time);
334 const sampleIssues = await page.evaluate(
335 (auditOptions: { time: number; tolerance: number }) => {
336 const win = window as unknown as {
337 __hyperframesLayoutAudit?: (options: { time: number; tolerance: number }) => unknown[];
338 };
339 return win.__hyperframesLayoutAudit?.(auditOptions) ?? [];
340 },
341 { time, tolerance },
342 );
343 issues.push(...(sampleIssues as LayoutIssue[]));
344 }
345 return issues;
346}
347
348/** Reject selectors matching multiple elements — first-match-only sampling silently passes for siblings. */
349async function findAmbiguousSelectors(

Callers 1

runLayoutAuditFunction · 0.85

Calls 3

loadLayoutAuditScriptFunction · 0.85
evaluateMethod · 0.80
seekToFunction · 0.70

Tested by

no test coverage detected