1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Gem updates

This commit is contained in:
Thomas Walpole 2020-11-26 12:16:11 -08:00
parent b6eef5e5a5
commit 2fd00e52b8
18 changed files with 34 additions and 30 deletions

View file

@ -87,7 +87,10 @@ Lint/EmptyBlock:
Exclude: Exclude:
- 'lib/capybara/spec/**/*' - 'lib/capybara/spec/**/*'
- 'spec/**/*.rb' - 'spec/**/*.rb'
Lint/DuplicateBranch:
Enabled: false
Naming/PredicateName: Naming/PredicateName:
Exclude: Exclude:
- '**/*/*matchers.rb' - '**/*/*matchers.rb'

View file

@ -32,7 +32,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('nokogiri', ['~> 1.8']) s.add_runtime_dependency('nokogiri', ['~> 1.8'])
s.add_runtime_dependency('rack', ['>= 1.6.0']) s.add_runtime_dependency('rack', ['>= 1.6.0'])
s.add_runtime_dependency('rack-test', ['>= 0.6.3']) s.add_runtime_dependency('rack-test', ['>= 0.6.3'])
s.add_runtime_dependency('regexp_parser', ['~>1.5']) s.add_runtime_dependency('regexp_parser', ['>=1.5', '<3.0'])
s.add_runtime_dependency('xpath', ['~>3.2']) s.add_runtime_dependency('xpath', ['~>3.2'])
s.add_development_dependency('byebug') unless RUBY_PLATFORM == 'java' s.add_development_dependency('byebug') unless RUBY_PLATFORM == 'java'
@ -46,7 +46,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('rake') s.add_development_dependency('rake')
s.add_development_dependency('rspec', ['>= 3.5.0']) s.add_development_dependency('rspec', ['>= 3.5.0'])
s.add_development_dependency('rspec-instafail') s.add_development_dependency('rspec-instafail')
s.add_development_dependency('rubocop', ['~>1.1.0']) s.add_development_dependency('rubocop', ['~>1.1'])
s.add_development_dependency('rubocop-performance') s.add_development_dependency('rubocop-performance')
s.add_development_dependency('rubocop-rspec', ['~>2.0.0.pre']) s.add_development_dependency('rubocop-rspec', ['~>2.0.0.pre'])
s.add_development_dependency('sauce_whisk') s.add_development_dependency('sauce_whisk')

View file

@ -103,19 +103,19 @@ module Capybara
# @api private # @api private
def find_css(css, **options) def find_css(css, **options)
if base.method(:find_css).arity != 1 if base.method(:find_css).arity == 1
base.find_css(css, **options)
else
base.find_css(css) base.find_css(css)
else
base.find_css(css, **options)
end end
end end
# @api private # @api private
def find_xpath(xpath, **options) def find_xpath(xpath, **options)
if base.method(:find_xpath).arity != 1 if base.method(:find_xpath).arity == 1
base.find_xpath(xpath, **options)
else
base.find_xpath(xpath) base.find_xpath(xpath)
else
base.find_xpath(xpath, **options)
end end
end end

View file

@ -386,7 +386,7 @@ module Capybara
# #
# page.has_field?('Email', type: 'email') # page.has_field?('Email', type: 'email')
# #
# Note: 'textarea' and 'select' are valid type values, matching the associated tag names. # NOTE: 'textarea' and 'select' are valid type values, matching the associated tag names.
# #
# @param [String] locator The label, name or id of a field to check for # @param [String] locator The label, name or id of a field to check for
# @option options [String, Regexp] :with The text content of the field or a Regexp to match # @option options [String, Regexp] :with The text content of the field or a Regexp to match

View file

@ -239,16 +239,16 @@ module Capybara
case selector_format case selector_format
when :css when :css
if node.method(:find_css).arity != 1 if node.method(:find_css).arity == 1
node.find_css(css, **hints)
else
node.find_css(css) node.find_css(css)
else
node.find_css(css, **hints)
end end
when :xpath when :xpath
if node.method(:find_xpath).arity != 1 if node.method(:find_xpath).arity == 1
node.find_xpath(xpath(exact), **hints)
else
node.find_xpath(xpath(exact)) node.find_xpath(xpath(exact))
else
node.find_xpath(xpath(exact), **hints)
end end
else else
raise ArgumentError, "Unknown format: #{selector_format}" raise ArgumentError, "Unknown format: #{selector_format}"

View file

@ -54,10 +54,10 @@ module Capybara
idx, length = args idx, length = args
max_idx = case idx max_idx = case idx
when Integer when Integer
if !idx.negative? if idx.negative?
length.nil? ? idx : idx + length - 1
else
nil nil
else
length.nil? ? idx : idx + length - 1
end end
when Range when Range
# idx.max is broken with beginless ranges # idx.max is broken with beginless ranges

View file

@ -171,7 +171,7 @@ require 'capybara/selector/definition'
# * Filters: # * Filters:
# * :\<any> (String, Regexp) - Match on any specified element attribute # * :\<any> (String, Regexp) - Match on any specified element attribute
# #
class Capybara::Selector; end class Capybara::Selector; end # rubocop:disable Lint/EmptyClass
Capybara::Selector::FilterSet.add(:_field) do Capybara::Selector::FilterSet.add(:_field) do
node_filter(:checked, :boolean) { |node, value| !(value ^ node.checked?) } node_filter(:checked, :boolean) { |node, value| !(value ^ node.checked?) }

View file

@ -9,7 +9,7 @@ Capybara.add_selector(:table_row, locator_type: [Array, Hash]) do
cell_xp = XPath.descendant(:td)[ cell_xp = XPath.descendant(:td)[
XPath.string.n.is(cell) & XPath.position.equals(header_xp.preceding_sibling.count.plus(1)) XPath.string.n.is(cell) & XPath.position.equals(header_xp.preceding_sibling.count.plus(1))
] ]
xp[cell_xp] xp.where(cell_xp)
end end
else else
initial_td = XPath.descendant(:td)[XPath.string.n.is(locator.shift)] initial_td = XPath.descendant(:td)[XPath.string.n.is(locator.shift)]

View file

@ -158,7 +158,7 @@
// the overflow style of the body, and the body is really overflow:visible. // the overflow style of the body, and the body is really overflow:visible.
var overflowElem = e; var overflowElem = e;
if (htmlOverflowStyle == "visible") { if (htmlOverflowStyle == "visible") {
// Note: bodyElem will be null/undefined in SVG documents. // NOTE: bodyElem will be null/undefined in SVG documents.
if (e == htmlElem && bodyElem) { if (e == htmlElem && bodyElem) {
overflowElem = bodyElem; overflowElem = bodyElem;
} else if (e == bodyElem) { } else if (e == bodyElem) {

View file

@ -126,7 +126,7 @@ private
end end
def chromedriver_version def chromedriver_version
capabilities['chrome']['chromedriverVersion'].split(' ')[0] capabilities['chrome']['chromedriverVersion'].split(' ')[0] # rubocop:disable Style/RedundantArgument
end end
def native_displayed? def native_displayed?

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
# Note: This file uses `sleep` to sync up parts of the tests. This is only implemented like this # NOTE: This file uses `sleep` to sync up parts of the tests. This is only implemented like this
# because of the methods being tested. In tests using Capybara this type of behavior should be implemented # because of the methods being tested. In tests using Capybara this type of behavior should be implemented
# using Capybara provided assertions with builtin waiting behavior. # using Capybara provided assertions with builtin waiting behavior.

View file

@ -7,6 +7,7 @@ require 'yaml'
class TestApp < Sinatra::Base class TestApp < Sinatra::Base
class TestAppError < Exception; end # rubocop:disable Lint/InheritException class TestAppError < Exception; end # rubocop:disable Lint/InheritException
class TestAppOtherError < Exception # rubocop:disable Lint/InheritException class TestAppOtherError < Exception # rubocop:disable Lint/InheritException
def initialize(string1, msg) def initialize(string1, msg)
super() super()