bdd: Add a test for :stop.

This commit is contained in:
Florian Bruhin 2015-11-21 14:23:44 +01:00
parent 8607d527bf
commit 4f165a7669
2 changed files with 20 additions and 0 deletions

View File

@ -20,6 +20,7 @@
"""Steps for bdd-like tests."""
import re
import time
import logging
import yaml
@ -135,6 +136,11 @@ def compare_session(quteproc, expected):
assert utils.partial_compare(data, expected)
@bdd.when(bdd.parsers.parse("I wait {delay}s"))
def wait_time(quteproc, delay):
time.sleep(float(delay))
@bdd.then(bdd.parsers.parse('"{pattern}" should not be logged'))
def ensure_not_logged(quteproc, pattern):
quteproc.ensure_not_logged(message=pattern)

View File

@ -147,3 +147,17 @@ Feature: Various utility commands.
When I run :fake-key -g x
And I wait for "got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>" in the log
Then no crash should happen
# :stop
Scenario: :stop
# We can't use "When I open" because we don't want to wait for load
# finished
When I run :open http://localhost:(port)/custom/redirect-later
And I wait for "emitting: cur_load_status_changed('loading') (tab *)" in the log
And I wait 0.5s
And I run :stop
And I wait 1s
Then the requests should be:
custom/redirect-later
# no request on / because we stopped the redirect