@@ -11,50 +11,55 @@ import {
11
11
} from '../../../utils/replayEventTemplates' ;
12
12
import { getCustomRecordingEvents , getReplayEvent , waitForReplayRequest } from '../../../utils/replayHelpers' ;
13
13
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
+ } ) ;
28
31
} ) ;
29
- } ) ;
30
32
31
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
33
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
32
34
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 ) ;
36
38
37
- expect ( replayEvent0 ) . toEqual ( getExpectedReplayEvent ( { segment_id : 0 } ) ) ;
39
+ expect ( replayEvent0 ) . toEqual ( getExpectedReplayEvent ( { segment_id : 0 } ) ) ;
38
40
39
- await page . click ( 'button' ) ;
41
+ await page . click ( 'button' ) ;
40
42
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 ) ;
43
45
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
+ ) ;
45
49
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 ] ;
49
53
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