@@ -17,11 +17,12 @@ sentryTest('makes a call to sentry.io to diagnose SDK connectivity', async ({ ge
17
17
} ) ;
18
18
} ) ;
19
19
20
- let diagnoseMessage : string | undefined ;
21
- page . on ( 'console' , msg => {
22
- if ( msg . text ( ) . includes ( 'SDK connectivity:' ) ) {
23
- diagnoseMessage = msg . text ( ) ;
24
- }
20
+ const diagnoseMessagePromise = new Promise < string > ( resolve => {
21
+ page . on ( 'console' , msg => {
22
+ if ( msg . text ( ) . includes ( 'SDK connectivity:' ) ) {
23
+ resolve ( msg . text ( ) ) ;
24
+ }
25
+ } ) ;
25
26
} ) ;
26
27
27
28
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
@@ -30,9 +31,17 @@ sentryTest('makes a call to sentry.io to diagnose SDK connectivity', async ({ ge
30
31
const pageLoadEvent = envelopeRequestParser ( await pageloadRequestPromise ) ;
31
32
32
33
// udnefined is expected and means the request was successful
33
- expect ( diagnoseMessage ) . toEqual ( 'SDK connectivity: undefined' ) ;
34
+ expect ( await diagnoseMessagePromise ) . toEqual ( 'SDK connectivity: undefined' ) ;
34
35
35
36
// the request to sentry.io should not be traced, hence no http.client span should be sent.
36
37
const httpClientSpans = pageLoadEvent . spans ?. filter ( s => s . op === 'http.client' ) ;
37
38
expect ( httpClientSpans ) . toHaveLength ( 0 ) ;
39
+
40
+ // no fetch breadcrumb should be sent (only breadcrumb for the console log)
41
+ expect ( pageLoadEvent . breadcrumbs ) . toEqual ( [
42
+ expect . objectContaining ( {
43
+ category : 'console' ,
44
+ message : 'SDK connectivity: undefined' ,
45
+ } ) ,
46
+ ] ) ;
38
47
} ) ;
0 commit comments