| 902 | } |
| 903 | |
| 904 | export 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 | |
| 929 | export async function waitForNoErrorToast( |
| 930 | browser: Playwright, |