From 06190a048825eea7c961b645c9ef8f281df25d91 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 14 Mar 2016 19:06:16 +0100 Subject: [PATCH] bdd: Do better cleanup/separation for downloads --- tests/integration/features/downloads.feature | 4 ++-- tests/integration/features/test_downloads.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/integration/features/downloads.feature b/tests/integration/features/downloads.feature index d2ce1ce3c..da26e8d43 100644 --- a/tests/integration/features/downloads.feature +++ b/tests/integration/features/downloads.feature @@ -1,8 +1,8 @@ Feature: Downloading things from a website. Background: - Given I set storage -> prompt-download-directory to false - And I run :download-clear + Given I set up a temporary download dir + And I clean old downloads Scenario: Downloading which redirects with closed tab (issue 889) When I set tabs -> last-close to blank diff --git a/tests/integration/features/test_downloads.py b/tests/integration/features/test_downloads.py index 86301a6e3..d2bc7eb7b 100644 --- a/tests/integration/features/test_downloads.py +++ b/tests/integration/features/test_downloads.py @@ -21,6 +21,19 @@ import pytest_bdd as bdd bdd.scenarios('downloads.feature') +@bdd.given("I set up a temporary download dir") +def temporary_download_dir(quteproc, tmpdir): + quteproc.set_setting('storage', 'prompt-download-directory', 'false') + quteproc.set_setting('storage', 'remember-download-directory', 'false') + quteproc.set_setting('storage', 'download-directory', str(tmpdir)) + + +@bdd.given("I clean old downloads") +def clean_old_downloads(quteproc): + quteproc.send_cmd(':download-cancel --all') + quteproc.send_cmd(':download-clear') + + @bdd.when("I wait until the download is finished") def wait_for_download_finished(quteproc): quteproc.wait_for(category='downloads', message='Download finished')