0

I need to test WS messages with specific text are received/send from/to a 3rd party provider.

for example: in https://websocketstest.com/ I need to validate there is a time message received. enter image description here

I don't need to mock the messages, I don't need to establish connection through Cypress. Just check the messages. I tried to setup this lib cypress-websocket-testing as set in their example, but to no avail. does anyone have successfully tested such scenarios? Cypress are claiming they support WS, but have literally 0 documentation about it.

  • please take a look into: https://stackoverflow.com/questions/71705986/capture-websocket-request-in-cypress – Dxg125 Mar 23 '23 at 15:34
  • ***To no avail*** - what did you try, can you give an example of a failed test? – Fornasetti Mar 23 '23 at 20:11
  • @Dxg125, yes, i tried the lib linked in this thread. basically copied the examples here https://github.com/lensesio/cypress-websocket-testing/blob/master/examples/cypress/integration/examples/stream.spec.ts and changed the wss url, i was hoping the first test will pass and go from there. but all my tests are failing because of 'WebSocket connection to 'wss://websocketstest.com/' failed: WebSocket is closed before the connection is established.' in dev console – Ivan Haralampiev Mar 25 '23 at 12:22
  • Hey, did you consider debugging why the request (as per screenshot) is getting blocked by the client? Do you maybe have some .htaccess / server config files that restrict WSS? Also the warning right before the error is suspect, as maybe some CORS or else is blocking. – Dxg125 Mar 27 '23 at 12:45

0 Answers0