@@ -20,6 +20,17 @@ async function extractTraceAndBaggageFromMeta(
20
20
return { sentryTrace : sentryTraceContent , sentryBaggage : sentryBaggageContent } ;
21
21
}
22
22
23
+ async function mockExampleRoute ( page : Page ) : Promise < void > {
24
+ await page . route ( 'https://example.com/**/*' , route => {
25
+ return route . fulfill ( {
26
+ status : 200 ,
27
+ body : JSON . stringify ( {
28
+ foo : 'bar' ,
29
+ } ) ,
30
+ } ) ;
31
+ } ) ;
32
+ }
33
+
23
34
test ( 'should inject `sentry-trace` and `baggage` into root loader returning an empty object.' , async ( { page } ) => {
24
35
await page . goto ( '/?type=empty' ) ;
25
36
@@ -123,6 +134,7 @@ test('should inject `sentry-trace` and `baggage` into root loader returning `und
123
134
test ( 'should inject `sentry-trace` and `baggage` into root loader throwing a redirection to a plain object.' , async ( {
124
135
page,
125
136
} ) => {
137
+ await mockExampleRoute ( page ) ;
126
138
await page . goto ( '/?type=throwRedirect' ) ;
127
139
128
140
const { sentryTrace, sentryBaggage } = await extractTraceAndBaggageFromMeta ( page ) ;
@@ -144,6 +156,7 @@ test('should inject `sentry-trace` and `baggage` into root loader throwing a red
144
156
test ( 'should inject `sentry-trace` and `baggage` into root loader returning a redirection to valid path.' , async ( {
145
157
page,
146
158
} ) => {
159
+ await mockExampleRoute ( page ) ;
147
160
await page . goto ( '/?type=returnRedirect' ) ;
148
161
149
162
const { sentryTrace, sentryBaggage } = await extractTraceAndBaggageFromMeta ( page ) ;
@@ -163,6 +176,7 @@ test('should inject `sentry-trace` and `baggage` into root loader returning a re
163
176
} ) ;
164
177
165
178
test ( 'should return redirect to an external path with no baggage and trace injected.' , async ( { page } ) => {
179
+ await mockExampleRoute ( page ) ;
166
180
await page . goto ( '/?type=returnRedirectToExternal' ) ;
167
181
168
182
const { sentryTrace, sentryBaggage } = await extractTraceAndBaggageFromMeta ( page ) ;
@@ -175,6 +189,7 @@ test('should return redirect to an external path with no baggage and trace injec
175
189
} ) ;
176
190
177
191
test ( 'should throw redirect to an external path with no baggage and trace injected.' , async ( { page } ) => {
192
+ await mockExampleRoute ( page ) ;
178
193
await page . goto ( '/?type=throwRedirectToExternal' ) ;
179
194
180
195
const { sentryTrace, sentryBaggage } = await extractTraceAndBaggageFromMeta ( page ) ;
0 commit comments