From 4f165a766950109f8335e32a4f558c5d6c679802 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 21 Nov 2015 14:23:44 +0100 Subject: [PATCH] bdd: Add a test for :stop. --- tests/integration/features/conftest.py | 6 ++++++ tests/integration/features/misc.feature | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 7024fcb8c..76e56962d 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -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) diff --git a/tests/integration/features/misc.feature b/tests/integration/features/misc.feature index 269b3aeaf..657abdc77 100644 --- a/tests/integration/features/misc.feature +++ b/tests/integration/features/misc.feature @@ -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 " 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