From edc0397f2cd97c050c77d64f8e4a79bbeba6117a Mon Sep 17 00:00:00 2001 From: Ray Zane Date: Thu, 11 Apr 2024 21:27:12 -0400 Subject: [PATCH] Support symbols as test ids consistently (#2758) --- lib/capybara/selector/definition/frame.rb | 2 +- lib/capybara/selector/definition/label.rb | 2 +- lib/capybara/selector/definition/table.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/capybara/selector/definition/frame.rb b/lib/capybara/selector/definition/frame.rb index 70649b40e..f5e26639d 100644 --- a/lib/capybara/selector/definition/frame.rb +++ b/lib/capybara/selector/definition/frame.rb @@ -5,7 +5,7 @@ xpath = XPath.descendant(:iframe).union(XPath.descendant(:frame)) unless locator.nil? locator_matchers = (XPath.attr(:id) == locator.to_s) | (XPath.attr(:name) == locator.to_s) - locator_matchers |= XPath.attr(test_id) == locator if test_id + locator_matchers |= XPath.attr(test_id) == locator.to_s if test_id xpath = xpath[locator_matchers] end xpath[find_by_attr(:name, name)] diff --git a/lib/capybara/selector/definition/label.rb b/lib/capybara/selector/definition/label.rb index ff6d764e2..bd3baff0d 100644 --- a/lib/capybara/selector/definition/label.rb +++ b/lib/capybara/selector/definition/label.rb @@ -6,7 +6,7 @@ xpath = XPath.descendant(:label) unless locator.nil? locator_matchers = XPath.string.n.is(locator.to_s) | (XPath.attr(:id) == locator.to_s) - locator_matchers |= XPath.attr(test_id) == locator if test_id + locator_matchers |= XPath.attr(test_id) == locator.to_s if test_id xpath = xpath[locator_matchers] end if options.key?(:for) diff --git a/lib/capybara/selector/definition/table.rb b/lib/capybara/selector/definition/table.rb index b93f4812f..d5d41888a 100644 --- a/lib/capybara/selector/definition/table.rb +++ b/lib/capybara/selector/definition/table.rb @@ -5,7 +5,7 @@ xpath = XPath.descendant(:table) unless locator.nil? locator_matchers = (XPath.attr(:id) == locator.to_s) | XPath.descendant(:caption).is(locator.to_s) - locator_matchers |= XPath.attr(test_id) == locator if test_id + locator_matchers |= XPath.attr(test_id) == locator.to_s if test_id xpath = xpath[locator_matchers] end xpath = xpath[XPath.descendant(:caption) == caption] if caption