[IMP] core: JS test runner
Emit JS warnings as Python warnings, otherwise it's a pain in the ass to identify the t-raw messages (they get lost in the INFO spam). Also just log exceptions when looking for specific messages instead of re-raising them: if the pipe from chrome is full of exception reports, the runner may blow its stack as it looks for the screenshot message: on the first it takes a screenshot, then looks for the screenshot message, finds an exception, takes a screenshot, looks for a screenshot message, finds an exception, takes a screenshot, looks for a s...
This commit is contained in:
+17
-6
@@ -1051,11 +1051,22 @@ class ChromeBrowser():
|
||||
res['success'] = 'test successful' in message
|
||||
|
||||
if res.get('method') == 'Runtime.exceptionThrown':
|
||||
exception_details = res['params']['exceptionDetails']
|
||||
descr = exception_details.get('exception', {}).get('description')
|
||||
self.take_screenshot()
|
||||
self._save_screencast()
|
||||
raise ChromeBrowserException(descr or pprint.pformat(exception_details))
|
||||
details = res['params']['exceptionDetails']
|
||||
message = details['text']
|
||||
exception = details.get('exception')
|
||||
if exception:
|
||||
message += str(self._from_remoteobject(exception))
|
||||
details['type'] = 'trace' # fake this so _format_stack works
|
||||
stack = ''.join(self._format_stack(details))
|
||||
if stack:
|
||||
message += '\n' + stack
|
||||
|
||||
if raise_log_error:
|
||||
self.take_screenshot()
|
||||
self._save_screencast()
|
||||
raise ChromeBrowserException(message)
|
||||
else:
|
||||
self._logger.getChild('browser').error(message)
|
||||
|
||||
return res
|
||||
|
||||
@@ -1063,7 +1074,7 @@ class ChromeBrowser():
|
||||
'debug': logging.DEBUG,
|
||||
'log': logging.INFO,
|
||||
'info': logging.INFO,
|
||||
'warning': logging.INFO, # logging.WARNING,
|
||||
'warning': logging.WARNING,
|
||||
'error': logging.ERROR,
|
||||
# TODO: what do with
|
||||
# dir, dirxml, table, trace, clear, startGroup, startGroupCollapsed,
|
||||
|
||||
Reference in New Issue
Block a user