From dfd9c9b8d0c99ce023dda28f6f91ed92c1954383 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Wed, 29 Nov 2023 08:16:52 +1000 Subject: [PATCH] DEV: Fix flagging post flaky (#24619) Followup to 91ec3323ddcb46279d211ae34a3982ab7337ba14, remove DB check and check actual UI. --- spec/system/flagging_post_spec.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/system/flagging_post_spec.rb b/spec/system/flagging_post_spec.rb index a0025294e0e..f6c5a9906d4 100644 --- a/spec/system/flagging_post_spec.rb +++ b/spec/system/flagging_post_spec.rb @@ -13,6 +13,8 @@ describe "Flagging post", type: :system do describe "Using Take Action" do it "can select the default action to hide the post, agree with other flags, and reach the flag threshold" do other_flag = Fabricate(:flag, post: post_to_flag, user: Fabricate(:moderator)) + other_flag_reviewable = + Fabricate(:reviewable_flagged_post, target: post_to_flag, created_by: other_flag.user) expect(other_flag.reload.agreed_at).to be_nil topic_page.visit_topic(post_to_flag.topic) topic_page.expand_post_actions(post_to_flag) @@ -24,7 +26,10 @@ describe "Flagging post", type: :system do topic_page.post_by_number(post_to_flag).ancestor(".topic-post.post-hidden"), ).to be_present - try_until_success { expect(other_flag.reload.agreed_at).to be_present } + visit "/review/#{other_flag_reviewable.id}" + + expect(page).to have_content(I18n.t("js.review.statuses.approved_flag.title")) + expect(page).to have_css(".reviewable-meta-data .status .approved") end end end