add tests for hints auto-follow in word mode

This commit is contained in:
Jakub Klinkovský 2016-08-11 15:20:52 +02:00
parent cdcc9996a0
commit 9b1c07e2e2
2 changed files with 68 additions and 1 deletions

View File

@ -352,4 +352,46 @@ Feature: Using hints
And I press the key "<Enter>"
Then data/hello.txt should be loaded
# TODO: tests for word mode - it tries to access /usr/share/dict/words on the system
Scenario: Using hints -> auto-follow == 'always' in word mode
When I open data/hints/html/simple.html
And I set hints -> mode to word
And I set hints -> auto-follow to always
And I run :hint
Then data/hello.txt should be loaded
Scenario: Using hints -> auto-follow == 'unique-match' in word mode
When I open data/hints/html/simple.html
And I set hints -> mode to word
And I set hints -> auto-follow to unique-match
And I run :hint
# the link gets "hello" as the hint
And I press the key "h"
Then data/hello.txt should be loaded
Scenario: Using hints -> auto-follow == 'full-match' in word mode
When I open data/hints/html/simple.html
And I set hints -> mode to word
And I set hints -> auto-follow to full-match
And I run :hint
# this actually presses the keys one by one
And I press the key "hello"
Then data/hello.txt should be loaded
Scenario: Using hints -> auto-follow == 'never' without Enter in word mode
When I open data/hints/html/simple.html
And I set hints -> mode to word
And I set hints -> auto-follow to never
And I run :hint
# this actually presses the keys one by one
And I press the key "hello"
Then "Leaving mode KeyMode.hint (reason: followed)" should not be logged
Scenario: Using hints -> auto-follow == 'never' in word mode
When I open data/hints/html/simple.html
And I set hints -> mode to word
And I set hints -> auto-follow to never
And I run :hint
# this actually presses the keys one by one
And I press the key "hello"
And I press the key "<Enter>"
Then data/hello.txt should be loaded

View File

@ -17,5 +17,30 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import textwrap
import pytest
import pytest_bdd as bdd
bdd.scenarios('hints.feature')
@pytest.fixture(autouse=True)
def set_up_word_hints(tmpdir, quteproc):
dict_file = tmpdir / 'dict'
dict_file.write(textwrap.dedent("""
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
"""))
quteproc.set_setting('hints', 'dictionary', str(dict_file))