capybara 3.38.0 → 3.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +20 -0
- data/lib/capybara/node/actions.rb +4 -4
- data/lib/capybara/node/finders.rb +2 -0
- data/lib/capybara/node/whitespace_normalizer.rb +81 -0
- data/lib/capybara/rack_test/node.rb +18 -15
- data/lib/capybara/registrations/drivers.rb +3 -3
- data/lib/capybara/registrations/servers.rb +16 -4
- data/lib/capybara/rspec/matcher_proxies.rb +3 -3
- data/lib/capybara/rspec/matchers/base.rb +8 -6
- data/lib/capybara/rspec/matchers/compound.rb +1 -1
- data/lib/capybara/selector/definition/link.rb +2 -1
- data/lib/capybara/selenium/driver.rb +4 -4
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +8 -4
- data/lib/capybara/selenium/extensions/html5_drag.rb +3 -0
- data/lib/capybara/selenium/node.rb +8 -10
- data/lib/capybara/selenium/nodes/chrome_node.rb +5 -1
- data/lib/capybara/selenium/nodes/edge_node.rb +24 -2
- data/lib/capybara/selenium/patches/action_pauser.rb +3 -3
- data/lib/capybara/selenium/patches/atoms.rb +1 -1
- data/lib/capybara/selenium/patches/pause_duration_fix.rb +1 -1
- data/lib/capybara/server/animation_disabler.rb +2 -3
- data/lib/capybara/spec/public/test.js +4 -0
- data/lib/capybara/spec/session/all_spec.rb +1 -1
- data/lib/capybara/spec/session/click_link_spec.rb +11 -0
- data/lib/capybara/spec/session/find_link_spec.rb +10 -0
- data/lib/capybara/spec/session/find_spec.rb +1 -1
- data/lib/capybara/spec/session/first_spec.rb +1 -1
- data/lib/capybara/spec/session/frame/within_frame_spec.rb +2 -0
- data/lib/capybara/spec/session/has_all_selectors_spec.rb +5 -5
- data/lib/capybara/spec/session/has_any_selectors_spec.rb +2 -2
- data/lib/capybara/spec/session/has_current_path_spec.rb +1 -1
- data/lib/capybara/spec/session/has_link_spec.rb +5 -1
- data/lib/capybara/spec/session/has_none_selectors_spec.rb +7 -7
- data/lib/capybara/spec/session/matches_style_spec.rb +2 -0
- data/lib/capybara/spec/session/node_spec.rb +16 -0
- data/lib/capybara/spec/session/scroll_spec.rb +3 -1
- data/lib/capybara/spec/session/window/windows_spec.rb +1 -1
- data/lib/capybara/spec/views/form.erb +4 -0
- data/lib/capybara/spec/views/with_html.erb +1 -1
- data/lib/capybara/version.rb +1 -1
- data/spec/css_builder_spec.rb +1 -1
- data/spec/css_splitter_spec.rb +1 -1
- data/spec/rack_test_spec.rb +2 -2
- data/spec/rspec/scenarios_spec.rb +1 -1
- data/spec/rspec_matchers_spec.rb +25 -0
- data/spec/sauce_spec_chrome.rb +1 -1
- data/spec/selenium_spec_chrome.rb +5 -6
- data/spec/selenium_spec_chrome_remote.rb +5 -7
- data/spec/selenium_spec_edge.rb +11 -7
- data/spec/selenium_spec_firefox.rb +10 -4
- data/spec/selenium_spec_firefox_remote.rb +16 -3
- data/spec/selenium_spec_ie.rb +1 -1
- data/spec/selenium_spec_safari.rb +1 -1
- data/spec/server_spec.rb +2 -2
- data/spec/shared_selenium_session.rb +2 -1
- data/spec/spec_helper.rb +33 -0
- data/spec/whitespace_normalizer_spec.rb +54 -0
- data/spec/xpath_builder_spec.rb +1 -1
- metadata +4 -2
@@ -281,6 +281,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
281
281
|
end
|
282
282
|
|
283
283
|
it 'returns a shadow root' do
|
284
|
+
skip 'Not supported with this Selenium version' if selenium_lt?('4.1', session)
|
284
285
|
pending "Geckodriver doesn't fully support shadow root yet" if firefox?(session)
|
285
286
|
session.visit('/with_shadow')
|
286
287
|
shadow = session.find(:css, '#shadow_host')
|
@@ -344,7 +345,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
344
345
|
it 'can attach a directory' do
|
345
346
|
pending "Geckodriver doesn't support uploading a directory" if firefox?(session)
|
346
347
|
pending "Selenium remote doesn't support transferring a directory" if remote?(session)
|
347
|
-
pending "Headless Chrome doesn't support directory upload - https://bugs.chromium.org/p/chromedriver/issues/detail?id=2521&q=directory%20upload&colspec=ID%20Status%20Pri%20Owner%20Summary" if chrome?(session) && ENV.fetch('HEADLESS', nil)
|
348
|
+
pending "Headless Chrome doesn't support directory upload - https://bugs.chromium.org/p/chromedriver/issues/detail?id=2521&q=directory%20upload&colspec=ID%20Status%20Pri%20Owner%20Summary" if chrome?(session) && chrome_lt?(110, session) && ENV.fetch('HEADLESS', nil)
|
348
349
|
pending "IE doesn't support uploading a directory" if ie?(session)
|
349
350
|
pending 'Chrome/chromedriver 73 breaks this' if chrome?(session) && chrome_gte?(73, session) && chrome_lt?(75, session)
|
350
351
|
|
data/spec/spec_helper.rb
CHANGED
@@ -28,6 +28,18 @@ module Capybara
|
|
28
28
|
firefox?(session) && (session.driver.browser.capabilities[:browser_version].to_f >= version)
|
29
29
|
end
|
30
30
|
|
31
|
+
def geckodriver_version(session)
|
32
|
+
Gem::Version.new(session.driver.browser.capabilities['moz:geckodriverVersion'])
|
33
|
+
end
|
34
|
+
|
35
|
+
def geckodriver_gte?(version, session)
|
36
|
+
firefox?(session) && geckodriver_version(session) >= Gem::Version.new(version)
|
37
|
+
end
|
38
|
+
|
39
|
+
def geckodriver_lt?(version, session)
|
40
|
+
firefox?(session) && geckodriver_version(session) < Gem::Version.new(version)
|
41
|
+
end
|
42
|
+
|
31
43
|
def chrome?(session)
|
32
44
|
browser_name(session) == :chrome
|
33
45
|
end
|
@@ -45,6 +57,27 @@ module Capybara
|
|
45
57
|
chrome?(session) && (chrome_version(session) >= version)
|
46
58
|
end
|
47
59
|
|
60
|
+
def chromedriver_version(session)
|
61
|
+
Gem::Version.new(session.driver.browser.capabilities['chrome']['chromedriverVersion'].split[0])
|
62
|
+
end
|
63
|
+
|
64
|
+
def chromedriver_gte?(version, session)
|
65
|
+
chrome?(session) && chromedriver_version(session) >= Gem::Version.new(version)
|
66
|
+
end
|
67
|
+
|
68
|
+
def chromedriver_lt?(version, session)
|
69
|
+
chrome?(session) && chromedriver_version(session) < Gem::Version.new(version)
|
70
|
+
end
|
71
|
+
|
72
|
+
def selenium?(session)
|
73
|
+
session.driver.is_a? Capybara::Selenium::Driver
|
74
|
+
end
|
75
|
+
|
76
|
+
def selenium_lt?(version, session)
|
77
|
+
selenium?(session) &&
|
78
|
+
Gem::Version.new(::Selenium::WebDriver::VERSION) < Gem::Version.new(version)
|
79
|
+
end
|
80
|
+
|
48
81
|
def edge?(session)
|
49
82
|
browser_name(session).to_s.start_with?('edge')
|
50
83
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'capybara/node/whitespace_normalizer'
|
5
|
+
|
6
|
+
RSpec.describe Capybara::Node::WhitespaceNormalizer do
|
7
|
+
subject(:normalizer) do
|
8
|
+
klass = Class.new do
|
9
|
+
include Capybara::Node::WhitespaceNormalizer
|
10
|
+
end
|
11
|
+
|
12
|
+
klass.new
|
13
|
+
end
|
14
|
+
|
15
|
+
let(:text_needing_correction) do
|
16
|
+
<<~TEXT
|
17
|
+
Some #{described_class::NON_BREAKING_SPACE}text
|
18
|
+
#{described_class::RIGHT_TO_LEFT_MARK}
|
19
|
+
#{described_class::ZERO_WIDTH_SPACE * 30}
|
20
|
+
#{described_class::LEFT_TO_RIGHT_MARK}
|
21
|
+
Here
|
22
|
+
TEXT
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#normalize_spacing' do
|
26
|
+
it 'does nothing to text not containing special characters' do
|
27
|
+
expect(normalizer.normalize_spacing('text')).to eq('text')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'compresses excess breaking spacing' do
|
31
|
+
expect(
|
32
|
+
normalizer.normalize_spacing(text_needing_correction)
|
33
|
+
).to eq('Some text Here')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#normalize_visible_spacing' do
|
38
|
+
it 'does nothing to text not containing special characters' do
|
39
|
+
expect(normalizer.normalize_visible_spacing('text')).to eq('text')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'compresses excess breaking visible spacing' do
|
43
|
+
expect(
|
44
|
+
normalizer.normalize_visible_spacing(text_needing_correction)
|
45
|
+
).to eq <<~TEXT.chomp
|
46
|
+
Some text
|
47
|
+
#{described_class::RIGHT_TO_LEFT_MARK}
|
48
|
+
#{described_class::ZERO_WIDTH_SPACE * 30}
|
49
|
+
#{described_class::LEFT_TO_RIGHT_MARK}
|
50
|
+
Here
|
51
|
+
TEXT
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/xpath_builder_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.39.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Walpole
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|
@@ -487,6 +487,7 @@ files:
|
|
487
487
|
- lib/capybara/node/finders.rb
|
488
488
|
- lib/capybara/node/matchers.rb
|
489
489
|
- lib/capybara/node/simple.rb
|
490
|
+
- lib/capybara/node/whitespace_normalizer.rb
|
490
491
|
- lib/capybara/queries/active_element_query.rb
|
491
492
|
- lib/capybara/queries/ancestor_query.rb
|
492
493
|
- lib/capybara/queries/base_query.rb
|
@@ -781,6 +782,7 @@ files:
|
|
781
782
|
- spec/shared_selenium_node.rb
|
782
783
|
- spec/shared_selenium_session.rb
|
783
784
|
- spec/spec_helper.rb
|
785
|
+
- spec/whitespace_normalizer_spec.rb
|
784
786
|
- spec/xpath_builder_spec.rb
|
785
787
|
homepage: https://github.com/teamcapybara/capybara
|
786
788
|
licenses:
|