Skip to content

Commit 8892f89

Browse files
committed
try waiting for image response finish
1 parent aa2e45f commit 8892f89

File tree

1 file changed

+5
-2
lines changed
  • dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp

1 file changed

+5
-2
lines changed

dev-packages/browser-integration-tests/suites/tracing/metrics/web-vitals-lcp/test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ sentryTest('should capture a LCP vital with element details.', async ({ browserN
1010
sentryTest.skip();
1111
}
1212
const imageSrc = 'https://example.com/path/to/image.png';
13+
const imageResponsePromise = page.waitForResponse(imageSrc);
1314
page.route('**', route => route.continue());
1415
page.route('**/path/to/image.png', async (route: Route) => {
1516
return route.fulfill({ path: `${__dirname}/assets/sentry-logo-600x179.png` });
1617
});
1718

1819
const url = await getLocalTestPath({ testDir: __dirname });
19-
const [eventData] = await Promise.all([
20+
const [eventData, imageResponse] = await Promise.all([
2021
getFirstSentryEnvelopeRequest<Event>(page),
2122
page.goto(url),
22-
page.waitForResponse(imageSrc),
23+
imageResponsePromise,
2324
]);
2425

26+
await imageResponse?.finished();
27+
2528
// Clicking the button before image loads will result in the button being the LCP
2629
await page.locator('button').click();
2730

0 commit comments

Comments
 (0)