blob: f551d732f3bdfed5901e4941b41e686dee7a3dcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
|
Feature: Yanking and pasting.
:yank, {clipboard} and {primary} can be used to copy/paste the URL or title
from/to the clipboard and primary selection.
Background:
Given I clean up open tabs
#### :yank
Scenario: Yanking URLs to clipboard
When I open data/title.html
And I run :yank
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"
Scenario: Yanking URLs to primary selection
When selection is supported
And I open data/title.html
And I run :yank --sel
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"
Scenario: Yanking URLs with ref and UTM parameters
When I open data/title.html?utm_source=kikolani&utm_medium=320banner&utm_campaign=bpp&ref=facebook
And I run :yank
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"
Scenario: Yanking URLs with ref and UTM parameters and some other parameters
When I open data/title.html?stype=models&utm_source=kikolani&utm_medium=320banner&utm_campaign=bpp&ref=facebook
And I run :yank
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title.html?stype=models" should be shown
And the clipboard should contain "http://localhost:(port)/data/title.html?stype=models"
Scenario: Yanking title to clipboard
When I open data/title.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 inline to clipboard
When I open data/title.html
And I run :yank inline '[[{url}][qutebrowser</3org]]'
Then the message "Yanked inline block to clipboard: [[http://localhost:(port)/data/title.html][qutebrowser</3org]]" should be shown
And the clipboard should contain "[[http://localhost:(port)/data/title.html][qutebrowser</3org]]"
Scenario: Yanking domain to clipboard
When I open data/title.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)"
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
And I run :yank pretty-url
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"
Scenario: Yanking URL that has = and & in its query string
When I open data/title.html?a=b&c=d
And I run :yank
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title.html?a=b&c=d" should be shown
And the clipboard should contain "http://localhost:(port)/data/title.html?a=b&c=d"
Scenario: Yanking URL that has = and ; in its query string
When I open data/title.html?a=b;c=d
And I run :yank
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title.html?a=b;c=d" should be shown
And the clipboard should contain "http://localhost:(port)/data/title.html?a=b;c=d"
Scenario: Yanking URL with both & and ; in its query string
When I open data/title.html?a;b&c=d
And I run :yank
Then the message "Yanked URL to clipboard: http://localhost:(port)/data/title.html?a;b&c=d" should be shown
And the clipboard should contain "http://localhost:(port)/data/title.html?a;b&c=d"
Scenario: Yanking with --quiet
When I open data/title.html
And I run :yank --quiet
Then "Yanked URL to clipboard: *" should not be logged
#### {clipboard} and {primary}
Scenario: Pasting a URL
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open {clipboard}
Then data/hello.txt should be loaded
Scenario: Pasting a URL from primary selection
When selection is supported
And I put "http://localhost:(port)/data/hello2.txt" into the primary selection
And I run :open {primary}
Then data/hello2.txt should be loaded
Scenario: Pasting with empty clipboard
When I put "" into the clipboard
And I run :open {clipboard} (invalid command)
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 :open {primary} (invalid command)
Then the error "Primary selection is empty." should be shown
Scenario: Pasting without primary selection being supported
When selection is not supported
And I run :open {primary} (invalid command)
Then the error "Primary selection is not supported on this platform!" should be shown
Scenario: Pasting with a space in clipboard
When I put " " into the clipboard
And I run :open {clipboard} (invalid command)
Then the error "Clipboard is empty." should be shown
Scenario: Pasting in a new tab
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -t {clipboard}
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
- about:blank
- data/hello.txt (active)
Scenario: Pasting in a background tab
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -b {clipboard}
And I wait until data/hello.txt is loaded
Then the following tabs should be open:
- about:blank (active)
- data/hello.txt
Scenario: Pasting in a new window
When I put "http://localhost:(port)/data/hello.txt" into the clipboard
And I run :open -w {clipboard}
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
Scenario: Pasting an invalid URL
When I set url.auto_search to never
And I put "foo bar" into the clipboard
And I run :open {clipboard}
Then the error "Invalid URL" should be shown
# https://travis-ci.org/qutebrowser/qutebrowser/jobs/157941726
@qtwebengine_flaky
Scenario: Pasting multiple urls in a new tab
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
And I run :open -t {clipboard}
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
Scenario: Pasting multiline text
When I set url.auto_search to naive
And I set url.searchengines to {"DEFAULT": "http://localhost:(port)/data/hello.txt?q={}"}
And I put the following lines into the clipboard:
this url:
http://qutebrowser.org
should not open
And I run :open -t {clipboard}
And I wait until data/hello.txt?q=this%20url%3A%0Ahttp%3A//qutebrowser.org%0Ashould%20not%20open is loaded
Then the following tabs should be open:
- about:blank
- 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
When I set url.auto_search to naive
And I set url.searchengines to {"DEFAULT": "http://localhost:(port)/data/hello.txt?q={}"}
And I put the following lines into the clipboard:
text:
should open
as search
And I run :open -t {clipboard}
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)
# https://travis-ci.org/qutebrowser/qutebrowser/jobs/157941726
@qtwebengine_flaky
Scenario: Pasting multiple urls in a background tab
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
And I run :open -b {clipboard}
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
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
And I run :open -w {clipboard}
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
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
And I run :open -t {clipboard}
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
And I run :open -t {clipboard}
Then no crash should happen
#### :insert-text
Scenario: Inserting text into an empty text field
When I open data/paste_primary.html
And I run :click-element id qute-textarea
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
And I run :insert-text Hello world
# Compare
Then the javascript message "textarea contents: Hello world" should be logged
Scenario: Inserting text into an empty text field with javascript disabled
When I set content.javascript.enabled to false
And I open data/paste_primary.html
And I run :click-element id qute-textarea
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
And I run :insert-text Hello world
And I wait for "Inserting text into element *" in the log
And I run :jseval console.log("textarea contents: " + document.getElementById('qute-textarea').value);
# Enable javascript again for the other tests
And I set content.javascript.enabled to true
# Compare
Then the javascript message "textarea contents: Hello world" should be logged
Scenario: Inserting text into a text field at specific position
When I open data/paste_primary.html
And I insert "one two three four" into the text field
And I run :click-element id qute-textarea
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
# Move to the beginning and two characters to the right
And I press the keys "<Home>"
And I press the key "<Right>"
And I press the key "<Right>"
And I run :insert-text Hello world
# Compare
Then the javascript message "textarea contents: onHello worlde two three four" should be logged
Scenario: Inserting text into a text field with undo
When I open data/paste_primary.html
And I run :click-element id qute-textarea
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
# Paste and undo
And I run :insert-text This text should be undone
And I wait for the javascript message "textarea contents: This text should be undone"
And I press the key "<Ctrl+z>"
And I wait for the javascript message "textarea contents: "
# Paste final text
And I run :insert-text This text should stay
# Compare
Then the javascript message "textarea contents: This text should stay" should be logged
Scenario: Inserting text without a focused field
When I open data/paste_primary.html
And I run :mode-enter insert
And I run :insert-text test
Then the error "No element focused!" should be shown
Scenario: Inserting text with a read-only field
When I open data/paste_primary.html
And I run :click-element id qute-textarea-noedit
And I wait for "Clicked non-editable element!" in the log
And I run :mode-enter insert
And I run :insert-text test
Then the error "Element is not editable!" should be shown
|