X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0931f474836d12d24a11564e77dcb1bb69b170dc..HEAD:/test/system/resolve_note_test.rb diff --git a/test/system/resolve_note_test.rb b/test/system/resolve_note_test.rb index 90990dcbd..f9c28a999 100644 --- a/test/system/resolve_note_test.rb +++ b/test/system/resolve_note_test.rb @@ -9,6 +9,7 @@ class ResolveNoteTest < ApplicationSystemTestCase within_sidebar do assert_button "Resolve" + assert_no_button "Comment & Resolve" assert_no_button "Reactivate" click_on "Resolve" @@ -17,6 +18,28 @@ class ResolveNoteTest < ApplicationSystemTestCase end end + test "can resolve an open note with a comment" do + note = create(:note_with_comments) + user = create(:user) + sign_in_as(user) + visit note_path(note) + + within_sidebar do + assert_button "Resolve" + assert_no_button "Comment & Resolve" + assert_no_button "Reactivate" + + fill_in "text", :with => "Note resolve text" + + assert_button "Comment & Resolve" + + click_on "Comment & Resolve" + + assert_content "Resolved note ##{note.id}" + assert_content "Note resolve text" + end + end + test "can reactivate a closed note" do note = create(:note_with_comments, :closed) user = create(:user) @@ -25,6 +48,7 @@ class ResolveNoteTest < ApplicationSystemTestCase within_sidebar do assert_no_button "Resolve" + assert_no_button "Comment & Resolve" assert_button "Reactivate" click_on "Reactivate" @@ -33,4 +57,81 @@ class ResolveNoteTest < ApplicationSystemTestCase assert_no_content " user) + + within_sidebar do + assert_text "Unresolved note" + assert_no_text "Resolved note" + assert_no_text "Your access to the API has been blocked" + assert_button "Resolve", :disabled => false + assert_button "Comment", :disabled => true + + click_on "Resolve" + + assert_text "Unresolved note" + assert_no_text "Resolved note" + assert_text "Your access to the API has been blocked" + assert_button "Resolve", :disabled => false + assert_button "Comment", :disabled => true + end + end + + test "can't reactivate a note when blocked" do + note = create(:note_with_comments, :closed) + user = create(:user) + sign_in_as(user) + visit note_path(note) + create(:user_block, :user => user) + + within_sidebar do + assert_no_text "Unresolved note" + assert_text "Resolved note" + assert_no_text "Your access to the API has been blocked" + assert_button "Reactivate", :disabled => false + + click_on "Reactivate" + + assert_no_text "Unresolved note" + assert_text "Resolved note" + assert_text "Your access to the API has been blocked" + assert_button "Reactivate", :disabled => false + end + end end