Project

General

Profile

Feature #5201 » issue_5201_tracker_description_test.patch

Patch for test, including ui test. - Akiko Takano, 2017-05-04 15:45

View differences:

test/fixtures/trackers.yml (working copy)
5 5
  is_in_chlog: true
6 6
  default_status_id: 1
7 7
  position: 1
8
  description: Description for Bug tracker
8 9
trackers_002: 
9 10
  name: Feature request
10 11
  id: 2
test/functional/issues_controller_test.rb (working copy)
1814 1814
      assert_select 'input[name=?]', 'issue[is_private]'
1815 1815
      assert_select 'select[name=?]', 'issue[project_id]', 0
1816 1816
      assert_select 'select[name=?]', 'issue[tracker_id]'
1817
      assert_select '#display_tracker_description'
1818
      assert_select '#trackers_description_dialog'
1817 1819
      assert_select 'input[name=?]', 'issue[subject]'
1818 1820
      assert_select 'textarea[name=?]', 'issue[description]'
1819 1821
      assert_select 'select[name=?]', 'issue[status_id]'
......
1848 1850
      assert_select 'input[name=?]', 'issue[is_private]', 0
1849 1851
      assert_select 'select[name=?]', 'issue[project_id]', 0
1850 1852
      assert_select 'select[name=?]', 'issue[tracker_id]'
1853
      assert_select '#display_tracker_description'
1854
      assert_select '#trackers_description_dialog'
1851 1855
      assert_select 'input[name=?]', 'issue[subject]'
1852 1856
      assert_select 'textarea[name=?]', 'issue[description]'
1853 1857
      assert_select 'select[name=?]', 'issue[status_id]'
......
1872 1876
    assert_select 'form#issue-form[action=?]', '/issues'
1873 1877
    assert_select 'form#issue-form' do
1874 1878
      assert_select 'select[name=?]', 'issue[project_id]'
1879
      assert_select '#display_tracker_description'
1880
      assert_select '#trackers_description_dialog'
1875 1881
    end
1876 1882
  end
1877 1883

  
......
1930 1936
      assert_select 'option[value="1"]'
1931 1937
      assert_select 'option[value="3"]'
1932 1938
    end
1939
    # tracker description dialog has the same numbers of tracker.
1940
    assert_select '#trackers_description_dialog table tr', 2
1933 1941
  end
1934 1942

  
1935 1943
  def test_new_should_default_to_first_tracker
......
1941 1949
      assert_select 'option', 3
1942 1950
      assert_select 'option[value="1"][selected=selected]'
1943 1951
    end
1952
    assert_select '#display_tracker_description'
1953
    # tracker description dialog has the same numbers of tracker.
1954
    assert_select '#trackers_description_dialog table tr', 3
1944 1955
  end
1945 1956

  
1946 1957
  def test_new_with_parent_issue_id_should_default_to_first_tracker_without_disabled_parent_field
......
1956 1967
      assert_select 'option[value="2"][selected=selected]'
1957 1968
      assert_select 'option[value="1"]', 0
1958 1969
    end
1970
    assert_select '#display_tracker_description'
1971
    assert_select '#trackers_description_dialog table tr[name="1"]', 0
1959 1972
  end
1960 1973

  
1961 1974
  def test_new_without_allowed_trackers_should_respond_with_403
test/integration/issues_test.rb (working copy)
223 223
      assert_select 'option[value=?]', tester.id.to_s, :text => tester.name
224 224
    end
225 225

  
226
    assert_select '#display_tracker_description'
227
    assert_select '#trackers_description_dialog'
228

  
226 229
    # Create issue
227 230
    issue = new_record(Issue) do
228 231
      post '/projects/ecookbook/issues',
test/ui/tracker_description_test_ui.rb (working copy)
1
require File.expand_path('../base', __FILE__)
2

  
3
class Redmine::UiTest::TrackerDescriptionTest < Redmine::UiTest::Base
4
  fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
5
           :trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
6
           :enumerations
7

  
8
  def test_tracker_descriptions_on_project_overview
9
    log_user('jsmith', 'jsmith')
10
    visit '/projects/ecookbook'
11
    within('div.issues.box > table') do
12
      within('tr:nth-child(1) td.name') do
13
        assert_selector(:css, '.tooltip_body', visible: false)
14
        find('div > a').hover
15
        assert_selector(:css, '.tooltip_body')
16
      end
17
    end
18
  end
19

  
20
  def test_tracker_descriptions_on_project_setting
21
    log_user('admin', 'admin')
22
    visit '/projects/ecookbook/settings'
23
    within('#project_trackers') do
24
      within('label:nth-child(2)') do
25
        assert_selector(:css, '.tooltip_body', visible: false)
26
        find("input[type='checkbox']").hover
27
        assert_selector(:css, '.tooltip_body')
28
      end
29
    end
30
  end
31

  
32
  # Test for Tracker Description
33
  def test_tracker_description_dialog
34
    log_user('jsmith', 'jsmith')
35
    visit '/projects/ecookbook/issues/new'
36
    tracker_count = page.all('#issue_tracker_id option').size
37
    within('form#issue-form') do
38
      assert_selector(:css, '#trackers_description_dialog', visible: :hidden)
39
      find('#display_tracker_description').click
40
    end
41
    assert_selector(:css, '#trackers_description_dialog')
42
    # dialog has the same number of table rows to tracker_id pulldown.
43
    within('#trackers_description_dialog') do
44
      assert page.has_css?('table tbody tr', count: tracker_count)
45
      assert page.has_css?("tr[name='3']")
46
      find("tr[name='2'] td a.icon-test").click
47
    end
48
    assert_equal find('#issue_tracker_id').value, '2'
49
  end
50
end
test/unit/tracker_test.rb (working copy)
128 128
      end
129 129
    end
130 130
  end
131

  
132
  def test_tracker_should_have_description
133
    tracker = Tracker.find(1)
134
    assert tracker.respond_to?(:description)
135
    assert_equal tracker.description, "Description for Bug tracker"
136
  end
131 137
end
(5-5/12)