Rewrite word hint test as BDD test

See #1842.
This commit is contained in:
Florian Bruhin 2016-08-16 13:08:49 +02:00
parent 7b7dff30bf
commit 2d7d47dc30
3 changed files with 25 additions and 20 deletions

View File

@ -6,8 +6,19 @@
<title>Many links</title>
</head>
<body>
<a href="/data/hello.txt">1</a>
<a href="/data/hello2.txt">2</a>
<a href="/data/hello3.txt">3</a>
<a href="/data/numbers/1.txt">1</a>
<a href="/data/numbers/2.txt">2</a>
<a href="/data/numbers/3.txt">3</a>
<a href="/data/numbers/4.txt">4</a>
<a href="/data/numbers/5.txt">5</a>
<a href="/data/numbers/6.txt">6</a>
<a href="/data/numbers/7.txt">7</a>
<a href="/data/numbers/8.txt">8</a>
<a href="/data/numbers/9.txt">9</a>
<a href="/data/numbers/10.txt">10</a>
<a href="/data/numbers/11.txt">11</a>
<a href="/data/numbers/12.txt">12</a>
<a href="/data/numbers/13.txt">13</a>
<a href="/data/numbers/14.txt">14</a>
</body>
</html>

View File

@ -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

View File

@ -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')