summaryrefslogtreecommitdiffstats
path: root/test/application_system_test_case.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-09-25 17:30:07 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-09-25 17:30:07 +0000
commit942eb6e06bf49cc761fb55faec5edf5ff927c116 (patch)
treef72dbaeeff57ce763dbe8fee806b610b4ac9f818 /test/application_system_test_case.rb
parent39101580a9a3ae93ec7ba94384b1e6c24b566db8 (diff)
downloadredmine-942eb6e06bf49cc761fb55faec5edf5ff927c116.tar.gz
redmine-942eb6e06bf49cc761fb55faec5edf5ff927c116.zip
detect Chrome downloaded file more strictly
git-svn-id: http://svn.redmine.org/redmine/trunk@18536 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/application_system_test_case.rb')
-rw-r--r--test/application_system_test_case.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index 55bb6d37e..6ee256f8c 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -66,15 +66,21 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
def downloaded_files(filename='*')
# https://github.com/SeleniumHQ/selenium/issues/5292
downloaded_path = Redmine::Platform.mswin? ? DOWNLOADS_PATH : "#{ENV['HOME']}/Downloads"
- Dir.glob("#{downloaded_path}/#{filename}").reject {|f| f=~/\.(tmp|crdownload)$/}
+ Dir.glob("#{downloaded_path}/#{filename}").
+ reject{|f| f=~/\.(tmp|crdownload)$/}.sort_by{|f| File.mtime(f)}
end
# Returns the path of the download file
def downloaded_file(filename='*')
+ files = []
Timeout.timeout(5) do
- sleep 0.2 while downloaded_files(filename).empty?
+ loop do
+ files = downloaded_files(filename)
+ break if files.present?
+ sleep 0.2
+ end
end
- downloaded_files(filename).first
+ files.last
end
end