@@ -300,6 +300,44 @@ describe('integration', function () {
300
300
} ) ;
301
301
302
302
describe ( 'breadcrumbs' , function ( ) {
303
+
304
+ it ( 'should record an XMLHttpRequest' , function ( done ) {
305
+ var iframe = this . iframe ;
306
+
307
+ iframeExecute ( iframe , done ,
308
+ function ( ) {
309
+
310
+ // some browsers trigger onpopstate for load / reset breadcrumb state
311
+ Raven . _breadcrumbs = [ ] ;
312
+
313
+ var xhr = new XMLHttpRequest ( ) ;
314
+
315
+ xhr . open ( 'GET' , '/test/integration/example.json' ) ;
316
+ xhr . setRequestHeader ( 'Content-type' , 'application/json' ) ;
317
+ xhr . onreadystatechange = function ( ) {
318
+ // don't fire `done` handler until at least *one* onreadystatechange
319
+ // has occurred (doesn't actually need to finish)
320
+ if ( xhr . readyState === 4 ) {
321
+ setTimeout ( done ) ;
322
+ }
323
+ } ;
324
+ xhr . send ( ) ;
325
+ } ,
326
+ function ( ) {
327
+ var Raven = iframe . contentWindow . Raven ,
328
+ breadcrumbs = Raven . _breadcrumbs ;
329
+
330
+ assert . equal ( breadcrumbs . length , 1 ) ;
331
+
332
+ assert . equal ( breadcrumbs [ 0 ] . type , 'http_request' ) ;
333
+ assert . equal ( breadcrumbs [ 0 ] . data . method , 'GET' ) ;
334
+ // NOTE: not checking status code because we seem to get
335
+ // statusCode 0/undefined from Phantom when fetching
336
+ // example.json (CORS issue?
337
+ }
338
+ ) ;
339
+ } ) ;
340
+
303
341
it ( 'should record a mouse click on element WITH click handler present' , function ( done ) {
304
342
var iframe = this . iframe ;
305
343
0 commit comments