Make prompt tests run
This commit is contained in:
parent
6697d692e1
commit
d93bc8b26b
@ -130,12 +130,12 @@ class WebEnginePage(QWebEnginePage):
|
|||||||
self.certificate_error.emit()
|
self.certificate_error.emit()
|
||||||
url = error.url()
|
url = error.url()
|
||||||
error = webenginetab.CertificateErrorWrapper(error)
|
error = webenginetab.CertificateErrorWrapper(error)
|
||||||
|
log.webview.debug("Certificate error: {}".format(error))
|
||||||
|
|
||||||
# FIXME
|
url_string = url.toDisplayString()
|
||||||
error_page = jinja.render('error.html',
|
error_page = jinja.render(
|
||||||
title="Error while loading page",
|
'error.html', title="Error loading page: {}".format(url_string),
|
||||||
url=url.toDisplayString(), error=str(error),
|
url=url_string, error=str(error), icon='')
|
||||||
icon='', qutescheme=False)
|
|
||||||
|
|
||||||
if not error.is_overridable():
|
if not error.is_overridable():
|
||||||
log.webview.error("Non-overridable certificate error: "
|
log.webview.error("Non-overridable certificate error: "
|
||||||
@ -147,7 +147,6 @@ class WebEnginePage(QWebEnginePage):
|
|||||||
url, [error], abort_on=[self.loadStarted, self.shutting_down])
|
url, [error], abort_on=[self.loadStarted, self.shutting_down])
|
||||||
|
|
||||||
if not ignore:
|
if not ignore:
|
||||||
log.webview.error("Certificate error: {}".format(error))
|
|
||||||
self.setHtml(error_page)
|
self.setHtml(error_page)
|
||||||
|
|
||||||
return ignore
|
return ignore
|
||||||
|
@ -234,7 +234,8 @@ class NetworkManager(QNetworkAccessManager):
|
|||||||
errors: A list of errors.
|
errors: A list of errors.
|
||||||
"""
|
"""
|
||||||
errors = [webkittab.CertificateErrorWrapper(e) for e in errors]
|
errors = [webkittab.CertificateErrorWrapper(e) for e in errors]
|
||||||
log.webview.debug("Certificate errors {!r}".format(errors))
|
log.webview.debug("Certificate errors: {!r}".format(
|
||||||
|
' / '.join(str(err) for err in errors)))
|
||||||
try:
|
try:
|
||||||
host_tpl = urlutils.host_tuple(reply.url())
|
host_tpl = urlutils.host_tuple(reply.url())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -167,7 +167,7 @@ Feature: Prompts
|
|||||||
# SSL
|
# SSL
|
||||||
|
|
||||||
Scenario: SSL error with ssl-strict = false
|
Scenario: SSL error with ssl-strict = false
|
||||||
When I run :debug-clear-ssl-errors
|
When I clear SSL errors
|
||||||
And I set network -> ssl-strict to false
|
And I set network -> ssl-strict to false
|
||||||
And I load an SSL page
|
And I load an SSL page
|
||||||
And I wait until the SSL page finished loading
|
And I wait until the SSL page finished loading
|
||||||
@ -175,14 +175,13 @@ Feature: Prompts
|
|||||||
And the page should contain the plaintext "Hello World via SSL!"
|
And the page should contain the plaintext "Hello World via SSL!"
|
||||||
|
|
||||||
Scenario: SSL error with ssl-strict = true
|
Scenario: SSL error with ssl-strict = true
|
||||||
When I run :debug-clear-ssl-errors
|
When I clear SSL errors
|
||||||
And I set network -> ssl-strict to true
|
And I set network -> ssl-strict to true
|
||||||
And I load an SSL page
|
And I load an SSL page
|
||||||
Then "Error while loading *: SSL handshake failed" should be logged
|
Then a SSL error page should be shown
|
||||||
And the page should contain the plaintext "Unable to load page"
|
|
||||||
|
|
||||||
Scenario: SSL error with ssl-strict = ask -> yes
|
Scenario: SSL error with ssl-strict = ask -> yes
|
||||||
When I run :debug-clear-ssl-errors
|
When I clear SSL errors
|
||||||
And I set network -> ssl-strict to ask
|
And I set network -> ssl-strict to ask
|
||||||
And I load an SSL page
|
And I load an SSL page
|
||||||
And I wait for a prompt
|
And I wait for a prompt
|
||||||
@ -191,13 +190,12 @@ Feature: Prompts
|
|||||||
Then the page should contain the plaintext "Hello World via SSL!"
|
Then the page should contain the plaintext "Hello World via SSL!"
|
||||||
|
|
||||||
Scenario: SSL error with ssl-strict = ask -> no
|
Scenario: SSL error with ssl-strict = ask -> no
|
||||||
When I run :debug-clear-ssl-errors
|
When I clear SSL errors
|
||||||
And I set network -> ssl-strict to ask
|
And I set network -> ssl-strict to ask
|
||||||
And I load an SSL page
|
And I load an SSL page
|
||||||
And I wait for a prompt
|
And I wait for a prompt
|
||||||
And I run :prompt-accept no
|
And I run :prompt-accept no
|
||||||
Then "Error while loading *: SSL handshake failed" should be logged
|
Then a SSL error page should be shown
|
||||||
And the page should contain the plaintext "Unable to load page"
|
|
||||||
|
|
||||||
# Geolocation
|
# Geolocation
|
||||||
|
|
||||||
@ -469,6 +467,7 @@ Feature: Prompts
|
|||||||
|
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/1249#issuecomment-175205531
|
# https://github.com/The-Compiler/qutebrowser/issues/1249#issuecomment-175205531
|
||||||
# https://github.com/The-Compiler/qutebrowser/pull/2054#issuecomment-258285544
|
# https://github.com/The-Compiler/qutebrowser/pull/2054#issuecomment-258285544
|
||||||
|
@qtwebengine_todo: Permissions are not implemented yet
|
||||||
Scenario: Interrupting SSL prompt during a notification prompt
|
Scenario: Interrupting SSL prompt during a notification prompt
|
||||||
When I set content -> notifications to ask
|
When I set content -> notifications to ask
|
||||||
And I set network -> ssl-strict to ask
|
And I set network -> ssl-strict to ask
|
||||||
|
@ -22,6 +22,15 @@ import pytest_bdd as bdd
|
|||||||
bdd.scenarios('prompts.feature')
|
bdd.scenarios('prompts.feature')
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.when("I clear SSL errors")
|
||||||
|
def clear_ssl_errors(request, quteproc):
|
||||||
|
if request.config.webengine:
|
||||||
|
quteproc.terminate()
|
||||||
|
quteproc.start()
|
||||||
|
else:
|
||||||
|
quteproc.send_cmd(':debug-clear-ssl-errors')
|
||||||
|
|
||||||
|
|
||||||
@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):
|
||||||
# We don't wait here as we can get an SSL question.
|
# We don't wait here as we can get an SSL question.
|
||||||
@ -43,3 +52,15 @@ def wait_for_prompt(quteproc):
|
|||||||
def no_prompt_shown(quteproc):
|
def no_prompt_shown(quteproc):
|
||||||
quteproc.ensure_not_logged(message='Entering mode KeyMode.* (reason: '
|
quteproc.ensure_not_logged(message='Entering mode KeyMode.* (reason: '
|
||||||
'question asked)')
|
'question asked)')
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.then("a SSL error page should be shown")
|
||||||
|
def ssl_error_page(request, quteproc):
|
||||||
|
if not request.config.webengine:
|
||||||
|
line = quteproc.wait_for(message='Error while loading *: SSL '
|
||||||
|
'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
|
||||||
|
Loading…
Reference in New Issue
Block a user