summaryrefslogtreecommitdiffstats
path: root/test/system
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-03-18 03:58:29 +0000
committerGo MAEDA <maeda@farend.jp>2021-03-18 03:58:29 +0000
commit44ea826a21071ab3e0b07ecfcd56020eea219078 (patch)
tree6006b28121b01d573d3545c23010bea66e8c189e /test/system
parent06ac3473e0eb9d233611320ca2ed6d2c3e4f6547 (diff)
downloadredmine-44ea826a21071ab3e0b07ecfcd56020eea219078.tar.gz
redmine-44ea826a21071ab3e0b07ecfcd56020eea219078.zip
"Copy link" feature for issue and issue journal (#34703).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@20816 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/system')
-rw-r--r--test/system/copy_to_clipboard_test.rb63
1 files changed, 63 insertions, 0 deletions
diff --git a/test/system/copy_to_clipboard_test.rb b/test/system/copy_to_clipboard_test.rb
new file mode 100644
index 000000000..ffa7b79fe
--- /dev/null
+++ b/test/system/copy_to_clipboard_test.rb
@@ -0,0 +1,63 @@
+# frozen_string_literal: true
+
+# Redmine - project management software
+# Copyright (C) 2006-2020 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require_relative '../application_system_test_case'
+
+class CopyToClipboardSystemTest < ApplicationSystemTestCase
+ fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
+ :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
+ :enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
+ :watchers, :journals, :journal_details, :versions,
+ :workflows, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions
+
+ def test_copy_issue_url_to_clipboard
+ log_user('jsmith', 'jsmith')
+ visit 'issues/1'
+
+ # Copy issue url to Clipboard
+ first('.contextual span.icon-actions').click
+ find('.contextual div.drdn-items a.icon-copy-link').click
+
+ # Paste the value copied to the clipboard into the textarea to get and test
+ first('.icon-edit').click
+ find('textarea#issue_notes').send_keys([modifier_key, 'v'])
+ assert find('textarea#issue_notes').value.end_with?('/issues/1')
+ end
+
+ def test_copy_issue_journal_url_to_clipboard
+ log_user('jsmith', 'jsmith')
+ visit 'issues/1'
+
+ # Copy issue journal url to Clipboard
+ first('#note-2 .icon-actions').click
+ first('#note-2 div.drdn-items a.icon-copy-link').click
+
+ # Paste the value copied to the clipboard into the textarea to get and test
+ first('.icon-edit').click
+ find('textarea#issue_notes').send_keys([modifier_key, 'v'])
+ assert find('textarea#issue_notes').value.end_with?('/issues/1#note-2')
+ end
+
+ private
+
+ def modifier_key
+ modifier = osx? ? 'command' : 'control'
+ modifier.to_sym
+ end
+end