vendredi 29 mai 2020

How to mock websocket messages in Cypress

In my team we are using websockets to push some notifications that then update the state of the app. I tried to test changes in UI, but real data is to random and I have to mock it. Unfortunately, as for now I was unsuccessful. I tried to use @lensesio/cypress-websocket-testing plugin, but all I can do with it is catch real data and check what it was.

Is there a way to mock websockets in Cypress? I want my mocked server to send the message, that UI will display in browser and Cypress will assert if it's true. Something like cy.route for websockets.

Aucun commentaire:

Enregistrer un commentaire