diff --git a/test/basic.test.ts b/test/basic.test.ts index abc51f220a..540a3c5cbc 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -2921,14 +2921,18 @@ describe('lazy import components', () => { }) it('handles time-based hydration correctly', async () => { - const { page } = await renderPage('/lazy-import-components/time') - const unhydratedText = 'This is not mounted.' - const hydratedText = 'This is mounted.' + const html = await $fetch('/lazy-import-components/time') + expect(html).toContain(unhydratedText) - await page.locator('[data-testid=hydrate-after]', { hasText: unhydratedText }).waitFor({ state: 'visible' }) + const { page, consoleLogs } = await renderPage('/lazy-import-components/time') + + const hydratedText = 'This is mounted.' await page.locator('[data-testid=hydrate-after]', { hasText: hydratedText }).waitFor({ state: 'visible' }) + const hydrationLogs = consoleLogs.filter(log => log.type !== 'warn') + expect(hydrationLogs.map(log => log.text)).toEqual([]) + await page.close() })