From a723a41794ac0bfbef7254eb586426d27b17e3d3 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 2 Aug 2026 00:38:25 +0000 Subject: [PATCH] =?UTF-8?q?fix(e2e):=20wait=20for=20drawer=20FULL=20snap;?= =?UTF-8?q?=20scope=20advisors=20trigger=20by=20munic=C3=ADpio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B109 fullscreen assert raced the snap animation in CI; B27 advisors button matched multiple rows — pin to the claimed municipality name. --- tests/e2e/campaignMunicipalities.e2e.spec.ts | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/e2e/campaignMunicipalities.e2e.spec.ts b/tests/e2e/campaignMunicipalities.e2e.spec.ts index 3df22418..e89e530a 100644 --- a/tests/e2e/campaignMunicipalities.e2e.spec.ts +++ b/tests/e2e/campaignMunicipalities.e2e.spec.ts @@ -115,7 +115,9 @@ test.describe('Municípios — jornadas por papel', () => { ) await expect(page.getByRole('heading', { name: 'Municípios', exact: true })).toBeVisible() - const advisorsTrigger = page.getByRole('button', { name: 'Editar assessores' }) + const advisorsTrigger = page.getByRole('button', { + name: new RegExp(`^Editar assessores em ${municipality.name}\\b`), + }) await advisorsTrigger.click() const advisorsPopover = page.locator('[data-slot="popover-content"]') @@ -506,14 +508,18 @@ test.describe('Municípios — bottom drawer polish (B109)', () => { const search = page.getByLabel('Buscar na campanha') await search.focus() await expect(page.getByRole('link', { name: 'Mudar tendência' })).toBeHidden() - + // Wait for the FULL snap to settle — measuring mid-animation flakes in CI + // (handle y hovered ~60–100px before the sheet finished covering the viewport). + await expect(page.locator('[data-snap="full"]')).toBeVisible() const handle = page.getByRole('button', { name: 'Ocultar ações rápidas' }) - const handleBox = await handle.boundingBox() - expect(handleBox).toBeTruthy() - // Fullscreen search docks the strip under the safe-area top bar; allow a - // few px of layout jitter (subpixel / font metrics) without losing the - // "near the top" assertion. - expect(handleBox!.y).toBeLessThan(48) + await expect + .poll(async () => { + const box = await handle.boundingBox() + return box?.y ?? Number.POSITIVE_INFINITY + }) + // Fullscreen docks under the safe-area top bar; allow a few px of layout + // jitter once the FULL snap has settled (mid-animation y hovered ~60–100). + .toBeLessThan(48) // Scope to the drawer: the município detail page also has a "Sugestões" region. const drawer = page.getByRole('dialog', { name: 'Ações rápidas' })