Skip to content

Commit a7426de

Browse files
committed
only run on firefox
1 parent 1450873 commit a7426de

File tree

1 file changed

+43
-38
lines changed
  • packages/integration-tests/suites/replay/customEvents

1 file changed

+43
-38
lines changed

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

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,55 @@ import {
1111
} from '../../../utils/replayEventTemplates';
1212
import { getCustomRecordingEvents, getReplayEvent, waitForReplayRequest } from '../../../utils/replayHelpers';
1313

14-
sentryTest('replay recording should contain default performance spans', async ({ getLocalTestPath, page }) => {
15-
// Replay bundles are es6 only
16-
if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_es5')) {
17-
sentryTest.skip();
18-
}
19-
20-
const reqPromise0 = waitForReplayRequest(page, 0);
21-
const reqPromise1 = waitForReplayRequest(page, 1);
22-
23-
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
24-
return route.fulfill({
25-
status: 200,
26-
contentType: 'application/json',
27-
body: JSON.stringify({ id: 'test-id' }),
14+
sentryTest(
15+
'replay recording should contain default performance spans',
16+
async ({ getLocalTestPath, page, browserName }) => {
17+
// Replay bundles are es6 only and most performance entries are only available in chromium
18+
if ((process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_es5')) || browserName !== 'chromium') {
19+
sentryTest.skip();
20+
}
21+
22+
const reqPromise0 = waitForReplayRequest(page, 0);
23+
const reqPromise1 = waitForReplayRequest(page, 1);
24+
25+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
26+
return route.fulfill({
27+
status: 200,
28+
contentType: 'application/json',
29+
body: JSON.stringify({ id: 'test-id' }),
30+
});
2831
});
29-
});
3032

31-
const url = await getLocalTestPath({ testDir: __dirname });
33+
const url = await getLocalTestPath({ testDir: __dirname });
3234

33-
await page.goto(url);
34-
const replayEvent0 = getReplayEvent(await reqPromise0);
35-
const { performanceSpans: performanceSpans0 } = getCustomRecordingEvents(await reqPromise0);
35+
await page.goto(url);
36+
const replayEvent0 = getReplayEvent(await reqPromise0);
37+
const { performanceSpans: performanceSpans0 } = getCustomRecordingEvents(await reqPromise0);
3638

37-
expect(replayEvent0).toEqual(getExpectedReplayEvent({ segment_id: 0 }));
39+
expect(replayEvent0).toEqual(getExpectedReplayEvent({ segment_id: 0 }));
3840

39-
await page.click('button');
41+
await page.click('button');
4042

41-
const replayEvent1 = getReplayEvent(await reqPromise1);
42-
const { performanceSpans: performanceSpans1 } = getCustomRecordingEvents(await reqPromise1);
43+
const replayEvent1 = getReplayEvent(await reqPromise1);
44+
const { performanceSpans: performanceSpans1 } = getCustomRecordingEvents(await reqPromise1);
4345

44-
expect(replayEvent1).toEqual(getExpectedReplayEvent({ segment_id: 1, urls: [], replay_start_timestamp: undefined }));
46+
expect(replayEvent1).toEqual(
47+
getExpectedReplayEvent({ segment_id: 1, urls: [], replay_start_timestamp: undefined }),
48+
);
4549

46-
// We can't guarantee the order of the performance spans, or in which of the two segments they are sent
47-
// So we collect them all and check that they are all there
48-
const collectedPerformanceSpans = [...performanceSpans0, ...performanceSpans1];
50+
// We can't guarantee the order of the performance spans, or in which of the two segments they are sent
51+
// So to avoid flakes, we collect them all and check that they are all there
52+
const collectedPerformanceSpans = [...performanceSpans0, ...performanceSpans1];
4953

50-
expect(collectedPerformanceSpans).toEqual(
51-
expect.arrayContaining([
52-
expectedNavigationPerformanceSpan,
53-
expectedLCPPerformanceSpan,
54-
expectedFPPerformanceSpan,
55-
expectedFCPPerformanceSpan,
56-
expectedMemoryPerformanceSpan, // two memory spans - once per flush
57-
expectedMemoryPerformanceSpan,
58-
]),
59-
);
60-
});
54+
expect(collectedPerformanceSpans).toEqual(
55+
expect.arrayContaining([
56+
expectedNavigationPerformanceSpan,
57+
expectedLCPPerformanceSpan,
58+
expectedFPPerformanceSpan,
59+
expectedFCPPerformanceSpan,
60+
expectedMemoryPerformanceSpan, // two memory spans - once per flush
61+
expectedMemoryPerformanceSpan,
62+
]),
63+
);
64+
},
65+
);

0 commit comments

Comments
 (0)