qutebrowser/tests/end2end/features/test_prompts_bdd.py

52 lines
1.8 KiB
Python
Raw Normal View History

# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import pytest_bdd as bdd
2016-01-12 08:20:08 +01:00
bdd.scenarios('prompts.feature')
@bdd.when("I load an SSL page")
2016-01-12 23:21:52 +01:00
def load_ssl_page(quteproc, ssl_server):
# We don't wait here as we can get an SSL question.
quteproc.open_path('/', port=ssl_server.port, https=True, wait=False)
2016-01-12 23:21:52 +01:00
@bdd.when("I wait until the SSL page finished loading")
2016-01-13 06:41:22 +01:00
def wait_ssl_page_finished_loading(quteproc, ssl_server):
2016-01-12 23:21:52 +01:00
quteproc.wait_for_load_finished('/', port=ssl_server.port, https=True,
load_status='warn')
@bdd.when("I click the button")
def click_button(quteproc):
quteproc.send_cmd(':hint')
quteproc.send_cmd(':follow-hint a')
2016-01-13 21:45:34 +01:00
@bdd.when("I wait for a prompt")
def wait_for_prompt(quteproc):
quteproc.wait_for(message='Entering mode KeyMode.* (reason: question '
'asked)')
2016-01-13 22:36:27 +01:00
2016-01-13 22:36:27 +01:00
@bdd.then("no prompt should be shown")
def no_prompt_shown(quteproc):
quteproc.ensure_not_logged(message='Entering mode KeyMode.* (reason: '
'question asked)')