summaryrefslogtreecommitdiffstats
path: root/test/system
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-01-07 05:43:52 +0000
committerGo MAEDA <maeda@farend.jp>2021-01-07 05:43:52 +0000
commit1bf01c5677914e98891c332ffcfcd8a0c60ee7f7 (patch)
treed8904d98d8d70f9ef7a2dac766453aa4183caf4b /test/system
parent81efbcaa2f592234ffa22a289f650a3aeb288e3c (diff)
downloadredmine-1bf01c5677914e98891c332ffcfcd8a0c60ee7f7.tar.gz
redmine-1bf01c5677914e98891c332ffcfcd8a0c60ee7f7.zip
Adding system tests for keyboard shortcuts (#30459).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20707 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/system')
-rw-r--r--test/system/keyboard_shortcuts_test.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/system/keyboard_shortcuts_test.rb b/test/system/keyboard_shortcuts_test.rb
new file mode 100644
index 000000000..115ee6d74
--- /dev/null
+++ b/test/system/keyboard_shortcuts_test.rb
@@ -0,0 +1,71 @@
+# 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 File.expand_path('../../application_system_test_case', __FILE__)
+
+class InlineAutocompleteSystemTest < 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
+
+ def test_keyboard_shortcuts_to_switch_edit_preview_tabs
+ log_user('jsmith', 'jsmith')
+ visit 'issues/new'
+
+ fill_in 'Description', :with => 'new issue description'
+
+ # Switch to preview using control + shift + p
+ find('#issue_description').click.send_keys([:control, :shift, 'p'])
+ find 'div.wiki-preview', :visible => true, :text => 'new issue description'
+
+ # Switch to edit using control + shift + p
+ page.find('body').send_keys([:control, :shift, 'p'])
+ find 'div.wiki-preview', :visible => false
+ find 'textarea.wiki-edit', :visible => true
+
+ # Switch back to preview using command + shift + p
+ find('#issue_description').click.send_keys([:command, :shift, 'p'])
+ find 'div.wiki-preview', :visible => true, :text => 'new issue description'
+
+ # Switch to edit using control + shift + p
+ page.find('body').send_keys([:command, :shift, 'p'])
+ find 'div.wiki-preview', :visible => false
+ find 'textarea.wiki-edit', :visible => true
+ end
+
+ def test_keyboard_shortcuts_should_switch_to_edit_tab_the_last_previewed_tab
+ log_user('jsmith', 'jsmith')
+ visit 'issues/1/edit'
+
+ page.first(:link, 'Edit').click
+ # Preview issue description by clicking the Preview tab
+ page.find('#issue_description_and_toolbar').click_link('Preview')
+ find 'div#preview_issue_description', :visible => true
+
+ # Preview issue notes by clicking the Preview tab
+ page.find('fieldset:nth-child(3)').click_link('Preview')
+ find 'div#preview_issue_notes', :visible => true
+
+ page.find('body').send_keys([:command, :shift, 'p'])
+ find 'textarea#issue_notes', :visible => true
+ find 'div#preview_issue_notes', :visible => false
+ end
+end