From 0949ded18540f3d74160c0d082ecc3d668e1b9a3 Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Tue, 18 Aug 2026 00:46:17 -0300 Subject: [PATCH] =?UTF-8?q?fix(e2e=20S1):=20warm-up=20na=20home=20ap=C3=B3?= =?UTF-8?q?s=20revalidateTag=20(ISR=20pode=20servir=20stale=20uma=20vez)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sob a suíte completa em paralelo, a regeneração pós-revalidate às vezes servia a página velha uma vez; o DOM carregado nunca refrescava e o assert de cleanup falhava (1 flaky no gate). Requisição GET de warm-up entre o revalidate e o goto torna o estado determinístico. --- tests/e2e/frontend.e2e.spec.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/e2e/frontend.e2e.spec.ts b/tests/e2e/frontend.e2e.spec.ts index ff5bce61..a96df3ac 100644 --- a/tests/e2e/frontend.e2e.spec.ts +++ b/tests/e2e/frontend.e2e.spec.ts @@ -481,6 +481,13 @@ test.describe('Campaign home content section', () => { return doc } + // ISR serves the stale page once while it regenerates after a revalidateTag + // (slower under the parallel suite). A warm-up GET triggers that + // regeneration so the navigation that follows always lands on fresh HTML. + const warmHome = async (request: APIRequestContext) => { + await request.get(`${baseURL}/`).catch(() => undefined) + } + test('hides the content section while no articles are visible', async ({ page, request }) => { // The dev server persists its `posts` cache to .next-e2e/cache/fetch-cache // between runs, so an earlier full-state run could leave it populated. @@ -490,6 +497,7 @@ test.describe('Campaign home content section', () => { headers: { 'x-revalidate-secret': revalidateSecret }, }) .catch(() => undefined) + await warmHome(request) await page.goto('/') await expect(page).toHaveURL(/\/$/) @@ -565,6 +573,9 @@ test.describe('Campaign home content section', () => { try { await page.setViewportSize({ width: 1280, height: 900 }) + // The create hooks revalidated the `posts` tag in the server process; + // warm the home so the navigation lands on the regenerated page. + await warmHome(request) await page.goto('/') const section = page.locator('[data-home-section="contents"]') await expect(section).toBeVisible() @@ -652,6 +663,7 @@ test.describe('Campaign home content section', () => { // Converge the persisted dev cache back to the empty state so the // next run starts deterministic (fail-closed on delete, too). + await warmHome(request) await page.setViewportSize({ width: 1280, height: 900 }) await page.goto('/') await expect(page.locator('[data-home-section="contents"]')).toHaveCount(0)