| 88 | const HYDRATION_TIMEOUT_MS = 10_000; |
| 89 | |
| 90 | export const hydrated = async (page: Page): Promise<void> => { |
| 91 | await page |
| 92 | .waitForFunction( |
| 93 | () => |
| 94 | [...document.body.children].some((element) => |
| 95 | Object.keys(element).some((key) => key.startsWith("__reactContainer$")), |
| 96 | ), |
| 97 | undefined, |
| 98 | { timeout: HYDRATION_TIMEOUT_MS }, |
| 99 | ) |
| 100 | // oxlint-disable-next-line executor/no-promise-catch -- boundary: a page with no React root is a legitimate destination |
| 101 | .catch(() => {}); |
| 102 | }; |
| 103 | |
| 104 | /** |
| 105 | * Navigate, then wait for the page to be interactive. The drop-in for a `goto` |