From a5f1022330c5d222a449f07c929f1987ed9842ec Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 20 Mar 2018 11:56:46 +0100 Subject: [PATCH] Log document.body in JS tests --- tests/unit/javascript/conftest.py | 4 ++-- tests/unit/javascript/stylesheet/test_stylesheet.py | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/unit/javascript/conftest.py b/tests/unit/javascript/conftest.py index a71baef11..89db706e5 100644 --- a/tests/unit/javascript/conftest.py +++ b/tests/unit/javascript/conftest.py @@ -46,10 +46,10 @@ class JSTester: self.qtbot = qtbot loader = jinja2.FileSystemLoader(os.path.dirname(__file__)) self._jinja_env = jinja2.Environment(loader=loader, autoescape=True) - # Make sure logging via JS fails tests + # Make sure error logging via JS fails tests config_stub.val.content.javascript.log = { + 'info': 'info', 'error': 'error', - 'info': 'error', 'unknown': 'error', 'warning': 'error' } diff --git a/tests/unit/javascript/stylesheet/test_stylesheet.py b/tests/unit/javascript/stylesheet/test_stylesheet.py index 7b507b0c0..1553d4f14 100644 --- a/tests/unit/javascript/stylesheet/test_stylesheet.py +++ b/tests/unit/javascript/stylesheet/test_stylesheet.py @@ -60,10 +60,12 @@ class StylesheetTester: def check_set(self, value, css_style="background-color", document_element="document.body"): """Check whether the css in ELEMENT is set to VALUE.""" - self.js.run("window.getComputedStyle({}, null)" - ".getPropertyValue('{}');" - .format(document_element, - javascript.string_escape(css_style)), value) + self.js.run("console.log({document});" + "window.getComputedStyle({document}, null)" + ".getPropertyValue('{prop}');".format( + document=document_element, + prop=javascript.string_escape(css_style)), + value) def check_eq(self, one, two, true=True): """Check if one and two are equal."""