Cypress intercept not honoring actual pathname/query

Viewed 633

I've had this a few times now, 100+ routes in this cypress application however sometimes they work, sometimes they don't, the issue is that even though i've setup my routes correctly they're showing up as an asterix in the route section (see screenshots), after the /campaign route you can see a bunch of asterix, which are all the interceptions using pathname and query.

Why are these showing up as a wild matching route?

I've tried regular expression matches, pathname & query, default method & url:

cy.intercept('GET', new RegExp(`\/placement\?where\={"campaign"\:"${campaign.id}"}$`), {
    body: placements
});
cy.intercept('GET', `/placement?where={"campaign":"${campaign.id}"}`, {
    body: placements
});
cy.intercept({
    method: 'GET',
    pathname: `/placement`
    query: {
        where: `{"campaign":"${campaign.id}"}`
    }
}, {
    body: placements
});

As per their documentation, i don't see why ANY of the above 3 examples shouldn't work, they all match the same thing?

enter image description here

enter image description here

0 Answers
Related