diff --git a/packages/app/e2e/smoke/session-timeline.spec.ts b/packages/app/e2e/smoke/session-timeline.spec.ts index d5330ac7d9..225a722893 100644 --- a/packages/app/e2e/smoke/session-timeline.spec.ts +++ b/packages/app/e2e/smoke/session-timeline.spec.ts @@ -189,7 +189,12 @@ test.describe("smoke: session timeline", () => { .querySelector('[data-timeline-row="bottom-spacer"]') ?.getBoundingClientRect() samples.push({ ids: visible, last: visible.includes(last), bottomError: bottom?.bottom - view.bottom }) - if (!firstPaint && visible.includes(last) && Math.abs((bottom?.bottom ?? Infinity) - view.bottom) <= 1) { + if ( + !firstPaint && + visible.includes(last) && + Math.abs((bottom?.bottom ?? Infinity) - view.bottom) <= 1 && + !root.querySelector('[data-markdown-key="initial"]') + ) { firstPaint = true root.querySelectorAll("[data-timeline-key]").forEach((row) => { const rect = row.getBoundingClientRect() @@ -204,10 +209,16 @@ test.describe("smoke: session timeline", () => { } ;( window as Window & { - __sessionTabPaint?: { samples: typeof samples; removed: () => number; stop: () => void } + __sessionTabPaint?: { + samples: typeof samples + painted: () => boolean + removed: () => number + stop: () => void + } } ).__sessionTabPaint = { samples, + painted: () => firstPaint, removed: () => removedFirstPaintNodes, stop: () => { running = false @@ -219,17 +230,19 @@ test.describe("smoke: session timeline", () => { ) await switchTitlebarSession(page, fixture.targetID, fixture.expected.targetTitle) - await page.waitForFunction(() => - ( - window as Window & { __sessionTabPaint?: { samples: Array<{ ids: string[] }> } } - ).__sessionTabPaint?.samples.some((sample) => sample.ids.length > 0), - ) + await page.waitForFunction(() => { + const probe = ( + window as Window & { __sessionTabPaint?: { samples: Array<{ ids: string[] }>; painted: () => boolean } } + ).__sessionTabPaint + return probe?.painted() && probe.samples.some((sample) => sample.ids.length > 0) + }) await page.waitForTimeout(200) const first = await page.evaluate(() => { const probe = ( window as Window & { __sessionTabPaint?: { samples: Array<{ ids: string[]; last: boolean; bottomError?: number }> + painted: () => boolean removed: () => number stop: () => void }