def _print_webengine_output(result): errors = result['errors'] messages = result['messages'] for message in messages: level = message['level'] text = message['text'] url = message['url'] line = message['line'] col = message['col'] msg = "{%s} %s:%s:%s %s" % (level, url, line, col, text) info(msg, label="JS") for error in errors: for line in error['text'].split("\n"): fail(line, label="JS")
def _print_phantomjs_output(result): errors = result['errors'] messages = result['messages'] resources = result['resources'] for message in messages: msg = message['msg'] line = message.get('line') source = message.get('source') if source and line: msg = "%s:%s: %s" % (source, line, msg) info(msg, label="JS") for resource in resources: fail(resource['errorString'], label="JS") for error in errors: fail(error['msg'], label="JS") for item in error['trace']: file = item['file'] line = item['line'] if file and line: fail(" %s: %d" % (file, line), label="JS")
def _print_phantomjs_output(result): errors = result['errors'] messages = result['messages'] resources = result['resources'] for message in messages: msg = message['msg'] line = message.get('line') source = message.get('source') if source and line: msg = "%s:%s: %s" % (source, line, msg) info(msg, label="JS") # Process resources for resource in resources: url = resource['url'] if url.endswith(".png"): ok("%s: %s (%s)" % (url, yellow(resource['status']), resource['statusText'])) else: fail("Resource error:: %s: %s (%s)" % (url, red(resource['status']), resource['statusText']), label="JS") # You can have a successful test, and still have errors reported, so not failing here. for error in errors: fail(error['msg'], label="JS") for item in error['trace']: file = item['file'] line = item['line'] if file and line: fail(" %s: %d" % (file, line), label="JS")