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