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

Function waitForNoRedbox

test/lib/next-test-utils.ts:904–927  ·  view source on GitHub ↗
(
  browser: Playwright,
  { waitInMs = 5000 }: { waitInMs?: number } = {}
)

Source from the content-addressed store, hash-verified

902}
903
904export async function waitForNoRedbox(
905 browser: Playwright,
906 { waitInMs = 5000 }: { waitInMs?: number } = {}
907) {
908 await waitFor(waitInMs)
909 const redbox = browser.locateRedbox()
910
911 if (await redbox.isVisible()) {
912 const [redboxHeader, redboxDescription, redboxSource] = await Promise.all([
913 getRedboxHeader(browser).catch(() => '<missing>'),
914 getRedboxDescription(browser).catch(() => '<missing>'),
915 getRedboxSource(browser).catch(() => '<missing>'),
916 ])
917
918 const error = new Error(
919 'Expected no visible Redbox but found one\n' +
920 `header: ${redboxHeader}\n` +
921 `description: ${redboxDescription}\n` +
922 `source: ${redboxSource}`
923 )
924 Error.captureStackTrace(error, waitForNoRedbox)
925 throw error
926 }
927}
928
929export async function waitForNoErrorToast(
930 browser: Playwright,

Callers 15

runTestsFunction · 0.90
runTestsFunction · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
index.test.tsFile · 0.90
runTestsFunction · 0.90
runTestsFunction · 0.90
runTestsFunction · 0.90
runTestsFunction · 0.90
runTestsFunction · 0.90
runTestsFunction · 0.90

Calls 7

getRedboxHeaderFunction · 0.85
locateRedboxMethod · 0.80
allMethod · 0.80
waitForFunction · 0.70
getRedboxDescriptionFunction · 0.70
getRedboxSourceFunction · 0.70
catchMethod · 0.45

Tested by 12

runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
runTestsFunction · 0.72
testPageFunction · 0.72
runTestsFunction · 0.72