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
2016-09-10 15:50:18 +02:00
And 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 - 1
2015-11-09 07:49:11 +01:00
2016-09-09 16:17:59 +02:00
## starting downloads
Scenario : Clicking an unknown link
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 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 s . h t m l
And I r u n : c l i c k - e l e m e n t i d 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 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 e x i s t
Scenario : Using :download
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
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 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
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 e x i s t
Scenario : Using hints
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 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 s . h t m l
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
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 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 e x i s t
Scenario : Using rapid hints
# We don't expect any prompts with rapid hinting even if this is true
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 s . h t m l
And I h i n t w i t h a r g s " - - r a p i d l i n k s d o w n l o a d " a n d f o l l o w a
And I r u n : f o l l o w - h i n t s
And I w a i t u n t i l t h e d o w n l o a d d o w n l o a d . b i n i s f i n i s h e d
And I w a i t u n t i l t h e d o w n l o a d d o w n l o a d 2. b i n i s f i n i s h e d
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 e x i s t
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 2. b i n s h o u l d e x i s t
## Regression tests
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
2016-09-09 16:17:59 +02:00
Scenario : Closing window with remove-finished-downloads timeout (issue 1242)
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
Scenario : Quitting with finished downloads and confirm-quit=downloads (issue 846)
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
## :download-retry
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
2016-09-10 15:51:49 +02:00
Scenario : Retrying 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 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 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 w i t h c o u n t 2
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 a t a / d o w n l o a d s / d o w n l o a d . b i n
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 two failed 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 o e s - n o t - e x i s t
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 o e s - n o t - e x i s t - 2
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 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 "
2015-11-09 07:49:11 +01:00
And I r u n : d o w n l o a d - r e t r y
2016-09-10 15:51:49 +02:00
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 - 2
d o e s - n o t - e x i s t
Scenario : Retrying a download which does not exist
When I r u n : d o w n l o a d - r e t r y 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 : Retrying a download which did not fail
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 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 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 d i d n o t f a i l ! " s h o u l d b e s h o w n
2015-11-09 07:49:11 +01:00
2016-09-10 15:51:49 +02:00
Scenario : Retrying a download with no failed ones
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 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-20 18:31:39 +01:00
2016-09-09 16:17:59 +02:00
## Wrong invocations
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
2016-09-09 17:52:20 +02:00
Scenario : :download with a directory which doesn't exist
When I r u n : d o w n l o a d - - d e s t ( t m p d i r ) / s o m e d i r / f i l e n a m e h t t p : / / l o c a l h o s t : ( p o r t ) /
Then t h e e r r o r " D o w n l o a d e r r o r : N o s u c h f i l e o r d i r e c t o r y " s h o u l d b e s h o w n
2016-09-09 16:17:59 +02:00
## mhtml downloads
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
2016-09-10 15:51:49 +02:00
Scenario : Cancelling with no download and no ID
When 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 " T h e r e ' s n o d o w n l o a d ! " s h o u l d b e s h o w n
2016-03-14 19:06:42 +01:00
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-09-10 15:51:49 +02:00
## :download-remove / :download-clear
Scenario : Removing 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 - r e m o v e
Then " R e m o v e d d o w n l o a d * " s h o u l d b e l o g g e d
Scenario : Removing a download which does not exist
When I r u n : d o w n l o a d - r e m o v 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 : Removing 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 - r e m o v 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 : Removing 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 - r e m o v 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
Scenario : Removing all downloads via :download-remove
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 d a t a / d o w n l o a d s / d o w n l o a d 2. 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 m o v e - - a l l
Then " R e m o v e d d o w n l o a d * " s h o u l d b e l o g g e d
Scenario : Removing all downloads via :download-clear
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 d a t a / d o w n l o a d s / d o w n l o a d 2. 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 l e a r
Then " R e m o v e d d o w n l o a d * " s h o u l d b e l o g g e d
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
2016-09-09 18:42:55 +02:00
Scenario : Opening a download with a placeholder
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 w i t h a p l a c e h o l d e r
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
2016-09-09 16:17:59 +02:00
# https://github.com/The-Compiler/qutebrowser/issues/1728
2016-08-03 17:55:52 +02:00
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-09-09 16:17:59 +02:00
# https://github.com/The-Compiler/qutebrowser/issues/1725
2016-08-04 01:06:42 +02:00
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-09-09 16:17:59 +02:00
## storage -> remember-download-directory
2016-03-31 19:09:43 +02:00
2016-09-09 16:17:59 +02:00
Scenario : Remembering the last download directory
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 s e t s t o r a g e - > r e m e m b e r - 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 w a i t f o r t h e d o w n l o a d p r o m p t f o r " * / d o w n l o a d . b i n "
# (tmpdir) equals {downloaddir}
And I r u n : p r o m p t - a c c e p t ( t m p d i r ) / s u b d i r
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 2. 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 } / s u b d i r / d o w n l o a d 2 . b i n "
2016-05-09 07:06:58 +02:00
2016-09-09 16:17:59 +02:00
Scenario : Not remembering the last download directory
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 s e t s t o r a g e - > r e m e m b e r - d o w n l o a d - d i r e c t o r y t o f a l s e
2016-05-09 07:06:58 +02:00
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
2016-09-09 16:17:59 +02:00
And I w a i t f o r t h e d o w n l o a d p r o m p t f o r " { d o w n l o a d d i r } / d o w n l o a d . b i n "
# (tmpdir) equals {downloaddir}
And I r u n : p r o m p t - a c c e p t ( t m p d i r ) / s u b d i r
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 2. 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 2 . b i n "
2016-09-09 16:58:39 +02:00
2016-09-10 15:51:49 +02:00
# Overwriting files
Scenario : Not overwriting an existing file
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 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 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 h t t p : / / l o c a l h o s t : ( p o r t ) / d a t a / d o w n l o a d s / d o w n l o a d 2. b i n - - d e s t d o w n l o a d . b i n
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 . y e s n o * " 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 n o
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 c o n t a i n 1 b y t e s
Scenario : Overwriting an existing file
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 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 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 h t t p : / / l o c a l h o s t : ( p o r t ) / d a t a / d o w n l o a d s / d o w n l o a d 2. b i n - - d e s t d o w n l o a d . b i n
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 . y e s n o * " 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 y e s
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 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 c o n t a i n 2 b y t e s
@linux
Scenario : Not overwriting a special file
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 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 a t a / d o w n l o a d s / d o w n l o a d . b i n - - d e s t f i f o
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 . y e s n o * " 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 n o
Then t h e F I F O s h o u l d s t i l l b e a F I F O
## Redirects
Scenario : Downloading with infinite redirect
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 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 ) / r e d i r e c t / 12 - - d e s t r e d i r e c t i o n
Then t h e e r r o r " D o w n l o a d e r r o r : M a x i m u m r e d i r e c t i o n c o u n t r e a c h e d ! " s h o u l d b e s h o w n
And " D e l e t e d * / r e d i r e c t i o n " s h o u l d b e l o g g e d
And t h e d o w n l o a d e d f i l e r e d i r e c t i o n s h o u l d n o t e x i s t
Scenario : Downloading with redirect to itself
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 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 ) / c u s t o m / r e d i r e c t - s e l f
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 t h e d o w n l o a d e d f i l e r e d i r e c t - s e l f s h o u l d e x i s t
Scenario : Downloading with absolute redirect
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 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 ) / a b s o l u t e - r e d i r e c t / 1
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 t h e d o w n l o a d e d f i l e 1 s h o u l d e x i s t
Scenario : Downloading with relative redirect
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 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 ) / r e l a t i v e - r e d i r e c t / 1
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 t h e d o w n l o a d e d f i l e 1 s h o u l d e x i s t
2016-09-09 16:58:39 +02:00
## Other
Scenario : Download without a content-size
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
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 ) / c u s t o m / c o n t e n t - s i z e
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 t h e d o w n l o a d e d f i l e c o n t e n t - s i z e s h o u l d e x i s t
2016-09-10 15:51:49 +02:00
@posix
Scenario : Downloading to unwritable destination
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 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 a t a / d o w n l o a d s / d o w n l o a d . b i n - - d e s t ( t m p d i r ) / u n w r i t a b l e
Then t h e e r r o r " D o w n l o a d e r r o r : P e r m i s s i o n d e n i e d " s h o u l d b e s h o w n
Scenario : Downloading 20MB file
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 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 ) / c u s t o m / t w e n t y - m b
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 t h e d o w n l o a d e d f i l e t w e n t y - m b s h o u l d c o n t a i n 20971520 b y t e s
Scenario : Downloading 20MB file with late prompt confirmation
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 ) / c u s t o m / t w e n t y - m b
And I w a i t 1 s
And I r u n : p r o m p t - a c c e p t
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 t h e d o w n l o a d e d f i l e t w e n t y - m b s h o u l d c o n t a i n 20971520 b y t e s
Scenario : Downloading invalid URL
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 g e n e r a l - > a u t o - s e a r c h t o f a l s e
And I r u n : d o w n l o a d f o o !
Then t h e e r r o r " I n v a l i d U R L " s h o u l d b e s h o w n
Scenario : Downloading via pdfjs
Given p d f j s i s a v a i l a b l 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 c o n t e n t - > e n a b l e - p d f j s t o t r u e
And I o p e n d a t a / m i s c / t e s t . p d f
And I w a i t f o r t h e j a v a s c r i p t m e s s a g e " P D F * [ * ] ( P D F . j s : * ) "
And I r u n : c l i c k - e l e m e n t i d 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 t h e d o w n l o a d e d f i l e t e s t . p d f s h o u l d e x i s t