blob: 018d65b9f0b2d84cd4c0b77bf640bd970cf9fe72 (
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
|
Feature: Opening external editors
## :edit-url
Scenario: Editing a URL
When I open data/numbers/1.txt
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url
Then data/numbers/2.txt should be loaded
Scenario: Editing a URL with -t
When I run :tab-only
And I open data/numbers/1.txt
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url -t
Then data/numbers/2.txt should be loaded
And the following tabs should be open:
- data/numbers/1.txt
- data/numbers/2.txt (active)
Scenario: Editing a URL with -rt
When I set tabs.new_position.related to prev
And I open data/numbers/1.txt
And I run :tab-only
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url -rt
Then data/numbers/2.txt should be loaded
And the following tabs should be open:
- data/numbers/2.txt (active)
- data/numbers/1.txt
Scenario: Editing a URL with -b
When I run :tab-only
And I open data/numbers/1.txt
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url -b
Then data/numbers/2.txt should be loaded
And the following tabs should be open:
- data/numbers/1.txt (active)
- data/numbers/2.txt
Scenario: Editing a URL with -w
When I run :window-only
And I open data/numbers/1.txt in a new tab
And I run :tab-only
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url -w
Then data/numbers/2.txt should be loaded
And the session should look like:
windows:
- tabs:
- active: true
history:
- active: true
url: http://localhost:*/data/numbers/1.txt
- tabs:
- active: true
history:
- active: true
url: http://localhost:*/data/numbers/2.txt
Scenario: Editing a URL with -p
When I open data/numbers/1.txt in a new tab
And I run :tab-only
And I run :window-only
And I setup a fake editor replacing "1.txt" by "2.txt"
And I run :edit-url -p
Then data/numbers/2.txt should be loaded
And the session should look like:
windows:
- tabs:
- active: true
history:
- active: true
url: http://localhost:*/data/numbers/1.txt
- tabs:
- active: true
history:
- active: true
url: http://localhost:*/data/numbers/2.txt
private: true
Scenario: Editing a URL with -t and -b
When I run :edit-url -t -b
Then the error "Only one of -t/-b/-w can be given!" should be shown
@flaky
Scenario: Editing a URL with invalid URL
When I set url.auto_search to never
And I open data/hello.txt
And I setup a fake editor replacing "http://localhost:(port)/data/hello.txt" by "foo!"
And I run :edit-url
Then the error "Invalid URL" should be shown
Scenario: Spawning an editor successfully
Given I have a fresh instance
When I setup a fake editor returning "foobar"
And I open data/editor.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 :edit-text
And I wait for "Read back: foobar" in the log
Then the javascript message "text: foobar" should be logged
Scenario: Spawning an editor in normal mode
When I setup a fake editor returning "foobar"
And I open data/editor.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 :mode-leave
And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log
And I run :edit-text
And I wait for "Read back: foobar" in the log
Then the javascript message "text: foobar" should be logged
# Could not get signals working on Windows
# There's no guarantee that the tab gets deleted...
@posix
Scenario: Spawning an editor and closing the tab
When I setup a fake editor that writes "foobar" on save
And I open data/editor.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 :edit-text
And I wait until the editor has started
And I set tabs.last_close to blank
And I run :tab-close
And I kill the waiting editor
Then the error "Edited element vanished" should be shown
And the message "Editor backup at *" should be shown
# Could not get signals working on Windows
@posix
Scenario: Spawning an editor and saving
When I setup a fake editor that writes "foobar" on save
And I open data/editor.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 :edit-text
And I wait until the editor has started
And I save without exiting the editor
And I wait for "Read back: foobar" in the log
Then the javascript message "text: foobar" should be logged
Scenario: Spawning an editor in caret mode
When I setup a fake editor returning "foobar"
And I open data/editor.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 :mode-leave
And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log
And I run :mode-enter caret
And I wait for "Entering mode KeyMode.caret (reason: command)" in the log
And I run :edit-text
And I wait for "Read back: foobar" in the log
And I run :mode-leave
Then the javascript message "text: foobar" should be logged
Scenario: Spawning an editor with existing text
When I setup a fake editor replacing "foo" by "bar"
And I open data/editor.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 foo
And I wait for "Inserting text into element *" in the log
And I run :edit-text
And I wait for "Read back: bar" in the log
Then the javascript message "text: bar" should be logged
## :cmd-edit
Scenario: Edit a command and run it
When I run :cmd-set-text :message-info foo
And I setup a fake editor replacing "foo" by "bar"
And I run :cmd-edit --run
Then the message "bar" should be shown
And "Leaving mode KeyMode.command (reason: cmd accept)" should be logged
Scenario: Edit a command and omit the start char
When I setup a fake editor returning "message-info foo"
And I run :cmd-edit
Then the error "command must start with one of :/?" should be shown
And "Leaving mode KeyMode.command *" should not be logged
Scenario: Edit a command to be empty
When I run :cmd-set-text :
When I setup a fake editor returning empty text
And I run :cmd-edit
Then the error "command must start with one of :/?" should be shown
And "Leaving mode KeyMode.command *" should not be logged
And I run :mode-leave
And "Leaving mode KeyMode.command *" should be logged
## select single file
Scenario: Select one file with single file command
When I setup a fake single_file fileselector selecting "tests/end2end/data/numbers/1.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: 1.txt" should be logged
Scenario: Select one file with single file command that writes to stdout
When I setup a fake single_file fileselector selecting "tests/end2end/data/numbers/1.txt" and writes to stdout
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: 1.txt" should be logged
Scenario: Select two files with single file command
When I setup a fake single_file fileselector selecting "tests/end2end/data/numbers/1.txt tests/end2end/data/numbers/2.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: 1.txt" should be logged
And the warning "More than one file/folder chosen, using only the first" should be shown
## select multiple files
Scenario: Select one file with multiple files command
When I setup a fake multiple_files fileselector selecting "tests/end2end/data/numbers/1.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id multiple_files
Then the javascript message "Files: 1.txt" should be logged
Scenario: Select two files with multiple files command
When I setup a fake multiple_files fileselector selecting "tests/end2end/data/numbers/1.txt tests/end2end/data/numbers/2.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id multiple_files
Then the javascript message "Files: 1.txt, 2.txt" should be logged
## No temporary file created
Scenario: File selector deleting temporary file
When I set fileselect.handler to external
And I set fileselect.single_file.command to ['rm', '{}']
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: 1.txt" should not be logged
And the error "Failed to open tempfile *" should be shown
And "Failed to delete tempfile *" should be logged with level error
## Select non-existent file
Scenario: Select non-existent file
When I set fileselect.handler to external
When I setup a fake single_file fileselector selecting "tests/end2end/data/numbers/non-existent.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: non-existent.txt" should not be logged
And the warning "Ignoring non-existent file *non-existent.txt'" should be shown
## Select folder when expecting file
Scenario: Select folder for file
When I set fileselect.handler to external
When I setup a fake single_file fileselector selecting "tests/end2end/data/numbers" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id single_file
Then the javascript message "Files: *" should not be logged
And the warning "Expected file but got folder, ignoring *numbers'" should be shown
## Select file when expecting folder
@qtwebkit_skip
Scenario: Select file for folder
When I set fileselect.handler to external
When I setup a fake folder fileselector selecting "tests/end2end/data/numbers/1.txt" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id folder
Then the javascript message "Files: 1.txt" should not be logged
And the warning "Expected folder but got file, ignoring *1.txt'" should be shown
## Select folder
@qtwebkit_skip
Scenario: Select one folder with folder command
When I set fileselect.handler to external
And I setup a fake folder fileselector selecting "tests/end2end/data/backforward/" and writes to a temporary file
And I open data/fileselect.html
And I run :click-element id folder
Then the javascript message "Files: 1.txt, 2.txt, 3.txt" should be logged
|