Fix SSL error page tests

This commit is contained in:
Florian Bruhin 2018-06-25 22:51:48 +02:00
parent 81b3ef937e
commit 87778277e0

View File

@ -20,6 +20,8 @@
import pytest_bdd as bdd import pytest_bdd as bdd
bdd.scenarios('prompts.feature') bdd.scenarios('prompts.feature')
from qutebrowser.utils import qtutils
@bdd.when("I load an SSL page") @bdd.when("I load an SSL page")
def load_ssl_page(quteproc, ssl_server): def load_ssl_page(quteproc, ssl_server):
@ -46,14 +48,19 @@ def no_prompt_shown(quteproc):
@bdd.then("a SSL error page should be shown") @bdd.then("a SSL error page should be shown")
def ssl_error_page(request, quteproc): def ssl_error_page(request, quteproc):
if not request.config.webengine: if request.config.webengine and qtutils.version_check('5.9'):
line = quteproc.wait_for(message='Error while loading *: SSL ' quteproc.wait_for(message="Certificate error: *")
'handshake failed') content = quteproc.get_content().strip()
line.expected = True assert "ERR_INSECURE_RESPONSE" in content
quteproc.wait_for(message="Changing title for idx * to 'Error " else:
"loading page: *'") if not request.config.webengine:
content = quteproc.get_content().strip() line = quteproc.wait_for(message='Error while loading *: SSL '
assert "Unable to load page" in content 'handshake failed')
line.expected = True
quteproc.wait_for(message="Changing title for idx * to 'Error "
"loading page: *'")
content = quteproc.get_content().strip()
assert "Unable to load page" in content
class AbstractCertificateErrorWrapper: class AbstractCertificateErrorWrapper: