2024-05-29 12:39:58 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe "Admin Flags Page", type: :system do
|
|
|
|
fab!(:admin)
|
|
|
|
fab!(:topic)
|
|
|
|
fab!(:post) { Fabricate(:post, topic: topic) }
|
|
|
|
|
|
|
|
let(:topic_page) { PageObjects::Pages::Topic.new }
|
|
|
|
let(:admin_flags_page) { PageObjects::Pages::AdminFlags.new }
|
|
|
|
|
|
|
|
before { sign_in(admin) }
|
|
|
|
|
|
|
|
it "allows admin to disable flags" do
|
|
|
|
topic_page.visit_topic(post.topic)
|
|
|
|
topic_page.open_flag_topic_modal
|
|
|
|
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
|
|
|
|
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
|
|
|
|
)
|
|
|
|
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
admin_flags_page.toggle("spam")
|
|
|
|
|
|
|
|
topic_page.visit_topic(post.topic)
|
|
|
|
topic_page.open_flag_topic_modal
|
|
|
|
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
|
|
|
|
["Something Else", "It's Inappropriate", "It's Illegal"],
|
|
|
|
)
|
|
|
|
end
|
2024-06-05 11:27:06 +08:00
|
|
|
|
|
|
|
it "allows admin to change order of flags" do
|
|
|
|
topic_page.visit_topic(post.topic)
|
|
|
|
topic_page.open_flag_topic_modal
|
|
|
|
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
|
|
|
|
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
|
|
|
|
)
|
|
|
|
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
admin_flags_page.move_down("spam")
|
|
|
|
|
|
|
|
topic_page.visit_topic(post.topic)
|
|
|
|
topic_page.open_flag_topic_modal
|
|
|
|
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
|
|
|
|
["Something Else", "It's Inappropriate", "It's Illegal", "It's Spam"],
|
|
|
|
)
|
|
|
|
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
admin_flags_page.move_up("spam")
|
|
|
|
|
|
|
|
topic_page.visit_topic(post.topic)
|
|
|
|
topic_page.open_flag_topic_modal
|
|
|
|
expect(all(".flag-action-type-details strong").map(&:text)).to eq(
|
|
|
|
["Something Else", "It's Inappropriate", "It's Spam", "It's Illegal"],
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not allow to move notify user flag" do
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
expect(page).not_to have_css(".notify_user .flag-menu-trigger")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not allow bottom flag to move down" do
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
admin_flags_page.open_flag_menu("illegal")
|
|
|
|
expect(page).not_to have_css(".dropdown-menu__item .move-down")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not allow top flag to move up" do
|
|
|
|
visit "/admin/config/flags"
|
|
|
|
admin_flags_page.open_flag_menu("notify_moderators")
|
|
|
|
expect(page).not_to have_css(".dropdown-menu__item .move-up")
|
|
|
|
end
|
2024-05-29 12:39:58 +08:00
|
|
|
end
|