From 8266af83398e3f544506d904d0a366797f467328 Mon Sep 17 00:00:00 2001 From: Pierre Paridans Date: Tue, 19 Dec 2023 10:00:55 +0100 Subject: [PATCH] [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) Signed-off-by: Pierre Paridans (app) --- odoo/tests/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 0c8c9de8b65..03d3a1bf8c7 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -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