@@ -35,7 +35,7 @@ sentryTest('handles empty/missing request headers', async ({ getLocalTestPath, p
35
35
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
36
36
await page . goto ( url ) ;
37
37
38
- const [ , request ] = await Promise . all ( [
38
+ const [ , request , { replayRecordingSnapshots } ] = await Promise . all ( [
39
39
page . evaluate ( ( ) => {
40
40
/* eslint-disable */
41
41
fetch ( 'http://localhost:7654/foo' , {
@@ -47,6 +47,7 @@ sentryTest('handles empty/missing request headers', async ({ getLocalTestPath, p
47
47
/* eslint-enable */
48
48
} ) ,
49
49
requestPromise ,
50
+ replayRequestPromise ,
50
51
] ) ;
51
52
52
53
const eventData = envelopeRequestParser ( request ) ;
@@ -65,7 +66,6 @@ sentryTest('handles empty/missing request headers', async ({ getLocalTestPath, p
65
66
} ,
66
67
} ) ;
67
68
68
- const { replayRecordingSnapshots } = await replayRequestPromise ;
69
69
expect ( getReplayPerformanceSpans ( replayRecordingSnapshots ) . filter ( span => span . op === 'resource.fetch' ) ) . toEqual ( [
70
70
{
71
71
data : {
@@ -110,7 +110,7 @@ sentryTest('captures request headers as POJO', async ({ getLocalTestPath, page,
110
110
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
111
111
await page . goto ( url ) ;
112
112
113
- const [ , request ] = await Promise . all ( [
113
+ const [ , request , { replayRecordingSnapshots } ] = await Promise . all ( [
114
114
page . evaluate ( ( ) => {
115
115
/* eslint-disable */
116
116
fetch ( 'http://localhost:7654/foo' , {
@@ -129,6 +129,7 @@ sentryTest('captures request headers as POJO', async ({ getLocalTestPath, page,
129
129
/* eslint-enable */
130
130
} ) ,
131
131
requestPromise ,
132
+ replayRequestPromise ,
132
133
] ) ;
133
134
134
135
const eventData = envelopeRequestParser ( request ) ;
@@ -147,7 +148,6 @@ sentryTest('captures request headers as POJO', async ({ getLocalTestPath, page,
147
148
} ,
148
149
} ) ;
149
150
150
- const { replayRecordingSnapshots } = await replayRequestPromise ;
151
151
expect ( getReplayPerformanceSpans ( replayRecordingSnapshots ) . filter ( span => span . op === 'resource.fetch' ) ) . toEqual ( [
152
152
{
153
153
data : {
@@ -197,25 +197,28 @@ sentryTest('captures request headers on Request', async ({ getLocalTestPath, pag
197
197
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
198
198
await page . goto ( url ) ;
199
199
200
- await page . evaluate ( ( ) => {
201
- const request = new Request ( 'http://localhost:7654/foo' , {
202
- method : 'POST' ,
203
- headers : {
204
- Accept : 'application/json' ,
205
- 'Content-Type' : 'application/json' ,
206
- Cache : 'no-cache' ,
207
- 'X-Custom-Header' : 'foo' ,
208
- } ,
209
- } ) ;
210
- /* eslint-disable */
211
- fetch ( request ) . then ( ( ) => {
212
- // @ts -expect-error Sentry is a global
213
- Sentry . captureException ( 'test error' ) ;
214
- } ) ;
215
- /* eslint-enable */
216
- } ) ;
200
+ const [ , request , { replayRecordingSnapshots } ] = await Promise . all ( [
201
+ page . evaluate ( ( ) => {
202
+ const request = new Request ( 'http://localhost:7654/foo' , {
203
+ method : 'POST' ,
204
+ headers : {
205
+ Accept : 'application/json' ,
206
+ 'Content-Type' : 'application/json' ,
207
+ Cache : 'no-cache' ,
208
+ 'X-Custom-Header' : 'foo' ,
209
+ } ,
210
+ } ) ;
211
+ /* eslint-disable */
212
+ fetch ( request ) . then ( ( ) => {
213
+ // @ts -expect-error Sentry is a global
214
+ Sentry . captureException ( 'test error' ) ;
215
+ } ) ;
216
+ /* eslint-enable */
217
+ } ) ,
218
+ requestPromise ,
219
+ replayRequestPromise ,
220
+ ] ) ;
217
221
218
- const request = await requestPromise ;
219
222
const eventData = envelopeRequestParser ( request ) ;
220
223
221
224
expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
@@ -232,7 +235,6 @@ sentryTest('captures request headers on Request', async ({ getLocalTestPath, pag
232
235
} ,
233
236
} ) ;
234
237
235
- const { replayRecordingSnapshots } = await replayRequestPromise ;
236
238
expect ( getReplayPerformanceSpans ( replayRecordingSnapshots ) . filter ( span => span . op === 'resource.fetch' ) ) . toEqual ( [
237
239
{
238
240
data : {
@@ -282,25 +284,28 @@ sentryTest('captures request headers as Headers instance', async ({ getLocalTest
282
284
283
285
await page . goto ( url ) ;
284
286
285
- await page . evaluate ( ( ) => {
286
- const headers = new Headers ( ) ;
287
- headers . append ( 'Accept' , 'application/json' ) ;
288
- headers . append ( 'Content-Type' , 'application/json' ) ;
289
- headers . append ( 'Cache' , 'no-cache' ) ;
290
- headers . append ( 'X-Custom-Header' , 'foo' ) ;
287
+ const [ , request , { replayRecordingSnapshots } ] = await Promise . all ( [
288
+ page . evaluate ( ( ) => {
289
+ const headers = new Headers ( ) ;
290
+ headers . append ( 'Accept' , 'application/json' ) ;
291
+ headers . append ( 'Content-Type' , 'application/json' ) ;
292
+ headers . append ( 'Cache' , 'no-cache' ) ;
293
+ headers . append ( 'X-Custom-Header' , 'foo' ) ;
291
294
292
- /* eslint-disable */
293
- fetch ( 'http://localhost:7654/foo' , {
294
- method : 'POST' ,
295
- headers,
296
- } ) . then ( ( ) => {
297
- // @ts -expect-error Sentry is a global
298
- Sentry . captureException ( 'test error' ) ;
299
- } ) ;
300
- /* eslint-enable */
301
- } ) ;
295
+ /* eslint-disable */
296
+ fetch ( 'http://localhost:7654/foo' , {
297
+ method : 'POST' ,
298
+ headers,
299
+ } ) . then ( ( ) => {
300
+ // @ts -expect-error Sentry is a global
301
+ Sentry . captureException ( 'test error' ) ;
302
+ } ) ;
303
+ /* eslint-enable */
304
+ } ) ,
305
+ requestPromise ,
306
+ replayRequestPromise ,
307
+ ] ) ;
302
308
303
- const request = await requestPromise ;
304
309
const eventData = envelopeRequestParser ( request ) ;
305
310
306
311
expect ( eventData . exception ?. values ) . toHaveLength ( 1 ) ;
@@ -317,7 +322,6 @@ sentryTest('captures request headers as Headers instance', async ({ getLocalTest
317
322
} ,
318
323
} ) ;
319
324
320
- const { replayRecordingSnapshots } = await replayRequestPromise ;
321
325
expect ( getReplayPerformanceSpans ( replayRecordingSnapshots ) . filter ( span => span . op === 'resource.fetch' ) ) . toEqual ( [
322
326
{
323
327
data : {
@@ -366,7 +370,7 @@ sentryTest('does not captures request headers if URL does not match', async ({ g
366
370
const url = await getLocalTestPath ( { testDir : __dirname } ) ;
367
371
await page . goto ( url ) ;
368
372
369
- const [ , request ] = await Promise . all ( [
373
+ const [ , request , { replayRecordingSnapshots } ] = await Promise . all ( [
370
374
page . evaluate ( ( ) => {
371
375
/* eslint-disable */
372
376
fetch ( 'http://localhost:7654/bar' , {
@@ -385,6 +389,7 @@ sentryTest('does not captures request headers if URL does not match', async ({ g
385
389
/* eslint-enable */
386
390
} ) ,
387
391
requestPromise ,
392
+ replayRequestPromise ,
388
393
] ) ;
389
394
390
395
const eventData = envelopeRequestParser ( request ) ;
@@ -403,7 +408,6 @@ sentryTest('does not captures request headers if URL does not match', async ({ g
403
408
} ,
404
409
} ) ;
405
410
406
- const { replayRecordingSnapshots } = await replayRequestPromise ;
407
411
expect ( getReplayPerformanceSpans ( replayRecordingSnapshots ) . filter ( span => span . op === 'resource.fetch' ) ) . toEqual ( [
408
412
{
409
413
data : {
0 commit comments