Skip to content

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

DEV: Fix flaky edit nav menu tags system test (#22424)

Alan Guo Xiang Tan631089a4b043
diff --git a/spec/system/editing_sidebar_tags_navigation_spec.rb b/spec/system/editing_sidebar_tags_navigation_spec.rb
index 172ab2b2041..3111dc8c922 100644
--- a/spec/system/editing_sidebar_tags_navigation_spec.rb
+++ b/spec/system/editing_sidebar_tags_navigation_spec.rb
@@ -151,7 +151,7 @@ RSpec.describe "Editing sidebar tags navigation", type: :system do
expect(sidebar).to have_no_section_link(tag4.name)
end
- xit "allows a user to filter the tag in the modal by selection" do
+ it "allows a user to filter the tag in the modal by selection" do
Fabricate(:tag_sidebar_section_link, linkable: tag1, user: user)
Fabricate(:tag_sidebar_section_link, linkable: tag2, user: user)
diff --git a/spec/system/page_objects/modals/sidebar_edit_tags.rb b/spec/system/page_objects/modals/sidebar_edit_tags.rb
index ba351fc0e03..e99f13844c7 100644
--- a/spec/system/page_objects/modals/sidebar_edit_tags.rb
+++ b/spec/system/page_objects/modals/sidebar_edit_tags.rb
@@ -6,10 +6,9 @@ module PageObjects
module Modals
class SidebarEditTags < SidebarEditNavigationModal
def has_tag_checkboxes?(tags)
- tag_checkboxes =
- all(".sidebar-tags-form .sidebar-tags-form__tag-label-name", count: tags.length)
-
- expect(tag_checkboxes.map(&:text)).to eq(tags.map(&:name))
+ find(".sidebar-tags-form").has_content?(
+ tags.map { |tag| "#{tag.name} (#{tag.public_topic_count})" }.join("\n"),
+ )
end
def has_no_tag_checkboxes?