Skip to content

Commit

Permalink
Support symbols as test ids consistently (#2758)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzane committed Apr 12, 2024
1 parent 1ace1d7 commit edc0397
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/capybara/selector/definition/frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selector/definition/label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/capybara/selector/definition/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit edc0397

Please sign in to comment.