You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

issues_import_test.rb 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006-2022 Jean-Philippe Lang
  4. #
  5. # This program is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU General Public License
  7. # as published by the Free Software Foundation; either version 2
  8. # of the License, or (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. require File.expand_path('../../application_system_test_case', __FILE__)
  19. class IssuesImportTest < ApplicationSystemTestCase
  20. fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
  21. :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
  22. :enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
  23. :watchers, :journals, :journal_details
  24. def test_import_issues_without_failures
  25. log_user('jsmith', 'jsmith')
  26. visit '/issues'
  27. find('div.contextual>span.drdn').click
  28. click_on 'Import'
  29. attach_file 'file', Rails.root.join('test/fixtures/files/import_issues.csv')
  30. click_on 'Next »'
  31. select 'Semicolon', :from => 'Field separator'
  32. select 'Double quote', :from => 'Field wrapper'
  33. select 'ISO-8859-1', :from => 'Encoding'
  34. select 'MM/DD/YYYY', :from => 'Date format'
  35. click_on 'Next »'
  36. select 'eCookbook', :from => 'Project'
  37. select 'tracker', :from => 'Tracker'
  38. select 'status', :from => 'Status'
  39. select 'subject', :from => 'Subject'
  40. assert_difference 'Issue.count', 3 do
  41. click_button 'Import'
  42. assert page.has_content?('3 items have been imported')
  43. end
  44. end
  45. end