From 4f6022dc581764f608d113e6c8481bc468e33ae6 Mon Sep 17 00:00:00 2001 From: dante01yoon Date: Wed, 1 Apr 2026 10:12:56 +0900 Subject: [PATCH] fix(test): use scrollTop on container instead of scrollIntoViewIfNeeded VirtualGrid virtualizes DOM nodes, so locating the last [data-virtual-grid-item] is unstable during scroll. Set scrollTop on the overflow-y-auto container directly to reliably reach the end. --- browser_tests/tests/sidebar/assets.spec.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/browser_tests/tests/sidebar/assets.spec.ts b/browser_tests/tests/sidebar/assets.spec.ts index 3330a5712b..61534fd34a 100644 --- a/browser_tests/tests/sidebar/assets.spec.ts +++ b/browser_tests/tests/sidebar/assets.spec.ts @@ -670,12 +670,16 @@ test.describe('Assets sidebar - pagination', () => { { timeout: 10_000 } ) - // Scroll the VirtualGrid container to the bottom to trigger the - // approach-end event, which calls loadMoreHistory() in production. - const scrollContainer = comfyPage.page.locator( - '.sidebar-content-container [data-virtual-grid-item]' - ) - await scrollContainer.last().scrollIntoViewIfNeeded() + // Scroll the VirtualGrid's scrollable container to the very bottom. + // scrollIntoViewIfNeeded on a virtual item is unreliable because + // VirtualGrid removes/adds DOM nodes during scroll. Instead, set + // scrollTop directly on the overflow-y-auto container. + await comfyPage.page + .locator('.sidebar-content-container .overflow-y-auto') + .first() + .evaluate((el) => { + el.scrollTop = el.scrollHeight + }) const req = await nextPageRequest const url = new URL(req.url())