Skip to content

Commit

Permalink
BDD: Wait until hints are ready after hinting
Browse files Browse the repository at this point in the history
With QtWebEngine, hinting happens async, so we need to wait for
"hints: ..." in the log before we can actually follow a hint.
  • Loading branch information
The-Compiler committed Aug 18, 2016
1 parent d711006 commit 745614e
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 87 deletions.
14 changes: 14 additions & 0 deletions tests/end2end/features/conftest.py
Expand Up @@ -309,6 +309,20 @@ def fill_clipboard_multiline(quteproc, httpbin, what, content):
fill_clipboard(quteproc, httpbin, what, textwrap.dedent(content)) fill_clipboard(quteproc, httpbin, what, textwrap.dedent(content))




@bdd.when(bdd.parsers.parse('I hint with args "{args}"'))
def hint(quteproc, args):
quteproc.send_cmd(':hint {}'.format(args))
quteproc.wait_for(message='hints: *')


@bdd.when(bdd.parsers.parse('I hint with args "{args}" and follow {letter}'))
def hint_and_follow(quteproc, args, letter):
args = args.replace('(testdata)', utils.abs_datapath())
quteproc.send_cmd(':hint {}'.format(args))
quteproc.wait_for(message='hints: *')
quteproc.send_cmd(':follow-hint {}'.format(letter))


## Then ## Then




Expand Down
12 changes: 4 additions & 8 deletions tests/end2end/features/downloads.feature
Expand Up @@ -7,17 +7,15 @@ Feature: Downloading things from a website.
Scenario: Downloading which redirects with closed tab (issue 889) Scenario: Downloading which redirects with closed tab (issue 889)
When I set tabs -> last-close to blank When I set tabs -> last-close to blank
And I open data/downloads/issue889.html And I open data/downloads/issue889.html
And I run :hint links download And I hint with args "links download" and follow a
And I run :follow-hint a
And I run :tab-close And I run :tab-close
And I wait for "* Handling redirect" in the log And I wait for "* Handling redirect" in the log
Then no crash should happen Then no crash should happen


Scenario: Downloading with error in closed tab (issue 889) Scenario: Downloading with error in closed tab (issue 889)
When I set tabs -> last-close to blank When I set tabs -> last-close to blank
And I open data/downloads/issue889.html And I open data/downloads/issue889.html
And I run :hint links download And I hint with args "links download" and follow s
And I run :follow-hint s
And I run :tab-close And I run :tab-close
And I wait for the error "Download error: * - server replied: NOT FOUND" And I wait for the error "Download error: * - server replied: NOT FOUND"
And I run :download-retry And I run :download-retry
Expand All @@ -28,17 +26,15 @@ Feature: Downloading things from a website.
When I set completion -> download-path-suggestion to filename When I set completion -> download-path-suggestion to filename
And I set storage -> prompt-download-directory to true And I set storage -> prompt-download-directory to true
And I open data/downloads/issue1243.html And I open data/downloads/issue1243.html
And I run :hint links download And I hint with args "links download" and follow a
And I run :follow-hint a
And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> text='Save file to:'>, *" in the log And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> text='Save file to:'>, *" in the log
Then the error "Download error: No handler found for qute://!" should be shown Then the error "Download error: No handler found for qute://!" should be shown


Scenario: Downloading a data: link (issue 1214) Scenario: Downloading a data: link (issue 1214)
When I set completion -> download-path-suggestion to filename When I set completion -> download-path-suggestion to filename
And I set storage -> prompt-download-directory to true And I set storage -> prompt-download-directory to true
And I open data/downloads/issue1214.html And I open data/downloads/issue1214.html
And I run :hint links download And I hint with args "links download" and follow a
And I run :follow-hint a
And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='binary blob' mode=<PromptMode.download: 5> text='Save file to:'>, *" in the log And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='binary blob' mode=<PromptMode.download: 5> text='Save file to:'>, *" in the log
And I run :leave-mode And I run :leave-mode
Then no crash should happen Then no crash should happen
Expand Down

0 comments on commit 745614e

Please sign in to comment.