bdd: Add "the following tabs should be open" step.
This simplifies a lot of .feature files because we don't actually need to check the full session.
This commit is contained in:
parent
c861cf54e6
commit
fac76576d7
@ -229,3 +229,29 @@ def check_contents(quteproc, filename):
|
|||||||
'data', os.path.join(*filename.split('/')))
|
'data', os.path.join(*filename.split('/')))
|
||||||
with open(path, 'r', encoding='utf-8') as f:
|
with open(path, 'r', encoding='utf-8') as f:
|
||||||
assert content == f.read()
|
assert content == f.read()
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.then(bdd.parsers.parse("the following tabs should be open:\n{tabs}"))
|
||||||
|
def check_open_tabs(quteproc, tabs):
|
||||||
|
session = quteproc.get_session()
|
||||||
|
active_suffix = ' (active)'
|
||||||
|
tabs = tabs.splitlines()
|
||||||
|
assert len(session['windows']) == 1
|
||||||
|
assert len(session['windows'][0]['tabs']) == len(tabs)
|
||||||
|
|
||||||
|
for i, line in enumerate(tabs):
|
||||||
|
line = line.strip()
|
||||||
|
line = line[2:] # remove "- " prefix
|
||||||
|
if line.endswith(active_suffix):
|
||||||
|
path = line[:-len(active_suffix)]
|
||||||
|
active = True
|
||||||
|
else:
|
||||||
|
path = line
|
||||||
|
active = False
|
||||||
|
|
||||||
|
session_tab = session['windows'][0]['tabs'][i]
|
||||||
|
assert session_tab['history'][-1]['url'] == quteproc.path_to_url(path)
|
||||||
|
if active:
|
||||||
|
assert session_tab['active']
|
||||||
|
else:
|
||||||
|
assert 'active' not in session_tab
|
||||||
|
@ -59,14 +59,8 @@ Feature: Setting settings.
|
|||||||
Scenario: Opening qute:settings
|
Scenario: Opening qute:settings
|
||||||
When I run :set
|
When I run :set
|
||||||
And I wait for "load status for <qutebrowser.browser.webview.WebView tab_id=0 url='qute:settings'>: LoadStatus.success" in the log
|
And I wait for "load status for <qutebrowser.browser.webview.WebView tab_id=0 url='qute:settings'>: LoadStatus.success" in the log
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- qute:settings (active)
|
||||||
- tabs:
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: about:blank
|
|
||||||
- active: true
|
|
||||||
url: qute:settings
|
|
||||||
|
|
||||||
Scenario: Empty option with ? (issue 1109)
|
Scenario: Empty option with ? (issue 1109)
|
||||||
When I run :set general ?
|
When I run :set general ?
|
||||||
|
@ -11,46 +11,28 @@ Feature: Tab management
|
|||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-close
|
And I run :tab-close
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with count
|
Scenario: :tab-close with count
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-close with count 1
|
And I run :tab-close with count 1
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/2.txt
|
||||||
- tabs:
|
- data/numbers/3.txt (active)
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with invalid count
|
Scenario: :tab-close with invalid count
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-close with count 23
|
And I run :tab-close with count 23
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt
|
||||||
- history:
|
- data/numbers/3.txt (active)
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = right
|
Scenario: :tab-close with select-on-remove = right
|
||||||
When I set tabs -> select-on-remove to right
|
When I set tabs -> select-on-remove to right
|
||||||
@ -59,15 +41,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close
|
And I run :tab-close
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/3.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = left
|
Scenario: :tab-close with select-on-remove = left
|
||||||
When I set tabs -> select-on-remove to left
|
When I set tabs -> select-on-remove to left
|
||||||
@ -76,15 +52,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close
|
And I run :tab-close
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt (active)
|
||||||
- tabs:
|
- data/numbers/3.txt
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = previous
|
Scenario: :tab-close with select-on-remove = previous
|
||||||
When I set tabs -> select-on-remove to previous
|
When I set tabs -> select-on-remove to previous
|
||||||
@ -94,17 +64,10 @@ Feature: Tab management
|
|||||||
And I open data/numbers/4.txt in a new tab
|
And I open data/numbers/4.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close
|
And I run :tab-close
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/3.txt
|
||||||
- history:
|
- data/numbers/4.txt (active)
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/4.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = left and --right
|
Scenario: :tab-close with select-on-remove = left and --right
|
||||||
When I set tabs -> select-on-remove to left
|
When I set tabs -> select-on-remove to left
|
||||||
@ -113,15 +76,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close --right
|
And I run :tab-close --right
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/3.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = right and --left
|
Scenario: :tab-close with select-on-remove = right and --left
|
||||||
When I set tabs -> select-on-remove to right
|
When I set tabs -> select-on-remove to right
|
||||||
@ -130,15 +87,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close --left
|
And I run :tab-close --left
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt (active)
|
||||||
- tabs:
|
- data/numbers/3.txt
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = left and --opposite
|
Scenario: :tab-close with select-on-remove = left and --opposite
|
||||||
When I set tabs -> select-on-remove to left
|
When I set tabs -> select-on-remove to left
|
||||||
@ -147,15 +98,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close --opposite
|
And I run :tab-close --opposite
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/3.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = right and --opposite
|
Scenario: :tab-close with select-on-remove = right and --opposite
|
||||||
When I set tabs -> select-on-remove to right
|
When I set tabs -> select-on-remove to right
|
||||||
@ -164,15 +109,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close --opposite
|
And I run :tab-close --opposite
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt (active)
|
||||||
- tabs:
|
- data/numbers/3.txt
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-close with select-on-remove = previous and --opposite
|
Scenario: :tab-close with select-on-remove = previous and --opposite
|
||||||
When I set tabs -> select-on-remove to previous
|
When I set tabs -> select-on-remove to previous
|
||||||
@ -189,15 +128,9 @@ Feature: Tab management
|
|||||||
And I run :tab-close --left
|
And I run :tab-close --left
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-close
|
And I run :tab-close
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/4.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/4.txt
|
|
||||||
|
|
||||||
# :tab-only
|
# :tab-only
|
||||||
|
|
||||||
@ -206,12 +139,8 @@ Feature: Tab management
|
|||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-only
|
And I run :tab-only
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/3.txt (active)
|
||||||
- tabs:
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-only with --left
|
Scenario: :tab-only with --left
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
@ -219,15 +148,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-only --left
|
And I run :tab-only --left
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt (active)
|
||||||
- history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
|
|
||||||
Scenario: :tab-only with --right
|
Scenario: :tab-only with --right
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
@ -235,14 +158,9 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-only --right
|
And I run :tab-only --right
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/2.txt (active)
|
||||||
- tabs:
|
- data/numbers/3.txt
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-only with --left and --right
|
Scenario: :tab-only with --left and --right
|
||||||
When I run :tab-only --left --right
|
When I run :tab-only --left --right
|
||||||
@ -259,17 +177,10 @@ Feature: Tab management
|
|||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt (active)
|
||||||
- history:
|
- data/numbers/3.txt
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-focus without index/count
|
Scenario: :tab-focus without index/count
|
||||||
When I open data/numbers/1.txt
|
When I open data/numbers/1.txt
|
||||||
@ -277,17 +188,10 @@ Feature: Tab management
|
|||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus 2
|
And I run :tab-focus 2
|
||||||
And I run :tab-focus
|
And I run :tab-focus
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt
|
||||||
- history:
|
- data/numbers/3.txt (active)
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-focus with invalid index
|
Scenario: :tab-focus with invalid index
|
||||||
When I run :tab-focus 23
|
When I run :tab-focus 23
|
||||||
@ -302,17 +206,10 @@ Feature: Tab management
|
|||||||
And I open data/numbers/2.txt in a new tab
|
And I open data/numbers/2.txt in a new tab
|
||||||
And I open data/numbers/3.txt in a new tab
|
And I open data/numbers/3.txt in a new tab
|
||||||
And I run :tab-focus with count 2
|
And I run :tab-focus with count 2
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt
|
||||||
- tabs:
|
- data/numbers/2.txt (active)
|
||||||
- history:
|
- data/numbers/3.txt
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-focus with count and index
|
Scenario: :tab-focus with count and index
|
||||||
When I run :tab-focus 2 with count 2
|
When I run :tab-focus 2 with count 2
|
||||||
@ -325,17 +222,10 @@ Feature: Tab management
|
|||||||
And I run :tab-focus 1
|
And I run :tab-focus 1
|
||||||
And I run :tab-focus 3
|
And I run :tab-focus 3
|
||||||
And I run :tab-focus last
|
And I run :tab-focus last
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- data/numbers/1.txt (active)
|
||||||
- tabs:
|
- data/numbers/2.txt
|
||||||
- active: true
|
- data/numbers/3.txt
|
||||||
history:
|
|
||||||
- ...
|
|
||||||
- url: http://localhost:*/data/numbers/1.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/2.txt
|
|
||||||
- history:
|
|
||||||
- url: http://localhost:*/data/numbers/3.txt
|
|
||||||
|
|
||||||
Scenario: :tab-focus last with no last focused tab
|
Scenario: :tab-focus last with no last focused tab
|
||||||
Given I have a fresh instance
|
Given I have a fresh instance
|
||||||
|
@ -67,16 +67,9 @@ Feature: Yanking and pasting.
|
|||||||
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
||||||
And I run :paste -t
|
And I run :paste -t
|
||||||
And I wait until data/hello.txt is loaded
|
And I wait until data/hello.txt is loaded
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- about:blank
|
||||||
- tabs:
|
- data/hello.txt (active)
|
||||||
- history:
|
|
||||||
- active: true
|
|
||||||
url: about:blank
|
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- active: true
|
|
||||||
url: http://localhost:*/data/hello.txt
|
|
||||||
|
|
||||||
Scenario: Pasting in a background tab
|
Scenario: Pasting in a background tab
|
||||||
Given I open about:blank
|
Given I open about:blank
|
||||||
@ -84,16 +77,9 @@ Feature: Yanking and pasting.
|
|||||||
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
||||||
And I run :paste -b
|
And I run :paste -b
|
||||||
And I wait until data/hello.txt is loaded
|
And I wait until data/hello.txt is loaded
|
||||||
Then the session should look like:
|
Then the following tabs should be open:
|
||||||
windows:
|
- about:blank (active)
|
||||||
- tabs:
|
- data/hello.txt
|
||||||
- active: true
|
|
||||||
history:
|
|
||||||
- active: true
|
|
||||||
url: about:blank
|
|
||||||
- history:
|
|
||||||
- active: true
|
|
||||||
url: http://localhost:*/data/hello.txt
|
|
||||||
|
|
||||||
Scenario: Pasting in a new window
|
Scenario: Pasting in a new window
|
||||||
Given I have a fresh instance
|
Given I have a fresh instance
|
||||||
|
Loading…
Reference in New Issue
Block a user