A platform for community discussion. Free, open, simple.
DEV: Change `have_section_link` match to use exact text match. (#22148)
Alan Guo Xiang Tand60c90aef159
diff --git a/spec/system/custom_sidebar_sections_spec.rb b/spec/system/custom_sidebar_sections_spec.rbindex 0492b823f2d..18c49d14040 100644--- a/spec/system/custom_sidebar_sections_spec.rb+++ b/spec/system/custom_sidebar_sections_spec.rb@@ -99,7 +99,7 @@ describe "Custom sidebar sections", type: :system dosection_modal.saveexpect(sidebar).to have_section("Edited section")- expect(sidebar).to have_section_link("Edited Tag")+ expect(sidebar).to have_section_link("Edited Tags")expect(sidebar).to have_no_section_link("Sidebar Categories")enddiff --git a/spec/system/page_objects/components/sidebar.rb b/spec/system/page_objects/components/sidebar.rbindex a8685200806..31a73dcee4b 100644--- a/spec/system/page_objects/components/sidebar.rb+++ b/spec/system/page_objects/components/sidebar.rb@@ -88,11 +88,11 @@ module PageObjectsprivatedef section_link_present?(name, href: nil, active: false, present:)- attributes = {}+ attributes = { exact_text: name }attributes[:href] = href if hrefattributes[:class] = SIDEBAR_SECTION_LINK_SELECTORattributes[:class] += "--active" if active- page.public_send(present ? :has_link? : :has_no_link?, name, **attributes)+ page.public_send(present ? :has_link? : :has_no_link?, **attributes)enddef add_section_button_text