Skip to content

Commit 2358cdb

Browse files
chargomeclaude
andcommitted
test(browser): Wait for the LCP handlers to see the image before finalizing
On Linux, Chromium reports the body as a first LCP candidate before the image. The subject's handlers get the candidates through an observer of their own, and finalizing LCP with the click while only the body was delivered to them froze that value, so the test failed on every CI run of some trees while passing locally. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 2ac1063 commit 2358cdb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp

‎dev-packages/browser-integration-tests/suites/tracing/metrics/handlers-lcp/test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ sentryTest(
2828
const lcpPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'ui.webvital.lcp');
2929
await page.goto(url);
3030
await waitForLcpCandidate(page, 'img');
31+
// The handlers observe LCP through their own observer; on Linux, Chromium reports the body before
32+
// the image, and finalizing LCP while only the body has been delivered to them freezes that value.
33+
await page.waitForFunction('window._LCP === 107400 && window._LCP2 === 107400');
3134
await page.locator('button').click();
3235
const lcpSpan = await lcpPromise;
3336

0 commit comments

Comments
 (0)