Skip to content

Commit e9dcc90

Browse files
committed
wait for replay requests
1 parent 9214bed commit e9dcc90

File tree

1 file changed

+17
-2
lines changed
  • packages/integration-tests/suites/replay/captureReplay

1 file changed

+17
-2
lines changed

packages/integration-tests/suites/replay/captureReplay/test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { expect } from '@playwright/test';
22
import { SDK_VERSION } from '@sentry/browser';
33
import type { Event } from '@sentry/types';
4+
import { parseEnvelope } from '@sentry/utils';
45

56
import { sentryTest } from '../../../utils/fixtures';
67
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';
@@ -21,11 +22,25 @@ sentryTest('captureReplay', async ({ getLocalTestPath, page }) => {
2122

2223
const url = await getLocalTestPath({ testDir: __dirname });
2324

24-
const reqPromise = page.waitForRequest('https://dsn.ingest.sentry.io/**/*');
25+
const reqPromise = page.waitForRequest(req => {
26+
const postData = req.postData();
27+
if (!postData) {
28+
return false;
29+
}
30+
return postData.includes('replay_event');
31+
});
32+
2533
await page.goto(url);
2634
await reqPromise;
2735

28-
const reqPromise2 = page.waitForRequest('https://dsn.ingest.sentry.io/**/*');
36+
const reqPromise2 = page.waitForRequest(req => {
37+
const postData = req.postData();
38+
if (!postData) {
39+
return false;
40+
}
41+
return postData.includes('replay_event');
42+
});
43+
2944
await page.click('button');
3045
await reqPromise2;
3146

0 commit comments

Comments
 (0)