@@ -156,6 +156,56 @@ describe("breadcrumbs", function() {
156156 }
157157 ) ;
158158
159+ it (
160+ optional (
161+ "should transform XMLHttpRequests with transactions type to the Sentry envelope endpoint as sentry.transaction type breadcrumb" ,
162+ IS_LOADER
163+ ) ,
164+ function ( ) {
165+ return runInSandbox ( sandbox , { manual : true } , function ( ) {
166+ var envelope =
167+ document . location . protocol +
168+ "//" +
169+ document . location . hostname +
170+ ( document . location . port ? ":" + document . location . port : "" ) +
171+ "/api/1/envelope/" +
172+ "?sentry_key=1337" ;
173+
174+ var xhr = new XMLHttpRequest ( ) ;
175+ xhr . open ( "POST" , envelope ) ;
176+ xhr . send (
177+ `
178+ {
179+ "event_id": "aa3ff046696b4bc6b609ce6d28fde9e2",
180+ "sent_at": "2020-05-19T15:44:49.028Z"
181+ }
182+ {
183+ "type": "transaction"
184+ }
185+ {
186+ "message":"someMessage",
187+ "transaction":"wat",
188+ "level":"warning",
189+ }
190+ ` . trim ( )
191+ ) ;
192+ waitForXHR ( xhr , function ( ) {
193+ Sentry . captureMessage ( "test" ) ;
194+ window . finalizeManualTest ( ) ;
195+ } ) ;
196+ } ) . then ( function ( summary ) {
197+ // The async loader doesn't wrap XHR
198+ if ( IS_LOADER ) {
199+ return ;
200+ }
201+ assert . equal ( summary . breadcrumbs . length , 1 ) ;
202+ assert . equal ( summary . breadcrumbs [ 0 ] . category , "sentry.transaction" ) ;
203+ assert . equal ( summary . breadcrumbs [ 0 ] . level , "warning" ) ;
204+ assert . equal ( summary . breadcrumbs [ 0 ] . message , "someMessage" ) ;
205+ } ) ;
206+ }
207+ ) ;
208+
159209 it (
160210 optional (
161211 "should not transform XMLHttpRequests with transactions attribute to the Sentry store endpoint as sentry.transaction type breadcrumb" ,
0 commit comments