(
page: import("puppeteer-core").Page,
times: number[],
selectors: string[],
livenessScopes: string[],
)
| 366 | } |
| 367 | |
| 368 | async function collectMotionFrames( |
| 369 | page: import("puppeteer-core").Page, |
| 370 | times: number[], |
| 371 | selectors: string[], |
| 372 | livenessScopes: string[], |
| 373 | ): Promise<MotionFrame[]> { |
| 374 | const frames: MotionFrame[] = []; |
| 375 | for (const time of times) { |
| 376 | await seekTo(page, time); |
| 377 | const sample = await page.evaluate( |
| 378 | (options: { selectors: string[]; livenessScopes: string[] }) => { |
| 379 | const win = window as unknown as { |
| 380 | __hyperframesMotionSample?: (o: { selectors: string[]; livenessScopes: string[] }) => { |
| 381 | data: MotionFrame["data"]; |
| 382 | liveness: Record<string, string>; |
| 383 | }; |
| 384 | }; |
| 385 | return win.__hyperframesMotionSample?.(options) ?? { data: {}, liveness: {} }; |
| 386 | }, |
| 387 | { selectors, livenessScopes }, |
| 388 | ); |
| 389 | frames.push({ time, data: sample.data, liveness: sample.liveness }); |
| 390 | } |
| 391 | return frames; |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Motion verification (#1437): sample the asserted selectors on a dense grid |
no test coverage detected