fix(e2e): agenda — waits de visibilidade para medir o slot do calendário (estabiliza inline/mais detalhes)

This commit is contained in:
Francisco Solla 2026-08-09 02:59:17 -03:00
parent 340407c758
commit 6c631bdeec

View file

@ -168,10 +168,14 @@ test.describe('Agenda — calendário operacional', () => {
const dayCell = page.getByRole('gridcell').nth(1) const dayCell = page.getByRole('gridcell').nth(1)
await dayCell.scrollIntoViewIfNeeded() await dayCell.scrollIntoViewIfNeeded()
const [slotBox, dayBox] = await Promise.all([ // FullCalendar renders the time axis lazily and re-lays out on mount —
page.locator('[data-time="14:00:00"]').last().boundingBox(), // wait for both targets to be attached+visible before measuring, or the
dayCell.boundingBox(), // bounding boxes race the grid render.
]) const slotLocator = page.locator('[data-time="14:00:00"]:visible').last()
await expect(slotLocator).toBeVisible()
await expect(dayCell).toBeVisible()
const slotBox = await slotLocator.boundingBox()
const dayBox = await dayCell.boundingBox()
if (!slotBox || !dayBox) throw new Error('A grade semanal não expôs o slot esperado.') if (!slotBox || !dayBox) throw new Error('A grade semanal não expôs o slot esperado.')
await dayCell.click({ await dayCell.click({
position: { position: {
@ -216,10 +220,11 @@ test.describe('Agenda — calendário operacional', () => {
const dayCell = page.getByRole('gridcell').nth(1) const dayCell = page.getByRole('gridcell').nth(1)
await dayCell.scrollIntoViewIfNeeded() await dayCell.scrollIntoViewIfNeeded()
const [slotBox, dayBox] = await Promise.all([ const slotLocator = page.locator('[data-time="14:00:00"]:visible').last()
page.locator('[data-time="14:00:00"]').last().boundingBox(), await expect(slotLocator).toBeVisible()
dayCell.boundingBox(), await expect(dayCell).toBeVisible()
]) const slotBox = await slotLocator.boundingBox()
const dayBox = await dayCell.boundingBox()
if (!slotBox || !dayBox) throw new Error('A grade semanal não expôs o slot esperado.') if (!slotBox || !dayBox) throw new Error('A grade semanal não expôs o slot esperado.')
await dayCell.click({ await dayCell.click({
position: { position: {