tests: Fix more issues with new config

This commit is contained in:
Florian Bruhin 2017-06-16 18:16:19 +02:00
parent 089e1ee91b
commit bd9b45bb96
18 changed files with 93 additions and 113 deletions

View File

@ -90,7 +90,7 @@ Feature: Using completion
Scenario: Updating the value completion in realtime
Given I set colors.statusbar.normal.bg to green
When I run :set-cmd-text -s :set colors statusbar.bg
When I run :set-cmd-text -s :set colors.statusbar.normal.bg
And I set colors.statusbar.normal.bg to yellow
And I run :completion-item-focus next
And I run :completion-item-focus next

View File

@ -631,7 +631,7 @@ def check_not_scrolled(request, quteproc):
assert y == 0
@bdd.then(bdd.parsers.parse("{section} should be {value}"))
@bdd.then(bdd.parsers.parse("{option} should be set to {value}"))
def check_option(quteproc, option, value):
actual_value = quteproc.get_setting(option)
assert actual_value == value

View File

@ -609,7 +609,7 @@ Feature: Downloading things from a website.
Scenario: Downloading via pdfjs
Given pdfjs is available
When I set downloads.location.prompt to false
And I set content.enable_pdfjs to true
And I set content.pdfjs to true
And I open data/misc/test.pdf
And I wait for the javascript message "PDF * [*] (PDF.js: *)"
And I run :click-element id download

View File

@ -96,7 +96,7 @@ Feature: Invoking a new process
Scenario: Opening a new qutebrowser instance with no parameters
When I set new_instance_open_target to tab
And I set start_page to http://localhost:(port)/data/hello.txt
And I set start_page to ["http://localhost:(port)/data/hello.txt"]
And I open data/title.html
And I spawn a new window
And I wait until data/hello.txt is loaded

View File

@ -57,14 +57,14 @@ Feature: Javascript stuff
Scenario: Opening window without user interaction with javascript-can-open-windows-automatically set to true
When I open data/hello.txt
And I set content.javascript_can_open_windows_automatically to true
And I set content.javascript.can_open_windows_automatically to true
And I run :tab-only
And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); }
Then the javascript message "window opened" should be logged
Scenario: Opening window without user interaction with javascript-can-open-windows-automatically set to false
When I open data/hello.txt
And I set content.javascript_can_open_windows_automatically to false
And I set content.javascript.can_open_windows_automatically to false
And I run :tab-only
And I run :jseval if (window.open('about:blank')) { console.log('window opened'); } else { console.log('error while opening window'); }
Then the javascript message "error while opening window" should be logged
@ -72,7 +72,7 @@ Feature: Javascript stuff
Scenario: Executing jseval when javascript is disabled
When I set content.javascript.enabled to false
And I run :jseval console.log('jseval executed')
And I set content -> allow-javascript to true
And I set content.javascript.enabled to true
Then the javascript message "jseval executed" should be logged
## webelement issues (mostly with QtWebEngine)
@ -111,7 +111,7 @@ Feature: Javascript stuff
Scenario: Checking visible/invisible window size
When I run :tab-only
And I set general -> log-javascript-console to info
And I set content.javascript.log to info
And I open data/javascript/windowsize.html in a new background tab
And I wait for "[*/data/javascript/windowsize.html:*] loaded" in the log
And I run :tab-next
@ -119,8 +119,8 @@ Feature: Javascript stuff
Scenario: Checking visible/invisible window size with vertical tabbar
When I run :tab-only
And I set general -> log-javascript-console to info
And I set tabs -> position to left
And I set content.javascript.log to info
And I set tabs.position to left
And I open data/javascript/windowsize.html in a new background tab
And I wait for "[*/data/javascript/windowsize.html:*] loaded" in the log
And I run :tab-next

View File

@ -331,12 +331,12 @@ Feature: Various utility commands.
# :home
Scenario: :home with single page
When I set start_page to http://localhost:(port)/data/hello2.txt
When I set start_page to ["http://localhost:(port)/data/hello2.txt"]
And I run :home
Then data/hello2.txt should be loaded
Scenario: :home with multiple pages
When I set start_page to http://localhost:(port)/data/numbers/1.txt,http://localhost:(port)/data/numbers/2.txt
When I set start_page to ["http://localhost:(port)/data/numbers/1.txt", "http://localhost:(port)/data/numbers/2.txt"]
And I run :home
Then data/numbers/1.txt should be loaded
@ -345,13 +345,13 @@ Feature: Various utility commands.
@qtwebengine_skip: pdfjs is not implemented yet
Scenario: pdfjs is used for pdf files
Given pdfjs is available
When I set content.enable_pdfjs to true
When I set content.pdfjs to true
And I open data/misc/test.pdf
Then the javascript message "PDF * [*] (PDF.js: *)" should be logged
@qtwebengine_todo: pdfjs is not implemented yet
Scenario: pdfjs is not used when disabled
When I set content.enable_pdfjs to false
When I set content.pdfjs to false
And I set downloads.location.prompt to false
And I open data/misc/test.pdf
Then "Download test.pdf finished" should be logged
@ -363,7 +363,7 @@ Feature: Various utility commands.
# Might be related to https://bugreports.qt.io/browse/QTBUG-13524 and
# a weird interaction with the previous test.
And I have a fresh instance
When I set content.enable_pdfjs to true
When I set content.pdfjs to true
And I set downloads.location.suggestion to filename
And I set downloads.location.prompt to true
And I open data/misc/test.pdf

View File

@ -98,7 +98,7 @@ Feature: Using :navigate
Then data/numbers/3.txt should be loaded
Scenario: Setting url-incdec-segments
When I set url_incdec_segments to anchor
When I set url_incdec_segments to [anchor]
And I open data/numbers/1.txt
And I run :navigate increment
Then the error "No number found in URL!" should be shown

View File

@ -79,8 +79,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (explicit)
Given I open about:blank
When I set tabs.new_tab_position_explicit to next
And I set tabs.new_tab_position to prev
When I set tabs.new_position_explicit to next
And I set tabs.new_position to prev
And I run :tab-only
And I run :open -t http://localhost:(port)/data/numbers/7.txt
And I wait until data/numbers/7.txt is loaded
@ -90,8 +90,8 @@ Feature: Opening pages
Scenario: Opening in a new tab (implicit)
Given I open about:blank
When I set tabs.new_tab_position_explicit to next
And I set tabs.new_tab_position to prev
When I set tabs.new_position_explicit to next
And I set tabs.new_position to prev
And I run :tab-only
And I run :open -t -i http://localhost:(port)/data/numbers/8.txt
And I wait until data/numbers/8.txt is loaded

View File

@ -72,7 +72,7 @@ Feature: Prompts
@qtwebengine_skip: QtWebEngine refuses to load anything with a JS question
Scenario: Blocking question interrupted by blocking one
When I set content.ignore_javascript_alert to false
When I set content.javascript.alert to true
And I open data/prompt/jsalert.html
And I run :click-element id button
And I wait for a prompt
@ -88,7 +88,7 @@ Feature: Prompts
@qtwebengine_skip: QtWebEngine refuses to load anything with a JS question
Scenario: Blocking question interrupted by async one
When I set content.ignore_javascript_alert to false
When I set content.javascript.alert to true
And I set content.notifications to ask
And I open data/prompt/jsalert.html
And I run :click-element id button
@ -121,7 +121,7 @@ Feature: Prompts
@qtwebengine_todo: Notifications are not implemented in QtWebEngine
Scenario: Async question interrupted by blocking one
When I set content.notifications to ask
And I set content.ignore_javascript_alert to false
And I set content.javascript.alert to true
And I open data/prompt/notifications.html in a new tab
And I run :click-element id button
And I wait for a prompt
@ -369,7 +369,7 @@ Feature: Prompts
# :prompt-accept with value argument
Scenario: Javascript alert with value
When I set content.ignore_javascript_alert to false
When I set content.javascript.alert to true
And I open data/prompt/jsalert.html
And I run :click-element id button
And I wait for a prompt
@ -380,7 +380,7 @@ Feature: Prompts
@js_prompt
Scenario: Javascript prompt with value
When I set content.ignore_javascript_prompt to false
When I set content.javascript.prompt to true
And I open data/prompt/jsprompt.html
And I run :click-element id button
And I wait for a prompt

View File

@ -323,7 +323,7 @@ Feature: Scrolling
Then data/hello2.txt should be loaded
Scenario: Scrolling to anchor in background tab
When I set general -> log-javascript-console to info
When I set content.javascript.log to info
And I open about:blank
And I run :tab-only
And I open data/scroll/simple.html#anchor in a new background tab

View File

@ -22,7 +22,7 @@ Feature: Searching on a page
Then "Bar" should be found
Scenario: Searching with --reverse
When I set ignore_case to true
When I set ignore_case to always
And I run :search -r foo
And I wait for "search found foo with flags FindBackward" in the log
Then "Foo" should be found
@ -54,14 +54,14 @@ Feature: Searching on a page
## ignore-case
Scenario: Searching text with ignore-case = true
When I set ignore_case to true
Scenario: Searching text with ignore-case = always
When I set ignore_case to always
And I run :search bar
And I wait for "search found bar" in the log
Then "Bar" should be found
Scenario: Searching text with ignore-case = false
When I set ignore_case to false
Scenario: Searching text with ignore-case = never
When I set ignore_case to never
And I run :search bar
And I wait for "search found bar with flags FindCaseSensitively" in the log
Then "bar" should be found
@ -81,7 +81,7 @@ Feature: Searching on a page
## :search-next
Scenario: Jumping to next match
When I set ignore_case to true
When I set ignore_case to always
And I run :search foo
And I wait for "search found foo" in the log
And I run :search-next
@ -89,7 +89,7 @@ Feature: Searching on a page
Then "Foo" should be found
Scenario: Jumping to next match with count
When I set ignore_case to true
When I set ignore_case to always
And I run :search baz
And I wait for "search found baz" in the log
And I run :search-next with count 2
@ -97,7 +97,7 @@ Feature: Searching on a page
Then "BAZ" should be found
Scenario: Jumping to next match with --reverse
When I set ignore_case to true
When I set ignore_case to always
And I run :search --reverse foo
And I wait for "search found foo with flags FindBackward" in the log
And I run :search-next
@ -121,7 +121,7 @@ Feature: Searching on a page
# https://github.com/qutebrowser/qutebrowser/issues/2438
Scenario: Jumping to next match after clearing
When I set ignore_case to true
When I set ignore_case to always
And I run :search foo
And I wait for "search found foo" in the log
And I run :search
@ -132,7 +132,7 @@ Feature: Searching on a page
## :search-prev
Scenario: Jumping to previous match
When I set ignore_case to true
When I set ignore_case to always
And I run :search foo
And I wait for "search found foo" in the log
And I run :search-next
@ -142,7 +142,7 @@ Feature: Searching on a page
Then "foo" should be found
Scenario: Jumping to previous match with count
When I set ignore_case to true
When I set ignore_case to always
And I run :search baz
And I wait for "search found baz" in the log
And I run :search-next
@ -154,7 +154,7 @@ Feature: Searching on a page
Then "baz" should be found
Scenario: Jumping to previous match with --reverse
When I set ignore_case to true
When I set ignore_case to always
And I run :search --reverse foo
And I wait for "search found foo with flags FindBackward" in the log
And I run :search-next

View File

@ -7,7 +7,7 @@ Feature: Setting settings.
Scenario: Using :set
When I run :set colors.statusbar.normal.bg magenta
Then colors.statusbar.normal.bg should be magenta
Then colors.statusbar.normal.bg should be set to magenta
Scenario: Without value
When I run :set colors.statusbar.normal.bg
@ -15,60 +15,60 @@ Feature: Setting settings.
Scenario: Invalid option
When I run :set blub foo
Then the error "set: No option 'blub' in section 'general'" should be shown
Then the error "set: No option 'blub'" should be shown
Scenario: Toggling an option
When I run :set auto_save.config false
And I run :set auto_save.config!
Then auto_save_config should be true
Then auto_save.config should be set to true
Scenario: Toggling a non-bool option
When I run :set colors statusbar.bg!
When I run :set colors.statusbar.normal.bg!
Then the error "set: Attempted inversion of non-boolean value." should be shown
Scenario: Cycling an option
When I run :set colors statusbar.bg magenta
And I run :set colors statusbar.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be blue
When I run :set colors.statusbar.normal.bg magenta
And I run :set colors.statusbar.normal.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be set to blue
Scenario: Cycling an option through the end of the list
When I run :set colors statusbar.bg yellow
And I run :set colors statusbar.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be green
When I run :set colors.statusbar.normal.bg yellow
And I run :set colors.statusbar.normal.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be set to green
Scenario: Cycling an option that's not on the list
When I run :set colors statusbar.bg red
And I run :set colors statusbar.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be green
When I run :set colors.statusbar.normal.bg red
And I run :set colors.statusbar.normal.bg green magenta blue yellow
Then colors.statusbar.normal.bg should be set to green
Scenario: Cycling through a single option
When I run :set colors statusbar.bg red
And I run :set colors statusbar.bg red
Then colors.statusbar.normal.bg should be red
When I run :set colors.statusbar.normal.bg red
And I run :set colors.statusbar.normal.bg red
Then colors.statusbar.normal.bg should be set to red
Scenario: Getting an option
When I run :set colors statusbar.bg magenta
And I run :set colors statusbar.bg?
Then the message "colors statusbar.bg = magenta" should be shown
When I run :set colors.statusbar.normal.bg magenta
And I run :set colors.statusbar.normal.bg?
Then the message "colors.statusbar.normal.bg = magenta" should be shown
Scenario: Using -p
When I run :set -p colors statusbar.bg red
Then the message "colors statusbar.bg = red" should be shown
When I run :set -p colors.statusbar.normal.bg red
Then the message "colors.statusbar.normal.bg = red" should be shown
Scenario: Using ! and -p
When I run :set general auto_save_config false
And I run :set -p auto_save_config!
Then the message "auto_save_config = true" should be shown
When I run :set auto_save.config false
And I run :set -p auto_save.config!
Then the message "auto_save.config = true" should be shown
Scenario: Setting an invalid value
When I run :set general auto_save_config blah
When I run :set auto_save.config blah
Then the error "set: Invalid value 'blah' - must be a boolean!" should be shown
Scenario: Setting a temporary option
# We don't actually check if the option is temporary as this isn't easy
# to check.
When I run :set -t colors statusbar.bg green
Then colors.statusbar.normal.bg should be green
When I run :set -t colors.statusbar.normal.bg green
Then colors.statusbar.normal.bg should be set to green
# qute://settings isn't actually implemented on QtWebEngine, but this works
# (and displays a page saying it's not available)
@ -79,18 +79,18 @@ Feature: Setting settings.
- qute://settings (active)
Scenario: Focusing input fields in qute://settings and entering valid value
When I set ignore_case to false
When I set ignore_case to never
And I open qute://settings
# scroll to the right - the table does not fit in the default screen
And I run :scroll-perc -x 100
And I hint with args "inputs" and follow a
And I wait for "Entering mode KeyMode.insert *" in the log
And I press the key "<Ctrl+Backspace>"
And I press the keys "true"
And I press the keys "always"
And I press the key "<Escape>"
# an explicit Tab to unfocus the input field seems to stabilize the tests
And I press the key "<Tab>"
Then ignore-case should be true
Then ignore_case should be set to always
Scenario: Focusing input fields in qute://settings and entering invalid value
When I open qute://settings
@ -106,33 +106,13 @@ Feature: Setting settings.
Then "Invalid value 'foo' *" should be logged
Scenario: Empty option with ? (issue 1109)
When I run :set general ?
Then the error "set: The following arguments are required: value" should be shown
Scenario: Invalid section and empty option with ? (issue 1109)
When I run :set blah ?
When I run :set ?
Then the error "set: The following arguments are required: value" should be shown
Scenario: Invalid option with ? (issue 1109)
When I run :set general foo?
Then the error "set: No option 'foo' in section 'general'" should be shown
Scenario: Invalid section/option with ? (issue 1109)
When I run :set blah foo ?
Then the error "set: Section 'blah' does not exist!" should be shown
Scenario: Empty option with !
When I run :set general !
Then the error "set: The following arguments are required: value" should be shown
Scenario: Invalid section and empty option with !
When I run :set blah !
Then the error "set: The following arguments are required: value" should be shown
When I run :set foo?
Then the error "set: No option 'foo'" should be shown
Scenario: Invalid option with !
When I run :set general foo!
Then the error "set: No option 'foo' in section 'general'" should be shown
Scenario: Invalid section/option with !
When I run :set blah foo !
Then the error "set: Section 'blah' does not exist!" should be shown
When I run :set foo!
Then the error "set: No option 'foo'" should be shown

View File

@ -715,7 +715,7 @@ Feature: Tab management
When I open data/hello.txt
And I run :tab-only
And I set tabs.last_close to startpage
And I set start_page to http://localhost:(port)/data/numbers/4.txt,http://localhost:(port)/data/numbers/5.txt
And I set start_page to ["http://localhost:(port)/data/numbers/4.txt", "http://localhost:(port)/data/numbers/5.txt"]
And I run :tab-close
And I wait until data/numbers/4.txt is loaded
And I run :undo
@ -807,7 +807,7 @@ Feature: Tab management
- about:blank (active)
Scenario: last-close = startpage
When I set start_page to http://localhost:(port)/data/numbers/7.txt,http://localhost:(port)/data/numbers/8.txt
When I set start_page to ["http://localhost:(port)/data/numbers/7.txt", "http://localhost:(port)/data/numbers/8.txt"]
And I set tabs.last_close to startpage
And I open data/hello.txt
And I run :tab-only
@ -836,7 +836,7 @@ Feature: Tab management
# tab settings
Scenario: opening links with tabs.background true
When I set tabs.background_tabs to true
When I set tabs.background to true
And I open data/hints/html/simple.html
And I hint with args "all tab" and follow a
And I wait until data/hello.txt is loaded
@ -844,9 +844,9 @@ Feature: Tab management
- data/hints/html/simple.html (active)
- data/hello.txt
Scenario: opening tab with tabs.new_tab_position prev
When I set tabs.new_tab_position to prev
And I set tabs.background_tabs to false
Scenario: opening tab with tabs.new_position prev
When I set tabs.new_position to prev
And I set tabs.background to false
And I open about:blank
And I open data/hints/html/simple.html in a new tab
And I run :click-element id link --target=tab
@ -856,9 +856,9 @@ Feature: Tab management
- data/hello.txt (active)
- data/hints/html/simple.html
Scenario: opening tab with tabs.new_tab_position next
When I set tabs.new_tab_position to next
And I set tabs.background_tabs to false
Scenario: opening tab with tabs.new_position next
When I set tabs.new_position to next
And I set tabs.background to false
And I open about:blank
And I open data/hints/html/simple.html in a new tab
And I run :click-element id link --target=tab
@ -868,9 +868,9 @@ Feature: Tab management
- data/hints/html/simple.html
- data/hello.txt (active)
Scenario: opening tab with tabs.new_tab_position first
When I set tabs.new_tab_position to first
And I set tabs.background_tabs to false
Scenario: opening tab with tabs.new_position first
When I set tabs.new_position to first
And I set tabs.background to false
And I open about:blank
And I open data/hints/html/simple.html in a new tab
And I run :click-element id link --target=tab
@ -880,9 +880,9 @@ Feature: Tab management
- about:blank
- data/hints/html/simple.html
Scenario: opening tab with tabs.new_tab_position last
When I set tabs.new_tab_position to last
And I set tabs.background_tabs to false
Scenario: opening tab with tabs.new_position last
When I set tabs.new_position to last
And I set tabs.background to false
And I open data/hints/html/simple.html
And I open about:blank in a new tab
And I run :tab-focus last

View File

@ -116,7 +116,7 @@ def download_prompt(tmpdir, quteproc, path):
def default_open_dispatcher_python(quteproc, tmpdir):
cmd = '{} -c "import sys; print(sys.argv[1])"'.format(
shlex.quote(sys.executable))
quteproc.set_setting('general', 'default-open-dispatcher', cmd)
quteproc.set_setting('downloads.open_dispatcher', cmd)
@bdd.when("I open the download")

View File

@ -23,5 +23,5 @@ import pytest_bdd as bdd
bdd.scenarios('keyinput.feature')
## FIXME:conf
pytestmark = pytest.mark.skipif(True)
pytestmark = pytest.mark.skipif(True, reason="FIXME:conf")

View File

@ -33,7 +33,7 @@ def init_fake_clipboard(quteproc):
quteproc.send_cmd(':debug-set-fake-clipboard')
@bdd.when(bdd.parsers.parse('I set the text field to "{value}"'))
@bdd.when(bdd.parsers.parse('I insert "{value}" into the text field'))
def set_text_field(request, quteproc, value):
if request.config.webengine and PYQT_VERSION >= 0x50700:
cmd = ":jseval --world=0 set_text('{}')".format(value)

View File

@ -282,7 +282,7 @@ Feature: Yanking and pasting.
Scenario: Inserting text into a text field at specific position
When I set content.javascript.log to info
And I open data/paste_primary.html
And I set the text field to "one two three four"
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

View File

@ -4,7 +4,7 @@ Feature: Zooming in and out
Background:
Given I open data/hello.txt
And I set zoom.levels to 50%,90%,100%,110%,120%
And I set zoom.levels to [50%, 90%, 100%, 110%, 120%]
And I run :tab-only
Scenario: Zooming in