Add some BDD tests for downloads.
This commit is contained in:
parent
b59a56921e
commit
0daf5885be
BIN
tests/integration/data/downloads/download.bin
Normal file
BIN
tests/integration/data/downloads/download.bin
Normal file
Binary file not shown.
11
tests/integration/data/downloads/issue889.html
Normal file
11
tests/integration/data/downloads/issue889.html
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Failing download when redirecting/aborting</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a href="/custom/redirect-later?delay=1">redirect after 1s</a>
|
||||||
|
<a href="/does-not-exist">404</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
44
tests/integration/features/downloads.feature
Normal file
44
tests/integration/features/downloads.feature
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
Feature: Downloading things from a website.
|
||||||
|
|
||||||
|
Background:
|
||||||
|
Given I set storage -> prompt-download-directory to false
|
||||||
|
And I run :download-clear
|
||||||
|
|
||||||
|
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 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 run :tab-close
|
||||||
|
And I wait for the error "Download error: * - server replied: NOT FOUND"
|
||||||
|
And I run :download-retry
|
||||||
|
And I wait for the error "Download error: * - server replied: NOT FOUND"
|
||||||
|
Then no crash should happen
|
||||||
|
|
||||||
|
Scenario: Retrying a failed download
|
||||||
|
When I run :download http://localhost:(port)/does-not-exist
|
||||||
|
And I wait for the error "Download error: * - server replied: NOT FOUND"
|
||||||
|
And I run :download-retry
|
||||||
|
And I wait for the error "Download error: * - server replied: NOT FOUND"
|
||||||
|
Then the requests should be:
|
||||||
|
does-not-exist
|
||||||
|
does-not-exist
|
||||||
|
|
||||||
|
Scenario: Retrying with no failed downloads
|
||||||
|
When I open data/downloads/download.bin
|
||||||
|
And I wait until the download is finished
|
||||||
|
And I run :download-retry
|
||||||
|
Then the error "No failed downloads!" should be shown.
|
||||||
|
|
||||||
|
Scenario: Retrying with no downloads
|
||||||
|
When I run :download-retry
|
||||||
|
Then the error "No failed downloads!" should be shown.
|
26
tests/integration/features/test_downloads.py
Normal file
26
tests/integration/features/test_downloads.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||||
|
|
||||||
|
# Copyright 2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
||||||
|
#
|
||||||
|
# This file is part of qutebrowser.
|
||||||
|
#
|
||||||
|
# qutebrowser is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# qutebrowser is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import pytest_bdd as bdd
|
||||||
|
bdd.scenarios('downloads.feature')
|
||||||
|
|
||||||
|
|
||||||
|
@bdd.when("I wait until the download is finished")
|
||||||
|
def wait_for_download_finished(quteproc):
|
||||||
|
quteproc.wait_for(category='downloads', message='Download finished')
|
Loading…
Reference in New Issue
Block a user