bdd: Only check logs for "... should be loaded".

Checking the requests from the webserver proved problematic, as often there's
some kind of caching going on. Instead, we only check the log, as this is used
for things like :navigate anyways, so if the log says the page got loaded, we
can trust it.

There's still "... should be requested" to check the actual requests.
This commit is contained in:
Florian Bruhin 2016-01-06 22:57:49 +01:00
parent b1bf75f069
commit 7dc03710b1

View File

@ -197,7 +197,20 @@ def fill_clipboard(qtbot, qapp, httpbin, what, content):
@bdd.then(bdd.parsers.parse("{path} should be loaded"))
def path_should_be_loaded(httpbin, path):
def path_should_be_loaded(quteproc, path):
"""Make sure the given path was loaded according to the log.
This is usally the better check compared to "should be requested" as the
page could be loaded from local cache.
"""
url = quteproc.path_to_url(path)
pattern = ("load status for <qutebrowser.browser.webview.WebView tab_id=* "
"url='{}'>: LoadStatus.success".format(url))
quteproc.wait_for(message=pattern)
@bdd.then(bdd.parsers.parse("{path} should be requested"))
def path_should_be_requested(httpbin, path):
"""Make sure the given path was loaded from the webserver."""
httpbin.wait_for(verb='GET', path='/' + path)