Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix bookmark system spec flaky (#22630)

Martin Brennanb2ff00cc74a9
diff --git a/spec/system/bookmarks_spec.rb b/spec/system/bookmarks_spec.rb
index a16eb786b1d..732b130c9d1 100644
--- a/spec/system/bookmarks_spec.rb
+++ b/spec/system/bookmarks_spec.rb
@@ -108,6 +108,7 @@ describe "Bookmarking posts and topics", type: :system do
expect(dialog).to have_content(I18n.t("js.bookmarks.confirm_clear"))
dialog.click_yes
expect(dialog).to be_closed
+ expect(topic_page).to have_no_bookmarks
expect(Bookmark.where(user: current_user).count).to eq(0)
end
end
diff --git a/spec/system/page_objects/pages/topic.rb b/spec/system/page_objects/pages/topic.rb
index 15b7e23c926..b791f537922 100644
--- a/spec/system/page_objects/pages/topic.rb
+++ b/spec/system/page_objects/pages/topic.rb
@@ -88,6 +88,10 @@ module PageObjects
has_css?("#{topic_footer_button_id("bookmark")}.bookmarked", text: "Edit Bookmark")
end
+ def has_no_bookmarks?
+ has_no_css?("#{topic_footer_button_id("bookmark")}.bookmarked")
+ end
+
def find_topic_footer_button(button)
find(topic_footer_button_id(button))
end