From 2d7d47dc30e9daad0b84e84c63d8c01ca96e5348 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 16 Aug 2016 13:08:49 +0200 Subject: [PATCH] Rewrite word hint test as BDD test See #1842. --- tests/end2end/data/hints/short_dict.html | 17 ++++++++++++++--- tests/end2end/features/hints.feature | 11 +++++++++++ tests/end2end/test_hints_html.py | 17 ----------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/tests/end2end/data/hints/short_dict.html b/tests/end2end/data/hints/short_dict.html index 9c2140315..b24bdcae0 100644 --- a/tests/end2end/data/hints/short_dict.html +++ b/tests/end2end/data/hints/short_dict.html @@ -6,8 +6,19 @@ Many links - 1 - 2 - 3 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index f735bea38..f66f8d1a0 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -188,6 +188,17 @@ Feature: Using hints And I press the key "," Then the message "Keypress worked!" should be shown + ### Word hints + + Scenario: Hinting with a too short dictionary + When I open data/hints/short_dict.html + And I set hints -> mode to word + And I run :hint + # Test letter fallback + And I run :follow-hint d + Then the error "Not enough words in the dictionary." should be shown + And data/numbers/5.txt should be loaded + ### Number hint mode # https://github.com/The-Compiler/qutebrowser/issues/308 diff --git a/tests/end2end/test_hints_html.py b/tests/end2end/test_hints_html.py index ef2e4f725..58a19eb21 100644 --- a/tests/end2end/test_hints_html.py +++ b/tests/end2end/test_hints_html.py @@ -113,20 +113,3 @@ def test_word_hints_issue1393(quteproc, tmpdir): quteproc.wait_for(message='hints: *', category='hints') quteproc.send_cmd(':follow-hint {}'.format(hint)) quteproc.wait_for_load_finished('data/{}'.format(target)) - - -def test_short_dict(quteproc, tmpdir): - dict_file = tmpdir / 'dict' - dict_file.write(textwrap.dedent(""" - worda - wordb - """)) - quteproc.set_setting('hints', 'mode', 'word') - quteproc.set_setting('hints', 'dictionary', str(dict_file)) - quteproc.open_path('data/hints/short_dict.html') - quteproc.send_cmd(':hint') - line = quteproc.wait_for(message='Not enough words in the dictionary.') - line.expected = True - quteproc.wait_for(message='hints: *', category='hints') - quteproc.send_cmd(':follow-hint d') - quteproc.wait_for_load_finished('data/hello3.txt')