Project

General

Profile

Feature #5201 » issue_5201_tracker_description_test.patch

Add test for rest api. (20170510 updated) - Akiko Takano, 2017-05-10 01:33

View differences:

test/fixtures/trackers.yml (working copy)
---
trackers_001:
---
trackers_001:
name: Bug
id: 1
is_in_chlog: true
default_status_id: 1
position: 1
trackers_002:
description: Description for Bug tracker
trackers_002:
name: Feature request
id: 2
is_in_chlog: true
default_status_id: 1
position: 2
trackers_003:
description: Description for Feature request tracker
trackers_003:
name: Support request
id: 3
is_in_chlog: false
default_status_id: 1
position: 3
description: Description for Support request tracker
test/functional/issues_controller_test.rb (working copy)
assert_select 'input[name=?]', 'issue[is_private]'
assert_select 'select[name=?]', 'issue[project_id]', 0
assert_select 'select[name=?]', 'issue[tracker_id]'
assert_select '#display_tracker_description'
assert_select '#trackers_description_dialog'
assert_select 'input[name=?]', 'issue[subject]'
assert_select 'textarea[name=?]', 'issue[description]'
assert_select 'select[name=?]', 'issue[status_id]'
......
assert_select 'input[name=?]', 'issue[is_private]', 0
assert_select 'select[name=?]', 'issue[project_id]', 0
assert_select 'select[name=?]', 'issue[tracker_id]'
assert_select '#display_tracker_description'
assert_select '#trackers_description_dialog'
assert_select 'input[name=?]', 'issue[subject]'
assert_select 'textarea[name=?]', 'issue[description]'
assert_select 'select[name=?]', 'issue[status_id]'
......
assert_select 'form#issue-form[action=?]', '/issues'
assert_select 'form#issue-form' do
assert_select 'select[name=?]', 'issue[project_id]'
assert_select '#display_tracker_description'
assert_select '#trackers_description_dialog'
end
end
......
assert_select 'option[value="1"]'
assert_select 'option[value="3"]'
end
# tracker description dialog has the same numbers of tracker.
assert_select '#trackers_description_dialog table tr', 2
end
def test_new_should_default_to_first_tracker
......
assert_select 'option', 3
assert_select 'option[value="1"][selected=selected]'
end
assert_select '#display_tracker_description'
# tracker description dialog has the same numbers of tracker.
assert_select '#trackers_description_dialog table tr', 3
end
def test_new_with_parent_issue_id_should_default_to_first_tracker_without_disabled_parent_field
......
assert_select 'option[value="2"][selected=selected]'
assert_select 'option[value="1"]', 0
end
assert_select '#display_tracker_description'
assert_select '#trackers_description_dialog table tr[name="1"]', 0
end
def test_new_without_allowed_trackers_should_respond_with_403
test/integration/api_test/trackers_test.rb (working copy)
assert_select 'trackers[type=array] tracker id', :text => '2' do
assert_select '~ name', :text => 'Feature request'
assert_select '~ description', :text => 'Description for Feature request tracker'
end
end
end
test/integration/issues_test.rb (working copy)
assert_select 'option[value=?]', tester.id.to_s, :text => tester.name
end
assert_select '#display_tracker_description'
assert_select '#trackers_description_dialog'
# Create issue
issue = new_record(Issue) do
post '/projects/ecookbook/issues',
test/ui/tracker_description_test_ui.rb (working copy)
require File.expand_path('../base', __FILE__)
class Redmine::UiTest::TrackerDescriptionTest < Redmine::UiTest::Base
fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles,
:trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
:enumerations
def test_tracker_descriptions_on_project_overview
log_user('jsmith', 'jsmith')
visit '/projects/ecookbook'
within('div.issues.box > table') do
within('tr:nth-child(1) td.name') do
assert_selector(:css, '.tooltip_body', visible: false)
find('div > a').hover
assert_selector(:css, '.tooltip_body')
end
end
end
def test_tracker_descriptions_on_project_setting
log_user('admin', 'admin')
visit '/projects/ecookbook/settings'
within('#project_trackers') do
within('label:nth-child(2)') do
assert_selector(:css, '.tooltip_body', visible: false)
find("input[type='checkbox']").hover
assert_selector(:css, '.tooltip_body')
end
end
end
# Test for Tracker Description
def test_tracker_description_dialog
log_user('jsmith', 'jsmith')
visit '/projects/ecookbook/issues/new'
tracker_count = page.all('#issue_tracker_id option').size
within('form#issue-form') do
assert_selector(:css, '#trackers_description_dialog', visible: :hidden)
find('#display_tracker_description').click
end
assert_selector(:css, '#trackers_description_dialog')
# dialog has the same number of table rows to tracker_id pulldown.
within('#trackers_description_dialog') do
assert page.has_css?('table tbody tr', count: tracker_count)
assert page.has_css?("tr[name='3']")
find("tr[name='2'] td a.icon-test").click
end
assert_equal find('#issue_tracker_id').value, '2'
end
end
test/unit/tracker_test.rb (working copy)
end
end
end
def test_tracker_should_have_description
tracker = Tracker.find(1)
assert tracker.respond_to?(:description)
assert_equal tracker.description, "Description for Bug tracker"
end
end
(12-12/12)