From bc6a2862be29b6e7dd4f10753086772984c5b484 Mon Sep 17 00:00:00 2001 From: Katsuya Hidaka Date: Mon, 16 Sep 2024 01:35:59 +0900 Subject: [PATCH 1/7] Add system tests for the current behavior --- test/system/issues_reply_test.rb | 60 ++++++++++++++++++++++++++++++++ test/system/messages_test.rb | 57 ++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 test/system/issues_reply_test.rb create mode 100644 test/system/messages_test.rb diff --git a/test/system/issues_reply_test.rb b/test/system/issues_reply_test.rb new file mode 100644 index 000000000..e2dc18804 --- /dev/null +++ b/test/system/issues_reply_test.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006- 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 IssuesReplyTest < ApplicationSystemTestCase + fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, + :trackers, :projects_trackers, :enabled_modules, + :issue_statuses, :issues, :issue_categories, + :enumerations, :custom_fields, :custom_values, :custom_fields_trackers, + :watchers, :journals, :journal_details, :versions, + :workflows + + setup do + log_user('jsmith', 'jsmith') + visit '/issues/1' + end + + def test_reply_to_issue + within '.issue.details' do + click_link 'Quote' + end + + assert_field 'issue_notes', with: <<~TEXT + John Smith wrote: + > Unable to print recipes + + TEXT + assert_selector :css, '#issue_notes:focus' + end + + def test_reply_to_note + within '#change-1' do + click_link 'Quote' + end + + assert_field 'issue_notes', with: <<~TEXT + Redmine Admin wrote in #note-1: + > Journal notes + + TEXT + assert_selector :css, '#issue_notes:focus' + end +end diff --git a/test/system/messages_test.rb b/test/system/messages_test.rb new file mode 100644 index 000000000..777781991 --- /dev/null +++ b/test/system/messages_test.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006- 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 MessagesTest < ApplicationSystemTestCase + fixtures :projects, :users, :roles, :members, :member_roles, + :enabled_modules, :enumerations, + :custom_fields, :custom_values, :custom_fields_trackers, + :watchers, :boards, :messages + + setup do + log_user('jsmith', 'jsmith') + visit '/boards/1/topics/1' + end + + def test_reply_to_topic_message + within '#content > .contextual' do + click_link 'Quote' + end + + assert_field 'message_content', with: <<~TEXT + Redmine Admin wrote: + > This is the very first post + > in the forum + + TEXT + end + + def test_reply_to_message + within '#message-2' do + click_link 'Quote' + end + + assert_field 'message_content', with: <<~TEXT + Redmine Admin wrote in message#2: + > Reply to the first post + + TEXT + end +end -- 2.44.0