Submit the form after preview.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11348 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-10 21:28:29 +00:00
parent 0df1b9b1a4
commit eed4954f0a
1 changed files with 24 additions and 22 deletions

View File

@ -23,10 +23,9 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
:enumerations, :custom_fields, :custom_values, :custom_fields_trackers, :enumerations, :custom_fields, :custom_values, :custom_fields_trackers,
:watchers :watchers
# create an issue def test_create_issue
def test_add_issue
log_user('jsmith', 'jsmith') log_user('jsmith', 'jsmith')
visit new_issue_path(:project_id => 1) visit '/projects/ecookbook/issues/new'
within('form#issue-form') do within('form#issue-form') do
select 'Bug', :from => 'Tracker' select 'Bug', :from => 'Tracker'
select 'Low', :from => 'Priority' select 'Low', :from => 'Priority'
@ -60,21 +59,21 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
def test_create_issue_with_watchers def test_create_issue_with_watchers
User.generate!(:firstname => 'Some', :lastname => 'Watcher') User.generate!(:firstname => 'Some', :lastname => 'Watcher')
log_user('jsmith', 'jsmith')
visit '/projects/ecookbook/issues/new'
fill_in 'Subject', :with => 'Issue with watchers'
# Add a project member as watcher
check 'Dave Lopper'
# Search for another user
click_link 'Search for watchers to add'
within('form#new-watcher-form') do
assert page.has_content?('Some One')
fill_in 'user_search', :with => 'watch'
assert page.has_no_content?('Some One')
check 'Some Watcher'
click_button 'Add'
end
assert_difference 'Issue.count' do assert_difference 'Issue.count' do
log_user('jsmith', 'jsmith')
visit '/projects/ecookbook/issues/new'
fill_in 'Subject', :with => 'Issue with watchers'
# Add a project member as watcher
check 'Dave Lopper'
# Search for another user
click_link 'Search for watchers to add'
within('form#new-watcher-form') do
assert page.has_content?('Some One')
fill_in 'user_search', :with => 'watch'
assert page.has_no_content?('Some One')
check 'Some Watcher'
click_button 'Add'
end
find('input[name=commit]').click find('input[name=commit]').click
end end
@ -82,18 +81,21 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort
end end
# TODO: `fill_in 'Description'` makes all visit calls inoperative
# and breaks all tests that run after that
def test_preview_issue_description def test_preview_issue_description
skip("Breaks the test suite")
log_user('jsmith', 'jsmith') log_user('jsmith', 'jsmith')
visit new_issue_path(:project_id => 1) visit '/projects/ecookbook/issues/new'
within('form#issue-form') do within('form#issue-form') do
fill_in 'Subject', :with => 'new issue subject'
fill_in 'Description', :with => 'new issue description' fill_in 'Description', :with => 'new issue description'
click_link 'Preview' click_link 'Preview'
end end
find 'div#preview fieldset', :visible => true, :text => 'new issue description' find 'div#preview fieldset', :visible => true, :text => 'new issue description'
assert_difference 'Issue.count' do
find('input[name=commit]').click
end
issue = Issue.order('id desc').first
assert_equal 'new issue description', issue.description
end end
def test_watch_issue_via_context_menu def test_watch_issue_via_context_menu