Remove some unnecessary "fresh instances" in tests
With the addition of :window-only, it's no longer necessary to use "Given I have a fresh instance" to clean up previous windows. This greatly cuts down on the amount of process restarts that need to happen to complete a full testing cycle. I also made one of the tests more robust against order alterations, and removed some unnecessary extra commands that were already implied by the background on others.
This commit is contained in:
parent
d5080bdb1a
commit
b6145d98a4
@ -108,7 +108,7 @@ Feature: Going back and forward.
|
|||||||
And the message "Still alive!" should be shown
|
And the message "Still alive!" should be shown
|
||||||
|
|
||||||
Scenario: Going back in a new window
|
Scenario: Going back in a new window
|
||||||
Given I have a fresh instance
|
Given I clean up open tabs
|
||||||
When I open data/backforward/1.txt
|
When I open data/backforward/1.txt
|
||||||
And I open data/backforward/2.txt
|
And I open data/backforward/2.txt
|
||||||
And I run :back -w
|
And I run :back -w
|
||||||
|
@ -139,6 +139,15 @@ def fresh_instance(quteproc):
|
|||||||
quteproc.start()
|
quteproc.start()
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.given("I clean up open tabs")
|
||||||
|
def clean_open_tabs(quteproc):
|
||||||
|
"""Clean up open windows and tabs."""
|
||||||
|
quteproc.set_setting('tabs', 'last-close', 'blank')
|
||||||
|
quteproc.send_cmd(':window-only')
|
||||||
|
quteproc.send_cmd(':tab-only')
|
||||||
|
quteproc.send_cmd(':tab-close')
|
||||||
|
|
||||||
|
|
||||||
## When
|
## When
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,8 +263,7 @@ Feature: Tab management
|
|||||||
Then the error "There's no tab with index -1!" should be shown
|
Then the error "There's no tab with index -1!" should be shown
|
||||||
|
|
||||||
Scenario: :tab-focus last with no last focused tab
|
Scenario: :tab-focus last with no last focused tab
|
||||||
Given I have a fresh instance
|
When I run :tab-focus last
|
||||||
And I run :tab-focus last
|
|
||||||
Then the error "No last focused tab!" should be shown
|
Then the error "No last focused tab!" should be shown
|
||||||
|
|
||||||
# tab-prev/tab-next
|
# tab-prev/tab-next
|
||||||
@ -564,7 +563,6 @@ Feature: Tab management
|
|||||||
- data/hello2.txt
|
- data/hello2.txt
|
||||||
|
|
||||||
Scenario: Cloning to new window
|
Scenario: Cloning to new window
|
||||||
Given I have a fresh instance
|
|
||||||
When I open data/title.html
|
When I open data/title.html
|
||||||
And I run :tab-clone -w
|
And I run :tab-clone -w
|
||||||
Then the session should look like:
|
Then the session should look like:
|
||||||
@ -583,7 +581,6 @@ Feature: Tab management
|
|||||||
title: Test title
|
title: Test title
|
||||||
|
|
||||||
Scenario: Cloning with tabs-are-windows = true
|
Scenario: Cloning with tabs-are-windows = true
|
||||||
Given I have a fresh instance
|
|
||||||
When I open data/title.html
|
When I open data/title.html
|
||||||
And I set tabs -> tabs-are-windows to true
|
And I set tabs -> tabs-are-windows to true
|
||||||
And I run :tab-clone
|
And I run :tab-clone
|
||||||
@ -605,7 +602,6 @@ Feature: Tab management
|
|||||||
# :tab-detach
|
# :tab-detach
|
||||||
|
|
||||||
Scenario: Detaching a tab
|
Scenario: Detaching a tab
|
||||||
Given I have a fresh instance
|
|
||||||
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 run :tab-detach
|
And I run :tab-detach
|
||||||
@ -856,7 +852,6 @@ Feature: Tab management
|
|||||||
# :buffer
|
# :buffer
|
||||||
|
|
||||||
Scenario: :buffer without args
|
Scenario: :buffer without args
|
||||||
Given I have a fresh instance
|
|
||||||
When I run :buffer
|
When I run :buffer
|
||||||
Then the error "buffer: The following arguments are required: index" should be shown
|
Then the error "buffer: The following arguments are required: index" should be shown
|
||||||
|
|
||||||
@ -909,8 +904,8 @@ Feature: Tab management
|
|||||||
|
|
||||||
Scenario: :buffer with no matching window index
|
Scenario: :buffer with no matching window index
|
||||||
When I open data/title.html
|
When I open data/title.html
|
||||||
And I run :buffer "2/1"
|
And I run :buffer "99/1"
|
||||||
Then the error "There's no window with id 2!" should be shown
|
Then the error "There's no window with id 99!" should be shown
|
||||||
|
|
||||||
Scenario: :buffer with matching window index
|
Scenario: :buffer with matching window index
|
||||||
Given I have a fresh instance
|
Given I have a fresh instance
|
||||||
@ -942,7 +937,6 @@ Feature: Tab management
|
|||||||
- url: http://localhost:*/data/paste_primary.html
|
- url: http://localhost:*/data/paste_primary.html
|
||||||
|
|
||||||
Scenario: :buffer with wrong argument (-1)
|
Scenario: :buffer with wrong argument (-1)
|
||||||
Given I have a fresh instance
|
|
||||||
When I open data/title.html
|
When I open data/title.html
|
||||||
And I run :buffer "-1"
|
And I run :buffer "-1"
|
||||||
Then the error "There's no tab with index -1!" should be shown
|
Then the error "There's no tab with index -1!" should be shown
|
||||||
|
@ -19,10 +19,3 @@
|
|||||||
|
|
||||||
import pytest_bdd as bdd
|
import pytest_bdd as bdd
|
||||||
bdd.scenarios('tabs.feature')
|
bdd.scenarios('tabs.feature')
|
||||||
|
|
||||||
|
|
||||||
@bdd.given("I clean up open tabs")
|
|
||||||
def clean_open_tabs(quteproc):
|
|
||||||
quteproc.set_setting('tabs', 'last-close', 'blank')
|
|
||||||
quteproc.send_cmd(':tab-only')
|
|
||||||
quteproc.send_cmd(':tab-close')
|
|
||||||
|
@ -3,7 +3,7 @@ Feature: Yanking and pasting.
|
|||||||
from/to the clipboard and primary selection.
|
from/to the clipboard and primary selection.
|
||||||
|
|
||||||
Background:
|
Background:
|
||||||
Given I run :tab-only
|
Given I clean up open tabs
|
||||||
|
|
||||||
#### :yank
|
#### :yank
|
||||||
|
|
||||||
@ -79,9 +79,7 @@ Feature: Yanking and pasting.
|
|||||||
Then the error "Clipboard is empty." should be shown
|
Then the error "Clipboard is empty." should be shown
|
||||||
|
|
||||||
Scenario: Pasting in a new tab
|
Scenario: Pasting in a new tab
|
||||||
Given I open about:blank
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
||||||
When I run :tab-only
|
|
||||||
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
|
||||||
And I run :open -t {clipboard}
|
And I run :open -t {clipboard}
|
||||||
And I wait until data/hello.txt is loaded
|
And I wait until data/hello.txt is loaded
|
||||||
Then the following tabs should be open:
|
Then the following tabs should be open:
|
||||||
@ -89,9 +87,7 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello.txt (active)
|
- data/hello.txt (active)
|
||||||
|
|
||||||
Scenario: Pasting in a background tab
|
Scenario: Pasting in a background tab
|
||||||
Given I open about:blank
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
||||||
When I run :tab-only
|
|
||||||
And I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
|
||||||
And I run :open -b {clipboard}
|
And I run :open -b {clipboard}
|
||||||
And I wait until data/hello.txt is loaded
|
And I wait until data/hello.txt is loaded
|
||||||
Then the following tabs should be open:
|
Then the following tabs should be open:
|
||||||
@ -99,7 +95,6 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello.txt
|
- data/hello.txt
|
||||||
|
|
||||||
Scenario: Pasting in a new window
|
Scenario: Pasting in a new window
|
||||||
Given I have a fresh instance
|
|
||||||
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
||||||
And I run :open -w {clipboard}
|
And I run :open -w {clipboard}
|
||||||
And I wait until data/hello.txt is loaded
|
And I wait until data/hello.txt is loaded
|
||||||
@ -123,7 +118,6 @@ Feature: Yanking and pasting.
|
|||||||
Then the error "Invalid URL" should be shown
|
Then the error "Invalid URL" should be shown
|
||||||
|
|
||||||
Scenario: Pasting multiple urls in a new tab
|
Scenario: Pasting multiple urls in a new tab
|
||||||
Given I have a fresh instance
|
|
||||||
When I put the following lines into the clipboard:
|
When I put the following lines into the clipboard:
|
||||||
http://localhost:(port)/data/hello.txt
|
http://localhost:(port)/data/hello.txt
|
||||||
http://localhost:(port)/data/hello2.txt
|
http://localhost:(port)/data/hello2.txt
|
||||||
@ -139,8 +133,8 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello3.txt
|
- data/hello3.txt
|
||||||
|
|
||||||
Scenario: Pasting multiline text
|
Scenario: Pasting multiline text
|
||||||
Given I have a fresh instance
|
When I set general -> auto-search to true
|
||||||
When I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
||||||
And I put the following lines into the clipboard:
|
And I put the following lines into the clipboard:
|
||||||
this url:
|
this url:
|
||||||
http://qutebrowser.org
|
http://qutebrowser.org
|
||||||
@ -152,9 +146,8 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open (active)
|
- data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open (active)
|
||||||
|
|
||||||
Scenario: Pasting multiline whose first line looks like a URI
|
Scenario: Pasting multiline whose first line looks like a URI
|
||||||
Given I open about:blank
|
When I set general -> auto-search to true
|
||||||
When I run :tab-only
|
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
||||||
When I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
|
||||||
And I put the following lines into the clipboard:
|
And I put the following lines into the clipboard:
|
||||||
text:
|
text:
|
||||||
should open
|
should open
|
||||||
@ -166,9 +159,7 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello.txt?q=text%3A%0Ashould%20open%0Aas%20search (active)
|
- data/hello.txt?q=text%3A%0Ashould%20open%0Aas%20search (active)
|
||||||
|
|
||||||
Scenario: Pasting multiple urls in a background tab
|
Scenario: Pasting multiple urls in a background tab
|
||||||
Given I open about:blank
|
When I put the following lines into the clipboard:
|
||||||
When I run :tab-only
|
|
||||||
And I put the following lines into the clipboard:
|
|
||||||
http://localhost:(port)/data/hello.txt
|
http://localhost:(port)/data/hello.txt
|
||||||
http://localhost:(port)/data/hello2.txt
|
http://localhost:(port)/data/hello2.txt
|
||||||
http://localhost:(port)/data/hello3.txt
|
http://localhost:(port)/data/hello3.txt
|
||||||
@ -183,7 +174,6 @@ Feature: Yanking and pasting.
|
|||||||
- data/hello3.txt
|
- data/hello3.txt
|
||||||
|
|
||||||
Scenario: Pasting multiple urls in new windows
|
Scenario: Pasting multiple urls in new windows
|
||||||
Given I have a fresh instance
|
|
||||||
When I put the following lines into the clipboard:
|
When I put the following lines into the clipboard:
|
||||||
http://localhost:(port)/data/hello.txt
|
http://localhost:(port)/data/hello.txt
|
||||||
http://localhost:(port)/data/hello2.txt
|
http://localhost:(port)/data/hello2.txt
|
||||||
@ -216,13 +206,11 @@ Feature: Yanking and pasting.
|
|||||||
url: http://localhost:*/data/hello3.txt
|
url: http://localhost:*/data/hello3.txt
|
||||||
|
|
||||||
Scenario: Pasting multiple urls with an empty one
|
Scenario: Pasting multiple urls with an empty one
|
||||||
When I open about:blank
|
|
||||||
And I put "http://localhost:(port)/data/hello.txt\n\nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
And I put "http://localhost:(port)/data/hello.txt\n\nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
||||||
And I run :open -t {clipboard}
|
And I run :open -t {clipboard}
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
|
||||||
Scenario: Pasting multiple urls with an almost empty one
|
Scenario: Pasting multiple urls with an almost empty one
|
||||||
When I open about:blank
|
|
||||||
And I put "http://localhost:(port)/data/hello.txt\n \nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
And I put "http://localhost:(port)/data/hello.txt\n \nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
||||||
And I run :open -t {clipboard}
|
And I run :open -t {clipboard}
|
||||||
Then no crash should happen
|
Then no crash should happen
|
||||||
|
Loading…
Reference in New Issue
Block a user