@@ -63,7 +63,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
6363 describe ( 'from the AUT' , ( ) => {
6464 beforeEach ( ( ) => {
6565 cy . intercept ( '/test-request' ) . as ( 'testRequest' )
66- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
66+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
6767
6868 cy . visit ( '/fixtures/primary-origin.html' )
6969 cy . get ( 'a[data-cy="xhr-fetch-requests"]' ) . click ( )
@@ -87,7 +87,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
8787
8888 cy . wait ( '@testRequest' )
8989 cy . then ( ( ) => {
90- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
90+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
9191 url : 'http://www.foobar.com:3500/test-request' ,
9292 resourceType : 'fetch' ,
9393 credentialStatus : assertCredentialStatus ,
@@ -107,7 +107,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
107107
108108 cy . wait ( '@testRequest' )
109109 cy . then ( ( ) => {
110- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
110+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
111111 url : 'http://www.foobar.com:3500/test-request' ,
112112 resourceType : 'fetch' ,
113113 credentialStatus : assertCredentialStatus ,
@@ -127,7 +127,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
127127
128128 cy . wait ( '@testRequest' )
129129 cy . then ( ( ) => {
130- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
130+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
131131 url : 'http://www.foobar.com:3500/test-request' ,
132132 resourceType : 'fetch' ,
133133 credentialStatus : assertCredentialStatus ,
@@ -152,7 +152,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
152152 )
153153
154154 cy . then ( ( ) => {
155- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
155+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
156156 } )
157157 } )
158158
@@ -171,7 +171,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
171171 )
172172
173173 cy . then ( ( ) => {
174- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
174+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
175175 url : 'http://app.foobar.com:3500/test-request' ,
176176 resourceType : 'fetch' ,
177177 credentialStatus : 'include' ,
@@ -184,7 +184,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
184184 describe ( 'from the spec bridge' , ( ) => {
185185 beforeEach ( ( ) => {
186186 cy . intercept ( '/test-request' ) . as ( 'testRequest' )
187- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
187+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
188188
189189 cy . visit ( '/fixtures/primary-origin.html' )
190190 cy . get ( 'a[data-cy="xhr-fetch-requests"]' ) . click ( )
@@ -216,7 +216,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
216216 } )
217217
218218 cy . then ( ( ) => {
219- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
219+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
220220 url : 'http://www.foobar.com:3500/test-request-credentials' ,
221221 resourceType : 'fetch' ,
222222 credentialStatus : assertCredentialStatus ,
@@ -246,7 +246,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
246246 } )
247247
248248 cy . then ( ( ) => {
249- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
249+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
250250 url : 'http://www.foobar.com:3500/test-request-credentials' ,
251251 resourceType : 'fetch' ,
252252 credentialStatus : assertCredentialStatus ,
@@ -274,7 +274,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
274274 } )
275275
276276 cy . then ( ( ) => {
277- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
277+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
278278 url : 'http://www.foobar.com:3500/test-request-credentials' ,
279279 resourceType : 'fetch' ,
280280 credentialStatus : assertCredentialStatus ,
@@ -297,7 +297,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
297297 } )
298298
299299 cy . then ( ( ) => {
300- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
300+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
301301 } )
302302 } )
303303 } )
@@ -326,7 +326,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
326326 } )
327327
328328 cy . then ( ( ) => {
329- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
329+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
330330 url : 'http://app.foobar.com:3500/test-request' ,
331331 resourceType : 'fetch' ,
332332 credentialStatus : 'include' ,
@@ -339,13 +339,13 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
339339 // manually remove the spec bridge iframe to ensure Cypress.state('window') is not already set
340340 window . top ?. document . getElementById ( 'Spec\ Bridge:\ foobar.com' ) ?. remove ( )
341341
342- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
342+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
343343
344344 cy . visit ( '/fixtures/primary-origin.html' )
345345 cy . get ( 'a[data-cy="xhr-fetch-requests-onload"]' ) . click ( )
346346
347347 cy . then ( ( ) => {
348- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
348+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
349349 url : 'http://localhost:3500/foo.bar.baz.json' ,
350350 resourceType : 'fetch' ,
351351 credentialStatus : 'same-origin' ,
@@ -354,7 +354,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
354354 } )
355355
356356 it ( 'does not patch fetch in the spec window or the AUT if the AUT is on the primary' , ( ) => {
357- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
357+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
358358 cy . visit ( 'fixtures/xhr-fetch-requests.html' )
359359
360360 cy . window ( ) . then ( ( win ) => {
@@ -371,14 +371,14 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
371371 cy . then ( async ( ) => {
372372 await fetch ( '/test-request' )
373373
374- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
374+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
375375 } )
376376
377377 // expect AUT to NOT be patched in primary
378378 cy . window ( ) . then ( async ( win ) => {
379379 await win . fetch ( '/test-request' )
380380
381- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
381+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
382382 } )
383383 } )
384384 } )
@@ -387,7 +387,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
387387 describe ( 'from the AUT' , ( ) => {
388388 beforeEach ( ( ) => {
389389 cy . intercept ( '/test-request' ) . as ( 'testRequest' )
390- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
390+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
391391
392392 cy . visit ( '/fixtures/primary-origin.html' )
393393 cy . get ( 'a[data-cy="xhr-fetch-requests"]' ) . click ( )
@@ -409,7 +409,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
409409
410410 cy . wait ( '@testRequest' )
411411 cy . then ( ( ) => {
412- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
412+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
413413 url : 'http://www.foobar.com:3500/test-request' ,
414414 resourceType : 'xhr' ,
415415 credentialStatus : withCredentials ,
@@ -431,7 +431,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
431431 } )
432432
433433 cy . then ( ( ) => {
434- expect ( Cypress . backend ) . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
434+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
435435 } )
436436 } )
437437 } )
@@ -449,7 +449,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
449449 } )
450450
451451 cy . then ( ( ) => {
452- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
452+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
453453 url : 'http://app.foobar.com:3500/test-request' ,
454454 resourceType : 'xhr' ,
455455 credentialStatus : true ,
@@ -461,9 +461,9 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
461461 describe ( 'from the spec bridge' , ( ) => {
462462 beforeEach ( ( ) => {
463463 cy . intercept ( '/test-request' ) . as ( 'testRequest' )
464- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
464+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
465465 cy . origin ( 'http://www.foobar.com:3500' , ( ) => {
466- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
466+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
467467 } )
468468
469469 cy . visit ( '/fixtures/primary-origin.html' )
@@ -501,7 +501,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
501501 } )
502502
503503 cy . then ( ( ) => {
504- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
504+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
505505 url : 'http://www.foobar.com:3500/test-request-credentials' ,
506506 resourceType : 'xhr' ,
507507 credentialStatus : withCredentials ,
@@ -523,7 +523,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
523523 } )
524524
525525 cy . then ( ( ) => {
526- expect ( Cypress . backend ) . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
526+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
527527 } )
528528 } )
529529
@@ -553,7 +553,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
553553 } )
554554
555555 cy . then ( ( ) => {
556- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
556+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
557557 url : 'http://app.foobar.com:3500/test-request' ,
558558 resourceType : 'xhr' ,
559559 credentialStatus : true ,
@@ -567,13 +567,13 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
567567 // manually remove the spec bridge iframe to ensure Cypress.state('window') is not already set
568568 window . top ?. document . getElementById ( 'Spec\ Bridge:\ foobar.com' ) ?. remove ( )
569569
570- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
570+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
571571
572572 cy . visit ( '/fixtures/primary-origin.html' )
573573 cy . get ( 'a[data-cy="xhr-fetch-requests-onload"]' ) . click ( )
574574
575575 cy . then ( ( ) => {
576- expect ( Cypress . backend ) . to . have . been . calledWith ( 'request:sent:with:credentials' , {
576+ expect ( Cypress . backendRequestHandler ) . to . have . been . calledWith ( 'backend:request' , 'request:sent:with:credentials' , {
577577 url : 'http://localhost:3500/foo.bar.baz.json' ,
578578 resourceType : 'xhr' ,
579579 credentialStatus : false ,
@@ -582,7 +582,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
582582 } )
583583
584584 it ( 'does not patch xmlHttpRequest in the spec window or the AUT if the AUT is on the primary' , ( ) => {
585- cy . stub ( Cypress , 'backend ' ) . log ( false ) . callThrough ( )
585+ cy . stub ( Cypress , 'backendRequestHandler ' ) . log ( false ) . callThrough ( )
586586 cy . visit ( 'fixtures/xhr-fetch-requests.html' )
587587
588588 cy . window ( ) . then ( ( win ) => {
@@ -614,7 +614,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
614614 xhr . send ( )
615615 } )
616616
617- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
617+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
618618 } )
619619
620620 // expect AUT to NOT be patched in primary
@@ -636,7 +636,7 @@ describe('src/cross-origin/patches', { browser: '!webkit', defaultCommandTimeout
636636 xhr . send ( )
637637 } )
638638
639- expect ( Cypress . backend ) . not . to . have . been . calledWithMatch ( 'request:sent:with:credentials' )
639+ expect ( Cypress . backendRequestHandler ) . not . to . have . been . calledWithMatch ( 'backend:request' , 'request:sent:with:credentials' )
640640 } )
641641 } )
642642 } )
0 commit comments