Move :repeat-command tests
This commit is contained in:
parent
4172e39045
commit
8039e7ab74
@ -492,3 +492,28 @@ def clipboard_contains_multiline(quteproc, httpbin, content):
|
||||
@bdd.then("qutebrowser should quit")
|
||||
def should_quit(qtbot, quteproc):
|
||||
quteproc.wait_for_quit()
|
||||
|
||||
|
||||
def _get_scroll_values(quteproc):
|
||||
data = quteproc.get_session()
|
||||
pos = data['windows'][0]['tabs'][0]['history'][0]['scroll-pos']
|
||||
return (pos['x'], pos['y'])
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.re(r"the page should be scrolled "
|
||||
r"(?P<direction>horizontally|vertically)"))
|
||||
def check_scrolled(quteproc, direction):
|
||||
x, y = _get_scroll_values(quteproc)
|
||||
if direction == 'horizontally':
|
||||
assert x != 0
|
||||
assert y == 0
|
||||
else:
|
||||
assert x == 0
|
||||
assert y != 0
|
||||
|
||||
|
||||
@bdd.then("the page should not be scrolled")
|
||||
def check_not_scrolled(quteproc):
|
||||
x, y = _get_scroll_values(quteproc)
|
||||
assert x == 0
|
||||
assert y == 0
|
||||
|
@ -464,3 +464,29 @@ Feature: Various utility commands.
|
||||
And I wait until cookies is loaded
|
||||
And I open cookies in a new tab
|
||||
Then the cookie qute-test should be set to 42
|
||||
|
||||
Scenario: :repeat-command
|
||||
Given I open data/scroll.html
|
||||
And I run :tab-only
|
||||
When I run :scroll down
|
||||
And I run :repeat-command
|
||||
And I run :scroll up
|
||||
Then the page should be scrolled vertically
|
||||
|
||||
Scenario: :repeat-command with count
|
||||
Given I open data/scroll.html
|
||||
And I run :tab-only
|
||||
When I run :scroll down with count 3
|
||||
And I run :scroll up
|
||||
And I run :repeat-command with count 2
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :repeat-command with not-normal command inbetween
|
||||
Given I open data/scroll.html
|
||||
And I run :tab-only
|
||||
When I run :scroll down with count 3
|
||||
And I run :scroll up
|
||||
And I run :prompt-accept
|
||||
And I run :repeat-command with count 2
|
||||
Then the page should not be scrolled
|
||||
And the error "prompt-accept: This command is only allowed in prompt/yesno mode." should be shown
|
||||
|
@ -241,23 +241,3 @@ Feature: Scrolling
|
||||
When I open data/hello.txt
|
||||
And I run :scroll-page 1 1
|
||||
Then no crash should happen
|
||||
|
||||
Scenario: :repeat-command
|
||||
When I run :scroll down
|
||||
And I run :repeat-command
|
||||
And I run :scroll up
|
||||
Then the page should be scrolled vertically
|
||||
|
||||
Scenario: :repeat-command with count
|
||||
When I run :scroll down with count 3
|
||||
And I run :scroll up
|
||||
And I run :repeat-command with count 2
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :repeat-command with not-normal command inbetween
|
||||
When I run :scroll down with count 3
|
||||
And I run :scroll up
|
||||
And I run :prompt-accept
|
||||
And I run :repeat-command with count 2
|
||||
Then the page should not be scrolled
|
||||
And the error "prompt-accept: This command is only allowed in prompt/yesno mode." should be shown
|
||||
|
@ -19,28 +19,3 @@
|
||||
|
||||
import pytest_bdd as bdd
|
||||
bdd.scenarios('scroll.feature')
|
||||
|
||||
|
||||
def _get_scroll_values(quteproc):
|
||||
data = quteproc.get_session()
|
||||
pos = data['windows'][0]['tabs'][0]['history'][0]['scroll-pos']
|
||||
return (pos['x'], pos['y'])
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.re(r"the page should be scrolled "
|
||||
r"(?P<direction>horizontally|vertically)"))
|
||||
def check_scrolled(quteproc, direction):
|
||||
x, y = _get_scroll_values(quteproc)
|
||||
if direction == 'horizontally':
|
||||
assert x != 0
|
||||
assert y == 0
|
||||
else:
|
||||
assert x == 0
|
||||
assert y != 0
|
||||
|
||||
|
||||
@bdd.then("the page should not be scrolled")
|
||||
def check_not_scrolled(quteproc):
|
||||
x, y = _get_scroll_values(quteproc)
|
||||
assert x == 0
|
||||
assert y == 0
|
||||
|
Loading…
Reference in New Issue
Block a user