| 879 | } |
| 880 | |
| 881 | export async function waitForRedbox(browser: Playwright) { |
| 882 | const redbox = browser.locateRedbox() |
| 883 | try { |
| 884 | await redbox.waitFor({ timeout: 5000 }) |
| 885 | } catch (errorCause) { |
| 886 | const error = new Error('Expected Redbox but found no visible one.') |
| 887 | Error.captureStackTrace(error, waitForRedbox) |
| 888 | throw error |
| 889 | } |
| 890 | |
| 891 | try { |
| 892 | await redbox |
| 893 | .locator('[data-nextjs-error-suspended]') |
| 894 | .waitFor({ state: 'detached', timeout: 10000 }) |
| 895 | } catch (cause) { |
| 896 | const error = new Error('Redbox still had suspended content after 10s', { |
| 897 | cause, |
| 898 | }) |
| 899 | Error.captureStackTrace(error, waitForRedbox) |
| 900 | throw error |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | export async function waitForNoRedbox( |
| 905 | browser: Playwright, |