-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
topic: networktype: enhancementRequested enhancement of existing featureRequested enhancement of existing feature
Description
Many developers are migrating to window.fetch from XHRs due to the simplified async interface it exposes. I happen to be one of those developers.
Cypress should support window.fetch with similar abilities to those of XHRs: I should be able to query the request and response, wait on them, and mock with data and fixtures.
Cypress team edit
This feature will work seamlessly once Full network stubbing is implemented.
Workarounds
- use experimental fetch polyfill available in v4.9.0
or do it yourself:
- delete
window.fetchbefore visiting the page to force your application to polyfill it on top of XHR. If the application does not include a polyfill, you can load one from your tests. - stub
window.fetchdirectly in JavaScript
See these solutions in Stubbing window.fetch example recipe
wejendorp, PhilippSpo, SMenigat, artursgirons, peterklijn and 392 moredsvalenciah-vendoo, sitvanit and Undistractionbaumannzone, tbell511, drewbrend, gersongoulart, belkozavr and 17 moreharshithjv, gersongoulart, smariapena, ajoseps, anyulled and 6 moreleegee, johackim, danielkcz, marcelmattsson, Bartosz-Szopiera and 28 moreabhidp, maximebrugel, hasangilakdev, taylorjdawson, 0ubbe and 6 morechristianmemije, gersongoulart, belkozavr, jtokarski, kshreve and 20 more
Metadata
Metadata
Assignees
Labels
topic: networktype: enhancementRequested enhancement of existing featureRequested enhancement of existing feature