capybara 3.32.2 → 3.33.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 +21 -1
- data/README.md +10 -3
- data/lib/capybara.rb +17 -7
- data/lib/capybara/cucumber.rb +1 -1
- data/lib/capybara/minitest.rb +2 -3
- data/lib/capybara/node/actions.rb +16 -20
- data/lib/capybara/node/matchers.rb +4 -6
- data/lib/capybara/queries/selector_query.rb +8 -1
- data/lib/capybara/queries/style_query.rb +1 -1
- data/lib/capybara/queries/text_query.rb +6 -0
- data/lib/capybara/registration_container.rb +44 -0
- data/lib/capybara/selector.rb +10 -1
- data/lib/capybara/selector/definition.rb +5 -4
- data/lib/capybara/selector/definition/button.rb +1 -0
- data/lib/capybara/selector/definition/fillable_field.rb +1 -1
- data/lib/capybara/selector/definition/link.rb +8 -0
- data/lib/capybara/selector/definition/table.rb +1 -1
- data/lib/capybara/selector/selector.rb +4 -0
- data/lib/capybara/selenium/driver.rb +2 -0
- data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +7 -9
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +7 -9
- data/lib/capybara/selenium/node.rb +3 -2
- data/lib/capybara/selenium/nodes/firefox_node.rb +1 -1
- data/lib/capybara/selenium/patches/logs.rb +3 -5
- data/lib/capybara/session.rb +3 -3
- data/lib/capybara/session/config.rb +3 -1
- data/lib/capybara/spec/public/test.js +7 -0
- data/lib/capybara/spec/session/click_button_spec.rb +11 -0
- data/lib/capybara/spec/session/has_button_spec.rb +16 -0
- data/lib/capybara/spec/session/has_current_path_spec.rb +2 -2
- data/lib/capybara/spec/session/has_field_spec.rb +16 -0
- data/lib/capybara/spec/session/has_select_spec.rb +4 -4
- data/lib/capybara/spec/session/has_selector_spec.rb +4 -4
- data/lib/capybara/spec/session/node_spec.rb +6 -6
- data/lib/capybara/spec/spec_helper.rb +1 -0
- data/lib/capybara/spec/test_app.rb +14 -18
- data/lib/capybara/spec/views/form.erb +2 -1
- data/lib/capybara/spec/views/with_dragula.erb +3 -1
- data/lib/capybara/spec/views/with_js.erb +1 -0
- data/lib/capybara/version.rb +1 -1
- data/spec/capybara_spec.rb +1 -1
- data/spec/dsl_spec.rb +14 -1
- data/spec/minitest_spec.rb +1 -1
- data/spec/rack_test_spec.rb +1 -0
- data/spec/rspec/shared_spec_matchers.rb +63 -51
- data/spec/selector_spec.rb +1 -1
- data/spec/selenium_spec_chrome.rb +0 -2
- data/spec/server_spec.rb +41 -49
- data/spec/shared_selenium_session.rb +10 -1
- data/spec/spec_helper.rb +1 -1
- metadata +4 -3
@@ -70,8 +70,6 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybar
|
|
70
70
|
pending "Chrome headless doesn't support maximize" if ENV['HEADLESS']
|
71
71
|
when /Capybara::Window#fullscreen should be able to fullscreen the window/
|
72
72
|
skip 'Chromedriver hangs on attempts to fullscreen in headless mode' if ENV['HEADLESS']
|
73
|
-
when /details non-summary descendants should be non-visible/
|
74
|
-
pending 'Chromedriver built-in is_displayed is currently broken' if ENV['W3C'] == 'false'
|
75
73
|
when /node #right_click delay should delay the mouse up/
|
76
74
|
skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
|
77
75
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -75,25 +75,21 @@ RSpec.describe Capybara::Server do
|
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'should handle that getting available ports fails randomly' do
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
begin
|
86
|
-
call_count.zero? ? d_server : m.call(*args)
|
87
|
-
ensure
|
88
|
-
call_count += 1
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
port = described_class.new(Object.new, host: '0.0.0.0').port
|
93
|
-
expect(port).not_to eq(server_port)
|
78
|
+
# Use a port to force a EADDRINUSE error to be generated
|
79
|
+
server = TCPServer.new('0.0.0.0', 0)
|
80
|
+
server_port = server.addr[1]
|
81
|
+
d_server = instance_double('TCPServer', addr: [nil, server_port, nil, nil], close: nil)
|
82
|
+
call_count = 0
|
83
|
+
allow(TCPServer).to receive(:new).and_wrap_original do |m, *args|
|
84
|
+
call_count.zero? ? d_server : m.call(*args)
|
94
85
|
ensure
|
95
|
-
|
86
|
+
call_count += 1
|
96
87
|
end
|
88
|
+
|
89
|
+
port = described_class.new(Object.new, host: '0.0.0.0').port
|
90
|
+
expect(port).not_to eq(server_port)
|
91
|
+
ensure
|
92
|
+
server&.close
|
97
93
|
end
|
98
94
|
|
99
95
|
it 'should return its #base_url' do
|
@@ -104,29 +100,27 @@ RSpec.describe Capybara::Server do
|
|
104
100
|
end
|
105
101
|
|
106
102
|
it 'should support SSL' do
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
server = described_class.new(app).boot
|
113
|
-
|
114
|
-
expect do
|
115
|
-
Net::HTTP.start(server.host, server.port, max_retries: 0) { |http| http.get('/__identify__') }
|
116
|
-
end.to(raise_error do |e|
|
117
|
-
expect(e.is_a?(EOFError) || e.is_a?(Net::ReadTimeout)).to be true
|
118
|
-
end)
|
103
|
+
key = File.join(Dir.pwd, 'spec', 'fixtures', 'key.pem')
|
104
|
+
cert = File.join(Dir.pwd, 'spec', 'fixtures', 'certificate.pem')
|
105
|
+
Capybara.server = :puma, { Host: "ssl://#{Capybara.server_host}?key=#{key}&cert=#{cert}" }
|
106
|
+
app = proc { |_env| [200, {}, ['Hello SSL Server!']] }
|
107
|
+
server = described_class.new(app).boot
|
119
108
|
|
120
|
-
|
121
|
-
|
122
|
-
|
109
|
+
expect do
|
110
|
+
Net::HTTP.start(server.host, server.port, max_retries: 0) { |http| http.get('/__identify__') }
|
111
|
+
end.to(raise_error do |e|
|
112
|
+
expect(e.is_a?(EOFError) || e.is_a?(Net::ReadTimeout)).to be true
|
113
|
+
end)
|
123
114
|
|
124
|
-
|
125
|
-
|
126
|
-
expect(uri.to_hash).to include(scheme: 'https', host: server.host, port: server.port)
|
127
|
-
ensure
|
128
|
-
Capybara.server = :default
|
115
|
+
res = Net::HTTP.start(server.host, server.port, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |https|
|
116
|
+
https.get('/')
|
129
117
|
end
|
118
|
+
|
119
|
+
expect(res.body).to include('Hello SSL Server!')
|
120
|
+
uri = ::Addressable::URI.parse(server.base_url)
|
121
|
+
expect(uri.to_hash).to include(scheme: 'https', host: server.host, port: server.port)
|
122
|
+
ensure
|
123
|
+
Capybara.server = :default
|
130
124
|
end
|
131
125
|
|
132
126
|
context 'When Capybara.reuse_server is true' do
|
@@ -224,19 +218,17 @@ RSpec.describe Capybara::Server do
|
|
224
218
|
end
|
225
219
|
|
226
220
|
it 'should raise server errors when the server errors before the timeout' do
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
raise 'kaboom'
|
231
|
-
end
|
232
|
-
Capybara.server = :kaboom
|
233
|
-
|
234
|
-
expect do
|
235
|
-
described_class.new(proc { |e| }).boot
|
236
|
-
end.to raise_error(RuntimeError, 'kaboom')
|
237
|
-
ensure
|
238
|
-
Capybara.server = :default
|
221
|
+
Capybara.register_server :kaboom do
|
222
|
+
sleep 0.1
|
223
|
+
raise 'kaboom'
|
239
224
|
end
|
225
|
+
Capybara.server = :kaboom
|
226
|
+
|
227
|
+
expect do
|
228
|
+
described_class.new(proc { |e| }).boot
|
229
|
+
end.to raise_error(RuntimeError, 'kaboom')
|
230
|
+
ensure
|
231
|
+
Capybara.server = :default
|
240
232
|
end
|
241
233
|
|
242
234
|
it 'should raise an error when there are pending requests' do
|
@@ -160,6 +160,15 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
160
160
|
fill_options: { clear: :none })
|
161
161
|
expect(session.find(:fillable_field, 'form_first_name').value).to eq('JohnHarry')
|
162
162
|
end
|
163
|
+
|
164
|
+
it 'works with rapid fill' do
|
165
|
+
pending 'Safari overwrites by default - need to figure out a workaround' if safari?(session)
|
166
|
+
|
167
|
+
long_string = (0...60).map { |i| ((i % 26) + 65).chr }.join
|
168
|
+
session.visit('/form')
|
169
|
+
session.fill_in('form_first_name', with: long_string, fill_options: { clear: :none })
|
170
|
+
expect(session.find(:fillable_field, 'form_first_name').value).to eq('John' + long_string)
|
171
|
+
end
|
163
172
|
end
|
164
173
|
|
165
174
|
describe '#fill_in with Date' do
|
@@ -425,7 +434,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
425
434
|
it 'can find html5 svg elements' do
|
426
435
|
session.visit('with_html5_svg')
|
427
436
|
expect(session).to have_selector(:element, :svg)
|
428
|
-
expect(session).to have_selector(:element, :rect, visible:
|
437
|
+
expect(session).to have_selector(:element, :rect, visible: :visible)
|
429
438
|
expect(session).to have_selector(:element, :circle)
|
430
439
|
expect(session).to have_selector(:element, :linearGradient, visible: :all)
|
431
440
|
end
|
data/spec/spec_helper.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.33.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Walpole
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- gem-public_cert.pem
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-06-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -450,6 +450,7 @@ files:
|
|
450
450
|
- lib/capybara/rack_test/form.rb
|
451
451
|
- lib/capybara/rack_test/node.rb
|
452
452
|
- lib/capybara/rails.rb
|
453
|
+
- lib/capybara/registration_container.rb
|
453
454
|
- lib/capybara/registrations/drivers.rb
|
454
455
|
- lib/capybara/registrations/patches/puma_ssl.rb
|
455
456
|
- lib/capybara/registrations/servers.rb
|
@@ -738,7 +739,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
738
739
|
requirements:
|
739
740
|
- - ">="
|
740
741
|
- !ruby/object:Gem::Version
|
741
|
-
version: 2.
|
742
|
+
version: 2.5.0
|
742
743
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
743
744
|
requirements:
|
744
745
|
- - ">="
|