I'm having trouble intercepting requests to the Backend using Cypress. Strangely, I can't see some of the XHR requests in the DevTools, even though they are there. To help illustrate the issue, I've included a screenshot with arrows. https://i.sstatic.net/dLHlP.png
Unfortunately, I can't share my project on a public repository, but perhaps you can provide some insights based on the test itself. I haven't included any beforeEach blocks, etc.
it('should generate the correct request for password change', () => {
cy.visit(`/courses/reset-password?token=${token}&userId=${userId}`);
cy.server();
cy.route('POST', '/auth/local/reset-password').as('resetRequest');
cy.get('#password').type(password);
cy.get('#confirmPassword').type(password);
cy.get('button[type="submit"]').click();
console.log('at the end');
cy.wait('@resetRequest').then((request) => {
// I never reach this point
console.log('fff', request);
console.log('requestBody', request.requestBody);
expect(request.body.newPassword).to.eq(password);
expect(request.body.token).to.eq(token);
expect(request.body.userId).to.eq(userId);
});
});
If you have any insights or suggestions, please feel free to share them with me :)