mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-25 11:13:09 +00:00
fix(e2e S1): warm-up na home após revalidateTag (ISR pode servir stale uma vez)
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.
This commit is contained in:
parent
41dbb564c6
commit
5c48329011
1 changed files with 12 additions and 0 deletions
|
|
@ -481,6 +481,13 @@ test.describe('Campaign home content section', () => {
|
||||||
return doc
|
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 }) => {
|
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
|
// 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.
|
// 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 },
|
headers: { 'x-revalidate-secret': revalidateSecret },
|
||||||
})
|
})
|
||||||
.catch(() => undefined)
|
.catch(() => undefined)
|
||||||
|
await warmHome(request)
|
||||||
|
|
||||||
await page.goto('/')
|
await page.goto('/')
|
||||||
await expect(page).toHaveURL(/\/$/)
|
await expect(page).toHaveURL(/\/$/)
|
||||||
|
|
@ -565,6 +573,9 @@ test.describe('Campaign home content section', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await page.setViewportSize({ width: 1280, height: 900 })
|
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('/')
|
await page.goto('/')
|
||||||
const section = page.locator('[data-home-section="contents"]')
|
const section = page.locator('[data-home-section="contents"]')
|
||||||
await expect(section).toBeVisible()
|
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
|
// Converge the persisted dev cache back to the empty state so the
|
||||||
// next run starts deterministic (fail-closed on delete, too).
|
// next run starts deterministic (fail-closed on delete, too).
|
||||||
|
await warmHome(request)
|
||||||
await page.setViewportSize({ width: 1280, height: 900 })
|
await page.setViewportSize({ width: 1280, height: 900 })
|
||||||
await page.goto('/')
|
await page.goto('/')
|
||||||
await expect(page.locator('[data-home-section="contents"]')).toHaveCount(0)
|
await expect(page.locator('[data-home-section="contents"]')).toHaveCount(0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue