summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy <jimmy@spalge.com>2016-03-08 10:24:04 +1300
committerJimmy <jimmy@spalge.com>2016-03-31 14:00:36 +1300
commit97ab6db655c8ab3de800a8e696574aff62b0789e (patch)
treed4ccf4147d96bdf03df594b15d81dc507734f32a
parent1c10a1aecfd5063b3013234f3eb00a19e805d14c (diff)
downloadqutebrowser-97ab6db655c8ab3de800a8e696574aff62b0789e.tar.gz
qutebrowser-97ab6db655c8ab3de800a8e696574aff62b0789e.zip
Adds tests for buffer command.
The buffer_troubling_args tests may look a little un-intuitive but that is because they are testing the edge cases for the current behaviour. If these edge cases are encountered during normal usage you are doing something wrong.
-rw-r--r--tests/integration/features/tabs.feature113
1 files changed, 113 insertions, 0 deletions
diff --git a/tests/integration/features/tabs.feature b/tests/integration/features/tabs.feature
index 8d898694b..630fa6279 100644
--- a/tests/integration/features/tabs.feature
+++ b/tests/integration/features/tabs.feature
@@ -709,3 +709,116 @@ Feature: Tab management
- data/hints/link.html
- about:blank
- data/hello.txt (active)
+
+ # :buffer
+
+ Scenario: buffer without args
+ Given I have a fresh instance
+ When I run :buffer
+ Then the error "buffer: The following arguments are required: index" should be shown
+
+ Scenario: buffer one window title present
+ When I open data/title.html
+ And I open data/search.html in a new tab
+ And I open data/scroll.html in a new tab
+ And I run :buffer "Searching text"
+ Then the following tabs should be open:
+ - data/title.html
+ - data/search.html (active)
+ - data/scroll.html
+
+ Scenario: buffer one window title not present
+ When I run :buffer "invalid title"
+ Then the error "No matching tab for: invalid title" should be shown
+
+ Scenario: buffer two window title present
+ When I open data/title.html
+ And I open data/search.html in a new tab
+ And I open data/scroll.html in a new tab
+ And I open data/caret.html in a new window
+ And I open data/paste_primary.html in a new tab
+ And I run :buffer "Scrolling"
+ Then the session should look like:
+ windows:
+ - active: true
+ tabs:
+ - history:
+ - url: about:blank
+ - url: http://localhost:*/data/title.html
+ - history:
+ - url: http://localhost:*/data/search.html
+ - active: true
+ history:
+ - url: http://localhost:*/data/scroll.html
+ - tabs:
+ - history:
+ - url: http://localhost:*/data/caret.html
+ - active: true
+ history:
+ - url: http://localhost:*/data/paste_primary.html
+
+ Scenario: buffer one window index not present
+ When I open data/title.html
+ And I run :buffer "666"
+ Then the error "There's no tab with index 666!" should be shown
+
+ Scenario: buffer one window win not present
+ When I open data/title.html
+ And I run :buffer "2/1"
+ Then the error "There's no window with id 2!" should be shown
+
+ Scenario: buffer two window index present
+ Given I have a fresh instance
+ When I open data/title.html
+ And I open data/search.html in a new tab
+ And I open data/scroll.html in a new tab
+ And I run :open -w http://localhost:(port)/data/caret.html
+ And I open data/paste_primary.html in a new tab
+ And I wait until data/caret.html is loaded
+ And I run :buffer "0/2"
+ Then the session should look like:
+ windows:
+ - active: true
+ tabs:
+ - history:
+ - url: about:blank
+ - url: http://localhost:*/data/title.html
+ - active: true
+ history:
+ - url: http://localhost:*/data/search.html
+ - history:
+ - url: http://localhost:*/data/scroll.html
+ - tabs:
+ - history:
+ - url: http://localhost:*/data/caret.html
+ - active: true
+ history:
+ - url: http://localhost:*/data/paste_primary.html
+
+ Scenario: buffer troubling args 01
+ Given I have a fresh instance
+ When I open data/title.html
+ And I run :buffer "-1"
+ Then the error "There's no tab with index -1!" should be shown
+
+ Scenario: buffer troubling args 02
+ When I open data/title.html
+ And I run :buffer "/"
+ Then the following tabs should be open:
+ - data/title.html (active)
+
+ Scenario: buffer troubling args 03
+ When I open data/title.html
+ And I run :buffer "//"
+ Then the following tabs should be open:
+ - data/title.html (active)
+
+ Scenario: buffer troubling args 04
+ When I open data/title.html
+ And I run :buffer "0/x"
+ Then the error "No matching tab for: 0/x" should be shown
+
+ Scenario: buffer troubling args 05
+ When I open data/title.html
+ And I run :buffer "1/2/3"
+ Then the error "No matching tab for: 1/2/3" should be shown