Patch #34119 » 0001-fix-chrome-options-key-for-system-tests-and-remove-c.patch
| test/application_system_test_case.rb | ||
|---|---|---|
|
:selenium, using: :chrome, screen_size: [1024, 900],
|
||
|
options: {
|
||
|
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
|
||
|
'chromeOptions' => {
|
||
|
'goog:chromeOptions' => {
|
||
|
'prefs' => {
|
||
|
'download.default_directory' => DOWNLOADS_PATH,
|
||
|
'download.prompt_for_download' => false,
|
||
| ... | ... | |
|
end
|
||
|
def clear_downloaded_files
|
||
|
# https://github.com/SeleniumHQ/selenium/issues/5292
|
||
|
FileUtils.rm downloaded_files if Redmine::Platform.mswin?
|
||
|
FileUtils.rm downloaded_files
|
||
|
end
|
||
|
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}").
|
||
|
Dir.glob("#{DOWNLOADS_PATH}/#{filename}").
|
||
|
reject{|f| f=~/\.(tmp|crdownload)$/}.sort_by{|f| File.mtime(f)}
|
||
|
end
|
||
| test/system/issues_test.rb | ||
|---|---|---|
|
click_on 'CSV'
|
||
|
click_on 'Export'
|
||
|
# https://github.com/SeleniumHQ/selenium/issues/5292
|
||
|
# if issues.csv exists, Chrome creates issues (1).csv, issues (2).csv ...
|
||
|
csv = CSV.read(downloaded_file("issues*.csv"))
|
||
|
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
|
||