diff --git a/test/basic.test.ts b/test/basic.test.ts index 9e72ec4db3..e826bca631 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -2924,14 +2924,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<string>('/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() })