You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the documentation for cy.route2 there's this example of the delay function:
cy.route2('/users', (req) => {
req.delay(200)
})
When I tried that I got a compilation error: Property 'delay' does not exist on 'InocmingHttpRequest'. From looking at the code, looks like it's on IncomingHttpResponse, not on the request itself.
Same thing applies to the throttle function. The redirect one does seem to compile OK though.
There's a couple of other minor issues too (let me know if you want separate issues logged for these):
One of the code snippets talks about beetle items in a response - it's not really clear what this is referring to.
The section about multiple requests isn't quite clear in terms of how to stub a single route, and give it a different response every time it's called (particularly required for GraphQL endpoints). For example, can you call cy.route2 multiple times in a test, to set up a different way to handle the call each time?
The text was updated successfully, but these errors were encountered:
Yeah, there's a typo, .delay and .throttle should be documented on res, not req.
For example, can you call cy.route2 multiple times in a test, to set up a different way to handle the call each time?
There's not an API for counting requests yet, but you can set up the counting yourself, for example:
lethitCount=0cy.route2('/someRoute',(req)=>{hitCount++switch(hitCount){case1: // do somethingcase2: // do something elsedefault: // do something for all further requests}})
In the documentation for
cy.route2
there's this example of thedelay
function:When I tried that I got a compilation error:
Property 'delay' does not exist on 'InocmingHttpRequest'
. From looking at the code, looks like it's onIncomingHttpResponse
, not on the request itself.Same thing applies to the
throttle
function. Theredirect
one does seem to compile OK though.There's a couple of other minor issues too (let me know if you want separate issues logged for these):
beetle
items in a response - it's not really clear what this is referring to.cy.route2
multiple times in a test, to set up a different way to handle the call each time?The text was updated successfully, but these errors were encountered: