lib/capybara/node/finders.rb in capybara-3.3.1 vs lib/capybara/node/finders.rb in capybara-3.4.0
- old
+ new
@@ -87,11 +87,11 @@
##
#
# Find a form field on the page. The field can be found by its name, id or label text.
#
# @overload find_field([locator], **options)
- # @param [String] locator name, id, placeholder or text of associated label element
+ # @param [String] locator name, id, Capybara.test_id attribute, placeholder or text of associated label element
#
# @macro waiting_behavior
#
#
# @option options [Boolean] checked Match checked field?
@@ -118,11 +118,11 @@
##
#
# Find a link on the page. The link can be found by its id or text.
#
# @overload find_link([locator], **options)
- # @param [String] locator id, title, text, or alt of enclosed img element
+ # @param [String] locator id, Capybara.test_id attribute, title, text, or alt of enclosed img element
#
# @macro waiting_behavior
#
# @option options [String,Regexp,nil] href Value to match against the links href, if nil finds link placeholders (<a> elements with no href attribute)
# @option options [String] id Match links with the id provided
@@ -137,15 +137,15 @@
##
#
# Find a button on the page.
# This can be any \<input> element of type submit, reset, image, button or it can be a
- # \<button> element. All buttons can be found by their id, value, or title. \<button> elements can also be found
+ # \<button> element. All buttons can be found by their id, Capbyara.test_id attribute, value, or title. \<button> elements can also be found
# by their text content, and image \<input> elements by their alt attribute
#
# @overload find_button([locator], **options)
- # @param [String] locator id, value, title, text content, alt of image
+ # @param [String] locator id, Capybara.test_id attribute, value, title, text content, alt of image
#
# @overload find_button(**options)
#
# @macro waiting_behavior
#
@@ -288,11 +288,11 @@
result = query.resolve_for(self, false) if result.empty? && query.supports_exact? && !query.exact?
else
result = query.resolve_for(self)
end
- raise Capybara::Ambiguous, "Ambiguous match, found #{result.size} elements matching #{query.description}" if ambiguous?(query, result)
- raise Capybara::ElementNotFound, "Unable to find #{query.description}" if result.empty?
+ raise Capybara::Ambiguous, "Ambiguous match, found #{result.size} elements matching #{query.applied_description}" if ambiguous?(query, result)
+ raise Capybara::ElementNotFound, "Unable to find #{query.applied_description}" if result.empty?
result.first
end.tap(&:allow_reload!)
end