-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
topic: cy.intercept()type: enhancementRequested enhancement of existing featureRequested enhancement of existing feature
Description
Current behavior:
To change the response for a route over time, currently, the user must implement counting themselves:
let k = 0;
cy.intercept('/favorite-fruits', (req) => {
k += 1
switch (k) {
case 1:
return req.reply(['apples 🍎'])
case 2:
return req.reply(['grapes 🍇'])
case 3:
return req.reply(['kiwi 🥝'])
default:
return
}
})Desired behavior:
There is an API for the user to specify the number of times to use a route's handler. Something like this:
cy.intercept({ url: '/favorite-fruits', times: 1 }, ['apples 🍎'])
cy.intercept({ url: '/favorite-fruits', times: 1 }, ['grapes 🍇'])
cy.intercept({ url: '/favorite-fruits', times: 1 }, ['kiwi 🥝'])camden-brown, amerryma, amortemousque, dheeraj-jn, slava-yefremov and 9 more
Metadata
Metadata
Assignees
Labels
topic: cy.intercept()type: enhancementRequested enhancement of existing featureRequested enhancement of existing feature