lensesio / cypress-websocket-testing

Test WebSocket connections with Cypress
Apache License 2.0
83 stars 12 forks source link

Is it possible to mock WS response? #17

Open captain-yossarian opened 3 years ago

captain-yossarian commented 3 years ago

I have found your package very useful! However, I don’t know/understand if I can mock WS response? Can I ask you to provide some super small example?

Some times WS are very slow, and my tests are failing. That's why I want mock them.

Thanks

dsebastian commented 3 years ago

Hi @captain-yossarian . Currently the lib is built for testing existing WebSocket connections. We have an internal tool that we use to mock our Web Sockets and are looking into open sourcing it. Will let you know once we have some updates on that. Thanks

captain-yossarian commented 3 years ago

@dsebastian Thanks for such fast response. I'm just curious, how you mock WS response? From the bird eye view

dsebastian commented 3 years ago

@captain-yossarian We use a custom built server to serve mock payloads. Similar to how Wiremock does it, but with streaming data.

mrpicklez70 commented 3 years ago

Hi there, I've also been looking for a library/solution to mock WS responses from my tests. It would be super useful to have access to your internal tool @dsebastian. Thanks in advance!

dsebastian commented 3 years ago

Hi @mrpicklez70 , we were quite busy with the latest release, which just went out. The task is on the list and will be picked up shortly hopefully if there are people interested in this functionality.

Belzee10 commented 3 years ago

I would be useful to have this, I have also been looking for a solution of how to mock WS responses, without success so far :(

hejtful commented 3 years ago

It would be amazing if you open sourced the tool for mocking WS responses 😄 Looking forward to trying it out as soon as it's published!

hriverahdez commented 3 years ago

This is exactly what we're missing out in our team to improve testing. Would definitely be very helpful if you make it happen.

jpresagios commented 3 years ago

It would be great to add the ability to mocking WS responses to allow testing on some slow WS connections.

dsebastian commented 3 years ago

Thanks to everyone for pushing this request forward. We have decided to include it in the upcoming sprint. There's a few features we are trying to iron out first, but will try to get something out and add features as they are needed. Still, if you have any feature requests/case scenarios that we can analyse and see if there are any quick wins to include them in v1, post them here.

mrpicklez70 commented 3 years ago

Thanks to everyone for pushing this request forward. We have decided to include it in the upcoming sprint. There's a few features we are trying to iron out first, but will try to get something out and add features as they are needed. Still, if you have any feature requests/case scenarios that we can analyse and see if there are any quick wins to include them in v1, post them here.

hi @dsebastian , any updates on this one?

dsebastian commented 3 years ago

Hi @mrpicklez70 , yes, we are working on it. We had to decouple a lot of our code from it. We have only a couple of items still in progress then we should go to testing. Unfortunately I can't give you an ETA yet. Thanks.

Cubo25 commented 2 years ago

Hello ! what's the status of this ? :) I would love to have this feature. Thanks

dsebastian commented 2 years ago

Hi @Cubo25 . Dev work is done for this, unfortunately there's some issues a bit outside of our control that need sorting before we get this in the public domain. Will let everyone know once that happens.

konstantinschuette commented 2 years ago

Hi @Cubo25 . Dev work is done for this, unfortunately there's some issues a bit outside of our control that need sorting before we get this in the public domain. Will let everyone know once that happens.

Is there any ETA on when this plugin/feature will be added?