jeudi 20 août 2020

WebSocket Connection check fails when running with Testcafe

Using testcafe to test the front end of an Angular Web Application.

The front end uses stomp.js to check whether there is a Websocket connection. If there is no connection, the console will output a 'WebSocket connection to 'ws://localhost:8103/websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED'.

We start a connector process with a batch file and let it run, when we stop the running connector process, the front end displays a message that the connection is lost. (Expected behavior with manual testing)

But whenever we use Testcafe to test the exact same scenario, we don't see the connection lost message. And we also don't see the Websocket connection failed error in the console of the tescafe execution browser. Unless we manually refresh the page in the browser that Testcafe started. Then we will start to see the Websocket connection failed error. It seems that when Testcafe starts a browser, the application is unable to use stomp.js to check whether there is a Websocket connection.

Browser used is Google Chrome version 84.04147.125;
Testcafe version: 1.8.8;
Stomp.js version: 7.2.0;
OS: Windows 10;

Could this be a Testcafe bug?

Aucun commentaire:

Enregistrer un commentaire