2017-03-31 17:16:31 +02:00
|
|
|
# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2016-04-06 06:47:19 +02:00
|
|
|
Feature: Opening external editors
|
|
|
|
|
2017-10-25 16:24:38 +02:00
|
|
|
Background:
|
|
|
|
Given I have a fresh instance
|
|
|
|
|
2016-04-06 06:47:19 +02:00
|
|
|
## :edit-url
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL
|
2016-04-06 06:47:19 +02:00
|
|
|
When I open data/numbers/1.txt
|
|
|
|
And I set up a fake editor replacing "1.txt" by "2.txt"
|
|
|
|
And I run :edit-url
|
|
|
|
Then data/numbers/2.txt should be loaded
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL with -t
|
2016-04-06 06:47:19 +02:00
|
|
|
When I run :tab-only
|
|
|
|
And I open data/numbers/1.txt
|
|
|
|
And I set up 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)
|
|
|
|
|
2017-10-27 04:13:35 +02:00
|
|
|
Scenario: Editing a URL with -rt
|
|
|
|
When I set tabs.new_position.related to prev
|
|
|
|
And I open data/numbers/1.txt
|
|
|
|
And I set up 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
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL with -b
|
2016-04-06 06:47:19 +02:00
|
|
|
When I run :tab-only
|
|
|
|
And I open data/numbers/1.txt
|
|
|
|
And I set up 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
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL with -w
|
2016-04-06 06:47:19 +02:00
|
|
|
When I open data/numbers/1.txt in a new tab
|
|
|
|
And I run :tab-only
|
|
|
|
And I set up 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
|
2016-05-18 06:37:26 +02:00
|
|
|
|
2017-10-25 16:24:38 +02:00
|
|
|
Scenario: Editing a URL with -p
|
|
|
|
When I open data/numbers/1.txt in a new tab
|
|
|
|
And I run :tab-only
|
|
|
|
And I set up 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
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL with -t and -b
|
2016-04-06 06:47:19 +02:00
|
|
|
When I run :edit-url -t -b
|
|
|
|
Then the error "Only one of -t/-b/-w can be given!" should be shown
|
|
|
|
|
2016-07-05 08:34:03 +02:00
|
|
|
Scenario: Editing a URL with invalid URL
|
2017-07-02 12:07:27 +02:00
|
|
|
When I set url.auto_search to never
|
2016-04-06 06:47:19 +02:00
|
|
|
And I open data/hello.txt
|
|
|
|
And I set up 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
|
2016-06-06 08:36:11 +02:00
|
|
|
|
|
|
|
Scenario: Spawning an editor successfully
|
|
|
|
When I set up a fake editor returning "foobar"
|
|
|
|
And I open data/editor.html
|
2016-08-18 15:38:14 +02:00
|
|
|
And I run :click-element id qute-textarea
|
2017-02-03 22:20:15 +01:00
|
|
|
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
|
2016-06-06 08:36:11 +02:00
|
|
|
And I run :open-editor
|
|
|
|
And I wait for "Read back: foobar" in the log
|
2016-08-18 15:38:14 +02:00
|
|
|
And I run :click-element id qute-button
|
2016-06-06 08:36:11 +02:00
|
|
|
Then the javascript message "text: foobar" should be logged
|
2016-09-04 22:23:16 +02:00
|
|
|
|
|
|
|
Scenario: Spawning an editor in normal mode
|
|
|
|
When I set up a fake editor returning "foobar"
|
|
|
|
And I open data/editor.html
|
|
|
|
And I run :click-element id qute-textarea
|
2017-02-03 22:20:15 +01:00
|
|
|
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
|
2016-09-04 22:23:16 +02:00
|
|
|
And I run :leave-mode
|
|
|
|
And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log
|
|
|
|
And I run :open-editor
|
|
|
|
And I wait for "Read back: foobar" in the log
|
|
|
|
And I run :click-element id qute-button
|
|
|
|
Then the javascript message "text: foobar" should be logged
|
|
|
|
|
2017-12-01 13:35:13 +01:00
|
|
|
# Could not get signals working on Windows
|
|
|
|
@posix
|
2017-11-24 21:15:03 +01:00
|
|
|
Scenario: Spawning an editor and closing the tab
|
2017-11-28 14:38:04 +01:00
|
|
|
When I set up a fake editor that waits
|
2017-11-24 21:15:03 +01:00
|
|
|
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 :open-editor
|
|
|
|
And I set tabs.last_close to blank
|
|
|
|
And I run :tab-close
|
2017-11-28 14:38:04 +01:00
|
|
|
And I kill the waiting editor
|
2017-12-02 14:49:06 +01:00
|
|
|
Then the error "Edited element vanished" should be shown
|
2017-11-24 21:15:03 +01:00
|
|
|
|
2017-02-04 22:16:22 +01:00
|
|
|
@qtwebengine_todo: Caret mode is not implemented yet
|
2016-09-04 22:23:16 +02:00
|
|
|
Scenario: Spawning an editor in caret mode
|
|
|
|
When I set up a fake editor returning "foobar"
|
|
|
|
And I open data/editor.html
|
|
|
|
And I run :click-element id qute-textarea
|
2017-02-03 22:20:15 +01:00
|
|
|
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
|
2016-09-04 22:23:16 +02:00
|
|
|
And I run :leave-mode
|
|
|
|
And I wait for "Leaving mode KeyMode.insert (reason: leave current)" in the log
|
|
|
|
And I run :enter-mode caret
|
|
|
|
And I wait for "Entering mode KeyMode.caret (reason: command)" in the log
|
|
|
|
And I run :open-editor
|
|
|
|
And I wait for "Read back: foobar" in the log
|
|
|
|
And I run :click-element id qute-button
|
|
|
|
Then the javascript message "text: foobar" should be logged
|
2016-11-16 12:15:43 +01:00
|
|
|
|
|
|
|
Scenario: Spawning an editor with existing text
|
|
|
|
When I set up a fake editor replacing "foo" by "bar"
|
|
|
|
And I open data/editor.html
|
|
|
|
And I run :click-element id qute-textarea
|
2017-02-03 22:20:15 +01:00
|
|
|
And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
|
2016-11-16 12:15:43 +01:00
|
|
|
And I run :insert-text foo
|
|
|
|
And I wait for "Inserting text into element *" in the log
|
|
|
|
And I run :open-editor
|
|
|
|
And I wait for "Read back: bar" in the log
|
|
|
|
And I run :click-element id qute-button
|
|
|
|
Then the javascript message "text: bar" should be logged
|
2017-11-16 13:38:03 +01:00
|
|
|
|
|
|
|
## :edit-command
|
|
|
|
|
|
|
|
Scenario: Edit a command and run it
|
|
|
|
When I run :set-cmd-text :message-info foo
|
|
|
|
And I set up a fake editor replacing "foo" by "bar"
|
|
|
|
And I run :edit-command --run
|
|
|
|
Then the message "bar" should be shown
|
2017-11-20 17:39:12 +01:00
|
|
|
And "Leaving mode KeyMode.command (reason: cmd accept)" should be logged
|
2017-11-23 14:07:11 +01:00
|
|
|
|
|
|
|
Scenario: Edit a command and omit the start char
|
|
|
|
When I set up a fake editor returning "message-info foo"
|
|
|
|
And I run :edit-command
|
|
|
|
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 :set-cmd-text :
|
|
|
|
When I set up a fake editor returning empty text
|
|
|
|
And I run :edit-command
|
|
|
|
Then the error "command must start with one of :/?" should be shown
|
|
|
|
And "Leaving mode KeyMode.command *" should not be logged
|