[FIX] tests: error when Chrome websocket returns empty message
Since Chrome 120 (specifically Chromium build 1208985), an empty message is received from the CDT at the end of a test run, which obviously cannot be parsed as JSON. This is due to a fix made in Chromium [1] where ChromeDriver didn't send the CLOSE frame in response to the CLOSE frame sent by the client. The websocket-client library we use to talk with the CDT interprets this frame as a empty string when receiving message (cf. in `_core.py` [2]). As we don't need to interpret more complex low-level messages, this commit simply skips the empty message (which was already implicitly done in 15.0 [3]). [1]: https://bugs.chromium.org/p/chromedriver/issues/detail?id=4499 [2]: https://github.com/websocket-client/websocket-client/blob/69e470fee083cd4d5f42bccaff3a6168bfeee863/websocket/_core.py#L379-L399 [3]: https://github.com/odoo/odoo/blob/b5b069564c0a0246f3f263804088d40c3990633a/odoo/tests/common.py#L1169 closes odoo/odoo#146913 X-original-commit: 28d5a2603fb0284629079af2b8b431b45d58cd18 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Pierre Paridans (app) <app@odoo.com>
This commit is contained in:
@@ -1162,6 +1162,8 @@ class ChromeBrowser:
|
||||
while True: # or maybe until `self._result` is `done()`?
|
||||
try:
|
||||
msg = self.ws.recv()
|
||||
if not msg:
|
||||
continue
|
||||
self._logger.debug('\n<- %s', msg)
|
||||
except websocket.WebSocketTimeoutException:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user