@@ -6,19 +6,36 @@ import {
6
6
shouldSkipTracingTest ,
7
7
waitForTransactionRequestOnUrl ,
8
8
} from '../../../../utils/helpers' ;
9
-
10
- sentryTest ( 'should send a transaction in an envelope' , async ( { getLocalTestPath, page } ) => {
11
- if ( shouldSkipTracingTest ( ) ) {
12
- sentryTest . skip ( ) ;
13
- }
14
-
15
- const url = await getLocalTestPath ( { testDir : __dirname } ) ;
16
- const req = await waitForTransactionRequestOnUrl ( page , url ) ;
17
- const transaction = envelopeRequestParser ( req ) ;
18
-
19
- expect ( transaction . transaction ) . toBe ( 'parent_span' ) ;
20
- expect ( transaction . spans ) . toBeDefined ( ) ;
21
- } ) ;
9
+ import {
10
+ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ,
11
+ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ,
12
+ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ,
13
+ } from '@sentry/browser' ;
14
+
15
+ sentryTest (
16
+ 'sends a transaction in an envelope with manual origin and custom source' ,
17
+ async ( { getLocalTestPath, page } ) => {
18
+ if ( shouldSkipTracingTest ( ) ) {
19
+ sentryTest . skip ( ) ;
20
+ }
21
+
22
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
23
+ const req = await waitForTransactionRequestOnUrl ( page , url ) ;
24
+ const transaction = envelopeRequestParser ( req ) ;
25
+
26
+ const attributes = transaction . contexts ?. trace ?. data ;
27
+ expect ( attributes ) . toEqual ( {
28
+ [ SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN ] : 'manual' ,
29
+ [ SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE ] : 1 ,
30
+ [ SEMANTIC_ATTRIBUTE_SENTRY_SOURCE ] : 'custom' ,
31
+ } ) ;
32
+
33
+ expect ( transaction . transaction_info ?. source ) . toBe ( 'custom' ) ;
34
+
35
+ expect ( transaction . transaction ) . toBe ( 'parent_span' ) ;
36
+ expect ( transaction . spans ) . toBeDefined ( ) ;
37
+ } ,
38
+ ) ;
22
39
23
40
sentryTest ( 'should report finished spans as children of the root transaction' , async ( { getLocalTestPath, page } ) => {
24
41
if ( shouldSkipTracingTest ( ) ) {
0 commit comments