Project

General

Profile

Feature #41294 » 0001-Add-system-tests-for-the-current-behavior.patch

Katsuya HIDAKA, 2024-09-22 13:00

View differences:

test/system/issues_reply_test.rb
1
# frozen_string_literal: true
2

  
3
# Redmine - project management software
4
# Copyright (C) 2006-  Jean-Philippe Lang
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19

  
20
require_relative '../application_system_test_case'
21

  
22
class IssuesReplyTest < ApplicationSystemTestCase
23
  fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
24
           :trackers, :projects_trackers, :enabled_modules,
25
           :issue_statuses, :issues, :issue_categories,
26
           :enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
27
           :watchers, :journals, :journal_details, :versions,
28
           :workflows
29

  
30
  setup do
31
    log_user('jsmith', 'jsmith')
32
    visit '/issues/1'
33
  end
34

  
35
  def test_reply_to_issue
36
    within '.issue.details' do
37
      click_link 'Quote'
38
    end
39

  
40
    assert_field 'issue_notes', with: <<~TEXT
41
      John Smith wrote:
42
      > Unable to print recipes
43

  
44
    TEXT
45
    assert_selector :css, '#issue_notes:focus'
46
  end
47

  
48
  def test_reply_to_note
49
    within '#change-1' do
50
      click_link 'Quote'
51
    end
52

  
53
    assert_field 'issue_notes', with: <<~TEXT
54
      Redmine Admin wrote in #note-1:
55
      > Journal notes
56

  
57
    TEXT
58
    assert_selector :css, '#issue_notes:focus'
59
  end
60
end
test/system/messages_test.rb
1
# frozen_string_literal: true
2

  
3
# Redmine - project management software
4
# Copyright (C) 2006-  Jean-Philippe Lang
5
#
6
# This program is free software; you can redistribute it and/or
7
# modify it under the terms of the GNU General Public License
8
# as published by the Free Software Foundation; either version 2
9
# of the License, or (at your option) any later version.
10
#
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19

  
20
require_relative '../application_system_test_case'
21

  
22
class MessagesTest < ApplicationSystemTestCase
23
  fixtures :projects, :users, :roles, :members, :member_roles,
24
           :enabled_modules, :enumerations,
25
           :custom_fields, :custom_values, :custom_fields_trackers,
26
           :watchers, :boards, :messages
27

  
28
  setup do
29
    log_user('jsmith', 'jsmith')
30
    visit '/boards/1/topics/1'
31
  end
32

  
33
  def test_reply_to_topic_message
34
    within '#content > .contextual' do
35
      click_link 'Quote'
36
    end
37

  
38
    assert_field 'message_content', with: <<~TEXT
39
      Redmine Admin wrote:
40
      > This is the very first post
41
      > in the forum
42

  
43
    TEXT
44
  end
45

  
46
  def test_reply_to_message
47
    within '#message-2' do
48
      click_link 'Quote'
49
    end
50

  
51
    assert_field 'message_content', with: <<~TEXT
52
      Redmine Admin wrote in message#2:
53
      > Reply to the first post
54

  
55
    TEXT
56
  end
57
end
(7-7/15)