From eed4954f0a43883b4ced7aa32f152538816b8d96 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 Feb 2013 21:28:29 +0000 Subject: [PATCH] Submit the form after preview. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11348 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/ui/issues_test.rb | 46 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/test/ui/issues_test.rb b/test/ui/issues_test.rb index 27de63a96..b0243bfda 100644 --- a/test/ui/issues_test.rb +++ b/test/ui/issues_test.rb @@ -23,10 +23,9 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base :enumerations, :custom_fields, :custom_values, :custom_fields_trackers, :watchers - # create an issue - def test_add_issue + def test_create_issue log_user('jsmith', 'jsmith') - visit new_issue_path(:project_id => 1) + visit '/projects/ecookbook/issues/new' within('form#issue-form') do select 'Bug', :from => 'Tracker' select 'Low', :from => 'Priority' @@ -60,21 +59,21 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base def test_create_issue_with_watchers 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 - 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 end @@ -82,18 +81,21 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base 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) + visit '/projects/ecookbook/issues/new' within('form#issue-form') do + fill_in 'Subject', :with => 'new issue subject' fill_in 'Description', :with => 'new issue description' click_link 'Preview' end 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 def test_watch_issue_via_context_menu -- 2.39.5