mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
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
This commit is contained in:
parent
83d5633a5f
commit
ddb24a2473
@ -62,14 +62,16 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
|||||||
FileUtils.rm downloaded_files
|
FileUtils.rm downloaded_files
|
||||||
end
|
end
|
||||||
|
|
||||||
def downloaded_files
|
def downloaded_files(filename='*')
|
||||||
Dir.glob("#{DOWNLOADS_PATH}/*").reject {|f| f=~/\.(tmp|crdownload)$/}
|
# 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
|
end
|
||||||
|
|
||||||
# Returns the path of the download file
|
# Returns the path of the download file
|
||||||
def downloaded_file
|
def downloaded_file(filename='*')
|
||||||
Timeout.timeout(5) do
|
Timeout.timeout(5) do
|
||||||
while downloaded_files.empty?
|
while downloaded_files(filename).empty?
|
||||||
sleep 0.2
|
sleep 0.2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -335,7 +335,7 @@ class IssuesTest < ApplicationSystemTestCase
|
|||||||
click_on 'CSV'
|
click_on 'CSV'
|
||||||
click_on 'Export'
|
click_on 'Export'
|
||||||
|
|
||||||
csv = CSV.read(downloaded_file)
|
csv = CSV.read(downloaded_file("issues.csv"))
|
||||||
subject_index = csv.shift.index('Subject')
|
subject_index = csv.shift.index('Subject')
|
||||||
subjects = csv.map {|row| row[subject_index]}
|
subjects = csv.map {|row| row[subject_index]}
|
||||||
assert_equal subjects.sort, subjects
|
assert_equal subjects.sort, subjects
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user