From d4f8f7ece69da99ce107e16fc43a8ac1066b953c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 7 Nov 2022 07:05:21 +0000 Subject: [PATCH] [IMP] core: handling of the form tour checker `DOM.querySelector` will generally return a `nodeId` of 0 when no node is found, however there is a small window during which the document can apparently get collected (?), which leads to an error Could not find node with given id which can break otherwise successful builds (cf 20832402 / staging 60731). Handle errors from the pipeline as if the node had not been found, though the matter was not fully investigated so it's possible this explanation is incomplete or incorrect. The CDTP documentation does not document the failure modes for either `DOM.getDocument` or `DOM.querySelector`. closes odoo/odoo#105734 X-original-commit: 5ef975f75cf8044e7dcd67f403ca11058630c85a Signed-off-by: Xavier Morel (xmo) --- odoo/tests/common.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/odoo/tests/common.py b/odoo/tests/common.py index fa380f52db9..0141426222c 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -7,6 +7,7 @@ helpers and classes to write tests. import base64 import collections import concurrent.futures +import contextlib import difflib import functools import importlib @@ -1320,9 +1321,11 @@ class ChromeBrowser: ) @qs.add_done_callback def _qs_result(fut): - # stupid dumbass chrome returns a nodeid of 0 when nothing - # is found - if fut.result()['nodeId']: + node_id = 0 + with contextlib.suppress(Exception): + node_id = fut.result()['nodeId'] + + if node_id: self.take_screenshot("unsaved_form_") self._result.set_exception(ChromeBrowserException("""\ Tour finished with an open form view in edition mode.