fix(test): use polling assertion for menu overflow timing

constrainMenuHeight runs via requestAnimationFrame, so the
max-height may not be applied when the test evaluates. Use
expect.poll and an extra nextFrame to wait for the constraint.
This commit is contained in:
dante01yoon
2026-04-09 05:42:24 +09:00
parent 6bff51807c
commit 1acef9ceba

View File

@@ -51,6 +51,9 @@ test.describe(
const menu = comfyPage.page.locator('.p-contextmenu')
await expect(menu).toBeVisible({ timeout: 3000 })
// Wait for constrainMenuHeight (runs via requestAnimationFrame in onMenuShow)
await comfyPage.nextFrame()
return menu
}
@@ -60,14 +63,16 @@ test.describe(
const menu = await openMoreOptions(comfyPage)
const rootList = menu.locator(':scope > ul')
const { clientHeight, scrollHeight } = await rootList.evaluate((el) => ({
clientHeight: el.clientHeight,
scrollHeight: el.scrollHeight
}))
expect(
scrollHeight,
'Menu should overflow vertically so this test exercises the viewport clamp'
).toBeGreaterThan(clientHeight)
await expect
.poll(
() => rootList.evaluate((el) => el.scrollHeight > el.clientHeight),
{
message:
'Menu should overflow vertically so this test exercises the viewport clamp',
timeout: 3000
}
)
.toBe(true)
// "Remove" is the last item in the More Options menu.
// It must become reachable by scrolling the bounded menu list.