MCPcopy
hub / github.com/vercel/next.js / beforePageLoad

Function beforePageLoad

test/e2e/app-dir/next-image/next-image-https.test.ts:18–32  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

16 let failCount = 0
17 const browser = await next.browser('/', {
18 beforePageLoad(page) {
19 page.on('response', (response) => {
20 const url = response.url()
21 if (!url.includes('/_next/image')) return
22
23 const status = response.status()
24
25 console.log(`URL: ${url} Status: ${status}`)
26
27 if (!response.ok()) {
28 console.log(`Request failed: ${url}`)
29 failCount++
30 }
31 })
32 },
33 })
34 const image = browser.elementByCss('#app-page')
35 const src = await image.getAttribute('src')

Callers

nothing calls this directly

Calls 6

includesMethod · 0.80
urlMethod · 0.65
okMethod · 0.65
onMethod · 0.45
statusMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected