Created
December 9, 2019 14:26
-
-
Save vincentchalamon/19e2641de2a51d2d9b4668d42f6fe113 to your computer and use it in GitHub Desktop.
Replace `fetch` requests to `xhr` in Cypress configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before(() => { | |
Cypress.log({}); | |
cy.request('https://unpkg.com/unfetch@4.1.0/dist/unfetch.umd.js', {log: false}).as('unfetch').then(unfetch => { | |
Cypress.on('window:before:load', win => { | |
delete win.fetch; | |
win.eval(unfetch); | |
win.fetch = win.unfetch; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment