Reputation: 15945
I couldn't find anything in the documentation about asserting on the xhr response on the page.
Would like to know how it could be achieved in code?
Upvotes: 0
Views: 378
Reputation: 76
you can use expect let's suppose that you set up the cypress server as below:
cy.server()
cy.route({<your route details>}).as('aliasName')
Then later in the code, you can use
cy.wait('@aliasName').then(xhr => {
expect(xhr.responseBody.<your Item>).to.eql('something')
})
Upvotes: 1