Permalink
Browse files

BDD: Wait until hints are ready after hinting

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 745614e45d1cbb1754af9a8fc37c2d37aeca9d3d
@@ -309,6 +309,20 @@ def fill_clipboard_multiline(quteproc, httpbin, what, 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
@@ -7,17 +7,15 @@ Feature: Downloading things from a website.
Scenario: Downloading which redirects with closed tab (issue 889)
When I set tabs -> last-close to blank
And I open data/downloads/issue889.html
- And I run :hint links download
- And I run :follow-hint a
+ And I hint with args "links download" and follow a
And I run :tab-close
And I wait for "* Handling redirect" in the log
Then no crash should happen
Scenario: Downloading with error in closed tab (issue 889)
When I set tabs -> last-close to blank
And I open data/downloads/issue889.html
- And I run :hint links download
- And I run :follow-hint s
+ And I hint with args "links download" and follow s
And I run :tab-close
And I wait for the error "Download error: * - server replied: NOT FOUND"
And I run :download-retry
@@ -28,17 +26,15 @@ Feature: Downloading things from a website.
When I set completion -> download-path-suggestion to filename
And I set storage -> prompt-download-directory to true
And I open data/downloads/issue1243.html
- And I run :hint links download
- And I run :follow-hint a
+ And I hint with args "links download" and follow 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
Then the error "Download error: No handler found for qute://!" should be shown
Scenario: Downloading a data: link (issue 1214)
When I set completion -> download-path-suggestion to filename
And I set storage -> prompt-download-directory to true
And I open data/downloads/issue1214.html
- And I run :hint links download
- And I run :follow-hint a
+ And I hint with args "links download" and follow 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 run :leave-mode
Then no crash should happen
Oops, something went wrong.

0 comments on commit 745614e

Please sign in to comment.