Remove o botão Salvar da lista de municípios; grava via POST political-trend sem revalidar a lista, com flush coalescido e feedback na célula.
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { expect, test } from '@playwright/test'
|
|
|
|
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000'
|
|
|
|
test('prewarms shared Next route bundles sequentially', async ({ request }) => {
|
|
test.slow()
|
|
for (const path of [
|
|
'/campanha/login',
|
|
'/campanha/municipios',
|
|
'/campanha/territorios',
|
|
'/campanha/municipios/e2e-prewarm',
|
|
'/campanha/demandas',
|
|
'/campanha/conceitos',
|
|
'/campanha/convite/e2e-prewarm',
|
|
'/',
|
|
]) {
|
|
const response = await request.get(`${baseURL}${path}`)
|
|
expect(response.ok(), `Failed to prewarm ${path}`).toBe(true)
|
|
}
|
|
|
|
// POST-only API route handlers (auto-save popovers): Next dev compiles a
|
|
// route on its first hit, and that compile can trigger a full-page reload
|
|
// for any client currently connected — which aborts an in-flight fetch mid
|
|
// test. An unauthenticated POST never succeeds, but it still forces the
|
|
// compile before any spec's client makes the real request.
|
|
for (const path of [
|
|
'/campanha/municipios/advisors',
|
|
'/campanha/municipios/expected-votes',
|
|
'/campanha/municipios/political-trend',
|
|
]) {
|
|
await request.post(`${baseURL}${path}`, { data: {} }).catch(() => undefined)
|
|
}
|
|
})
|