2015-11-02 07:43:37 +01:00
|
|
|
Feature: Yanking and pasting.
|
2016-08-06 22:03:50 +02:00
|
|
|
:yank, {clipboard} and {primary} can be used to copy/paste the URL or title
|
|
|
|
from/to the clipboard and primary selection.
|
2015-11-02 07:43:37 +01:00
|
|
|
|
|
|
|
Background:
|
2016-08-12 00:00:18 +02:00
|
|
|
Given I clean up open tabs
|
2015-11-12 21:52:39 +01:00
|
|
|
|
|
|
|
#### :yank
|
2015-11-02 07:43:37 +01:00
|
|
|
|
|
|
|
Scenario: Yanking URLs to clipboard
|
2015-11-26 18:37:33 +01:00
|
|
|
When I open data/title.html
|
2015-11-12 21:52:39 +01:00
|
|
|
And I run :yank
|
2015-11-26 18:37:33 +01:00
|
|
|
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title.html" should be shown
|
|
|
|
And the clipboard should contain "http://localhost:(port)/data/title.html"
|
2015-11-02 07:43:37 +01:00
|
|
|
|
|
|
|
Scenario: Yanking URLs to primary selection
|
2015-11-02 08:07:25 +01:00
|
|
|
When selection is supported
|
2015-11-26 18:37:33 +01:00
|
|
|
And I open data/title.html
|
2015-11-02 08:07:25 +01:00
|
|
|
And I run :yank --sel
|
2015-11-26 18:37:33 +01:00
|
|
|
Then the message "Yanked URL to primary selection: http://localhost:(port)/data/title.html" should be shown
|
|
|
|
And the primary selection should contain "http://localhost:(port)/data/title.html"
|
2015-11-02 07:43:37 +01:00
|
|
|
|
|
|
|
Scenario: Yanking title to clipboard
|
2015-11-26 18:37:33 +01:00
|
|
|
When I open data/title.html
|
2015-11-12 21:52:39 +01:00
|
|
|
And I wait for regex "Changing title for idx \d to 'Test title'" in the log
|
2016-08-06 03:55:51 +02:00
|
|
|
And I run :yank title
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the message "Yanked title to clipboard: Test title" should be shown
|
2015-11-02 07:43:37 +01:00
|
|
|
And the clipboard should contain "Test title"
|
|
|
|
|
|
|
|
Scenario: Yanking domain to clipboard
|
2015-11-26 18:37:33 +01:00
|
|
|
When I open data/title.html
|
2016-08-06 03:55:51 +02:00
|
|
|
And I run :yank domain
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the message "Yanked domain to clipboard: http://localhost:(port)" should be shown
|
2015-11-02 07:43:37 +01:00
|
|
|
And the clipboard should contain "http://localhost:(port)"
|
2015-11-11 22:38:43 +01:00
|
|
|
|
2016-04-18 21:54:17 +02:00
|
|
|
Scenario: Yanking fully encoded URL
|
|
|
|
When I open data/title with spaces.html
|
|
|
|
And I run :yank
|
|
|
|
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title%20with%20spaces.html" should be shown
|
|
|
|
And the clipboard should contain "http://localhost:(port)/data/title%20with%20spaces.html"
|
|
|
|
|
|
|
|
Scenario: Yanking pretty decoded URL
|
|
|
|
When I open data/title with spaces.html
|
2016-08-06 03:55:51 +02:00
|
|
|
And I run :yank pretty-url
|
2016-04-18 21:54:17 +02:00
|
|
|
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title with spaces.html" should be shown
|
|
|
|
And the clipboard should contain "http://localhost:(port)/data/title with spaces.html"
|
|
|
|
|
2016-08-06 22:03:50 +02:00
|
|
|
#### {clipboard} and {primary}
|
2015-11-12 21:52:39 +01:00
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Pasting a URL
|
2015-11-11 22:38:43 +01:00
|
|
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {clipboard}
|
2016-08-18 23:58:33 +02:00
|
|
|
Then data/hello.txt should be loaded
|
2015-11-11 22:38:43 +01:00
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Pasting a URL from primary selection
|
2015-11-11 22:38:43 +01:00
|
|
|
When selection is supported
|
|
|
|
And I put "http://localhost:(port)/data/hello2.txt" into the primary selection
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {primary}
|
2016-08-18 23:58:33 +02:00
|
|
|
Then data/hello2.txt should be loaded
|
2015-11-12 21:52:39 +01:00
|
|
|
|
|
|
|
Scenario: Pasting with empty clipboard
|
|
|
|
When I put "" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {clipboard} (invalid command)
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Clipboard is empty." should be shown
|
2015-11-12 21:52:39 +01:00
|
|
|
|
|
|
|
Scenario: Pasting with empty selection
|
|
|
|
When selection is supported
|
|
|
|
And I put "" into the primary selection
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {primary} (invalid command)
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "Primary selection is empty." should be shown
|
2015-11-12 21:52:39 +01:00
|
|
|
|
2016-02-02 06:37:49 +01:00
|
|
|
Scenario: Pasting with a space in clipboard
|
|
|
|
When I put " " into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {clipboard} (invalid command)
|
2016-02-02 06:37:49 +01:00
|
|
|
Then the error "Clipboard is empty." should be shown
|
|
|
|
|
2015-11-12 21:52:39 +01:00
|
|
|
Scenario: Pasting in a new tab
|
2016-08-12 00:00:18 +02:00
|
|
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2015-11-12 21:52:39 +01:00
|
|
|
And I wait until data/hello.txt is loaded
|
2015-11-26 01:33:56 +01:00
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank
|
|
|
|
- data/hello.txt (active)
|
2015-11-12 21:52:39 +01:00
|
|
|
|
|
|
|
Scenario: Pasting in a background tab
|
2016-08-12 00:00:18 +02:00
|
|
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -b {clipboard}
|
2015-11-12 21:52:39 +01:00
|
|
|
And I wait until data/hello.txt is loaded
|
2015-11-26 01:33:56 +01:00
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank (active)
|
|
|
|
- data/hello.txt
|
2015-11-12 21:52:39 +01:00
|
|
|
|
|
|
|
Scenario: Pasting in a new window
|
|
|
|
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -w {clipboard}
|
2015-11-12 21:52:39 +01:00
|
|
|
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
|
2016-01-06 22:07:19 +01:00
|
|
|
|
|
|
|
Scenario: Pasting an invalid URL
|
|
|
|
When I set general -> auto-search to false
|
|
|
|
And I put "foo bar" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open {clipboard}
|
2016-01-06 22:07:19 +01:00
|
|
|
Then the error "Invalid URL" should be shown
|
2016-01-09 11:32:12 +01:00
|
|
|
|
|
|
|
Scenario: Pasting multiple urls in a new tab
|
2016-01-12 11:25:14 +01:00
|
|
|
When I put the following lines into the clipboard:
|
|
|
|
http://localhost:(port)/data/hello.txt
|
|
|
|
http://localhost:(port)/data/hello2.txt
|
|
|
|
http://localhost:(port)/data/hello3.txt
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2016-01-09 11:32:12 +01:00
|
|
|
And I wait until data/hello.txt is loaded
|
|
|
|
And I wait until data/hello2.txt is loaded
|
|
|
|
And I wait until data/hello3.txt is loaded
|
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank
|
|
|
|
- data/hello.txt (active)
|
|
|
|
- data/hello2.txt
|
|
|
|
- data/hello3.txt
|
|
|
|
|
2016-02-28 23:44:26 +01:00
|
|
|
Scenario: Pasting multiline text
|
2016-08-12 00:00:18 +02:00
|
|
|
When I set general -> auto-search to true
|
|
|
|
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
2016-02-28 23:44:26 +01:00
|
|
|
And I put the following lines into the clipboard:
|
|
|
|
this url:
|
|
|
|
http://qutebrowser.org
|
|
|
|
should not open
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2016-02-29 00:39:37 +01:00
|
|
|
And I wait until data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open is loaded
|
2016-02-28 23:44:26 +01:00
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank
|
|
|
|
- data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open (active)
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Pasting multiline whose first line looks like a URI
|
2016-08-12 00:00:18 +02:00
|
|
|
When I set general -> auto-search to true
|
|
|
|
And I set searchengines -> DEFAULT to http://localhost:(port)/data/hello.txt?q={}
|
2016-04-07 18:45:56 +02:00
|
|
|
And I put the following lines into the clipboard:
|
|
|
|
text:
|
|
|
|
should open
|
|
|
|
as search
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2016-04-07 18:45:56 +02:00
|
|
|
And I wait until data/hello.txt?q=text%3A%0Ashould%20open%0Aas%20search is loaded
|
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank
|
|
|
|
- data/hello.txt?q=text%3A%0Ashould%20open%0Aas%20search (active)
|
|
|
|
|
2016-01-09 11:32:12 +01:00
|
|
|
Scenario: Pasting multiple urls in a background tab
|
2016-08-12 00:00:18 +02:00
|
|
|
When I put the following lines into the clipboard:
|
2016-01-12 11:25:14 +01:00
|
|
|
http://localhost:(port)/data/hello.txt
|
|
|
|
http://localhost:(port)/data/hello2.txt
|
|
|
|
http://localhost:(port)/data/hello3.txt
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -b {clipboard}
|
2016-01-09 11:32:12 +01:00
|
|
|
And I wait until data/hello.txt is loaded
|
|
|
|
And I wait until data/hello2.txt is loaded
|
|
|
|
And I wait until data/hello3.txt is loaded
|
|
|
|
Then the following tabs should be open:
|
|
|
|
- about:blank (active)
|
|
|
|
- data/hello.txt
|
|
|
|
- data/hello2.txt
|
|
|
|
- data/hello3.txt
|
|
|
|
|
|
|
|
Scenario: Pasting multiple urls in new windows
|
2016-01-12 09:59:03 +01:00
|
|
|
When I put the following lines into the clipboard:
|
2016-01-12 11:25:14 +01:00
|
|
|
http://localhost:(port)/data/hello.txt
|
|
|
|
http://localhost:(port)/data/hello2.txt
|
|
|
|
http://localhost:(port)/data/hello3.txt
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -w {clipboard}
|
2016-01-09 11:32:12 +01:00
|
|
|
And I wait until data/hello.txt is loaded
|
|
|
|
And I wait until data/hello2.txt is loaded
|
|
|
|
And I wait until data/hello3.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
|
|
|
|
- tabs:
|
|
|
|
- active: true
|
|
|
|
history:
|
|
|
|
- active: true
|
|
|
|
url: http://localhost:*/data/hello2.txt
|
|
|
|
- tabs:
|
|
|
|
- active: true
|
|
|
|
history:
|
|
|
|
- active: true
|
|
|
|
url: http://localhost:*/data/hello3.txt
|
2016-01-30 13:57:26 +01:00
|
|
|
|
2016-02-02 06:37:49 +01:00
|
|
|
Scenario: Pasting multiple urls with an empty one
|
|
|
|
And I put "http://localhost:(port)/data/hello.txt\n\nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2016-02-02 06:37:49 +01:00
|
|
|
Then no crash should happen
|
|
|
|
|
|
|
|
Scenario: Pasting multiple urls with an almost empty one
|
|
|
|
And I put "http://localhost:(port)/data/hello.txt\n \nhttp://localhost:(port)/data/hello2.txt" into the clipboard
|
2016-08-06 22:03:50 +02:00
|
|
|
And I run :open -t {clipboard}
|
2016-02-02 06:37:49 +01:00
|
|
|
Then no crash should happen
|
|
|
|
|
2016-08-10 21:55:16 +02:00
|
|
|
#### :insert-text
|
2016-01-31 20:56:37 +01:00
|
|
|
|
2016-08-18 23:04:03 +02:00
|
|
|
@qtwebengine_todo: :insert-text is not implemented yet
|
2016-08-10 21:55:16 +02:00
|
|
|
Scenario: Inserting text into an empty text field
|
|
|
|
When I open data/paste_primary.html
|
2016-08-18 16:13:38 +02:00
|
|
|
And I run :click-element id qute-textarea
|
2016-05-30 14:54:06 +02:00
|
|
|
And I wait for "Clicked editable element!" in the log
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text Hello world
|
2016-01-30 13:57:26 +01:00
|
|
|
# Compare
|
2016-01-31 20:56:37 +01:00
|
|
|
Then the text field should contain "Hello world"
|
2016-01-30 13:57:26 +01:00
|
|
|
|
2016-08-18 23:04:03 +02:00
|
|
|
@qtwebengine_todo: :insert-text is not implemented yet
|
2016-08-10 21:55:16 +02:00
|
|
|
Scenario: Inserting text into a text field at specific position
|
|
|
|
When I open data/paste_primary.html
|
2016-01-31 20:56:37 +01:00
|
|
|
And I set the text field to "one two three four"
|
2016-08-18 16:13:38 +02:00
|
|
|
And I run :click-element id qute-textarea
|
2016-05-30 14:54:06 +02:00
|
|
|
And I wait for "Clicked editable element!" in the log
|
2016-08-11 14:04:30 +02:00
|
|
|
# Move to the beginning and two characters to the right
|
2016-01-30 13:57:26 +01:00
|
|
|
And I press the keys "<Home>"
|
2016-08-11 02:26:48 +02:00
|
|
|
And I press the key "<Right>"
|
|
|
|
And I press the key "<Right>"
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text Hello world
|
2016-01-30 13:57:26 +01:00
|
|
|
# Compare
|
2016-08-11 02:26:48 +02:00
|
|
|
Then the text field should contain "onHello worlde two three four"
|
2016-01-30 13:57:26 +01:00
|
|
|
|
2016-08-18 23:04:03 +02:00
|
|
|
@qtwebengine_todo: :insert-text is not implemented yet
|
2016-08-10 21:55:16 +02:00
|
|
|
Scenario: Inserting text into a text field with undo
|
|
|
|
When I open data/paste_primary.html
|
2016-08-18 16:13:38 +02:00
|
|
|
And I run :click-element id qute-textarea
|
2016-05-30 14:54:06 +02:00
|
|
|
And I wait for "Clicked editable element!" in the log
|
2016-01-30 13:57:26 +01:00
|
|
|
# Paste and undo
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text This text should be undone
|
2016-01-30 13:57:26 +01:00
|
|
|
And I press the key "<Ctrl+z>"
|
2016-01-30 14:03:54 +01:00
|
|
|
# Paste final text
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text This text should stay
|
2016-01-30 13:57:26 +01:00
|
|
|
# Compare
|
2016-01-31 20:56:37 +01:00
|
|
|
Then the text field should contain "This text should stay"
|
2016-01-31 22:08:46 +01:00
|
|
|
|
2016-08-18 23:04:03 +02:00
|
|
|
@qtwebengine_todo: :insert-text is not implemented yet
|
2016-08-10 21:55:16 +02:00
|
|
|
Scenario: Inserting text without a focused field
|
|
|
|
When I open data/paste_primary.html
|
2016-01-31 22:08:46 +01:00
|
|
|
And I run :enter-mode insert
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text test
|
2016-01-31 22:08:46 +01:00
|
|
|
Then the error "No element focused!" should be shown
|
|
|
|
|
2016-08-18 23:04:03 +02:00
|
|
|
@qtwebengine_todo: :insert-text is not implemented yet
|
2016-08-10 21:55:16 +02:00
|
|
|
Scenario: Inserting text with a read-only field
|
|
|
|
When I open data/paste_primary.html
|
2016-08-18 16:13:38 +02:00
|
|
|
And I run :click-element id qute-textarea-noedit
|
2016-05-30 14:54:06 +02:00
|
|
|
And I wait for "Clicked non-editable element!" in the log
|
2016-01-31 22:08:46 +01:00
|
|
|
And I run :enter-mode insert
|
2016-08-10 21:55:16 +02:00
|
|
|
And I run :insert-text test
|
2016-01-31 22:08:46 +01:00
|
|
|
Then the error "Focused element is not editable!" should be shown
|