diff --git a/tests/playwright/site-full.spec.js b/tests/playwright/site-full.spec.js index 70eabf3c..854fec20 100644 --- a/tests/playwright/site-full.spec.js +++ b/tests/playwright/site-full.spec.js @@ -159,9 +159,23 @@ test('home', async ({ page }) => { const errors = trackErrors(page); const entries = []; - await page.goto(server.baseUrl + '/sx/', { waitUntil: 'domcontentloaded', timeout: 30000 }); + // Capture SSR state before JS runs — detect hydration flash + const ssrResponse = await page.goto(server.baseUrl + '/sx/', { waitUntil: 'commit', timeout: 30000 }); + const ssrHtml = await ssrResponse.text(); + const ssrMatch = ssrHtml.match(/tabular-nums[^>]*>(\d+) \/ (\d+)<\/span>/); + const ssrIndex = ssrMatch ? ssrMatch[1] : null; + + // Wait for hydration await waitForSxReady(page); + // Check post-hydration index + const hydratedIndex = await page.evaluate(() => { + const m = document.body.textContent.match(/(\d+)\s*\/\s*16/); + return m ? m[1] : null; + }); + const noFlash = ssrIndex === hydratedIndex; + entries.push({ ok: noFlash, label: `No flash: SSR=${ssrIndex} hydrated=${hydratedIndex}`, feature: 'no-flash' }); + const info = await discoverPage(page); entries.push({ ok: true, label: 'Boot: data-sx-ready', feature: 'boot' });