DEV: Fix bookmark system spec flaky (#22630)

1) Bookmarking posts and topics topic level bookmarks clears all topic bookmarks from the topic bookmark button if more than one post is bookmarked
     Failure/Error: expect(Bookmark.where(user: current_user).count).to eq(0)

       expected: 0
            got: 2
This commit is contained in:
Martin Brennan 2023-07-17 15:34:11 +10:00 committed by GitHub
parent 37fd05af4e
commit b2ff00cc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -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