When the socket from a browser timeout, reconnection of the socket doesn't get handled by testem
See original GitHub issueI am experiencing browser timeout inconsistently as part of my test execution. I was able to observe that when this happens, the socket was closed and testem receives a disconnect event that starts the timer for the browser timeout error. During this time, socketio will reconnect the socket via a new id. But since testem does not handle the reconnection, the timeout will expire and the browser timeout error will be thrown.
To reproduce this, I added debug logs from socket.io in both server & client side:
DEBUG=socket.io:* when executing test command
And on the browser, setting localStorage.debug = '*'
From Client side, I get logs as such:
engine.io-client:socket socket close with reason transport close socket.io-client:manager onclose socket.io-client:manager cleanup socket.io-client:manager cleanup transport close socket.io-client:manager will wait %dms before reconnect attempt 579 socket.io-client:manager attempting reconnect socket.io-client:manager readyState closed socket.io-client:manager opening localhost:7357 engine.io-client:socket creating transport polling engine.io-client:polling polling engine.io-client:polling-xhr xhr poll engine.io-client:polling-xhr xhr open GET http://localhost:7357/socket.io/?EIO=3&transport=polling&t=MBpRduP engine.io-client:polling-xhr xhr data null engine.io-client:socket setting transport polling socket.io-client:manager connect attempt will timeout after 20000 engine.io-client:polling polling got data “96:0{"sid":"0kZ0foLaS_CiaQf1AAAQ","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40” engine.io-client:socket socket receive: type open engine.io-client:socket socket open socket.io-client:manager open socket.io-client:manager cleanup socket.io-client:socket transport is open - connecting socket.io-client:manager reconnect success
From the testem side, i get:
2018-04-23T16:55:27.515Z socket.io:server incoming connection with id 0kZ0foLaS_CiaQf1AAAQ 2018-04-23T16:55:27.515Z socket.io:client connecting to namespace / 2018-04-23T16:55:27.515Z socket.io:namespace adding socket to nsp / 2018-04-23T16:55:27.515Z socket.io:socket socket connected - writing packet 2018-04-23T16:55:27.515Z socket.io:socket joining room 0kZ0foLaS_CiaQf1AAAQ 2018-04-23T16:55:27.516Z socket.io:socket packet already sent in initial handshake 2018-04-23T16:55:27.516Z socket.io:socket joined room 0kZ0foLaS_CiaQf1AAAQ
This is related to #1021.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
Closing this issue since it has been taken care off by #1276
@step2yeung whats the current state of this issue?