Cy.Intercept Failing #16750
Unanswered
kchemutai
asked this question in
Component Testing
Replies: 1 comment
-
You need to update the matcher for the url so that it will match a url that includes a query param. Instead of it('test cy.intercept()', () => {
cy.intercept('/api/roles*').as('getUrl')
cy.visit('https://example.com')
cy.window().then((win) => {
const xhr = new win.XMLHttpRequest()
xhr.open('GET', '/api/roles?country=UG')
xhr.send()
})
cy.wait('@getUrl')
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Cypress Intercept failing to detect a 200 response from a Post
Hi All,
I am trying to use a cypress Intercept to wait for a post request to /api/roles in my tests so that i can start assertions, the API returns 200 status code but cypress does not detect making the test to fail.
Here is a screen shot

Here is a Snipplet of code i am running
Beta Was this translation helpful? Give feedback.
All reactions