2017-03-31 17:16:31 +02:00
|
|
|
# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:
|
|
|
|
|
2015-11-25 17:20:53 +01:00
|
|
|
Feature: Keyboard input
|
|
|
|
|
2017-07-03 09:09:50 +02:00
|
|
|
Tests for :clear-keychain and other keyboard input related things.
|
2016-06-04 05:04:44 +02:00
|
|
|
|
2015-11-25 17:20:53 +01:00
|
|
|
# :clear-keychain
|
|
|
|
|
|
|
|
Scenario: Clearing the keychain
|
2017-09-13 21:15:02 +02:00
|
|
|
When I run :bind ,foo message-error test12
|
|
|
|
And I run :bind ,bar message-info test12-2
|
|
|
|
And I press the keys ",fo"
|
2015-11-25 17:20:53 +01:00
|
|
|
And I run :clear-keychain
|
2017-09-13 21:15:02 +02:00
|
|
|
And I press the keys ",bar"
|
|
|
|
And I run :unbind ,foo
|
|
|
|
And I run :unbind ,bar
|
2016-05-10 23:46:02 +02:00
|
|
|
Then the message "test12-2" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
2017-06-16 18:10:04 +02:00
|
|
|
# input.forward_unbound_keys
|
2015-11-25 17:20:53 +01:00
|
|
|
|
2018-07-02 23:19:57 +02:00
|
|
|
@qt<5.11.1
|
2015-11-25 17:20:53 +01:00
|
|
|
Scenario: Forwarding all keys
|
|
|
|
When I open data/keyinput/log.html
|
2017-06-16 16:22:41 +02:00
|
|
|
And I set input.forward_unbound_keys to all
|
2016-10-08 21:17:47 +02:00
|
|
|
And I press the key ","
|
2015-11-25 17:20:53 +01:00
|
|
|
And I press the key "<F1>"
|
2016-10-08 21:17:47 +02:00
|
|
|
# ,
|
|
|
|
Then the javascript message "key press: 188" should be logged
|
|
|
|
And the javascript message "key release: 188" should be logged
|
2015-11-25 17:20:53 +01:00
|
|
|
# <F1>
|
|
|
|
And the javascript message "key press: 112" should be logged
|
|
|
|
And the javascript message "key release: 112" should be logged
|
|
|
|
|
2018-07-02 23:19:57 +02:00
|
|
|
@qt<5.11.1
|
2015-11-25 17:20:53 +01:00
|
|
|
Scenario: Forwarding special keys
|
|
|
|
When I open data/keyinput/log.html
|
2017-06-16 16:22:41 +02:00
|
|
|
And I set input.forward_unbound_keys to auto
|
2018-02-26 20:02:43 +01:00
|
|
|
And I press the keys ",<F1>"
|
2015-11-25 17:20:53 +01:00
|
|
|
# <F1>
|
|
|
|
Then the javascript message "key press: 112" should be logged
|
|
|
|
And the javascript message "key release: 112" should be logged
|
2018-02-26 20:02:43 +01:00
|
|
|
# ,
|
|
|
|
And the javascript message "key press: 188" should not be logged
|
|
|
|
And the javascript message "key release: 188" should not be logged
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: Forwarding no keys
|
|
|
|
When I open data/keyinput/log.html
|
2017-06-16 16:22:41 +02:00
|
|
|
And I set input.forward_unbound_keys to none
|
2015-11-25 17:20:53 +01:00
|
|
|
And I press the key "<F1>"
|
|
|
|
# <F1>
|
|
|
|
Then the javascript message "key press: 112" should not be logged
|
|
|
|
And the javascript message "key release: 112" should not be logged
|
|
|
|
|
|
|
|
# :fake-key
|
|
|
|
|
|
|
|
Scenario: :fake-key with an unparsable key
|
|
|
|
When I run :fake-key <blub>
|
2018-03-06 07:39:41 +01:00
|
|
|
Then the error "Could not parse '<blub>': Got invalid key!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: :fake-key sending key to the website
|
2017-09-13 22:26:38 +02:00
|
|
|
When I open data/keyinput/log.html
|
2015-11-25 17:20:53 +01:00
|
|
|
And I run :fake-key x
|
|
|
|
Then the javascript message "key press: 88" should be logged
|
|
|
|
And the javascript message "key release: 88" should be logged
|
|
|
|
|
2016-10-05 14:27:57 +02:00
|
|
|
@no_xvfb @posix @qtwebengine_skip
|
2015-11-25 17:20:53 +01:00
|
|
|
Scenario: :fake-key sending key to the website with other window focused
|
|
|
|
When I open data/keyinput/log.html
|
|
|
|
And I run :inspector
|
|
|
|
And I wait for "Focus object changed: <PyQt5.QtWebKitWidgets.QWebView object at *>" in the log
|
|
|
|
And I run :fake-key x
|
|
|
|
And I run :inspector
|
2016-06-13 10:49:58 +02:00
|
|
|
And I wait for "Focus object changed: <qutebrowser.browser.webkit.webview.WebView *>" in the log
|
2015-11-26 17:50:39 +01:00
|
|
|
Then the error "No focused webview!" should be shown
|
2015-11-25 17:20:53 +01:00
|
|
|
|
|
|
|
Scenario: :fake-key sending special key to the website
|
2017-09-13 22:26:38 +02:00
|
|
|
When I open data/keyinput/log.html
|
2015-11-25 17:20:53 +01:00
|
|
|
And I run :fake-key <Escape>
|
|
|
|
Then the javascript message "key press: 27" should be logged
|
|
|
|
And the javascript message "key release: 27" should be logged
|
|
|
|
|
|
|
|
Scenario: :fake-key sending keychain to the website
|
2017-09-13 22:26:38 +02:00
|
|
|
When I open data/keyinput/log.html
|
2015-11-25 17:20:53 +01:00
|
|
|
And I run :fake-key xy
|
|
|
|
Then the javascript message "key press: 88" should be logged
|
|
|
|
And the javascript message "key release: 88" should be logged
|
|
|
|
And the javascript message "key press: 89" should be logged
|
|
|
|
And the javascript message "key release: 89" should be logged
|
|
|
|
|
|
|
|
Scenario: :fake-key sending keypress to qutebrowser
|
|
|
|
When I run :fake-key -g x
|
|
|
|
And I wait for "got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>" in the log
|
|
|
|
Then no crash should happen
|
2016-11-10 06:51:59 +01:00
|
|
|
|
|
|
|
# Macros
|
|
|
|
|
|
|
|
Scenario: Recording a simple macro
|
2017-04-08 19:52:46 +02:00
|
|
|
When I run :record-macro
|
2016-11-10 06:51:59 +01:00
|
|
|
And I press the key "a"
|
2017-04-08 19:52:46 +02:00
|
|
|
And I run :message-info "foo 1"
|
|
|
|
And I run :message-info "bar 1"
|
2016-11-10 06:51:59 +01:00
|
|
|
And I run :record-macro
|
|
|
|
And I run :run-macro with count 2
|
|
|
|
And I press the key "a"
|
2017-04-08 19:52:46 +02:00
|
|
|
Then the message "foo 1" should be shown
|
|
|
|
And the message "bar 1" should be shown
|
|
|
|
And the message "foo 1" should be shown
|
|
|
|
And the message "bar 1" should be shown
|
|
|
|
And the message "foo 1" should be shown
|
|
|
|
And the message "bar 1" should be shown
|
2016-11-10 06:51:59 +01:00
|
|
|
|
|
|
|
Scenario: Recording a named macro
|
2017-04-08 19:52:46 +02:00
|
|
|
When I run :record-macro foo
|
|
|
|
And I run :message-info "foo 2"
|
|
|
|
And I run :message-info "bar 2"
|
2016-11-10 06:51:59 +01:00
|
|
|
And I run :record-macro foo
|
2017-04-08 19:52:46 +02:00
|
|
|
And I run :run-macro foo
|
|
|
|
Then the message "foo 2" should be shown
|
|
|
|
And the message "bar 2" should be shown
|
|
|
|
And the message "foo 2" should be shown
|
|
|
|
And the message "bar 2" should be shown
|
2016-11-10 06:51:59 +01:00
|
|
|
|
|
|
|
Scenario: Running an invalid macro
|
|
|
|
Given I open data/scroll/simple.html
|
|
|
|
And I run :tab-only
|
|
|
|
When I run :run-macro
|
|
|
|
And I press the key "b"
|
|
|
|
Then the error "No macro recorded in 'b'!" should be shown
|
|
|
|
And no crash should happen
|
|
|
|
|
|
|
|
Scenario: Running an invalid named macro
|
|
|
|
Given I open data/scroll/simple.html
|
|
|
|
And I run :tab-only
|
|
|
|
When I run :run-macro bar
|
|
|
|
Then the error "No macro recorded in 'bar'!" should be shown
|
|
|
|
And no crash should happen
|
2016-11-10 07:16:52 +01:00
|
|
|
|
|
|
|
Scenario: Running a macro with a mode-switching command
|
|
|
|
When I open data/hints/html/simple.html
|
|
|
|
And I run :record-macro a
|
|
|
|
And I run :hint links normal
|
|
|
|
And I wait for "hints: *" in the log
|
|
|
|
And I run :leave-mode
|
|
|
|
And I run :record-macro a
|
|
|
|
And I run :run-macro
|
|
|
|
And I press the key "a"
|
|
|
|
And I wait for "hints: *" in the log
|
|
|
|
Then no crash should happen
|
2016-11-11 02:45:59 +01:00
|
|
|
|
|
|
|
Scenario: Cancelling key input
|
|
|
|
When I run :record-macro
|
|
|
|
And I press the key "<Escape>"
|
2016-11-14 23:28:38 +01:00
|
|
|
Then "Leaving mode KeyMode.record_macro (reason: leave current)" should be logged
|
2017-01-20 17:26:14 +01:00
|
|
|
|
|
|
|
Scenario: Ignoring non-register keys
|
2017-04-08 19:52:46 +02:00
|
|
|
When I run :record-macro
|
2017-01-20 17:26:14 +01:00
|
|
|
And I press the key "<Menu>"
|
|
|
|
And I press the key "c"
|
2017-04-08 19:52:46 +02:00
|
|
|
And I run :message-info "foo 3"
|
2017-01-20 17:26:14 +01:00
|
|
|
And I run :record-macro
|
|
|
|
And I run :run-macro
|
|
|
|
And I press the key "c"
|
2017-04-08 19:52:46 +02:00
|
|
|
Then the message "foo 3" should be shown
|
|
|
|
And the message "foo 3" should be shown
|
2018-02-13 00:11:32 +01:00
|
|
|
|
2018-03-14 04:31:48 +01:00
|
|
|
# test all tabs.mode_on_change modes
|
2018-02-13 22:23:56 +01:00
|
|
|
|
|
|
|
Scenario: mode on change normal
|
2018-02-13 23:03:01 +01:00
|
|
|
Given I set tabs.mode_on_change to normal
|
2018-02-14 15:58:23 +01:00
|
|
|
And I clean up open tabs
|
2018-06-14 15:56:48 +02:00
|
|
|
When I open data/hello.txt
|
2018-02-13 00:11:32 +01:00
|
|
|
And I run :enter-mode insert
|
2018-06-14 15:56:48 +02:00
|
|
|
And I open data/hello2.txt in a new background tab
|
|
|
|
And I run :tab-focus 2
|
2018-02-13 00:11:32 +01:00
|
|
|
Then "Entering mode KeyMode.insert (reason: command)" should be logged
|
2018-02-13 22:23:56 +01:00
|
|
|
And "Leaving mode KeyMode.insert (reason: tab changed)" should be logged
|
2018-03-14 04:31:48 +01:00
|
|
|
And "Mode before tab change: insert (mode_on_change = normal)" should be logged
|
|
|
|
And "Mode after tab change: normal (mode_on_change = normal)" should be logged
|
2018-02-13 00:11:32 +01:00
|
|
|
|
2018-02-13 22:23:56 +01:00
|
|
|
Scenario: mode on change persist
|
2018-02-13 23:03:01 +01:00
|
|
|
Given I set tabs.mode_on_change to persist
|
2018-02-14 15:58:23 +01:00
|
|
|
And I clean up open tabs
|
2018-06-14 15:56:48 +02:00
|
|
|
When I open data/hello.txt
|
2018-02-13 00:11:32 +01:00
|
|
|
And I run :enter-mode insert
|
2018-06-14 15:56:48 +02:00
|
|
|
And I open data/hello2.txt in a new background tab
|
|
|
|
And I run :tab-focus 2
|
2018-02-13 00:11:32 +01:00
|
|
|
Then "Entering mode KeyMode.insert (reason: command)" should be logged
|
2018-03-14 04:31:48 +01:00
|
|
|
And "Leaving mode KeyMode.insert (reason: tab changed)" should not be logged
|
|
|
|
And "Mode before tab change: insert (mode_on_change = persist)" should be logged
|
|
|
|
And "Mode after tab change: insert (mode_on_change = persist)" should be logged
|
2018-02-13 00:11:32 +01:00
|
|
|
|
2018-02-13 22:23:56 +01:00
|
|
|
Scenario: mode on change restore
|
2018-02-13 23:03:01 +01:00
|
|
|
Given I set tabs.mode_on_change to restore
|
2018-02-14 15:58:23 +01:00
|
|
|
And I clean up open tabs
|
2018-06-14 15:56:48 +02:00
|
|
|
When I open data/hello.txt
|
2018-02-13 00:11:32 +01:00
|
|
|
And I run :enter-mode insert
|
2018-06-14 15:56:48 +02:00
|
|
|
And I open data/hello2.txt in a new background tab
|
|
|
|
And I run :tab-focus 2
|
2018-02-13 00:11:32 +01:00
|
|
|
And I run :enter-mode passthrough
|
|
|
|
And I run :tab-focus 1
|
|
|
|
Then "Entering mode KeyMode.insert (reason: command)" should be logged
|
2018-03-14 04:31:48 +01:00
|
|
|
And "Mode before tab change: insert (mode_on_change = restore)" should be logged
|
|
|
|
And "Mode after tab change: normal (mode_on_change = restore)" should be logged
|
2018-02-13 00:11:32 +01:00
|
|
|
And "Entering mode KeyMode.passthrough (reason: command)" should be logged
|
2018-03-14 04:31:48 +01:00
|
|
|
And "Mode before tab change: passthrough (mode_on_change = restore)" should be logged
|
2018-02-13 22:23:56 +01:00
|
|
|
And "Entering mode KeyMode.insert (reason: restore)" should be logged
|
2018-03-14 04:31:48 +01:00
|
|
|
And "Mode after tab change: insert (mode_on_change = restore)" should be logged
|