bdd: Add first SSL test.
This commit is contained in:
parent
8dd7f080f4
commit
9479b65d25
@ -62,3 +62,12 @@ Feature: Prompts
|
|||||||
And I run :hint
|
And I run :hint
|
||||||
And I run :follow-hint a
|
And I run :follow-hint a
|
||||||
Then the javascript message "Prompt reply: null" should be logged
|
Then the javascript message "Prompt reply: null" should be logged
|
||||||
|
|
||||||
|
# SSL
|
||||||
|
|
||||||
|
Scenario: SSL error with ssl-strict = false
|
||||||
|
When I set network -> ssl-strict to false
|
||||||
|
And I load a SSL page
|
||||||
|
And I wait until the SSL page finished loading
|
||||||
|
Then the error "SSL error: The certificate is self-signed, and untrusted" should be shown
|
||||||
|
And the page should contain the plaintext "Hello World via SSL!"
|
||||||
|
@ -21,6 +21,18 @@ import pytest_bdd as bdd
|
|||||||
bdd.scenarios('prompts.feature')
|
bdd.scenarios('prompts.feature')
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.when("I load a SSL page")
|
||||||
|
def load_ssl_page(quteproc, ssl_server):
|
||||||
|
quteproc.open_path('/', port=ssl_server.port, https=True)
|
||||||
|
# We don't call wait_for_load_finished here as we can get an SSL question.
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.when("I wait until the SSL page finished loading")
|
||||||
|
def load_ssl_page(quteproc, ssl_server):
|
||||||
|
quteproc.wait_for_load_finished('/', port=ssl_server.port, https=True,
|
||||||
|
load_status='warn')
|
||||||
|
|
||||||
|
|
||||||
@bdd.when("I click the button")
|
@bdd.when("I click the button")
|
||||||
def click_button(quteproc):
|
def click_button(quteproc):
|
||||||
quteproc.send_cmd(':hint')
|
quteproc.send_cmd(':hint')
|
||||||
|
@ -289,7 +289,7 @@ class QuteProc(testprocess.Process):
|
|||||||
line.expected = True
|
line.expected = True
|
||||||
|
|
||||||
def wait_for_load_finished(self, path, *, port=None, https=False,
|
def wait_for_load_finished(self, path, *, port=None, https=False,
|
||||||
timeout=None):
|
timeout=None, load_status='success'):
|
||||||
"""Wait until any tab has finished loading."""
|
"""Wait until any tab has finished loading."""
|
||||||
if timeout is None:
|
if timeout is None:
|
||||||
if 'CI' in os.environ:
|
if 'CI' in os.environ:
|
||||||
@ -303,9 +303,9 @@ class QuteProc(testprocess.Process):
|
|||||||
url = utils.elide(QUrl(url).toDisplayString(QUrl.EncodeUnicode), 100)
|
url = utils.elide(QUrl(url).toDisplayString(QUrl.EncodeUnicode), 100)
|
||||||
pattern = re.compile(
|
pattern = re.compile(
|
||||||
r"(load status for <qutebrowser\.browser\.webview\.WebView "
|
r"(load status for <qutebrowser\.browser\.webview\.WebView "
|
||||||
r"tab_id=\d+ url='{url}'>: LoadStatus\.success|fetch: "
|
r"tab_id=\d+ url='{url}'>: LoadStatus\.{load_status}|fetch: "
|
||||||
r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format(
|
r"PyQt5\.QtCore\.QUrl\('{url}'\) -> .*)".format(
|
||||||
url=re.escape(url)))
|
load_status=re.escape(load_status), url=re.escape(url)))
|
||||||
self.wait_for(message=pattern, timeout=timeout)
|
self.wait_for(message=pattern, timeout=timeout)
|
||||||
|
|
||||||
def get_session(self):
|
def get_session(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user