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.

copy_to_clipboard_test.rb 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # frozen_string_literal: true
  2. # Redmine - project management software
  3. # Copyright (C) 2006- 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_relative '../application_system_test_case'
  19. class CopyToClipboardSystemTest < 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, :versions,
  24. :workflows, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
  25. def test_copy_issue_url_to_clipboard
  26. log_user('jsmith', 'jsmith')
  27. visit 'issues/1'
  28. # Copy issue url to Clipboard
  29. first('.contextual span.icon-actions').click
  30. find('.contextual div.drdn-items a.icon-copy-link').click
  31. # Paste the value copied to the clipboard into the textarea to get and test
  32. first('.icon-edit').click
  33. find('textarea#issue_notes').send_keys([modifier_key, 'v'])
  34. assert find('textarea#issue_notes').value.end_with?('/issues/1')
  35. end
  36. def test_copy_issue_journal_url_to_clipboard
  37. log_user('jsmith', 'jsmith')
  38. visit 'issues/1'
  39. # Copy issue journal url to Clipboard
  40. first('#note-2 .icon-actions').click
  41. first('#note-2 div.drdn-items a.icon-copy-link').click
  42. # Paste the value copied to the clipboard into the textarea to get and test
  43. first('.icon-edit').click
  44. find('textarea#issue_notes').send_keys([modifier_key, 'v'])
  45. assert find('textarea#issue_notes').value.end_with?('/issues/1#note-2')
  46. end
  47. private
  48. def modifier_key
  49. modifier = osx? ? 'command' : 'control'
  50. modifier.to_sym
  51. end
  52. end