summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-09-25 12:31:40 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2019-09-25 12:31:40 +0000
commitddb24a2473e0b6303f4aefbc12ed569585d34a7d (patch)
treeba5ef2f542ab3cca206488cf1c3d198c8c0e44f6
parent83d5633a5f772bfbae51ad2c0e3e31d17cbe6bc1 (diff)
downloadredmine-ddb24a2473e0b6303f4aefbc12ed569585d34a7d.tar.gz
redmine-ddb24a2473e0b6303f4aefbc12ed569585d34a7d.zip
workaround Chrome default_directory ignored on Linux
https://github.com/SeleniumHQ/selenium/issues/5292 git-svn-id: http://svn.redmine.org/redmine/trunk@18530 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/application_system_test_case.rb10
-rw-r--r--test/system/issues_test.rb2
2 files changed, 7 insertions, 5 deletions
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index dce8b3a0e..8b552e3b7 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -62,14 +62,16 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
FileUtils.rm downloaded_files
end
- def downloaded_files
- Dir.glob("#{DOWNLOADS_PATH}/*").reject {|f| f=~/\.(tmp|crdownload)$/}
+ 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)$/}
end
# Returns the path of the download file
- def downloaded_file
+ def downloaded_file(filename='*')
Timeout.timeout(5) do
- while downloaded_files.empty?
+ while downloaded_files(filename).empty?
sleep 0.2
end
end
diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb
index 28eccedbc..0ed93a08d 100644
--- a/test/system/issues_test.rb
+++ b/test/system/issues_test.rb
@@ -335,7 +335,7 @@ class IssuesTest < ApplicationSystemTestCase
click_on 'CSV'
click_on 'Export'
- csv = CSV.read(downloaded_file)
+ csv = CSV.read(downloaded_file("issues.csv"))
subject_index = csv.shift.index('Subject')
subjects = csv.map {|row| row[subject_index]}
assert_equal subjects.sort, subjects