S1 — Seção de conteúdos na home de campanha — Artigos #29

Merged
fsolla merged 4 commits from S1-secao-de-conteudos-na-home-de-campanha-artigos into main 2026-08-18 05:07:27 +00:00
Showing only changes of commit 0949ded185 - Show all commits

View file

@ -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)