2015-11-09 07:49:11 +01:00
Feature : Downloading things from a website.
Background :
2016-03-14 19:06:16 +01:00
Given I s e t u p a t e m p o r a r y d o w n l o a d d i r
And I c l e a n o l d d o w n l o a d s
2015-11-09 07:49:11 +01:00
Scenario : Downloading which redirects with closed tab (issue 889)
When I s e t t a b s - > l a s t - c l o s e t o b l a n k
And I o p e n d a t a / d o w n l o a d s / i s s u e 889. h t m l
2016-08-18 17:21:50 +02:00
And I h i n t w i t h a r g s " l i n k s d o w n l o a d " a n d f o l l o w a
2015-11-09 07:49:11 +01:00
And I r u n : t a b - c l o s e
And I w a i t f o r " * H a n d l i n g r e d i r e c t " i n t h e l o g
Then n o c r a s h s h o u l d h a p p e n
Scenario : Downloading with error in closed tab (issue 889)
When I s e t t a b s - > l a s t - c l o s e t o b l a n k
And I o p e n d a t a / d o w n l o a d s / i s s u e 889. h t m l
2016-08-18 17:21:50 +02:00
And I h i n t w i t h a r g s " l i n k s d o w n l o a d " a n d f o l l o w s
2015-11-09 07:49:11 +01:00
And I r u n : t a b - c l o s e
And I w a i t f o r t h e e r r o r " D o w n l o a d e r r o r : * - s e r v e r r e p l i e d : N O T F O U N D "
And I r u n : d o w n l o a d - r e t r y
And I w a i t f o r t h e e r r o r " D o w n l o a d e r r o r : * - s e r v e r r e p l i e d : N O T F O U N D "
Then n o c r a s h s h o u l d h a p p e n
2016-01-26 22:37:46 +01:00
Scenario : Downloading a link without path information (issue 1243)
When I s e t c o m p l e t i o n - > d o w n l o a d - p a t h - s u g g e s t i o n t o f i l e n a m e
And I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I o p e n d a t a / d o w n l o a d s / i s s u e 1243. h t m l
2016-08-18 17:21:50 +02:00
And I h i n t w i t h a r g s " l i n k s d o w n l o a d " a n d f o l l o w a
2016-07-06 23:16:38 +02:00
And I w a i t f o r " A s k i n g q u e s t i o n <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> t e x t = ' S a v e f i l e t o : ' > , * " i n t h e l o g
tests: fix tests for downloads bdd test
The test was failing because of two reasons:
First, the old code had filename questions in DownloadManager.get and
DownloadManager.fetch which were almost identical, thus the part in
DownloadManager.get was removed in an earlier commit. All filename
asking is now done by DownloadManager.fetch. The good part is code
deduplication, the bad part is slightly modified behavior: The new code
doesn't wait for a filename to start the download, instead it tries to
fill the buffer immediately. This made the test fail because qute:// has
no registered handler, so in order for the test to pass now, the "no
crash" part is not enough, we also need to expect the "No handler"
error.
Secondly, and a rather rare (race) condition was the handling of errors
in the DownloadItem. If an error occured after the registration of
self.on_reply_error as error handler and before the check
reply.error() != QNetworkReply.NoError
at the end of the function, the error signal would be emitted twice:
Once by _die() (called by on_reply_error), and once by the init_reply
function directly (in the last if block). This lead to duplicated error
messages. This is also explained in a comment in the file (with small
"stack traces").
2016-07-07 00:08:13 +02:00
Then t h e e r r o r " D o w n l o a d e r r o r : N o h a n d l e r f o u n d f o r q u t e : / / ! " s h o u l d b e s h o w n
2016-02-18 16:17:35 +01:00
Scenario : Downloading a data: link (issue 1214)
When I s e t c o m p l e t i o n - > d o w n l o a d - p a t h - s u g g e s t i o n t o f i l e n a m e
And I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I o p e n d a t a / d o w n l o a d s / i s s u e 1214. h t m l
2016-08-18 17:21:50 +02:00
And I h i n t w i t h a r g s " l i n k s d o w n l o a d " a n d f o l l o w a
2016-07-06 23:16:38 +02:00
And I w a i t f o r " A s k i n g q u e s t i o n <qutebrowser.utils.usertypes.Question default='binary blob' mode=<PromptMode.download: 5> t e x t = ' S a v e f i l e t o : ' > , * " i n t h e l o g
2016-02-18 16:17:35 +01:00
And I r u n : l e a v e - m o d e
Then n o c r a s h s h o u l d h a p p e n
2015-11-09 07:49:11 +01:00
2016-05-05 00:04:58 +02:00
Scenario : Downloading with SSL errors (issue 1413)
When I r u n : d e b u g - c l e a r - s s l - e r r o r s
And I s e t n e t w o r k - > s s l - s t r i c t t o a s k
2016-07-05 08:34:03 +02:00
And I d o w n l o a d a n S S L p a g e
2016-05-05 00:04:58 +02:00
And I w a i t f o r " E n t e r i n g m o d e K e y M o d e . * ( r e a s o n : q u e s t i o n a s k e d ) " i n t h e l o g
And I r u n : p r o m p t - a c c e p t
Then t h e e r r o r " D o w n l o a d e r r o r : S S L h a n d s h a k e f a i l e d " s h o u l d b e s h o w n
2015-11-09 07:49:11 +01:00
Scenario : Retrying a failed download
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d o e s - n o t - e x i s t
And I w a i t f o r t h e e r r o r " D o w n l o a d e r r o r : * - s e r v e r r e p l i e d : N O T F O U N D "
And I r u n : d o w n l o a d - r e t r y
And I w a i t f o r t h e e r r o r " D o w n l o a d e r r o r : * - s e r v e r r e p l i e d : N O T F O U N D "
Then t h e r e q u e s t s s h o u l d b e :
d o e s - n o t - e x i s t
d o e s - n o t - e x i s t
Scenario : Retrying with no failed downloads
When I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : d o w n l o a d - r e t r y
2015-11-26 17:50:39 +01:00
Then t h e e r r o r " N o f a i l e d d o w n l o a d s ! " s h o u l d b e s h o w n
2015-11-09 07:49:11 +01:00
Scenario : Retrying with no downloads
When I r u n : d o w n l o a d - r e t r y
2015-11-26 17:50:39 +01:00
Then t h e e r r o r " N o f a i l e d d o w n l o a d s ! " s h o u l d b e s h o w n
2015-11-20 18:31:39 +01:00
Scenario : :download with deprecated dest-old argument
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d e p r e c a t e d - a r g u m e n t
2015-11-26 17:50:39 +01:00
Then t h e w a r n i n g " : d o w n l o a d [ u r l ] [ d e s t ] i s d e p r e c a t e d - u s e d o w n l o a d - - d e s t [ d e s t ] [ u r l ] " s h o u l d b e s h o w n
2015-11-20 18:31:39 +01:00
Scenario : Two destinations given
When I r u n : d o w n l o a d - - d e s t d e s t i n a t i o n 2 h t t p : / / l o c a l h o s t : ( p o r t ) / d e s t i n a t i o n 1
2015-11-26 17:50:39 +01:00
Then t h e w a r n i n g " : d o w n l o a d [ u r l ] [ d e s t ] i s d e p r e c a t e d - u s e d o w n l o a d - - d e s t [ d e s t ] [ u r l ] " s h o u l d b e s h o w n
And t h e e r r o r " C a n ' t g i v e t w o d e s t i n a t i o n s f o r t h e d o w n l o a d . " s h o u l d b e s h o w n
2015-11-20 18:31:39 +01:00
2016-07-05 08:34:03 +02:00
Scenario : :download --mhtml with a URL given
2015-11-20 18:31:39 +01:00
When I r u n : d o w n l o a d - - m h t m l h t t p : / / f o o b a r /
2015-11-26 17:50:39 +01:00
Then t h e e r r o r " C a n o n l y d o w n l o a d t h e c u r r e n t p a g e a s m h t m l . " s h o u l d b e s h o w n
2015-11-20 18:31:39 +01:00
Scenario : Downloading as mhtml is available
When I o p e n h t m l
And I r u n : d o w n l o a d - - m h t m l
2015-11-21 12:45:57 +01:00
And I w a i t f o r " F i l e s u c c e s s f u l l y w r i t t e n . " i n t h e l o g
2015-11-20 18:31:39 +01:00
Then n o c r a s h s h o u l d h a p p e n
Scenario : Downloading as mhtml with non-ASCII headers
When I o p e n r e s p o n s e - h e a d e r s ? C o n t e n t - T y p e = t e x t % 2 F p l % C 3 % A 4 i n
2015-11-21 12:37:26 +01:00
And I r u n : d o w n l o a d - - m h t m l - - d e s t m h t m l - r e s p o n s e - h e a d e r s . m h t
2015-11-21 12:45:57 +01:00
And I w a i t f o r " F i l e s u c c e s s f u l l y w r i t t e n . " i n t h e l o g
2015-11-20 18:31:39 +01:00
Then n o c r a s h s h o u l d h a p p e n
2016-03-14 19:06:42 +01:00
## :download-cancel
Scenario : Cancelling a download
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - c a n c e l
Then " c a n c e l l e d " s h o u l d b e l o g g e d
Scenario : Cancelling a download which does not exist
When I r u n : d o w n l o a d - c a n c e l w i t h c o u n t 42
Then t h e e r r o r " T h e r e ' s n o d o w n l o a d 4 2 ! " s h o u l d b e s h o w n
Scenario : Cancelling a download which is already done
When I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : d o w n l o a d - c a n c e l
Then t h e e r r o r " D o w n l o a d 1 i s a l r e a d y d o n e ! " s h o u l d b e s h o w n
Scenario : Cancelling a download which is already done (with count)
When I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : d o w n l o a d - c a n c e l w i t h c o u n t 1
Then t h e e r r o r " D o w n l o a d 1 i s a l r e a d y d o n e ! " s h o u l d b e s h o w n
Scenario : Cancelling all downloads
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - c a n c e l - - a l l
Then " c a n c e l l e d " s h o u l d b e l o g g e d
And " c a n c e l l e d " s h o u l d b e l o g g e d
2016-06-02 23:07:03 +02:00
# https://github.com/The-Compiler/qutebrowser/issues/1535
2016-07-05 08:34:03 +02:00
Scenario : Cancelling an MHTML download (issue 1535)
2016-06-02 23:07:03 +02:00
When I o p e n d a t a / d o w n l o a d s / i s s u e 1535. h t m l
And I r u n : d o w n l o a d - - m h t m l
2016-06-04 13:15:22 +02:00
And I w a i t f o r " f e t c h : P y Q t 5 . Q t C o r e . Q U r l ( ' h t t p : / / l o c a l h o s t : * / d r i p ? n u m b y t e s = 1 2 8 & d u r a t i o n = 2 ' ) - > d r i p " i n t h e l o g
2016-06-02 23:07:03 +02:00
And I r u n : d o w n l o a d - c a n c e l
Then n o c r a s h s h o u l d h a p p e n
2016-03-14 19:06:42 +01:00
## :download-delete
Scenario : Deleting a download
When I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : d o w n l o a d - d e l e t e
2016-04-26 22:56:06 +02:00
And I w a i t f o r " d e l e t e d d o w n l o a d * " i n t h e l o g
2016-03-14 19:06:42 +01:00
Then t h e d o w n l o a d e d f i l e d o w n l o a d . b i n s h o u l d n o t e x i s t
Scenario : Deleting a download which does not exist
When I r u n : d o w n l o a d - d e l e t e w i t h c o u n t 42
Then t h e e r r o r " T h e r e ' s n o d o w n l o a d 4 2 ! " s h o u l d b e s h o w n
Scenario : Deleting a download which is not done yet
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - d e l e t e
Then t h e e r r o r " D o w n l o a d 1 i s n o t d o n e ! " s h o u l d b e s h o w n
Scenario : Deleting a download which is not done yet (with count)
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - d e l e t e w i t h c o u n t 1
Then t h e e r r o r " D o w n l o a d 1 i s n o t d o n e ! " s h o u l d b e s h o w n
## :download-open
2016-08-03 17:55:52 +02:00
Scenario : Opening a download
When I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I o p e n t h e d o w n l o a d
Then " O p e n i n g * d o w n l o a d . b i n * w i t h [ * p y t h o n * ] " s h o u l d b e l o g g e d
2016-03-14 19:06:42 +01:00
Scenario : Opening a download which does not exist
When I r u n : d o w n l o a d - o p e n w i t h c o u n t 42
Then t h e e r r o r " T h e r e ' s n o d o w n l o a d 4 2 ! " s h o u l d b e s h o w n
Scenario : Opening a download which is not done yet
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - o p e n
Then t h e e r r o r " D o w n l o a d 1 i s n o t d o n e ! " s h o u l d b e s h o w n
Scenario : Opening a download which is not done yet (with count)
When I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I r u n : d o w n l o a d - o p e n w i t h c o u n t 1
Then t h e e r r o r " D o w n l o a d 1 i s n o t d o n e ! " s h o u l d b e s h o w n
2016-05-05 00:04:58 +02:00
2016-08-03 17:55:52 +02:00
## opening a file directly (prompt-open-download)
Scenario : Opening a download directly
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I d i r e c t l y o p e n t h e d o w n l o a d
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
Then " O p e n i n g * d o w n l o a d . b i n * w i t h [ * p y t h o n * ] " s h o u l d b e l o g g e d
## https://github.com/The-Compiler/qutebrowser/issues/1728
Scenario : Cancelling a download that should be opened
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I r u n : d o w n l o a d h t t p : / / l o c a l h o s t : ( p o r t ) / d r i p ? n u m b y t e s = 128 & d u r a t i o n = 5
And I d i r e c t l y o p e n t h e d o w n l o a d
And I r u n : d o w n l o a d - c a n c e l
Then " * f i n i s h e d b u t n o t s u c c e s s f u l , n o t o p e n i n g ! " s h o u l d b e l o g g e d
2016-08-04 01:06:42 +02:00
## https://github.com/The-Compiler/qutebrowser/issues/1725
Scenario : Directly open a download with a very long filename
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I o p e n d a t a / d o w n l o a d s / i s s u e 1725. h t m l
2016-08-18 16:13:38 +02:00
And I r u n : c l i c k - e l e m e n t i d l o n g - l i n k
2016-08-04 11:16:43 +02:00
And I w a i t f o r " A s k i n g q u e s t i o n <qutebrowser.utils.usertypes.Question default=* mode=<PromptMode.download: 5> t e x t = ' S a v e f i l e t o : ' > , * " i n t h e l o g
2016-08-04 01:06:42 +02:00
And I d i r e c t l y o p e n t h e d o w n l o a d
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
Then " O p e n i n g * w i t h [ * p y t h o n * ] " s h o u l d b e l o g g e d
2016-04-05 11:42:42 +02:00
## completion -> download-path-suggestion
Scenario : completion -> download-path-suggestion = path
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I s e t c o m p l e t i o n - > d o w n l o a d - p a t h - s u g g e s t i o n t o p a t h
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
Then t h e d o w n l o a d p r o m p t s h o u l d b e s h o w n w i t h " { d o w n l o a d d i r } / "
Scenario : completion -> download-path-suggestion = filename
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I s e t c o m p l e t i o n - > d o w n l o a d - p a t h - s u g g e s t i o n t o f i l e n a m e
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
Then t h e d o w n l o a d p r o m p t s h o u l d b e s h o w n w i t h " d o w n l o a d . b i n "
Scenario : completion -> download-path-suggestion = both
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o t r u e
And I s e t c o m p l e t i o n - > d o w n l o a d - p a t h - s u g g e s t i o n t o b o t h
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
Then t h e d o w n l o a d p r o m p t s h o u l d b e s h o w n w i t h " { d o w n l o a d d i r } / d o w n l o a d . b i n "
2016-03-31 19:09:43 +02:00
## https://github.com/The-Compiler/qutebrowser/issues/1242
Scenario : Closing window with remove-finished-downloads timeout
When I s e t u i - > r e m o v e - f i n i s h e d - d o w n l o a d s t o 500
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n i n a n e w w i n d o w
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : c l o s e
And I w a i t 0.5 s
Then n o c r a s h s h o u l d h a p p e n
2016-05-09 07:06:58 +02:00
## https://github.com/The-Compiler/qutebrowser/issues/846
Scenario : Quitting with finished downloads and confirm-quit=downloads
Given I h a v e a f r e s h i n s t a n c e
When I s e t s t o r a g e - > p r o m p t - d o w n l o a d - d i r e c t o r y t o f a l s e
And I s e t u i - > c o n f i r m - q u i t t o d o w n l o a d s
And I o p e n d a t a / d o w n l o a d s / d o w n l o a d . b i n
And I w a i t u n t i l t h e d o w n l o a d i s f i n i s h e d
And I r u n : c l o s e
Then q u t e b r o w s e r s h o u l d q u i t