Project

General

Profile

Patch #34119 » 0001-fix-chrome-options-key-for-system-tests-and-remove-c.patch

Jens Krämer, 2020-10-16 03:39

View differences:

test/application_system_test_case.rb
26 26
    :selenium, using: :chrome, screen_size: [1024, 900],
27 27
    options: {
28 28
      desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
29
        'chromeOptions' => {
29
        'goog:chromeOptions' => {
30 30
          'prefs' => {
31 31
            'download.default_directory' => DOWNLOADS_PATH,
32 32
            'download.prompt_for_download' => false,
......
62 62
  end
63 63

  
64 64
  def clear_downloaded_files
65
    # https://github.com/SeleniumHQ/selenium/issues/5292
66
    FileUtils.rm downloaded_files if Redmine::Platform.mswin?
65
    FileUtils.rm downloaded_files
67 66
  end
68 67

  
69 68
  def downloaded_files(filename='*')
70
    # https://github.com/SeleniumHQ/selenium/issues/5292
71
    downloaded_path = Redmine::Platform.mswin? ? DOWNLOADS_PATH : "#{ENV['HOME']}/Downloads"
72
    Dir.glob("#{downloaded_path}/#{filename}").
69
    Dir.glob("#{DOWNLOADS_PATH}/#{filename}").
73 70
      reject{|f| f=~/\.(tmp|crdownload)$/}.sort_by{|f| File.mtime(f)}
74 71
  end
75 72

  
test/system/issues_test.rb
519 519
    click_on 'CSV'
520 520
    click_on 'Export'
521 521

  
522
    # https://github.com/SeleniumHQ/selenium/issues/5292
523
    # if issues.csv exists, Chrome creates issues (1).csv, issues (2).csv ...
524
    csv = CSV.read(downloaded_file("issues*.csv"))
522
    csv = CSV.read(downloaded_file("issues.csv"))
525 523
    subject_index = csv.shift.index('Subject')
526 524
    subjects = csv.map {|row| row[subject_index]}
527 525
    assert_equal subjects.sort, subjects
(1-1/2)