[FIX] tests: stop test runner from opening error dialogs when not ready
Previously, the test runner would evaluate an expression to check if the browser test that is about to be run is ready, but before the test is ready, this expression may be invalid as the variables used in the expression may not be defined yet, causing a ReferenceError to be thrown by Chrome. In Chrome >=102, errors that are thrown when writing code in the console or by using Runtime.evaluate over CDP are thrown in the context of the current tab, which means that they trip registered error handlers in that tab. In Odoo, this means that we show error dialogs with the traceback. In the tour manager, when we are looking for an element to trigger, we only look for that element inside dialogs if there are any dialogs open (unless the in_dialog option is false on that specific step). This means that if an error dialog is open, most tours will fail (which is actually what we want). In order to avoid opening a bunch of error dialogs while waiting for the tour to be ready, we simply wrap the ready expression in a try catch so that it doesn't throw an error, and simply returns a undefined until the tour is ready instead of throwing a ReferenceError. closes odoo/odoo#95635 X-original-commit: 3872dbd63233d4c6d961a3cd896b84e4301a1f84 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
committed by
Xavier Morel
parent
2a44537c7c
commit
8f2673708a
@@ -1342,7 +1342,7 @@ class ChromeBrowser:
|
||||
break
|
||||
|
||||
result = self._websocket_request('Runtime.evaluate', params={
|
||||
'expression': ready_code,
|
||||
'expression': "try { %s } catch {}" % ready_code,
|
||||
'awaitPromise': True,
|
||||
}, timeout=timeout-taken)['result']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user