Skip to content
Permalink
Browse files

[FIX] tests: catch runtime exceptions during browser_js tests

Actually, when running browser_js tests, the test automatically fails
when a console error is seen.
In some cases, an exception can be thrown during a tour but without
console error. In that case, another type of devtools protocol event is
fired: Runtime.exceptionThorwn. This event is not catched by the
browser_js test.

With this commit the above mentioned event is catched and the test is
directly considered as failed.

closes #31555

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
  • Loading branch information...
d-fence committed Feb 27, 2019
1 parent 9450469 commit 7282a354c23d0e4794c78aca459f4abddc4b0ccb
Showing with 7 additions and 1 deletion.
  1. +7 −1 odoo/tests/common.py
@@ -734,7 +734,13 @@ def _wait_code_ok(self, code, timeout):
if res.get('result', {}).get('result').get('subtype', '') == 'error':
self._logger.error("Running code returned an error")
return False
elif res and res.get('method') == 'Runtime.consoleAPICalled' and res.get('params', {}).get('type') in ('log', 'error', 'trace'):
elif res and res.get('method') == 'Runtime.exceptionThrown':
exception_details = res.get('params', {}).get('exceptionDetails', {})
self._logger.error(exception_details)
self.take_screenshot()
self._save_screencast()
return False
elif res and res.get('method') in 'Runtime.consoleAPICalled' and res.get('params', {}).get('type') in ('log', 'error', 'trace'):
logs = res.get('params', {}).get('args')
log_type = res.get('params', {}).get('type')
content = " ".join([str(log.get('value', '')) for log in logs])

0 comments on commit 7282a35

Please sign in to comment.
You can’t perform that action at this time.