1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../utils/fixtures' ;
4
- import { getCustomRecordingEvents , shouldSkipReplayTest , waitForReplayRequest } from '../../../utils/replayHelpers' ;
4
+ import { getCustomRecordingEvents , getReplayRecordingContent , shouldSkipReplayTest , waitForReplayRequest } from '../../../utils/replayHelpers' ;
5
5
6
6
const THROTTLE_LIMIT = 300 ;
7
7
@@ -26,16 +26,19 @@ sentryTest(
26
26
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
27
27
28
28
await page . goto ( url ) ;
29
- await reqPromise0 ;
29
+ await forceFlushReplay ( ) ;
30
+ const res0 = getCustomRecordingEvents ( await reqPromise0 )
30
31
31
32
await page . click ( '[data-console]' ) ;
32
33
await forceFlushReplay ( ) ;
33
34
34
- const { breadcrumbs } = getCustomRecordingEvents ( await reqPromise1 ) ;
35
+ const res1 = getCustomRecordingEvents ( await reqPromise1 ) ;
35
36
36
- // 1 click breadcrumb + 1 throttled breadcrumb is why console logs are less
37
- // than throttle limit
38
- expect ( breadcrumbs . length ) . toBe ( THROTTLE_LIMIT ) ;
37
+ const breadcrumbs = [ ...res0 . breadcrumbs , ...res1 . breadcrumbs ] ;
38
+ const spans = [ ...res0 . performanceSpans , ...res1 . performanceSpans ] ;
39
39
expect ( breadcrumbs . filter ( breadcrumb => breadcrumb . category === 'replay.throttled' ) . length ) . toBe ( 1 ) ;
40
+ // replay.throttled breadcrumb does *not* use the throttledAddEvent as we
41
+ // alwants want that breadcrumb to be present in replay
42
+ expect ( breadcrumbs . length + spans . length ) . toBe ( THROTTLE_LIMIT + 1 ) ;
40
43
} ,
41
44
) ;
0 commit comments