1 require "application_system_test_case"
3 class ResolveNoteTest < ApplicationSystemTestCase
4 test "can resolve an open note" do
5 note = create(:note_with_comments)
11 assert_button "Resolve"
12 assert_no_button "Comment & Resolve"
13 assert_no_button "Reactivate"
17 assert_content "Resolved note ##{note.id}"
21 test "can resolve an open note with a comment" do
22 note = create(:note_with_comments)
28 assert_button "Resolve"
29 assert_no_button "Comment & Resolve"
30 assert_no_button "Reactivate"
32 fill_in "text", :with => "Note resolve text"
34 assert_button "Comment & Resolve"
36 click_on "Comment & Resolve"
38 assert_content "Resolved note ##{note.id}"
39 assert_content "Note resolve text"
43 test "can reactivate a closed note" do
44 note = create(:note_with_comments, :closed)
50 assert_no_button "Resolve"
51 assert_no_button "Comment & Resolve"
52 assert_button "Reactivate"
56 assert_content "Unresolved note ##{note.id}"
57 assert_no_content "<iframe" # leak from share textarea
61 test "can hide an open note as moderator" do
62 note = create(:note_with_comments)
63 user = create(:moderator_user)
72 assert_content "Hidden note ##{note.id}"
76 test "can hide a closed note as moderator" do
77 note = create(:note_with_comments, :closed)
78 user = create(:moderator_user)
87 assert_content "Hidden note ##{note.id}"
88 assert_no_content "<iframe" # leak from share textarea
89 assert_no_content "undefined" # value from missing comment textarea
93 test "can't resolve a note when blocked" do
94 note = create(:note_with_comments)
98 create(:user_block, :user => user)
101 assert_text "Unresolved note"
102 assert_no_text "Resolved note"
103 assert_no_text "Your access to the API has been blocked"
104 assert_button "Resolve", :disabled => false
105 assert_button "Comment", :disabled => true
109 assert_text "Unresolved note"
110 assert_no_text "Resolved note"
111 assert_text "Your access to the API has been blocked"
112 assert_button "Resolve", :disabled => false
113 assert_button "Comment", :disabled => true
117 test "can't reactivate a note when blocked" do
118 note = create(:note_with_comments, :closed)
121 visit note_path(note)
122 create(:user_block, :user => user)
125 assert_no_text "Unresolved note"
126 assert_text "Resolved note"
127 assert_no_text "Your access to the API has been blocked"
128 assert_button "Reactivate", :disabled => false
130 click_on "Reactivate"
132 assert_no_text "Unresolved note"
133 assert_text "Resolved note"
134 assert_text "Your access to the API has been blocked"
135 assert_button "Reactivate", :disabled => false