@@ -2,6 +2,7 @@ import { expect } from '@playwright/test';
2
2
3
3
import { sentryTest } from '../../../utils/fixtures' ;
4
4
import {
5
+ expectedClickBreadcrumb ,
5
6
expectedFCPPerformanceSpan ,
6
7
expectedFPPerformanceSpan ,
7
8
expectedLCPPerformanceSpan ,
@@ -63,3 +64,44 @@ sentryTest(
63
64
) ;
64
65
} ,
65
66
) ;
67
+
68
+ sentryTest (
69
+ 'replay recording should contain a click breadcrumb when a button is clicked' ,
70
+ async ( { getLocalTestPath, page, browserName } ) => {
71
+ // Replay bundles are es6 only and most performance entries are only available in chromium
72
+ if ( ( process . env . PW_BUNDLE && process . env . PW_BUNDLE . startsWith ( 'bundle_es5' ) ) || browserName !== 'chromium' ) {
73
+ sentryTest . skip ( ) ;
74
+ }
75
+
76
+ const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
77
+ const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
78
+
79
+ await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
80
+ return route . fulfill ( {
81
+ status : 200 ,
82
+ contentType : 'application/json' ,
83
+ body : JSON . stringify ( { id : 'test-id' } ) ,
84
+ } ) ;
85
+ } ) ;
86
+
87
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
88
+
89
+ await page . goto ( url ) ;
90
+ const replayEvent0 = getReplayEvent ( await reqPromise0 ) ;
91
+ const { breadcrumbs : breadcrumbs0 } = getCustomRecordingEvents ( await reqPromise0 ) ;
92
+
93
+ expect ( replayEvent0 ) . toEqual ( getExpectedReplayEvent ( { segment_id : 0 } ) ) ;
94
+ expect ( breadcrumbs0 . length ) . toEqual ( 0 ) ;
95
+
96
+ await page . click ( 'button' ) ;
97
+
98
+ const replayEvent1 = getReplayEvent ( await reqPromise1 ) ;
99
+ const { breadcrumbs : breadcrumbs1 } = getCustomRecordingEvents ( await reqPromise1 ) ;
100
+
101
+ expect ( replayEvent1 ) . toEqual (
102
+ getExpectedReplayEvent ( { segment_id : 1 , urls : [ ] , replay_start_timestamp : undefined } ) ,
103
+ ) ;
104
+
105
+ expect ( breadcrumbs1 ) . toEqual ( [ expectedClickBreadcrumb ] ) ;
106
+ } ,
107
+ ) ;
0 commit comments