diff --git a/spec/system/admin_flags_spec.rb b/spec/system/admin_flags_spec.rb index faf984b6ceb..a7a916d0b9c 100644 --- a/spec/system/admin_flags_spec.rb +++ b/spec/system/admin_flags_spec.rb @@ -12,7 +12,8 @@ describe "Admin Flags Page", type: :system do before { sign_in(admin) } - it "allows admin to disable flags" do + it "allows admin to disable, change order, create, update and delete flags" do + # disable topic_page.visit_topic(post.topic) topic_page.open_flag_topic_modal expect(all(".flag-action-type-details strong").map(&:text)).to eq( @@ -30,9 +31,8 @@ describe "Admin Flags Page", type: :system do ) Flag.system.where(name: "spam").update!(enabled: true) - end - it "allows admin to change order of flags" do + # change order topic_page.visit_topic(post.topic) topic_page.open_flag_topic_modal expect(all(".flag-action-type-details strong").map(&:text)).to eq( @@ -58,9 +58,8 @@ describe "Admin Flags Page", type: :system do expect(all(".flag-action-type-details strong").map(&:text)).to eq( ["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else"], ) - end - it "allows admin to create, edit and delete flags" do + # create topic_page.visit_topic(post.topic) topic_page.open_flag_topic_modal expect(all(".flag-action-type-details strong").map(&:text)).to eq( @@ -97,6 +96,7 @@ describe "Admin Flags Page", type: :system do ["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else", "Vulgar"], ) + # update visit "/admin/config/flags" admin_flags_page.click_edit_flag("vulgar") @@ -104,12 +104,25 @@ describe "Admin Flags Page", type: :system do admin_flag_form_page.fill_in_name("Tasteless") admin_flag_form_page.click_save + expect(all(".admin-flag-item__name").map(&:text)).to eq( + [ + "Send @%{username} a message", + "Off-Topic", + "Inappropriate", + "Spam", + "Illegal", + "Something Else", + "Tasteless", + ], + ) + topic_page.visit_topic(post.topic) topic_page.open_flag_topic_modal expect(all(".flag-action-type-details strong").map(&:text)).to eq( ["It's Inappropriate", "It's Spam", "It's Illegal", "Something Else", "Tasteless"], ) + # delete visit "/admin/config/flags" admin_flags_page.click_delete_flag("tasteless") admin_flags_page.confirm_delete