@@ -29,7 +29,7 @@ sentryTest(
29
29
let errorEventId : string | undefined ;
30
30
const reqPromise0 = waitForReplayRequest ( page , 0 ) ;
31
31
const reqPromise1 = waitForReplayRequest ( page , 1 ) ;
32
- // const reqPromise2 = waitForReplayRequest(page, 2);
32
+ const reqPromise2 = waitForReplayRequest ( page , 2 ) ;
33
33
const reqErrorPromise = waitForErrorRequest ( page ) ;
34
34
35
35
await page . route ( 'https://dsn.ingest.sentry.io/**/*' , route => {
@@ -100,18 +100,21 @@ sentryTest(
100
100
101
101
await page . click ( '#log' ) ;
102
102
await page . click ( '#go-background' ) ;
103
- await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
104
103
105
- // Switches to session mode
106
- expect ( callsToSentry ) . toEqual ( 4 ) ;
104
+ // Switches to session mode and then goes to background
107
105
const req1 = await reqPromise1 ;
106
+ const req2 = await reqPromise2 ;
107
+ expect ( callsToSentry ) . toEqual ( 5 ) ;
108
108
109
109
const event0 = getReplayEvent ( req0 ) ;
110
110
const content0 = getReplayRecordingContent ( req0 ) ;
111
111
112
112
const event1 = getReplayEvent ( req1 ) ;
113
113
const content1 = getReplayRecordingContent ( req1 ) ;
114
114
115
+ const event2 = getReplayEvent ( req2 ) ;
116
+ const content2 = getReplayRecordingContent ( req2 ) ;
117
+
115
118
expect ( event0 ) . toEqual (
116
119
getExpectedReplayEvent ( {
117
120
contexts : { replay : { error_sample_rate : 0 , session_sample_rate : 0 } } ,
@@ -150,31 +153,30 @@ sentryTest(
150
153
expect ( event1 ) . toEqual (
151
154
getExpectedReplayEvent ( {
152
155
contexts : { replay : { error_sample_rate : 0 , session_sample_rate : 0 } } ,
156
+ replay_start_timestamp : undefined ,
153
157
replay_type : 'buffer' , // although we're in session mode, we still send 'buffer' as replay_type
154
158
segment_id : 1 ,
155
159
urls : [ ] ,
156
160
} ) ,
157
161
) ;
158
162
159
- //
160
- expect ( content1 . fullSnapshots ) . toHaveLength ( 0 ) ;
163
+ // From switching to session mode
164
+ expect ( content1 . fullSnapshots ) . toHaveLength ( 1 ) ;
165
+
166
+ expect ( event2 ) . toEqual (
167
+ getExpectedReplayEvent ( {
168
+ contexts : { replay : { error_sample_rate : 0 , session_sample_rate : 0 } } ,
169
+ replay_start_timestamp : undefined ,
170
+ replay_type : 'buffer' , // although we're in session mode, we still send 'buffer' as replay_type
171
+ segment_id : 2 ,
172
+ urls : [ ] ,
173
+ } ) ,
174
+ ) ;
161
175
162
- expect ( content1 . breadcrumbs ) . toEqual (
176
+ expect ( content2 . fullSnapshots ) . toHaveLength ( 0 ) ;
177
+ expect ( content2 . breadcrumbs ) . toEqual (
163
178
expect . arrayContaining ( [
164
- {
165
- ...expectedClickBreadcrumb ,
166
- message : 'body > button#log' ,
167
- data : {
168
- node : {
169
- attributes : { id : 'log' } ,
170
- id : expect . any ( Number ) ,
171
- tagName : 'button' ,
172
- textContent : '*** ***** ** *** *******' ,
173
- } ,
174
- nodeId : expect . any ( Number ) ,
175
- } ,
176
- } ,
177
- { ...expectedConsoleBreadcrumb , level : 'log' , message : 'Some message' } ,
179
+ expectedClickBreadcrumb ,
178
180
] ) ,
179
181
) ;
180
182
} ,
0 commit comments