test(campaign): endurece locators de texto contra duplicata transitória de hidratação

Mesmo padrão já pinado em 'Otimista: 5.000': o slot server-composed
renderiza duas cópias por um instante durante a hidratação — .nth(0)
nas asserções de perfil (webauthn) e dossiê (municípios). Não relacionado
ao B176; observado deterministicamente no servidor de produção local.
This commit is contained in:
Francisco Solla 2026-08-09 03:09:36 -03:00
parent 14bbee6e00
commit 97dd13443e
2 changed files with 7 additions and 2 deletions

View file

@ -131,7 +131,9 @@ test.describe('Municípios — jornadas por papel', () => {
// B145: assessoria left the detail hero; it still appears on the dossiê tab.
await page.goto(`${campaign.baseURL}/campanha/municipios/${municipality.slug}?tab=dossie`)
await expect(page.getByText(`Assessoria: ${advisor.name}`)).toBeVisible()
// `.nth(0)`: same transient hydration duplicate the "Otimista: 5.000"
// assertion pins — the server-composed slot briefly renders twice.
await expect(page.getByText(`Assessoria: ${advisor.name}`).nth(0)).toBeVisible()
})
test('coordinator assigns an advisor from the list combobox with auto-save (B27)', async ({

View file

@ -74,7 +74,10 @@ test('enrolls a passkey, signs in with it, then revokes it', async ({
await expectCampaignBiometricsReady(page)
await page.goto('/campanha/perfil')
await expect(page.getByText('Nenhum aparelho cadastrado ainda.')).toBeVisible()
// `.nth(0)`: during hydration the server-composed slot can briefly coexist
// with its re-rendered copy (same transient duplicate the municipios spec
// pins for "Otimista: 5.000") — the copy settles to one element.
await expect(page.getByText('Nenhum aparelho cadastrado ainda.').nth(0)).toBeVisible()
const deviceLabel = page.getByLabel('Nome deste aparelho')
await expect(deviceLabel).toBeVisible()