From 69272256cdaec6d8391b4ff365fd3dbf2be747bc Mon Sep 17 00:00:00 2001 From: xarmian Date: Sun, 27 Sep 2026 02:12:13 -0400 Subject: [PATCH] test(e2e): the text-preview legs wait for the document, not just the card, before acting on it (BUG-3247) (#1601) The Lightbox renders `.lightbox-text-scroll` while the text loader is still `loading` (Lightbox.svelte ~2698), and openMarkdown waited only for that card. When the body was late, the scroll leg's single wheel landed on an empty, unscrollable card and scrollTop stayed 0 (2 first-attempt failures in 82 CI E2E jobs). openMarkdown now waits for `.lightbox-text-body`, which exists only in the `ready` phase, and the scroll leg asserts its premise that the card overflows. Control: the text body fetch delayed 1.5s by a route fails the scroll leg 10/10 with CI's signature without the wait, and passes 10/10 with it. Unforced, the whole spec x40 at 8 workers passes 160/160. Claude-Session: https://claude.ai/code/session_01NidgPePY7UvHcEJCMkD2Qz --- web/e2e/attachment-text-preview.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/e2e/attachment-text-preview.spec.ts b/web/e2e/attachment-text-preview.spec.ts index a5545b35a..fc3ca91ee 100644 --- a/web/e2e/attachment-text-preview.spec.ts +++ b/web/e2e/attachment-text-preview.spec.ts @@ -61,6 +61,9 @@ test.describe('attachment viewer — text preview (IDEA-2712)', () => { await page.goto(itemUrl(fixture, doc.slug)); await page.locator(TILE).first().click(); await expect(page.locator(TEXT_CARD)).toBeVisible(); + // The card is on screen while the body is still LOADING (BUG-3247): wait + // for the document, or a leg can act on an empty, unscrollable card. + await expect(page.locator(TEXT_RENDERED)).toBeVisible(); } test('renders the markdown, through the shared pipeline', async ({ page, fixture, request }) => { @@ -111,6 +114,8 @@ test.describe('attachment viewer — text preview (IDEA-2712)', () => { })); const before = await behind(); expect(await card.evaluate((el) => el.scrollTop)).toBe(0); + // PREMISE: there is something to scroll. + expect(await card.evaluate((el) => el.scrollHeight > el.clientHeight), 'the card does not overflow').toBe(true); await card.hover(); await page.mouse.wheel(0, 600);