mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Some documentation fixes
This commit is contained in:
parent
b1f4709c6e
commit
85ebea185f
10 changed files with 76 additions and 76 deletions
|
@ -40,15 +40,15 @@ module Capybara
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
def click(keys = [], options = {})
|
def click(keys = [], **options)
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
def right_click(keys = [], options = {})
|
def right_click(keys = [], **options)
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
def double_click(keys = [], options = {})
|
def double_click(keys = [], **options)
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
# @overload click_button([locator], options)
|
# @overload click_button([locator], **options)
|
||||||
# @param [String] locator Which button to find
|
# @param [String] locator Which button to find
|
||||||
# @param options See {Capybara::Node::Finders#find_button}
|
# @param options See {Capybara::Node::Finders#find_button}
|
||||||
# @return [Capybara::Node::Element] The element clicked
|
# @return [Capybara::Node::Element] The element clicked
|
||||||
|
@ -66,18 +66,18 @@ module Capybara
|
||||||
# page.fill_in 'Name', with: 'Bob'
|
# page.fill_in 'Name', with: 'Bob'
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# @overload fill_in([locator], options={})
|
# @overload fill_in([locator], with:, **options)
|
||||||
# @param [String] locator Which field to fill in
|
# @param [String] locator Which field to fill in
|
||||||
# @param [Hash] options
|
# @param [Hash] options
|
||||||
|
# @param with: [String] The value to fill_in
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
# @option options [String] :with The value to fill in - required
|
# @option options [String] currently_with The current value property of the field to fill in
|
||||||
# @option options [Hash] :fill_options Driver specific options regarding how to fill fields
|
# @option options [Boolean] multiple Match fields that can have multiple values?
|
||||||
# @option options [String] :currently_with The current value property of the field to fill in
|
# @option options [String] id Match fields that match the id attribute
|
||||||
# @option options [Boolean] :multiple Match fields that can have multiple values?
|
# @option options [String] name Match fields that match the name attribute
|
||||||
# @option options [String] :id Match fields that match the id attribute
|
# @option options [String] placeholder Match fields that match the placeholder attribute
|
||||||
# @option options [String] :name Match fields that match the name attribute
|
# @option options [String, Array<String>] class Match fields that match the class(es) provided
|
||||||
# @option options [String] :placeholder Match fields that match the placeholder attribute
|
# @option options [Hash] fill_options Driver specific options regarding how to fill fields
|
||||||
# @option options [String, Array<String>] :class Match fields that match the class(es) provided
|
|
||||||
#
|
#
|
||||||
# @return [Capybara::Node::Element] The element filled_in
|
# @return [Capybara::Node::Element] The element filled_in
|
||||||
def fill_in(locator = nil, with:, fill_options: {}, **options)
|
def fill_in(locator = nil, with:, fill_options: {}, **options)
|
||||||
|
@ -86,7 +86,7 @@ module Capybara
|
||||||
end
|
end
|
||||||
|
|
||||||
# @!macro label_click
|
# @!macro label_click
|
||||||
# @option options [Boolean] :allow_label_click (Capybara.automatic_label_click) Attempt to click the label to toggle state if element is non-visible.
|
# @option options [Boolean] allow_label_click (Capybara.automatic_label_click) Attempt to click the label to toggle state if element is non-visible.
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
|
@ -95,13 +95,13 @@ module Capybara
|
||||||
#
|
#
|
||||||
# page.choose('Male')
|
# page.choose('Male')
|
||||||
#
|
#
|
||||||
# @overload choose([locator], options)
|
# @overload choose([locator], **options)
|
||||||
# @param [String] locator Which radio button to choose
|
# @param [String] locator Which radio button to choose
|
||||||
#
|
#
|
||||||
# @option options [String] :option Value of the radio_button to choose
|
# @option options [String] option Value of the radio_button to choose
|
||||||
# @option options [String] :id Match fields that match the id attribute
|
# @option options [String] id Match fields that match the id attribute
|
||||||
# @option options [String] :name Match fields that match the name attribute
|
# @option options [String] name Match fields that match the name attribute
|
||||||
# @option options [String, Array<String>] :class Match fields that match the class(es) provided
|
# @option options [String, Array<String>] class Match fields that match the class(es) provided
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
# @macro label_click
|
# @macro label_click
|
||||||
#
|
#
|
||||||
|
@ -118,13 +118,13 @@ module Capybara
|
||||||
# page.check('German')
|
# page.check('German')
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# @overload check([locator], options)
|
# @overload check([locator], **options)
|
||||||
# @param [String] locator Which check box to check
|
# @param [String] locator Which check box to check
|
||||||
#
|
#
|
||||||
# @option options [String] :option Value of the checkbox to select
|
# @option options [String] option Value of the checkbox to select
|
||||||
# @option options [String] id Match fields that match the id attribute
|
# @option options [String] id Match fields that match the id attribute
|
||||||
# @option options [String] name Match fields that match the name attribute
|
# @option options [String] name Match fields that match the name attribute
|
||||||
# @option options [String, Array<String>] :class Match fields that match the class(es) provided
|
# @option options [String, Array<String>] class Match fields that match the class(es) provided
|
||||||
# @macro label_click
|
# @macro label_click
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
|
@ -141,13 +141,13 @@ module Capybara
|
||||||
# page.uncheck('German')
|
# page.uncheck('German')
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# @overload uncheck([locator], options)
|
# @overload uncheck([locator], **options)
|
||||||
# @param [String] locator Which check box to uncheck
|
# @param [String] locator Which check box to uncheck
|
||||||
#
|
#
|
||||||
# @option options [String] :option Value of the checkbox to deselect
|
# @option options [String] option Value of the checkbox to deselect
|
||||||
# @option options [String] id Match fields that match the id attribute
|
# @option options [String] id Match fields that match the id attribute
|
||||||
# @option options [String] name Match fields that match the name attribute
|
# @option options [String] name Match fields that match the name attribute
|
||||||
# @option options [String, Array<String>] :class Match fields that match the class(es) provided
|
# @option options [String, Array<String>] class Match fields that match the class(es) provided
|
||||||
# @macro label_click
|
# @macro label_click
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
|
@ -169,8 +169,8 @@ module Capybara
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
# @param [String] value Which option to select
|
# @param value [String] Which option to select
|
||||||
# @option options [String] :from The id, name or label of the select box
|
# @param from: [String] The id, name or label of the select box
|
||||||
#
|
#
|
||||||
# @return [Capybara::Node::Element] The option element selected
|
# @return [Capybara::Node::Element] The option element selected
|
||||||
def select(value = nil, from: nil, **options)
|
def select(value = nil, from: nil, **options)
|
||||||
|
@ -193,8 +193,8 @@ module Capybara
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
# @param [String] value Which option to unselect
|
# @param value [String] Which option to unselect
|
||||||
# @param [Hash{:from => String}] options The id, name or label of the select box
|
# @param from: [String] The id, name or label of the select box
|
||||||
#
|
#
|
||||||
# @return [Capybara::Node::Element] The option element unselected
|
# @return [Capybara::Node::Element] The option element unselected
|
||||||
def unselect(value = nil, from: nil, **options)
|
def unselect(value = nil, from: nil, **options)
|
||||||
|
@ -209,20 +209,21 @@ module Capybara
|
||||||
#
|
#
|
||||||
# page.attach_file(locator, '/path/to/file.png')
|
# page.attach_file(locator, '/path/to/file.png')
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @overload attach_file([locator], path, **options)
|
||||||
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
# @param [String] locator Which field to attach the file to
|
# @param [String] locator Which field to attach the file to
|
||||||
# @param [String] path The path of the file that will be attached, or an array of paths
|
# @param [String] path The path of the file that will be attached, or an array of paths
|
||||||
#
|
#
|
||||||
# @option options [Symbol] match (Capybara.match) The matching strategy to use (:one, :first, :prefer_exact, :smart).
|
# @option options [Symbol] match (Capybara.match) The matching strategy to use (:one, :first, :prefer_exact, :smart).
|
||||||
# @option options [Boolean] exact (Capybara.exact) Match the exact label name/contents or accept a partial match.
|
# @option options [Boolean] exact (Capybara.exact) Match the exact label name/contents or accept a partial match.
|
||||||
# @option options [Boolean] multiple Match field which allows multiple file selection
|
# @option options [Boolean] multiple Match field which allows multiple file selection
|
||||||
# @option options [String] id Match fields that match the id attribute
|
# @option options [String] id Match fields that match the id attribute
|
||||||
# @option options [String] name Match fields that match the name attribute
|
# @option options [String] name Match fields that match the name attribute
|
||||||
# @option options [String, Array<String>] :class Match fields that match the class(es) provided
|
# @option options [String, Array<String>] class Match fields that match the class(es) provided
|
||||||
# @option options [true, Hash] make_visible A Hash of CSS styles to change before attempting to attach the file, if `true` { opacity: 1, display: 'block', visibility: 'visible' } is used (may not be supported by all drivers)
|
# @option options [true, Hash] make_visible A Hash of CSS styles to change before attempting to attach the file, if `true` { opacity: 1, display: 'block', visibility: 'visible' } is used (may not be supported by all drivers)
|
||||||
#
|
#
|
||||||
# @return [Capybara::Node::Element] The file field element
|
# @return [Capybara::Node::Element] The file field element
|
||||||
def attach_file(locator = nil, path, make_visible: nil, **options) # rubocop:disable Style/OptionalArguments
|
def attach_file(locator = nil, path, make_visible: nil, **options) # rubocop:disable Style/OptionalArguments
|
||||||
Array(path).each do |p|
|
Array(path).each do |p|
|
||||||
raise Capybara::FileNotFound, "cannot attach file, #{p} does not exist" unless File.exist?(p.to_s)
|
raise Capybara::FileNotFound, "cannot attach file, #{p} does not exist" unless File.exist?(p.to_s)
|
||||||
|
|
|
@ -7,9 +7,9 @@ module Capybara
|
||||||
# Asserts that the page has the given title.
|
# Asserts that the page has the given title.
|
||||||
#
|
#
|
||||||
# @!macro title_query_params
|
# @!macro title_query_params
|
||||||
# @overload $0(string, options = {})
|
# @overload $0(string, **options)
|
||||||
# @param string [String] The string that title should include
|
# @param string [String] The string that title should include
|
||||||
# @overload $0(regexp, options = {})
|
# @overload $0(regexp, **options)
|
||||||
# @param regexp [Regexp] The regexp that title should match to
|
# @param regexp [Regexp] The regexp that title should match to
|
||||||
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time that Capybara will wait for title to eq/match given string/regexp argument
|
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time that Capybara will wait for title to eq/match given string/regexp argument
|
||||||
# @option options [Boolean] :exact (false) When passed a string should the match be exact or just substring
|
# @option options [Boolean] :exact (false) When passed a string should the match be exact or just substring
|
||||||
|
|
|
@ -50,7 +50,7 @@ module Capybara
|
||||||
# ignored. This behaviour can be overridden by passing `:all` to this
|
# ignored. This behaviour can be overridden by passing `:all` to this
|
||||||
# method.
|
# method.
|
||||||
#
|
#
|
||||||
# @param [:all, :visible] type Whether to return only visible or all text
|
# @param type [:all, :visible] Whether to return only visible or all text
|
||||||
# @return [String] The text of the element
|
# @return [String] The text of the element
|
||||||
#
|
#
|
||||||
def text(type = nil)
|
def text(type = nil)
|
||||||
|
@ -119,9 +119,11 @@ module Capybara
|
||||||
# Click the Element
|
# Click the Element
|
||||||
#
|
#
|
||||||
# @!macro click_modifiers
|
# @!macro click_modifiers
|
||||||
# @overload $0(*key_modifiers=[], offset={x: nil, y: nil})
|
# Both x: and y: must be specified if an offset is wanted, if not specified the click will occur at the middle of the element
|
||||||
# @param [Array<:alt, :control, :meta, :shift>] *key_modifiers Keys to be held down when clicking
|
# @overload $0(*modifier_keys, **offset)
|
||||||
# @param [Hash] offset x and y coordinates to offset the click location from the top left corner of the element. If not specified will click the middle of the element.
|
# @param *modifier_keys [:alt, :control, :meta, :shift] ([]) Keys to be held down when clicking
|
||||||
|
# @option offset [Integer] x X coordinate to offset the click location from the top left corner of the element
|
||||||
|
# @option offset [Integer] y Y coordinate to offset the click location from the top left corner of the element
|
||||||
# @return [Capybara::Node::Element] The element
|
# @return [Capybara::Node::Element] The element
|
||||||
def click(*keys, **offset)
|
def click(*keys, **offset)
|
||||||
synchronize { base.click(keys, offset) }
|
synchronize { base.click(keys, offset) }
|
||||||
|
@ -155,7 +157,7 @@ module Capybara
|
||||||
# Send Keystrokes to the Element
|
# Send Keystrokes to the Element
|
||||||
#
|
#
|
||||||
# @overload send_keys(keys, ...)
|
# @overload send_keys(keys, ...)
|
||||||
# @param [String, Symbol, Array<String,Symbol>] keys
|
# @param keys [String, Symbol, Array<String,Symbol>]
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
#
|
#
|
||||||
|
|
|
@ -88,7 +88,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# Find a form field on the page. The field can be found by its name, id or label text.
|
# Find a form field on the page. The field can be found by its name, id or label text.
|
||||||
#
|
#
|
||||||
# @overload find_field([locator], options={})
|
# @overload find_field([locator], **options)
|
||||||
# @param [String] locator name, id, placeholder or text of associated label element
|
# @param [String] locator name, id, placeholder or text of associated label element
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
|
@ -119,7 +119,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# Find a link on the page. The link can be found by its id or text.
|
# Find a link on the page. The link can be found by its id or text.
|
||||||
#
|
#
|
||||||
# @overload find_link([locator], options={})
|
# @overload find_link([locator], **options)
|
||||||
# @param [String] locator id, title, text, or alt of enclosed img element
|
# @param [String] locator id, title, text, or alt of enclosed img element
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
|
@ -142,10 +142,10 @@ module Capybara
|
||||||
# \<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, value, or title. \<button> elements can also be found
|
||||||
# by their text content, and image \<input> elements by their alt attribute
|
# by their text content, and image \<input> elements by their alt attribute
|
||||||
#
|
#
|
||||||
# @overload find_button([locator], options={})
|
# @overload find_button([locator], **options)
|
||||||
# @param [String] locator id, value, title, text content, alt of image
|
# @param [String] locator id, value, title, text content, alt of image
|
||||||
#
|
#
|
||||||
# @overload find_button(options={})
|
# @overload find_button(**options)
|
||||||
#
|
#
|
||||||
# @macro waiting_behavior
|
# @macro waiting_behavior
|
||||||
#
|
#
|
||||||
|
@ -178,7 +178,7 @@ module Capybara
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# @!method all([kind = Capybara.default_selector], locator = nil, options = {})
|
# @!method all([kind = Capybara.default_selector], locator = nil, **options)
|
||||||
#
|
#
|
||||||
# Find all elements on the page matching the given selector
|
# Find all elements on the page matching the given selector
|
||||||
# and options.
|
# and options.
|
||||||
|
@ -235,8 +235,8 @@ module Capybara
|
||||||
# @option options [Range] between Number of matches found must be within the given range
|
# @option options [Range] between Number of matches found must be within the given range
|
||||||
# @option options [Boolean] exact Control whether `is` expressions in the given XPath match exactly or partially
|
# @option options [Boolean] exact Control whether `is` expressions in the given XPath match exactly or partially
|
||||||
# @option options [Integer, false] wait (Capybara.default_max_wait_time) The time to wait for matching elements to become available
|
# @option options [Integer, false] wait (Capybara.default_max_wait_time) The time to wait for matching elements to become available
|
||||||
# @overload all([kind = Capybara.default_selector], locator = nil, options = {})
|
# @overload all([kind = Capybara.default_selector], locator = nil, **options)
|
||||||
# @overload all([kind = Capybara.default_selector], locator = nil, options = {}, &filter_block)
|
# @overload all([kind = Capybara.default_selector], locator = nil, **options, &filter_block)
|
||||||
# @yieldparam element [Capybara::Node::Element] The element being considered for inclusion in the results
|
# @yieldparam element [Capybara::Node::Element] The element being considered for inclusion in the results
|
||||||
# @yieldreturn [Boolean] Should the element be considered in the results?
|
# @yieldreturn [Boolean] Should the element be considered in the results?
|
||||||
# @return [Capybara::Result] A collection of found elements
|
# @return [Capybara::Result] A collection of found elements
|
||||||
|
|
|
@ -110,7 +110,7 @@ module Capybara
|
||||||
# The :wait option applies to all of the selectors as a group, so all of the locators must be present
|
# The :wait option applies to all of the selectors as a group, so all of the locators must be present
|
||||||
# within :wait (Defaults to Capybara.default_max_wait_time) seconds.
|
# within :wait (Defaults to Capybara.default_max_wait_time) seconds.
|
||||||
#
|
#
|
||||||
# @overload assert_all_of_selectors([kind = Capybara.default_selector], *locators, options = {})
|
# @overload assert_all_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
||||||
#
|
#
|
||||||
def assert_all_of_selectors(*args, wait: nil, **options, &optional_filter_block)
|
def assert_all_of_selectors(*args, wait: nil, **options, &optional_filter_block)
|
||||||
wait = session_options.default_max_wait_time if wait.nil?
|
wait = session_options.default_max_wait_time if wait.nil?
|
||||||
|
@ -135,7 +135,7 @@ module Capybara
|
||||||
# The :wait option applies to all of the selectors as a group, so none of the locators must be present
|
# The :wait option applies to all of the selectors as a group, so none of the locators must be present
|
||||||
# within :wait (Defaults to Capybara.default_max_wait_time) seconds.
|
# within :wait (Defaults to Capybara.default_max_wait_time) seconds.
|
||||||
#
|
#
|
||||||
# @overload assert_none_of_selectors([kind = Capybara.default_selector], *locators, options = {})
|
# @overload assert_none_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
||||||
#
|
#
|
||||||
def assert_none_of_selectors(*args, wait: nil, **options, &optional_filter_block)
|
def assert_none_of_selectors(*args, wait: nil, **options, &optional_filter_block)
|
||||||
wait = session_options.default_max_wait_time if wait.nil?
|
wait = session_options.default_max_wait_time if wait.nil?
|
||||||
|
@ -574,7 +574,7 @@ module Capybara
|
||||||
# ignoring any HTML tags.
|
# ignoring any HTML tags.
|
||||||
#
|
#
|
||||||
# @!macro text_query_params
|
# @!macro text_query_params
|
||||||
# @overload $0(type, text, options = {})
|
# @overload $0(type, text, **options)
|
||||||
# @param [:all, :visible] type Whether to check for only visible or all text. If this parameter is missing or nil then we use the value of `Capybara.ignore_hidden_elements`, which defaults to `true`, corresponding to `:visible`.
|
# @param [:all, :visible] type Whether to check for only visible or all text. If this parameter is missing or nil then we use the value of `Capybara.ignore_hidden_elements`, which defaults to `true`, corresponding to `:visible`.
|
||||||
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
||||||
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
||||||
|
@ -583,7 +583,7 @@ module Capybara
|
||||||
# @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs
|
# @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs
|
||||||
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time that Capybara will wait for text to eq/match given string/regexp argument
|
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time that Capybara will wait for text to eq/match given string/regexp argument
|
||||||
# @option options [Boolean] :exact (Capybara.exact_text) Whether text must be an exact match or just substring
|
# @option options [Boolean] :exact (Capybara.exact_text) Whether text must be an exact match or just substring
|
||||||
# @overload $0(text, options = {})
|
# @overload $0(text, **options)
|
||||||
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
||||||
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
||||||
# @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur
|
# @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Capybara::RackTest::Node < Capybara::Driver::Node
|
||||||
native.remove_attribute('selected')
|
native.remove_attribute('selected')
|
||||||
end
|
end
|
||||||
|
|
||||||
def click(keys = [], offset = {})
|
def click(keys = [], **offset)
|
||||||
raise ArgumentError, "The RackTest driver does not support click options" unless keys.empty? && offset.empty?
|
raise ArgumentError, "The RackTest driver does not support click options" unless keys.empty? && offset.empty?
|
||||||
|
|
||||||
if link?
|
if link?
|
||||||
|
@ -250,5 +250,4 @@ protected
|
||||||
def textarea?
|
def textarea?
|
||||||
tag_name == "textarea"
|
tag_name == "textarea"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,13 +76,13 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
||||||
native.click if selected?
|
native.click if selected?
|
||||||
end
|
end
|
||||||
|
|
||||||
def click(keys = [], options = {})
|
def click(keys = [], **options)
|
||||||
if keys.empty? && !has_coords?(options)
|
if keys.empty? && !coords?(options)
|
||||||
native.click
|
native.click
|
||||||
else
|
else
|
||||||
scroll_if_needed do
|
scroll_if_needed do
|
||||||
action_with_modifiers(keys, options) do |a|
|
action_with_modifiers(keys, options) do |a|
|
||||||
has_coords?(options) ? a.click : a.click(native)
|
coords?(options) ? a.click : a.click(native)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -94,18 +94,18 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
||||||
raise e
|
raise e
|
||||||
end
|
end
|
||||||
|
|
||||||
def right_click(keys = [], options = {})
|
def right_click(keys = [], **options)
|
||||||
scroll_if_needed do
|
scroll_if_needed do
|
||||||
action_with_modifiers(keys, options) do |a|
|
action_with_modifiers(keys, options) do |a|
|
||||||
has_coords?(options) ? a.context_click : a.context_click(native)
|
coords?(options) ? a.context_click : a.context_click(native)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def double_click(keys = [], options = {})
|
def double_click(keys = [], **options)
|
||||||
scroll_if_needed do
|
scroll_if_needed do
|
||||||
action_with_modifiers(keys, options) do |a|
|
action_with_modifiers(keys, options) do |a|
|
||||||
has_coords?(options) ? a.double_click : a.double_click(native)
|
coords?(options) ? a.double_click : a.double_click(native)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -182,7 +182,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def has_coords?(options)
|
def coords?(options)
|
||||||
options[:x] && options[:y]
|
options[:x] && options[:y]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ module Capybara
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# Session provides a number of methods for controlling the navigation of the page, such as +visit+,
|
# Session provides a number of methods for controlling the navigation of the page, such as +visit+,
|
||||||
# +current_path, and so on. It also delegate a number of methods to a Capybara::Document, representing
|
# +current_path, and so on. It also delegates a number of methods to a Capybara::Document, representing
|
||||||
# the current HTML document. This allows interaction:
|
# the current HTML document. This allows interaction:
|
||||||
#
|
#
|
||||||
# session.fill_in('q', with: 'Capybara')
|
# session.fill_in('q', with: 'Capybara')
|
||||||
|
@ -85,8 +85,6 @@ module Capybara
|
||||||
end
|
end
|
||||||
@server = if config.run_server && @app && driver.needs_server?
|
@server = if config.run_server && @app && driver.needs_server?
|
||||||
Capybara::Server.new(@app, port: config.server_port, host: config.server_host, reportable_errors: config.server_errors).boot
|
Capybara::Server.new(@app, port: config.server_port, host: config.server_host, reportable_errors: config.server_errors).boot
|
||||||
else
|
|
||||||
nil
|
|
||||||
end
|
end
|
||||||
@touched = false
|
@touched = false
|
||||||
end
|
end
|
||||||
|
@ -407,7 +405,7 @@ module Capybara
|
||||||
#
|
#
|
||||||
# @overload within_frame(element)
|
# @overload within_frame(element)
|
||||||
# @param [Capybara::Node::Element] frame element
|
# @param [Capybara::Node::Element] frame element
|
||||||
# @overload within_frame([kind = :frame], locator, options = {})
|
# @overload within_frame([kind = :frame], locator, **options)
|
||||||
# @param [Symbol] kind Optional selector type (:css, :xpath, :field, etc.) - Defaults to :frame
|
# @param [Symbol] kind Optional selector type (:css, :xpath, :field, etc.) - Defaults to :frame
|
||||||
# @param [String] locator The locator for the given selector kind. For :frame this is the name/id of a frame/iframe element
|
# @param [String] locator The locator for the given selector kind. For :frame this is the name/id of a frame/iframe element
|
||||||
# @overload within_frame(index)
|
# @overload within_frame(index)
|
||||||
|
@ -605,11 +603,11 @@ module Capybara
|
||||||
# $0 do
|
# $0 do
|
||||||
# click_link('link that triggers appearance of system modal')
|
# click_link('link that triggers appearance of system modal')
|
||||||
# end
|
# end
|
||||||
# @overload $0(text, options = {}, &blk)
|
# @overload $0(text, **options, &blk)
|
||||||
# @param text [String, Regexp] Text or regex to match against the text in the modal. If not provided any modal is matched
|
# @param text [String, Regexp] Text or regex to match against the text in the modal. If not provided any modal is matched
|
||||||
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time to wait for the modal to appear after executing the block.
|
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time to wait for the modal to appear after executing the block.
|
||||||
# @yield Block whose actions will trigger the system modal
|
# @yield Block whose actions will trigger the system modal
|
||||||
# @overload $0(options = {}, &blk)
|
# @overload $0(**options, &blk)
|
||||||
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time to wait for the modal to appear after executing the block.
|
# @option options [Numeric] :wait (Capybara.default_max_wait_time) Maximum time to wait for the modal to appear after executing the block.
|
||||||
# @yield Block whose actions will trigger the system modal
|
# @yield Block whose actions will trigger the system modal
|
||||||
# @return [String] the message shown in the modal
|
# @return [String] the message shown in the modal
|
||||||
|
|
|
@ -9,9 +9,9 @@ module Capybara
|
||||||
# the comparison will depend on the :url option
|
# the comparison will depend on the :url option
|
||||||
#
|
#
|
||||||
# @!macro current_path_query_params
|
# @!macro current_path_query_params
|
||||||
# @overload $0(string, options = {})
|
# @overload $0(string, **options)
|
||||||
# @param string [String] The string that the current 'path' should equal
|
# @param string [String] The string that the current 'path' should equal
|
||||||
# @overload $0(regexp, options = {})
|
# @overload $0(regexp, **options)
|
||||||
# @param regexp [Regexp] The regexp that the current 'path' should match to
|
# @param regexp [Regexp] The regexp that the current 'path' should match to
|
||||||
# @option options [Boolean] :url (true if `string` ia a full url, otherwise false) Whether the compare should be done against the full current url or just the path
|
# @option options [Boolean] :url (true if `string` ia a full url, otherwise false) Whether the compare should be done against the full current url or just the path
|
||||||
# @option options [Boolean] :ignore_query (false) Whether the query portion of the current url/path should be ignored
|
# @option options [Boolean] :ignore_query (false) Whether the query portion of the current url/path should be ignored
|
||||||
|
|
Loading…
Reference in a new issue