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
92 test "can't resolve a note when blocked" do
93 note = create(:note_with_comments)
97 create(:user_block, :user => user)
100 assert_text "Unresolved note"
101 assert_no_text "Resolved note"
102 assert_no_text "Your access to the API has been blocked"
103 assert_button "Resolve", :disabled => false
104 assert_button "Comment", :disabled => true
108 assert_text "Unresolved note"
109 assert_no_text "Resolved note"
110 assert_text "Your access to the API has been blocked"
111 assert_button "Resolve", :disabled => false
112 assert_button "Comment", :disabled => true
116 test "can't reactivate a note when blocked" do
117 note = create(:note_with_comments, :closed)
120 visit note_path(note)
121 create(:user_block, :user => user)
124 assert_no_text "Unresolved note"
125 assert_text "Resolved note"
126 assert_no_text "Your access to the API has been blocked"
127 assert_button "Reactivate", :disabled => false
129 click_on "Reactivate"
131 assert_no_text "Unresolved note"
132 assert_text "Resolved note"
133 assert_text "Your access to the API has been blocked"
134 assert_button "Reactivate", :disabled => false