mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fix low hanging fruit for Ruby 2.7 keyword warnings
This commit is contained in:
parent
eec7fa65d1
commit
1410793107
35 changed files with 166 additions and 149 deletions
|
@ -88,7 +88,14 @@ matrix:
|
|||
apt:
|
||||
packages:
|
||||
- awesome
|
||||
|
||||
- gemfile: Gemfile
|
||||
rvm: ruby-head
|
||||
env: CAPYBARA_FF=true
|
||||
addons:
|
||||
firefox: latest
|
||||
apt:
|
||||
packages:
|
||||
- awesome
|
||||
- gemfile: Gemfile
|
||||
rvm: 2.4
|
||||
env: CAPYBARA_FF=true HEADLESS=true
|
||||
|
|
|
@ -61,7 +61,7 @@ module Capybara
|
|||
@server = if name.respond_to? :call
|
||||
name
|
||||
elsif options
|
||||
proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, options) }
|
||||
proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, **options) }
|
||||
else
|
||||
Capybara.servers[name.to_sym]
|
||||
end
|
||||
|
|
|
@ -23,7 +23,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The element clicked
|
||||
#
|
||||
def click_link_or_button(locator = nil, **options)
|
||||
find(:link_or_button, locator, options).click
|
||||
find(:link_or_button, locator, **options).click
|
||||
end
|
||||
alias_method :click_on, :click_link_or_button
|
||||
|
||||
|
@ -39,7 +39,7 @@ module Capybara
|
|||
#
|
||||
# @return [Capybara::Node::Element] The element clicked
|
||||
def click_link(locator = nil, **options)
|
||||
find(:link, locator, options).click
|
||||
find(:link, locator, **options).click
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -55,7 +55,7 @@ module Capybara
|
|||
# @param [Hash] options See {Capybara::Node::Finders#find_button}
|
||||
# @return [Capybara::Node::Element] The element clicked
|
||||
def click_button(locator = nil, **options)
|
||||
find(:button, locator, options).click
|
||||
find(:button, locator, **options).click
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -88,7 +88,7 @@ module Capybara
|
|||
def fill_in(locator = nil, with:, currently_with: nil, fill_options: {}, **find_options)
|
||||
find_options[:with] = currently_with if currently_with
|
||||
find_options[:allow_self] = true if locator.nil?
|
||||
find(:fillable_field, locator, find_options).set(with, fill_options)
|
||||
find(:fillable_field, locator, **find_options).set(with, **fill_options)
|
||||
end
|
||||
|
||||
# @!macro label_click
|
||||
|
@ -119,7 +119,7 @@ module Capybara
|
|||
#
|
||||
# @return [Capybara::Node::Element] The element chosen or the label clicked
|
||||
def choose(locator = nil, **options)
|
||||
_check_with_label(:radio_button, true, locator, options)
|
||||
_check_with_label(:radio_button, true, locator, **options)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -147,7 +147,7 @@ module Capybara
|
|||
#
|
||||
# @return [Capybara::Node::Element] The element checked or the label clicked
|
||||
def check(locator = nil, **options)
|
||||
_check_with_label(:checkbox, true, locator, options)
|
||||
_check_with_label(:checkbox, true, locator, **options)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -175,7 +175,7 @@ module Capybara
|
|||
#
|
||||
# @return [Capybara::Node::Element] The element unchecked or the label clicked
|
||||
def uncheck(locator = nil, **options)
|
||||
_check_with_label(:checkbox, false, locator, options)
|
||||
_check_with_label(:checkbox, false, locator, **options)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -205,7 +205,7 @@ module Capybara
|
|||
if el.respond_to?(:tag_name) && (el.tag_name == 'input')
|
||||
select_datalist_option(el, value)
|
||||
else
|
||||
el.find(:option, value, options).select_option
|
||||
el.find(:option, value, **options).select_option
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -229,8 +229,8 @@ module Capybara
|
|||
def unselect(value = nil, from: nil, **options)
|
||||
raise ArgumentError, 'The :from option does not take an element' if from.is_a? Capybara::Node::Element
|
||||
|
||||
scope = from ? find(:select, from, options) : self
|
||||
scope.find(:option, value, options).unselect_option
|
||||
scope = from ? find(:select, from, **options) : self
|
||||
scope.find(:option, value, **options).unselect_option
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -297,10 +297,10 @@ module Capybara
|
|||
end
|
||||
# Allow user to update the CSS style of the file input since they are so often hidden on a page
|
||||
if make_visible
|
||||
ff = file_field || find(:file_field, locator, options.merge(visible: :all))
|
||||
ff = file_field || find(:file_field, locator, **options.merge(visible: :all))
|
||||
while_visible(ff, make_visible) { |el| el.set(paths) }
|
||||
else
|
||||
(file_field || find(:file_field, locator, options)).set(paths)
|
||||
(file_field || find(:file_field, locator, **options)).set(paths)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -309,12 +309,12 @@ module Capybara
|
|||
def find_select_or_datalist_input(from, options)
|
||||
synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do
|
||||
begin
|
||||
find(:select, from, options)
|
||||
find(:select, from, **options)
|
||||
rescue Capybara::ElementNotFound => select_error # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
raise if %i[selected with_selected multiple].any? { |option| options.key?(option) }
|
||||
|
||||
begin
|
||||
find(:datalist_input, from, options)
|
||||
find(:datalist_input, from, **options)
|
||||
rescue Capybara::ElementNotFound => dlinput_error # rubocop:disable Naming/RescuedExceptionsVariableName
|
||||
raise Capybara::ElementNotFound, "#{select_error.message} and #{dlinput_error.message}"
|
||||
end
|
||||
|
@ -368,13 +368,13 @@ module Capybara
|
|||
|
||||
synchronize(Capybara::Queries::BaseQuery.wait(options, session_options.default_max_wait_time)) do
|
||||
begin
|
||||
el = find(selector, locator, options)
|
||||
el = find(selector, locator, **options)
|
||||
el.set(checked)
|
||||
rescue StandardError => e
|
||||
raise unless allow_label_click && catch_error?(e)
|
||||
|
||||
begin
|
||||
el ||= find(selector, locator, options.merge(visible: :all))
|
||||
el ||= find(selector, locator, **options.merge(visible: :all))
|
||||
el.session.find(:label, for: el, visible: true).click unless el.checked? == checked
|
||||
rescue StandardError # swallow extra errors - raise original
|
||||
raise e
|
||||
|
|
|
@ -40,8 +40,8 @@ module Capybara
|
|||
find(:xpath, '/html').evaluate_script(*args)
|
||||
end
|
||||
|
||||
def scroll_to(*args)
|
||||
find(:xpath, '//body').scroll_to(*args)
|
||||
def scroll_to(*args, **options)
|
||||
find(:xpath, '//body').scroll_to(*args, **options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,7 +42,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_title?(title, **options)
|
||||
make_predicate(options) { assert_title(title, options) }
|
||||
make_predicate(options) { assert_title(title, **options) }
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -52,13 +52,13 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_no_title?(title, **options)
|
||||
make_predicate(options) { assert_no_title(title, options) }
|
||||
make_predicate(options) { assert_no_title(title, **options) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _verify_title(title, options)
|
||||
query = Capybara::Queries::TitleQuery.new(title, options)
|
||||
query = Capybara::Queries::TitleQuery.new(title, **options)
|
||||
synchronize(query.wait) { yield(query) }
|
||||
true
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ module Capybara
|
|||
end
|
||||
|
||||
options = session_options.default_set_options.to_h.merge(options)
|
||||
synchronize { base.set(value, options) }
|
||||
synchronize { base.set(value, **options) }
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -165,8 +165,8 @@ module Capybara
|
|||
# offset will be from the element center, otherwise it will be from the top left corner of the element
|
||||
# @return [Capybara::Node::Element] The element
|
||||
def click(*keys, **options)
|
||||
perform_click_action(keys, options) do |k, opts|
|
||||
base.click(k, opts)
|
||||
perform_click_action(keys, **options) do |k, opts|
|
||||
base.click(k, **opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -178,8 +178,8 @@ module Capybara
|
|||
# @macro click_modifiers
|
||||
# @return [Capybara::Node::Element] The element
|
||||
def right_click(*keys, **options)
|
||||
perform_click_action(keys, options) do |k, opts|
|
||||
base.right_click(k, opts)
|
||||
perform_click_action(keys, **options) do |k, opts|
|
||||
base.right_click(k, **opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -191,8 +191,8 @@ module Capybara
|
|||
# @macro click_modifiers
|
||||
# @return [Capybara::Node::Element] The element
|
||||
def double_click(*keys, **options)
|
||||
perform_click_action(keys, options) do |k, opts|
|
||||
base.double_click(k, opts)
|
||||
perform_click_action(keys, **options) do |k, opts|
|
||||
base.double_click(k, **opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ module Capybara
|
|||
#
|
||||
def find(*args, **options, &optional_filter_block)
|
||||
options[:session_options] = session_options
|
||||
synced_resolve Capybara::Queries::SelectorQuery.new(*args, options, &optional_filter_block)
|
||||
synced_resolve Capybara::Queries::SelectorQuery.new(*args, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -72,7 +72,7 @@ module Capybara
|
|||
#
|
||||
def ancestor(*args, **options, &optional_filter_block)
|
||||
options[:session_options] = session_options
|
||||
synced_resolve Capybara::Queries::AncestorQuery.new(*args, options, &optional_filter_block)
|
||||
synced_resolve Capybara::Queries::AncestorQuery.new(*args, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -95,7 +95,7 @@ module Capybara
|
|||
#
|
||||
def sibling(*args, **options, &optional_filter_block)
|
||||
options[:session_options] = session_options
|
||||
synced_resolve Capybara::Queries::SiblingQuery.new(*args, options, &optional_filter_block)
|
||||
synced_resolve Capybara::Queries::SiblingQuery.new(*args, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -125,7 +125,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The found element
|
||||
#
|
||||
def find_field(locator = nil, **options, &optional_filter_block)
|
||||
find(:field, locator, options, &optional_filter_block)
|
||||
find(:field, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -145,7 +145,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The found element
|
||||
#
|
||||
def find_link(locator = nil, **options, &optional_filter_block)
|
||||
find(:link, locator, options, &optional_filter_block)
|
||||
find(:link, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -172,7 +172,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The found element
|
||||
#
|
||||
def find_button(locator = nil, **options, &optional_filter_block)
|
||||
find(:button, locator, options, &optional_filter_block)
|
||||
find(:button, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -186,7 +186,7 @@ module Capybara
|
|||
# @return [Capybara::Node::Element] The found element
|
||||
#
|
||||
def find_by_id(id, **options, &optional_filter_block)
|
||||
find(:id, id, options, &optional_filter_block)
|
||||
find(:id, id, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -245,7 +245,7 @@ module Capybara
|
|||
minimum_specified = options_include_minimum?(options)
|
||||
options = { minimum: 1 }.merge(options) unless minimum_specified
|
||||
options[:session_options] = session_options
|
||||
query = Capybara::Queries::SelectorQuery.new(*args, options, &optional_filter_block)
|
||||
query = Capybara::Queries::SelectorQuery.new(*args, **options, &optional_filter_block)
|
||||
result = nil
|
||||
begin
|
||||
synchronize(query.wait) do
|
||||
|
@ -278,7 +278,7 @@ module Capybara
|
|||
#
|
||||
def first(*args, **options, &optional_filter_block)
|
||||
options = { minimum: 1 }.merge(options) unless options_include_minimum?(options)
|
||||
all(*args, options, &optional_filter_block).first
|
||||
all(*args, **options, &optional_filter_block).first
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -123,7 +123,7 @@ module Capybara
|
|||
# @raise [Capybara::ExpectationNotMet] If the element doesn't have the specified styles
|
||||
#
|
||||
def assert_matches_style(styles, **options)
|
||||
query_args = _set_query_session_options(styles, options)
|
||||
query_args = _set_query_session_options(styles, **options)
|
||||
query = Capybara::Queries::StyleQuery.new(*query_args)
|
||||
synchronize(query.wait) do
|
||||
raise Capybara::ExpectationNotMet, query.failure_message unless query.resolves_for?(self)
|
||||
|
@ -155,7 +155,7 @@ module Capybara
|
|||
# @overload assert_all_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
||||
#
|
||||
def assert_all_of_selectors(*args, **options, &optional_filter_block)
|
||||
_verify_multiple(*args, options) do |selector, locator, opts|
|
||||
_verify_multiple(*args, **options) do |selector, locator, opts|
|
||||
assert_selector(selector, locator, opts, &optional_filter_block)
|
||||
end
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ module Capybara
|
|||
# @overload assert_none_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
||||
#
|
||||
def assert_none_of_selectors(*args, **options, &optional_filter_block)
|
||||
_verify_multiple(*args, options) do |selector, locator, opts|
|
||||
_verify_multiple(*args, **options) do |selector, locator, opts|
|
||||
assert_no_selector(selector, locator, opts, &optional_filter_block)
|
||||
end
|
||||
end
|
||||
|
@ -268,7 +268,7 @@ module Capybara
|
|||
# @return [Boolean] If the expression exists
|
||||
#
|
||||
def has_xpath?(path, **options, &optional_filter_block)
|
||||
has_selector?(:xpath, path, options, &optional_filter_block)
|
||||
has_selector?(:xpath, path, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -280,7 +280,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_no_xpath?(path, **options, &optional_filter_block)
|
||||
has_no_selector?(:xpath, path, options, &optional_filter_block)
|
||||
has_no_selector?(:xpath, path, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -307,7 +307,7 @@ module Capybara
|
|||
# @return [Boolean] If the selector exists
|
||||
#
|
||||
def has_css?(path, **options, &optional_filter_block)
|
||||
has_selector?(:css, path, options, &optional_filter_block)
|
||||
has_selector?(:css, path, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -319,7 +319,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_no_css?(path, **options, &optional_filter_block)
|
||||
has_no_selector?(:css, path, options, &optional_filter_block)
|
||||
has_no_selector?(:css, path, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -332,7 +332,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_link?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:link, locator, options, &optional_filter_block)
|
||||
has_selector?(:link, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -344,7 +344,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_link?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:link, locator, options, &optional_filter_block)
|
||||
has_no_selector?(:link, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -356,7 +356,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_button?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:button, locator, options, &optional_filter_block)
|
||||
has_selector?(:button, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -368,7 +368,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_button?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:button, locator, options, &optional_filter_block)
|
||||
has_no_selector?(:button, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -394,7 +394,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:field, locator, options, &optional_filter_block)
|
||||
has_selector?(:field, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -408,7 +408,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:field, locator, options, &optional_filter_block)
|
||||
has_no_selector?(:field, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -421,7 +421,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_checked_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:field, locator, options.merge(checked: true), &optional_filter_block)
|
||||
has_selector?(:field, locator, **options.merge(checked: true), &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -434,7 +434,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_checked_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:field, locator, options.merge(checked: true), &optional_filter_block)
|
||||
has_no_selector?(:field, locator, **options.merge(checked: true), &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -447,7 +447,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_unchecked_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:field, locator, options.merge(unchecked: true), &optional_filter_block)
|
||||
has_selector?(:field, locator, **options.merge(unchecked: true), &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -460,7 +460,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_unchecked_field?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:field, locator, options.merge(unchecked: true), &optional_filter_block)
|
||||
has_no_selector?(:field, locator, **options.merge(unchecked: true), &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -493,7 +493,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_select?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:select, locator, options, &optional_filter_block)
|
||||
has_selector?(:select, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -505,7 +505,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_select?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:select, locator, options, &optional_filter_block)
|
||||
has_no_selector?(:select, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -527,7 +527,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it exists
|
||||
#
|
||||
def has_table?(locator = nil, **options, &optional_filter_block)
|
||||
has_selector?(:table, locator, options, &optional_filter_block)
|
||||
has_selector?(:table, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -539,7 +539,7 @@ module Capybara
|
|||
# @return [Boolean] Whether it doesn't exist
|
||||
#
|
||||
def has_no_table?(locator = nil, **options, &optional_filter_block)
|
||||
has_no_selector?(:table, locator, options, &optional_filter_block)
|
||||
has_no_selector?(:table, locator, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -597,7 +597,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def matches_xpath?(xpath, **options, &optional_filter_block)
|
||||
matches_selector?(:xpath, xpath, options, &optional_filter_block)
|
||||
matches_selector?(:xpath, xpath, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -608,7 +608,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def matches_css?(css, **options, &optional_filter_block)
|
||||
matches_selector?(:css, css, options, &optional_filter_block)
|
||||
matches_selector?(:css, css, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -631,7 +631,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def not_matches_xpath?(xpath, **options, &optional_filter_block)
|
||||
not_matches_selector?(:xpath, xpath, options, &optional_filter_block)
|
||||
not_matches_selector?(:xpath, xpath, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -642,7 +642,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def not_matches_css?(css, **options, &optional_filter_block)
|
||||
not_matches_selector?(:css, css, options, &optional_filter_block)
|
||||
not_matches_selector?(:css, css, **options, &optional_filter_block)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -108,7 +108,9 @@ module Capybara
|
|||
!find_xpath(VISIBILITY_XPATH)
|
||||
else
|
||||
# No need for an xpath if only checking the current element
|
||||
!(native.key?('hidden') || (/display:\s?none/.match? native[:style]) || %w[script head].include?(tag_name))
|
||||
!(native.key?('hidden') ||
|
||||
/display:\s?none/.match?(native[:style] || '') ||
|
||||
%w[script head].include?(tag_name))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module Capybara
|
|||
|
||||
raise ArgumentError, "Unused parameters passed to #{self.class.name} : #{args}" unless args.empty?
|
||||
|
||||
@expression = selector.call(@locator, @options)
|
||||
@expression = selector.call(@locator, **@options)
|
||||
|
||||
warn_exact_usage
|
||||
|
||||
|
@ -340,7 +340,7 @@ module Capybara
|
|||
conditions[:id] = options[:id] if use_default_id_filter?
|
||||
conditions[:class] = options[:class] if use_default_class_filter?
|
||||
conditions[:style] = options[:style] if use_default_style_filter? && !options[:style].is_a?(Hash)
|
||||
builder(expr).add_attribute_conditions(conditions)
|
||||
builder(expr).add_attribute_conditions(**conditions)
|
||||
end
|
||||
|
||||
def use_default_id_filter?
|
||||
|
|
|
@ -42,7 +42,7 @@ class Capybara::RackTest::Driver < Capybara::Driver::Base
|
|||
end
|
||||
|
||||
def visit(path, **attributes)
|
||||
browser.visit(path, attributes)
|
||||
browser.visit(path, **attributes)
|
||||
end
|
||||
|
||||
def refresh
|
||||
|
|
|
@ -56,7 +56,7 @@ private
|
|||
end
|
||||
|
||||
def request_method
|
||||
/post/i.match?(self[:method]) ? :post : :get
|
||||
/post/i.match?(self[:method] || '') ? :post : :get
|
||||
end
|
||||
|
||||
def merge_param!(params, key, value)
|
||||
|
|
|
@ -166,7 +166,7 @@ module Capybara
|
|||
|
||||
def locator_filter(*types, **options, &block)
|
||||
types.each { |type| options[type] = true }
|
||||
@locator_filter = Capybara::Selector::Filters::LocatorFilter.new(block, options) if block
|
||||
@locator_filter = Capybara::Selector::Filters::LocatorFilter.new(block, **options) if block
|
||||
@locator_filter
|
||||
end
|
||||
|
||||
|
@ -181,7 +181,7 @@ module Capybara
|
|||
describe(:expression_filters, &block)
|
||||
else
|
||||
describe(:expression_filters) do |**options|
|
||||
describe_all_expression_filters(options)
|
||||
describe_all_expression_filters(**options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ Capybara.add_selector(:button, locator_type: [String, Symbol]) do
|
|||
describe_expression_filters do |disabled: nil, **options|
|
||||
desc = +''
|
||||
desc << ' that is not disabled' if disabled == false
|
||||
desc << describe_all_expression_filters(options)
|
||||
desc << describe_all_expression_filters(**options)
|
||||
end
|
||||
|
||||
describe_node_filters do |disabled: nil, **|
|
||||
|
|
|
@ -5,7 +5,7 @@ Capybara.add_selector(:checkbox, locator_type: [String, Symbol]) do
|
|||
xpath = XPath.axis(allow_self ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'checkbox'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
filter_set(:_field, %i[checked unchecked disabled name])
|
||||
|
|
|
@ -5,7 +5,7 @@ Capybara.add_selector(:datalist_input, locator_type: [String, Symbol]) do
|
|||
|
||||
xpath do |locator, **options|
|
||||
xpath = XPath.descendant(:input)[XPath.attr(:list)]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
filter_set(:_field, %i[disabled name placeholder])
|
||||
|
|
|
@ -16,7 +16,7 @@ Capybara.add_selector(:datalist_option, locator_type: [String, Symbol]) do
|
|||
describe_expression_filters do |disabled: nil, **options|
|
||||
desc = +''
|
||||
desc << ' that is not disabled' if disabled == false
|
||||
desc << describe_all_expression_filters(options)
|
||||
desc << describe_all_expression_filters(**options)
|
||||
end
|
||||
|
||||
describe_node_filters do |**options|
|
||||
|
|
|
@ -19,7 +19,7 @@ Capybara.add_selector(:element, locator_type: [String, Symbol]) do
|
|||
|
||||
describe_expression_filters do |**options|
|
||||
booleans, values = options.partition { |_k, v| [true, false].include? v }.map(&:to_h)
|
||||
desc = describe_all_expression_filters(values)
|
||||
desc = describe_all_expression_filters(**values)
|
||||
desc + booleans.map do |k, v|
|
||||
v ? " with #{k} attribute" : "without #{k} attribute"
|
||||
end.join
|
||||
|
|
|
@ -7,7 +7,7 @@ Capybara.add_selector(:field, locator_type: [String, Symbol]) do
|
|||
invalid_types = %w[submit image]
|
||||
invalid_types << 'hidden' unless options[:type].to_s == 'hidden'
|
||||
xpath = XPath.descendant(:input, :textarea, :select)[!XPath.attr(:type).one_of(*invalid_types)]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
expression_filter(:type) do |expr, type|
|
||||
|
|
|
@ -6,7 +6,7 @@ Capybara.add_selector(:file_field, locator_type: [String, Symbol]) do
|
|||
xpath = XPath.axis(allow_self ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'file'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
filter_set(:_field, %i[disabled multiple name])
|
||||
|
|
|
@ -6,7 +6,7 @@ Capybara.add_selector(:fillable_field, locator_type: [String, Symbol]) do
|
|||
xpath = XPath.axis(allow_self ? :"descendant-or-self" : :descendant, :input, :textarea)[
|
||||
!XPath.attr(:type).one_of('submit', 'image', 'radio', 'checkbox', 'hidden', 'file')
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
expression_filter(:type) do |expr, type|
|
||||
|
|
|
@ -6,7 +6,7 @@ Capybara.add_selector(:radio_button, locator_type: [String, Symbol]) do
|
|||
xpath = XPath.axis(allow_self ? :"descendant-or-self" : :descendant, :input)[
|
||||
XPath.attr(:type) == 'radio'
|
||||
]
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
filter_set(:_field, %i[checked unchecked disabled name])
|
||||
|
|
|
@ -5,7 +5,7 @@ Capybara.add_selector(:select, locator_type: [String, Symbol]) do
|
|||
|
||||
xpath do |locator, **options|
|
||||
xpath = XPath.descendant(:select)
|
||||
locate_field(xpath, locator, options)
|
||||
locate_field(xpath, locator, **options)
|
||||
end
|
||||
|
||||
filter_set(:_field, %i[disabled multiple name placeholder])
|
||||
|
|
|
@ -15,15 +15,15 @@ module Capybara
|
|||
instance_eval(&block)
|
||||
end
|
||||
|
||||
def node_filter(names, *types_and_options, &block)
|
||||
def node_filter(names, *types, **options, &block)
|
||||
Array(names).each do |name|
|
||||
add_filter(name, Filters::NodeFilter, *types_and_options, &block)
|
||||
add_filter(name, Filters::NodeFilter, *types, **options, &block)
|
||||
end
|
||||
end
|
||||
alias_method :filter, :node_filter
|
||||
|
||||
def expression_filter(name, *types_and_options, &block)
|
||||
add_filter(name, Filters::ExpressionFilter, *types_and_options, &block)
|
||||
def expression_filter(name, *types, **options, &block)
|
||||
add_filter(name, Filters::ExpressionFilter, *types, **options, &block)
|
||||
end
|
||||
|
||||
def describe(what = nil, &block)
|
||||
|
@ -42,9 +42,9 @@ module Capybara
|
|||
def description(node_filters: true, expression_filters: true, **options)
|
||||
opts = options_with_defaults(options)
|
||||
description = +''
|
||||
description << undeclared_descriptions.map { |desc| desc.call(opts).to_s }.join
|
||||
description << expression_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if expression_filters
|
||||
description << node_filter_descriptions.map { |desc| desc.call(opts).to_s }.join if node_filters
|
||||
description << undeclared_descriptions.map { |desc| desc.call(**opts).to_s }.join
|
||||
description << expression_filter_descriptions.map { |desc| desc.call(**opts).to_s }.join if expression_filters
|
||||
description << node_filter_descriptions.map { |desc| desc.call(**opts).to_s }.join if node_filters
|
||||
description
|
||||
end
|
||||
|
||||
|
@ -116,7 +116,7 @@ module Capybara
|
|||
raise 'ArgumentError', ':default option is not supported for filters with a :matcher option'
|
||||
end
|
||||
|
||||
filter = filter_class.new(name, matcher, block, options)
|
||||
filter = filter_class.new(name, matcher, block, **options)
|
||||
(filter_class <= Filters::ExpressionFilter ? @expression_filters : @node_filters)[name] = filter
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ module Capybara
|
|||
module Filters
|
||||
class LocatorFilter < NodeFilter
|
||||
def initialize(block, **options)
|
||||
super(nil, nil, block, options)
|
||||
super(nil, nil, block, **options)
|
||||
end
|
||||
|
||||
def matches?(node, value, context = nil, exact:)
|
||||
|
|
|
@ -56,7 +56,7 @@ module Capybara
|
|||
if format
|
||||
raise ArgumentError, "Selector #{@name} does not support #{format}" unless expressions.key?(format)
|
||||
|
||||
instance_exec(locator, options, &expressions[format])
|
||||
instance_exec(locator, **options, &expressions[format])
|
||||
else
|
||||
warn 'Selector has no format'
|
||||
end
|
||||
|
|
|
@ -221,7 +221,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
|
||||
def accept_modal(_type, **options)
|
||||
yield if block_given?
|
||||
modal = find_modal(options)
|
||||
modal = find_modal(**options)
|
||||
|
||||
modal.send_keys options[:with] if options[:with]
|
||||
|
||||
|
@ -232,7 +232,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
|
||||
def dismiss_modal(_type, **options)
|
||||
yield if block_given?
|
||||
modal = find_modal(options)
|
||||
modal = find_modal(**options)
|
||||
message = modal.text
|
||||
modal.dismiss
|
||||
message
|
||||
|
|
|
@ -79,10 +79,10 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
|
|||
when 'color'
|
||||
set_color(value)
|
||||
else
|
||||
set_text(value, options)
|
||||
set_text(value, **options)
|
||||
end
|
||||
when 'textarea'
|
||||
set_text(value, options)
|
||||
set_text(value, **options)
|
||||
else
|
||||
set_content_editable(value)
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
|
|||
html5_drop(*args)
|
||||
end
|
||||
|
||||
def click(*)
|
||||
def click(*, **)
|
||||
super
|
||||
rescue ::Selenium::WebDriver::Error::ElementClickInterceptedError
|
||||
raise
|
||||
|
|
|
@ -14,7 +14,7 @@ class Capybara::Selenium::FirefoxNode < Capybara::Selenium::Node
|
|||
warn 'You are attempting to click a table row which has issues in geckodriver/marionette - '\
|
||||
'see https://github.com/mozilla/geckodriver/issues/1228. Your test should probably be '\
|
||||
'clicking on a table cell like a user would. Clicking the first cell in the row instead.'
|
||||
return find_css('th:first-child,td:first-child')[0].click(keys, options)
|
||||
return find_css('th:first-child,td:first-child')[0].click(keys, **options)
|
||||
end
|
||||
raise
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ module Capybara
|
|||
end
|
||||
|
||||
def https_request(&block)
|
||||
make_request(ssl_options, &block)
|
||||
make_request(**ssl_options, &block)
|
||||
end
|
||||
|
||||
def make_request(**options, &block)
|
||||
|
|
|
@ -90,7 +90,7 @@ module Capybara
|
|||
@server = if config.run_server && @app && driver.needs_server?
|
||||
server_options = { port: config.server_port, host: config.server_host, reportable_errors: config.server_errors }
|
||||
server_options[:extra_middleware] = [Capybara::Server::AnimationDisabler] if config.disable_animation
|
||||
Capybara::Server.new(@app, server_options).boot
|
||||
Capybara::Server.new(@app, **server_options).boot
|
||||
end
|
||||
@touched = false
|
||||
end
|
||||
|
@ -496,7 +496,7 @@ module Capybara
|
|||
'`within` or `within_frame` blocks.'
|
||||
end
|
||||
|
||||
_switch_to_window(window, options, &window_locator)
|
||||
_switch_to_window(window, **options, &window_locator)
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -723,7 +723,7 @@ module Capybara
|
|||
# @param [Hash] options a customizable set of options
|
||||
# @return [String] the path to which the file was saved
|
||||
def save_screenshot(path = nil, **options)
|
||||
prepare_path(path, 'png').tap { |p_path| driver.save_screenshot(p_path, options) }
|
||||
prepare_path(path, 'png').tap { |p_path| driver.save_screenshot(p_path, **options) }
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -738,7 +738,7 @@ module Capybara
|
|||
# @param [Hash] options a customizable set of options
|
||||
#
|
||||
def save_and_open_screenshot(path = nil, **options)
|
||||
save_screenshot(path, options).tap { |s_path| open_file(s_path) } # rubocop:disable Lint/Debugger
|
||||
save_screenshot(path, **options).tap { |s_path| open_file(s_path) } # rubocop:disable Lint/Debugger
|
||||
end
|
||||
|
||||
def document
|
||||
|
@ -821,11 +821,11 @@ module Capybara
|
|||
end
|
||||
|
||||
def accept_modal(type, text_or_options, options, &blk)
|
||||
driver.accept_modal(type, modal_options(text_or_options, options), &blk)
|
||||
driver.accept_modal(type, **modal_options(text_or_options, **options), &blk)
|
||||
end
|
||||
|
||||
def dismiss_modal(type, text_or_options, options, &blk)
|
||||
driver.dismiss_modal(type, modal_options(text_or_options, options), &blk)
|
||||
driver.dismiss_modal(type, **modal_options(text_or_options, **options), &blk)
|
||||
end
|
||||
|
||||
def modal_options(text = nil, **options)
|
||||
|
|
|
@ -20,7 +20,7 @@ module Capybara
|
|||
# @return [true]
|
||||
#
|
||||
def assert_current_path(path, **options)
|
||||
_verify_current_path(path, options) do |query|
|
||||
_verify_current_path(path, **options) do |query|
|
||||
raise Capybara::ExpectationNotMet, query.failure_message unless query.resolves_for?(self)
|
||||
end
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ module Capybara
|
|||
# @return [true]
|
||||
#
|
||||
def assert_no_current_path(path, **options)
|
||||
_verify_current_path(path, options) do |query|
|
||||
_verify_current_path(path, **options) do |query|
|
||||
raise Capybara::ExpectationNotMet, query.negative_failure_message if query.resolves_for?(self)
|
||||
end
|
||||
end
|
||||
|
@ -51,7 +51,7 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_current_path?(path, **options)
|
||||
make_predicate(options) { assert_current_path(path, options) }
|
||||
make_predicate(options) { assert_current_path(path, **options) }
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -64,13 +64,13 @@ module Capybara
|
|||
# @return [Boolean]
|
||||
#
|
||||
def has_no_current_path?(path, **options)
|
||||
make_predicate(options) { assert_no_current_path(path, options) }
|
||||
make_predicate(options) { assert_no_current_path(path, **options) }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _verify_current_path(path, options)
|
||||
query = Capybara::Queries::CurrentPathQuery.new(path, options)
|
||||
def _verify_current_path(path, **options)
|
||||
query = Capybara::Queries::CurrentPathQuery.new(path, **options)
|
||||
document.synchronize(query.wait) do
|
||||
yield(query)
|
||||
end
|
||||
|
|
|
@ -49,16 +49,20 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
|
|||
end
|
||||
|
||||
it 'handles optional characters for #alternated_substrings' do
|
||||
# rubocop:disable Style/BracesAroundHashParameters
|
||||
verify_alternated_strings(
|
||||
/abc*def/ => [%w[ab def]],
|
||||
/abc*/ => [%w[ab]],
|
||||
/c*/ => [],
|
||||
/abc?def/ => [%w[abdef], %w[abcdef]],
|
||||
/abc?/ => [%w[ab]],
|
||||
/abc?def?/ => [%w[abde], %w[abcde]],
|
||||
/abc?def?g/ => [%w[abdeg], %w[abdefg], %w[abcdeg], %w[abcdefg]],
|
||||
/d?/ => []
|
||||
{
|
||||
/abc*def/ => [%w[ab def]],
|
||||
/abc*/ => [%w[ab]],
|
||||
/c*/ => [],
|
||||
/abc?def/ => [%w[abdef], %w[abcdef]],
|
||||
/abc?/ => [%w[ab]],
|
||||
/abc?def?/ => [%w[abde], %w[abcde]],
|
||||
/abc?def?g/ => [%w[abdeg], %w[abdefg], %w[abcdeg], %w[abcdefg]],
|
||||
/d?/ => []
|
||||
}
|
||||
)
|
||||
# rubocop:enable Style/BracesAroundHashParameters
|
||||
end
|
||||
|
||||
it 'handles character classes' do
|
||||
|
@ -136,36 +140,40 @@ RSpec.describe Capybara::Selector::RegexpDisassembler, :aggregate_failures do
|
|||
end
|
||||
|
||||
it 'handles alternation for #alternated_substrings' do
|
||||
# rubocop:disable Style/BracesAroundHashParameters
|
||||
verify_alternated_strings(
|
||||
/abc|def/ => [%w[abc], %w[def]],
|
||||
/ab(?:c|d)/ => [%w[abc], %w[abd]],
|
||||
/ab(c|d|e)fg/ => [%w[abcfg], %w[abdfg], %w[abefg]],
|
||||
/ab?(c|d)fg/ => [%w[acfg], %w[adfg], %w[abcfg], %w[abdfg]],
|
||||
/ab(c|d)ef/ => [%w[abcef], %w[abdef]],
|
||||
/ab(cd?|ef)g/ => [%w[abcg], %w[abcdg], %w[abefg]],
|
||||
/ab(cd|ef*)g/ => [%w[abcdg], %w[abe g]],
|
||||
/ab|cd*/ => [%w[ab], %w[c]],
|
||||
/cd(?:ef|gh)|xyz/ => [%w[cdef], %w[cdgh], %w[xyz]],
|
||||
/(cd(?:ef|gh)|xyz)/ => [%w[cdef], %w[cdgh], %w[xyz]],
|
||||
/cd(ef|gh)+/ => [%w[cdef], %w[cdgh]],
|
||||
/cd(ef|gh)?/ => [%w[cd]],
|
||||
/cd(ef|gh)?ij/ => [%w[cdij], %w[cdefij], %w[cdghij]],
|
||||
/cd(ef|gh)+ij/ => [%w[cdef ij], %w[cdgh ij]],
|
||||
/cd(ef|gh){2}ij/ => [%w[cdefefij], %w[cdefghij], %w[cdghefij], %w[cdghghij]],
|
||||
/(cd(ef|g*))/ => [%w[cd]],
|
||||
/a|b*/ => [],
|
||||
/ab(?:c|d?)/ => [%w[ab]],
|
||||
/ab(c|d)|a*/ => [],
|
||||
/(abc)?(d|e)/ => [%w[d], %w[e]],
|
||||
/(abc*de)?(d|e)/ => [%w[d], %w[e]],
|
||||
/(abc*de)?(d|e?)/ => [],
|
||||
/(abc)?(d|e?)/ => [],
|
||||
/ab(cd){0,2}ef/ => [%w[ab ef]],
|
||||
/ab(cd){0,1}ef/ => [%w[abef], %w[abcdef]],
|
||||
/ab(cd|cd)ef/ => [%w[abcdef]],
|
||||
/ab(cd|cd)?ef/ => [%w[abef], %w[abcdef]],
|
||||
/ab\\?cd/ => [%w[abcd], %w[ab\cd]]
|
||||
{
|
||||
/abc|def/ => [%w[abc], %w[def]],
|
||||
/ab(?:c|d)/ => [%w[abc], %w[abd]],
|
||||
/ab(c|d|e)fg/ => [%w[abcfg], %w[abdfg], %w[abefg]],
|
||||
/ab?(c|d)fg/ => [%w[acfg], %w[adfg], %w[abcfg], %w[abdfg]],
|
||||
/ab(c|d)ef/ => [%w[abcef], %w[abdef]],
|
||||
/ab(cd?|ef)g/ => [%w[abcg], %w[abcdg], %w[abefg]],
|
||||
/ab(cd|ef*)g/ => [%w[abcdg], %w[abe g]],
|
||||
/ab|cd*/ => [%w[ab], %w[c]],
|
||||
/cd(?:ef|gh)|xyz/ => [%w[cdef], %w[cdgh], %w[xyz]],
|
||||
/(cd(?:ef|gh)|xyz)/ => [%w[cdef], %w[cdgh], %w[xyz]],
|
||||
/cd(ef|gh)+/ => [%w[cdef], %w[cdgh]],
|
||||
/cd(ef|gh)?/ => [%w[cd]],
|
||||
/cd(ef|gh)?ij/ => [%w[cdij], %w[cdefij], %w[cdghij]],
|
||||
/cd(ef|gh)+ij/ => [%w[cdef ij], %w[cdgh ij]],
|
||||
/cd(ef|gh){2}ij/ => [%w[cdefefij], %w[cdefghij], %w[cdghefij], %w[cdghghij]],
|
||||
/(cd(ef|g*))/ => [%w[cd]],
|
||||
/a|b*/ => [],
|
||||
/ab(?:c|d?)/ => [%w[ab]],
|
||||
/ab(c|d)|a*/ => [],
|
||||
/(abc)?(d|e)/ => [%w[d], %w[e]],
|
||||
/(abc*de)?(d|e)/ => [%w[d], %w[e]],
|
||||
/(abc*de)?(d|e?)/ => [],
|
||||
/(abc)?(d|e?)/ => [],
|
||||
/ab(cd){0,2}ef/ => [%w[ab ef]],
|
||||
/ab(cd){0,1}ef/ => [%w[abef], %w[abcdef]],
|
||||
/ab(cd|cd)ef/ => [%w[abcdef]],
|
||||
/ab(cd|cd)?ef/ => [%w[abef], %w[abcdef]],
|
||||
/ab\\?cd/ => [%w[abcd], %w[ab\cd]]
|
||||
}
|
||||
)
|
||||
# rubocop:enable Style/BracesAroundHashParameters
|
||||
end
|
||||
|
||||
it 'handles grouping' do
|
||||
|
|
|
@ -29,7 +29,7 @@ Capybara.register_driver :selenium_chrome_not_clear_storage do |app|
|
|||
browser: :chrome,
|
||||
options: browser_options
|
||||
}
|
||||
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_local_storage: false, clear_session_storage: false))
|
||||
Capybara::Selenium::Driver.new(app, **chrome_options.merge(clear_local_storage: false, clear_session_storage: false))
|
||||
end
|
||||
|
||||
Capybara.register_driver :selenium_chrome_not_clear_session_storage do |app|
|
||||
|
@ -37,7 +37,7 @@ Capybara.register_driver :selenium_chrome_not_clear_session_storage do |app|
|
|||
browser: :chrome,
|
||||
options: browser_options
|
||||
}
|
||||
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_session_storage: false))
|
||||
Capybara::Selenium::Driver.new(app, **chrome_options.merge(clear_session_storage: false))
|
||||
end
|
||||
|
||||
Capybara.register_driver :selenium_chrome_not_clear_local_storage do |app|
|
||||
|
@ -45,7 +45,7 @@ Capybara.register_driver :selenium_chrome_not_clear_local_storage do |app|
|
|||
browser: :chrome,
|
||||
options: browser_options
|
||||
}
|
||||
Capybara::Selenium::Driver.new(app, chrome_options.merge(clear_local_storage: false))
|
||||
Capybara::Selenium::Driver.new(app, **chrome_options.merge(clear_local_storage: false))
|
||||
end
|
||||
|
||||
Capybara.register_driver :selenium_driver_subclass_with_chrome do |app|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue