From 1d326a72ab8eb9ac7ec5bb919b02df33f94adf9b Mon Sep 17 00:00:00 2001 From: Francisco Solla Date: Sun, 9 Aug 2026 22:22:12 -0300 Subject: [PATCH] =?UTF-8?q?fix(C101):=20e2e=20mobile=20mira=20o=20primeiro?= =?UTF-8?q?=20.activity-agenda=20(FC=20mant=C3=A9m=20grids=20stale=20em=20?= =?UTF-8?q?transi=C3=A7=C3=B5es)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/e2e/campaignAgendaMobile.e2e.spec.ts | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/tests/e2e/campaignAgendaMobile.e2e.spec.ts b/tests/e2e/campaignAgendaMobile.e2e.spec.ts index 15982054..b01e102d 100644 --- a/tests/e2e/campaignAgendaMobile.e2e.spec.ts +++ b/tests/e2e/campaignAgendaMobile.e2e.spec.ts @@ -94,7 +94,8 @@ test.describe('C101 — agenda mobile com cara de app nativo', () => { // Navegação por arrasto: esquerda → dia seguinte; direita → volta. O // swipe direito começa longe da borda esquerda (x=0.4): um gesto que // nasça na borda é do Chrome (histórico), não da agenda. - const agendaBox = await page.locator('.activity-agenda').boundingBox() + // `.first()`: FC mantém grids de vista antigos no DOM durante transições. + const agendaBox = await page.locator('.activity-agenda').first().boundingBox() if (!agendaBox) throw new Error('Calendário não expôs área para o gesto de navegação.') const nextCivil = civilDatePlusDays(civilDate, 1) await touchSwipe(cdp, agendaBox, 0.8, 0.2) @@ -160,18 +161,21 @@ test.describe('C101 — agenda mobile com cara de app nativo', () => { // C101 — o grid de dia vira um scroller próprio (height fixa no mobile): // abre ancorado em 08:00 ("hoje é fixa em 08:00")... + // `.first()`: FC mantém grids de vista antigos no DOM durante transições. await expect .poll( () => page.evaluate(() => { - const scroller = [...document.querySelectorAll('.activity-agenda *')].find((el) => { - const style = getComputedStyle(el) - return ( - (style.overflowY === 'auto' || style.overflowY === 'scroll') && - el.scrollHeight > el.clientHeight && - el.querySelector('[role="rowheader"]') - ) - }) + const scroller = [...document.querySelector('.activity-agenda')!.querySelectorAll('*')].find( + (el) => { + const style = getComputedStyle(el) + return ( + (style.overflowY === 'auto' || style.overflowY === 'scroll') && + el.scrollHeight > el.clientHeight && + el.querySelector('[role="rowheader"]') + ) + }, + ) return scroller ? scroller.scrollTop : null }), { timeout: 15_000 }, @@ -183,7 +187,7 @@ test.describe('C101 — agenda mobile com cara de app nativo', () => { const colHeaderText = `${weekdayOf(civilDate)} ${Number(civilDate.slice(8, 10))}` const headerTop = () => page.evaluate((text) => { - const cell = [...document.querySelectorAll('.activity-agenda [role="columnheader"]')].find( + const cell = [...document.querySelector('.activity-agenda')!.querySelectorAll('[role="columnheader"]')].find( (el) => el.textContent?.includes(text), ) return cell ? Math.round(cell.getBoundingClientRect().top) : null @@ -193,14 +197,16 @@ test.describe('C101 — agenda mobile com cara de app nativo', () => { expect(headerBefore).not.toBeNull() const scrolledTo = await page.evaluate(() => { - const scroller = [...document.querySelectorAll('.activity-agenda *')].find((el) => { - const style = getComputedStyle(el) - return ( - (style.overflowY === 'auto' || style.overflowY === 'scroll') && - el.scrollHeight > el.clientHeight && - el.querySelector('[role="rowheader"]') - ) - }) + const scroller = [...document.querySelector('.activity-agenda')!.querySelectorAll('*')].find( + (el) => { + const style = getComputedStyle(el) + return ( + (style.overflowY === 'auto' || style.overflowY === 'scroll') && + el.scrollHeight > el.clientHeight && + el.querySelector('[role="rowheader"]') + ) + }, + ) if (!scroller) return false scroller.scrollTop = 300 return scroller.scrollTop