Add test for styling error pages

This commit is contained in:
Jay Kamat 2017-11-08 23:46:12 -05:00
parent 04b66e1a0a
commit 2f9a857a27
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 11 additions and 4 deletions

View File

@ -195,16 +195,17 @@ class JSWebEngineTester:
self.webview.setHtml(template.render(**kwargs))
assert blocker.args == [True]
def load_file(self, path: str):
def load_file(self, path: str, force=False):
"""Loads a file from disk"""
self.load_url(QUrl.fromLocalFile(
os.path.join(os.path.dirname(__file__), path)))
os.path.join(os.path.dirname(__file__), path)), force)
def load_url(self, url: QUrl):
def load_url(self, url: QUrl, force=False):
"""Load a given QUrl."""
with self._qtbot.waitSignal(self.webview.loadFinished) as blocker:
self.webview.load(url)
assert blocker.args == [True]
if not force:
assert blocker.args == [True]
import time
time.sleep(1)

View File

@ -111,3 +111,9 @@ def test_no_set_svg(stylesheet_tester):
stylesheet_tester.check_set(None)
stylesheet_tester.set_css("body {background-color: rgb(0, 255, 0);}")
stylesheet_tester.check_set(None)
def test_set_error(stylesheet_tester):
"""Test stylesheet modifies file not found error pages."""
stylesheet_tester.init_stylesheet()
stylesheet_tester.js.load_file('non-existent.html', force=True)
stylesheet_tester.check_set(GREEN_BODY_BG)