DEV: Fix flaky edit nav menu tags system test (#22424)
Previously , the test was flaky and failing with a selenium stale element error because we were retrieving the tag nodes with `all` and then calling `.map(&:text)` on it. However, there is a chance that a re-render happens and those nodes will end up being stale resulting in the selenium error.
This commit is contained in:
parent
865f7a9852
commit
631089a4b0
|
@ -151,7 +151,7 @@ RSpec.describe "Editing sidebar tags navigation", type: :system do
|
||||||
expect(sidebar).to have_no_section_link(tag4.name)
|
expect(sidebar).to have_no_section_link(tag4.name)
|
||||||
end
|
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: tag1, user: user)
|
||||||
Fabricate(:tag_sidebar_section_link, linkable: tag2, user: user)
|
Fabricate(:tag_sidebar_section_link, linkable: tag2, user: user)
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,9 @@ module PageObjects
|
||||||
module Modals
|
module Modals
|
||||||
class SidebarEditTags < SidebarEditNavigationModal
|
class SidebarEditTags < SidebarEditNavigationModal
|
||||||
def has_tag_checkboxes?(tags)
|
def has_tag_checkboxes?(tags)
|
||||||
tag_checkboxes =
|
find(".sidebar-tags-form").has_content?(
|
||||||
all(".sidebar-tags-form .sidebar-tags-form__tag-label-name", count: tags.length)
|
tags.map { |tag| "#{tag.name} (#{tag.public_topic_count})" }.join("\n"),
|
||||||
|
)
|
||||||
expect(tag_checkboxes.map(&:text)).to eq(tags.map(&:name))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_no_tag_checkboxes?
|
def has_no_tag_checkboxes?
|
||||||
|
|
Loading…
Reference in New Issue