summaryrefslogtreecommitdiffstats
path: root/test/system
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-03-22 07:03:19 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-03-22 07:03:19 +0000
commit30d91c85036132b3524845fee4746ae014c293d4 (patch)
treeb8149e62d1826d031ba7309d149b082b8fd882f1 /test/system
parent2e86acfa8742651c47fe5719c6d458299a428003 (diff)
downloadredmine-30d91c85036132b3524845fee4746ae014c293d4.tar.gz
redmine-30d91c85036132b3524845fee4746ae014c293d4.zip
Fix that Log time and/or Add notes sections from issue form page do not show or hide dynamically based on user permission (#34641).
git-svn-id: https://svn.redmine.org/redmine/trunk@21495 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/system')
-rw-r--r--test/system/issues_test.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb
index 4d0486088..935470e1a 100644
--- a/test/system/issues_test.rb
+++ b/test/system/issues_test.rb
@@ -587,4 +587,41 @@ class IssuesSystemTest < ApplicationSystemTestCase
assert page.has_text? 'Related to Bug #7'
end
end
+
+ def test_update_issue_form_should_include_time_entry_form_only_for_users_with_permission
+ log_user('jsmith', 'jsmith')
+
+ visit '/issues/2'
+ page.first(:link, 'Edit').click
+
+ # assert log time form exits for user with required permissions on the current project
+ assert page.has_css?('#log_time')
+
+ # Change project to trigger an update on issue form
+ page.find('#issue_project_id').select('» Private child of eCookbook')
+ wait_for_ajax
+
+ # assert log time form does not exist anymore for user without required permissions on the new project
+ assert_not page.has_css?('#log_time')
+ end
+
+ def test_update_issue_form_should_include_add_notes_form_only_for_users_with_permission
+ log_user('jsmith', 'jsmith')
+
+ visit '/issues/2'
+ page.first(:link, 'Edit').click
+
+ # assert add notes form exits for user with required permissions on the current project
+ assert page.has_css?('#add_notes')
+
+ # remove add issue notes permission from Manager role
+ Role.find_by_name('Manager').remove_permission! :add_issue_notes
+
+ # Change project to trigger an update on issue form
+ page.find('#issue_project_id').select('» Private child of eCookbook')
+ wait_for_ajax
+
+ # assert add notes form does not exist anymore for user without required permissions on the new project
+ assert_not page.has_css?('#add_notes')
+ end
end