From 00ccc236bb32abb40c1f62175b79ed226145a068 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 12 Nov 2015 21:52:39 +0100 Subject: [PATCH] bdd: Add more :paste tests. --- tests/integration/features/yankpaste.feature | 79 +++++++++++++++++++- 1 file changed, 75 insertions(+), 4 deletions(-) diff --git a/tests/integration/features/yankpaste.feature b/tests/integration/features/yankpaste.feature index 8f8e6c0f2..371abe1c1 100644 --- a/tests/integration/features/yankpaste.feature +++ b/tests/integration/features/yankpaste.feature @@ -3,30 +3,38 @@ Feature: Yanking and pasting. clipboard and primary selection. Background: - Given I open data/yankpaste.html + Given I run :tab-only + + #### :yank Scenario: Yanking URLs to clipboard - When I run :yank + When I open data/yankpaste.html + And I run :yank Then the message "Yanked URL to clipboard: http://localhost:(port)/data/yankpaste.html" should be shown. And the clipboard should contain "http://localhost:(port)/data/yankpaste.html" Scenario: Yanking URLs to primary selection When selection is supported + And I open data/yankpaste.html And I run :yank --sel Then the message "Yanked URL to primary selection: http://localhost:(port)/data/yankpaste.html" should be shown. And the primary selection should contain "http://localhost:(port)/data/yankpaste.html" Scenario: Yanking title to clipboard - When I wait for regex "Changing title for idx \d to 'Test title'" in the log + When I open data/yankpaste.html + And I wait for regex "Changing title for idx \d to 'Test title'" in the log And I run :yank --title Then the message "Yanked title to clipboard: Test title" should be shown. And the clipboard should contain "Test title" Scenario: Yanking domain to clipboard - When I run :yank --domain + When I open data/yankpaste.html + And I run :yank --domain Then the message "Yanked domain to clipboard: http://localhost:(port)" should be shown. And the clipboard should contain "http://localhost:(port)" + #### :paste + Scenario: Pasting an URL When I put "http://localhost:(port)/data/hello.txt" into the clipboard And I run :paste @@ -41,3 +49,66 @@ Feature: Yanking and pasting. And I wait until data/hello2.txt is loaded Then the requests should be: data/hello2.txt + + Scenario: Pasting with empty clipboard + When I put "" into the clipboard + And I run :paste + Then the error "Clipboard is empty." should be shown. + + Scenario: Pasting with empty selection + When selection is supported + And I put "" into the primary selection + And I run :paste --sel + Then the error "Primary selection is empty." should be shown. + + Scenario: Pasting in a new tab + Given I open about:blank + When I run :tab-only + And I put "http://localhost:(port)/data/hello.txt" into the clipboard + And I run :paste -t + And I wait until data/hello.txt is loaded + Then the session should look like: + windows: + - tabs: + - history: + - active: true + url: about:blank + - active: true + history: + - active: true + url: http://localhost:*/data/hello.txt + + Scenario: Pasting in a background tab + Given I open about:blank + When I run :tab-only + And I put "http://localhost:(port)/data/hello.txt" into the clipboard + And I run :paste -b + And I wait until data/hello.txt is loaded + Then the session should look like: + windows: + - tabs: + - active: true + history: + - active: true + url: about:blank + - history: + - active: true + url: http://localhost:*/data/hello.txt + + Scenario: Pasting in a new window + Given I have a fresh instance + When I put "http://localhost:(port)/data/hello.txt" into the clipboard + And I run :paste -w + And I wait until data/hello.txt is loaded + Then the session should look like: + windows: + - tabs: + - active: true + history: + - active: true + url: about:blank + - tabs: + - active: true + history: + - active: true + url: http://localhost:*/data/hello.txt