MCPcopy Index your code
hub / github.com/primer/react / waitForImages

Function waitForImages

e2e/test-helpers/waitForImages.ts:8–23  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

6 * development as there is always a connection listening for updates.
7 */
8export async function waitForImages(page: Page) {
9 await page.evaluate(async () => {
10 const images = Array.from(document.querySelectorAll('img'))
11 await Promise.all(
12 images.map(img => {
13 if (img.complete) {
14 return
15 }
16 return new Promise((resolve, reject) => {
17 img.addEventListener('load', resolve)
18 img.addEventListener('error', reject)
19 })
20 }),
21 )
22 })
23}

Callers 1

visitFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected