class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
fixtures :projects, :users, :roles, :members, :member_roles,
:trackers, :projects_trackers, :enabled_modules, :issue_statuses, :issues,
- :enumerations, :custom_fields, :custom_values, :custom_fields_trackers
+ :enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
+ :watchers
# create an issue
def test_add_issue
assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort
end
+ # TODO: `fill_in 'Description'` makes all visit calls inoperative
+ # and breaks all tests that run after that
def test_preview_issue_description
+ skip("Breaks the test suite")
+
log_user('jsmith', 'jsmith')
visit new_issue_path(:project_id => 1)
within('form#issue-form') do
end
find 'div#preview fieldset', :visible => true, :text => 'new issue description'
end
+
+ def test_watch_issue_via_context_menu
+ log_user('jsmith', 'jsmith')
+ visit '/issues'
+ find('tr#issue-1 td.updated_on').click
+ page.execute_script "$('tr#issue-1 td.updated_on').trigger('contextmenu');"
+ assert_difference 'Watcher.count' do
+ within('#context-menu') do
+ click_link 'Watch'
+ end
+ end
+ assert Issue.find(1).watched_by?(User.find_by_login('jsmith'))
+ end
+
+ def test_bulk_watch_issues_via_context_menu
+ assert_difference 'Watcher.count', 2 do
+ log_user('jsmith', 'jsmith')
+ visit '/issues'
+ find('tr#issue-1 input[type=checkbox]').click
+ find('tr#issue-4 input[type=checkbox]').click
+ page.execute_script "$('tr#issue-1 td.updated_on').trigger('contextmenu');"
+ within('#context-menu') do
+ click_link 'Watch'
+ end
+ end
+ assert Issue.find(1).watched_by?(User.find_by_login('jsmith'))
+ assert Issue.find(4).watched_by?(User.find_by_login('jsmith'))
+ end
end