Merge pull request #279 from fsolla/cursor/fix-e2e-b109-sugestoes

OPS — Fix e2e FAB chrome waits and B27 advisor strict-mode
This commit is contained in:
Francisco Solla 2026-08-02 17:57:07 -03:00 committed by GitHub
commit eb2b7791a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 3 deletions

View file

@ -79,8 +79,14 @@ export const E2E_AFFECTED_MANIFEST = [
'src/utilities/campaignDashboardData',
'src/lib/campaignHomeSearchHits',
'src/lib/homeSearchShare',
'src/lib/homeSearchExcludeCurrentEntity',
'src/lib/homeSearchNearestMunicipalityMerge',
'src/lib/homeSearchSuggest',
'src/lib/homeSearchUi',
],
specs: ['campaignHomeActions'],
// Home search suggest/exclude is exercised on municipality detail (B109)
// as well as the home action suite.
specs: ['campaignHomeActions', 'campaignMunicipalities'],
},
{
prefixes: [

View file

@ -94,7 +94,11 @@ test.describe('Municípios — jornadas por papel', () => {
)
await expect(campaignPageChrome(page, 'Municípios')).toBeVisible()
const advisorsTrigger = page.getByRole('button', { name: 'Editar assessores' }).first()
// Name includes the município — a substring search can return neighbors
// (strict-mode flake when two "Editar assessores …" buttons match).
const advisorsTrigger = page.getByRole('button', {
name: `Editar assessores em ${municipality.name}`,
})
await advisorsTrigger.click()
const advisorsPopover = page.locator('[data-slot="popover-content"]')
@ -119,12 +123,24 @@ test.describe('Municípios — jornadas por papel', () => {
// The popover stays open after the write (auto-save, not submit+close).
await expect(advisorsPopover).toBeVisible()
// Trigger label flips from "sem assessor" only after the write lands —
// wait for that before Escape/reload so we do not race optimistic chips.
await expect(
page.getByRole('button', {
name: `Editar assessores em ${municipality.name} — ${advisor.name}`,
}),
).toBeVisible()
await page.keyboard.press('Escape')
// Persistence: reload and reopen to confirm the server, not just local
// state, now holds the assignment.
await page.reload()
await page.getByRole('button', { name: 'Editar assessores' }).first().click()
await expect(campaignPageChrome(page, 'Municípios')).toBeVisible()
await page
.getByRole('button', {
name: `Editar assessores em ${municipality.name} — ${advisor.name}`,
})
.click()
await expect(
page.locator('[data-slot="popover-content"]').getByRole('button', {
name: `Remover ${advisor.name}`,
@ -498,6 +514,7 @@ test.describe('Municípios — FAB overlay polish (B126)', () => {
await suggestResponse
await expect(overlay.getByRole('link', { name: 'Registrar sinal' })).toBeHidden()
// Overlay scopes search suggest — list page has no E11 SuggestionsPanel.
await expect(overlay.getByRole('region', { name: 'Sugestões' })).toBeVisible()
})
})