capybara 3.31.0 → 3.34.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 +93 -13
- data/README.md +9 -4
- data/lib/capybara.rb +18 -8
- data/lib/capybara/config.rb +4 -6
- data/lib/capybara/cucumber.rb +1 -1
- data/lib/capybara/driver/base.rb +4 -0
- data/lib/capybara/helpers.rb +25 -1
- data/lib/capybara/minitest.rb +215 -141
- data/lib/capybara/minitest/spec.rb +156 -97
- data/lib/capybara/node/actions.rb +16 -21
- data/lib/capybara/node/element.rb +3 -5
- data/lib/capybara/node/finders.rb +7 -6
- data/lib/capybara/node/matchers.rb +11 -11
- data/lib/capybara/node/simple.rb +5 -1
- data/lib/capybara/queries/ancestor_query.rb +1 -1
- data/lib/capybara/queries/current_path_query.rb +14 -4
- data/lib/capybara/queries/selector_query.rb +16 -10
- data/lib/capybara/queries/sibling_query.rb +1 -1
- data/lib/capybara/queries/style_query.rb +1 -1
- data/lib/capybara/queries/text_query.rb +7 -1
- data/lib/capybara/rack_test/browser.rb +9 -3
- data/lib/capybara/rack_test/driver.rb +1 -0
- data/lib/capybara/rack_test/form.rb +1 -1
- data/lib/capybara/rack_test/node.rb +1 -1
- data/lib/capybara/registration_container.rb +44 -0
- data/lib/capybara/registrations/patches/puma_ssl.rb +3 -1
- data/lib/capybara/registrations/servers.rb +2 -1
- data/lib/capybara/result.rb +8 -8
- data/lib/capybara/rspec.rb +2 -0
- data/lib/capybara/rspec/matcher_proxies.rb +5 -5
- data/lib/capybara/rspec/matchers.rb +7 -6
- data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
- data/lib/capybara/rspec/matchers/have_text.rb +1 -1
- data/lib/capybara/rspec/matchers/match_style.rb +5 -0
- data/lib/capybara/selector.rb +10 -1
- data/lib/capybara/selector/definition.rb +11 -9
- data/lib/capybara/selector/definition/button.rb +8 -5
- data/lib/capybara/selector/definition/css.rb +1 -1
- data/lib/capybara/selector/definition/datalist_input.rb +1 -1
- data/lib/capybara/selector/definition/element.rb +2 -1
- data/lib/capybara/selector/definition/fillable_field.rb +1 -1
- data/lib/capybara/selector/definition/label.rb +1 -1
- data/lib/capybara/selector/definition/link.rb +8 -0
- data/lib/capybara/selector/definition/select.rb +1 -1
- data/lib/capybara/selector/definition/table.rb +1 -1
- data/lib/capybara/selector/definition/table_row.rb +1 -1
- data/lib/capybara/selector/filter_set.rb +2 -2
- data/lib/capybara/selector/selector.rb +9 -1
- data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -1
- data/lib/capybara/selenium/atoms/src/getAttribute.js +1 -1
- data/lib/capybara/selenium/driver.rb +35 -6
- data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +9 -11
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +9 -11
- data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +3 -3
- data/lib/capybara/selenium/extensions/find.rb +3 -3
- data/lib/capybara/selenium/extensions/scroll.rb +8 -10
- data/lib/capybara/selenium/node.rb +75 -12
- data/lib/capybara/selenium/nodes/chrome_node.rb +20 -11
- data/lib/capybara/selenium/nodes/firefox_node.rb +2 -2
- data/lib/capybara/selenium/nodes/safari_node.rb +1 -1
- data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
- data/lib/capybara/selenium/patches/atoms.rb +4 -4
- data/lib/capybara/selenium/patches/logs.rb +7 -9
- data/lib/capybara/server/animation_disabler.rb +3 -2
- data/lib/capybara/server/middleware.rb +4 -2
- data/lib/capybara/session.rb +23 -14
- data/lib/capybara/session/config.rb +3 -1
- data/lib/capybara/session/matchers.rb +11 -11
- data/lib/capybara/spec/public/test.js +24 -1
- data/lib/capybara/spec/session/accept_alert_spec.rb +1 -1
- data/lib/capybara/spec/session/check_spec.rb +6 -0
- data/lib/capybara/spec/session/click_button_spec.rb +11 -0
- data/lib/capybara/spec/session/current_url_spec.rb +11 -1
- data/lib/capybara/spec/session/fill_in_spec.rb +9 -0
- data/lib/capybara/spec/session/find_spec.rb +11 -8
- data/lib/capybara/spec/session/has_button_spec.rb +18 -0
- data/lib/capybara/spec/session/has_css_spec.rb +11 -7
- data/lib/capybara/spec/session/has_current_path_spec.rb +15 -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/has_text_spec.rb +0 -11
- data/lib/capybara/spec/session/matches_style_spec.rb +2 -2
- data/lib/capybara/spec/session/node_spec.rb +76 -29
- data/lib/capybara/spec/session/refresh_spec.rb +1 -0
- data/lib/capybara/spec/session/save_page_spec.rb +4 -4
- data/lib/capybara/spec/session/window/window_spec.rb +7 -7
- data/lib/capybara/spec/spec_helper.rb +13 -14
- data/lib/capybara/spec/test_app.rb +22 -21
- data/lib/capybara/spec/views/form.erb +25 -1
- data/lib/capybara/spec/views/with_animation.erb +8 -0
- data/lib/capybara/spec/views/with_dragula.erb +3 -1
- data/lib/capybara/spec/views/with_html.erb +2 -2
- data/lib/capybara/spec/views/with_js.erb +2 -0
- data/lib/capybara/spec/views/with_sortable_js.erb +1 -1
- data/lib/capybara/version.rb +1 -1
- data/lib/capybara/window.rb +3 -7
- data/spec/basic_node_spec.rb +9 -8
- data/spec/capybara_spec.rb +1 -1
- data/spec/dsl_spec.rb +14 -1
- data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
- data/spec/minitest_spec.rb +3 -2
- data/spec/rack_test_spec.rb +28 -5
- data/spec/regexp_dissassembler_spec.rb +0 -4
- data/spec/result_spec.rb +38 -31
- data/spec/rspec/features_spec.rb +3 -1
- data/spec/rspec/scenarios_spec.rb +4 -0
- data/spec/rspec/shared_spec_matchers.rb +63 -51
- data/spec/rspec_spec.rb +4 -0
- data/spec/selector_spec.rb +2 -1
- data/spec/selenium_spec_chrome.rb +4 -2
- data/spec/selenium_spec_chrome_remote.rb +2 -0
- data/spec/server_spec.rb +56 -49
- data/spec/shared_selenium_node.rb +18 -0
- data/spec/shared_selenium_session.rb +84 -7
- data/spec/spec_helper.rb +1 -1
- metadata +25 -24
- data/lib/capybara/spec/session/source_spec.rb +0 -0
data/spec/rspec_spec.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable RSpec/MultipleDescribes
|
4
|
+
|
3
5
|
require 'spec_helper'
|
4
6
|
|
5
7
|
RSpec.describe 'capybara/rspec' do
|
@@ -143,3 +145,5 @@ feature 'Feature DSL' do
|
|
143
145
|
expect(page.body).to include('Another World')
|
144
146
|
end
|
145
147
|
end
|
148
|
+
|
149
|
+
# rubocop:enable RSpec/MultipleDescribes
|
data/spec/selector_spec.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
RSpec.describe Capybara do
|
6
|
+
include Capybara::RSpecMatchers
|
6
7
|
describe 'Selectors' do
|
7
8
|
let :string do
|
8
9
|
described_class.string <<-STRING
|
@@ -476,7 +477,7 @@ RSpec.describe Capybara do
|
|
476
477
|
end
|
477
478
|
|
478
479
|
describe ':link_or_button selector' do
|
479
|
-
around
|
480
|
+
around do |example|
|
480
481
|
described_class.modify_selector(:link_or_button) do
|
481
482
|
expression_filter(:random) { |xpath, _| xpath } # do nothing filter
|
482
483
|
end
|
@@ -68,8 +68,10 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybar
|
|
68
68
|
skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
|
69
69
|
when /Capybara::Session selenium_chrome Capybara::Window#maximize/
|
70
70
|
pending "Chrome headless doesn't support maximize" if ENV['HEADLESS']
|
71
|
-
when /
|
72
|
-
|
71
|
+
when /Capybara::Window#fullscreen should be able to fullscreen the window/
|
72
|
+
skip 'Chromedriver hangs on attempts to fullscreen in headless mode' if ENV['HEADLESS']
|
73
|
+
when /node #right_click delay should delay the mouse up/
|
74
|
+
skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
@@ -62,6 +62,8 @@ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_REMOTE_DRIVER.to_s,
|
|
62
62
|
'Capybara::Session selenium_chrome_remote #attach_file with multipart form should fire change once for each set of files uploaded',
|
63
63
|
'Capybara::Session selenium_chrome_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
|
64
64
|
pending "Selenium with Remote Chrome doesn't support multiple file upload" unless selenium_gte?(3.14)
|
65
|
+
when /node #right_click delay should delay the mouse up/
|
66
|
+
skip "Legacy selenium doesn't support separate right button down/up" if ENV['W3C'] == 'false'
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
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
|
@@ -103,30 +99,43 @@ RSpec.describe Capybara::Server do
|
|
103
99
|
expect(uri.to_hash).to include(scheme: 'http', host: server.host, port: server.port)
|
104
100
|
end
|
105
101
|
|
106
|
-
it 'should
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
102
|
+
it 'should call #clamp on the puma configuration to ensure that environment is a string' do
|
103
|
+
Capybara.server = :puma
|
104
|
+
app_proc = proc { |_env| [200, {}, ['Hello Puma!']] }
|
105
|
+
require 'puma'
|
106
|
+
allow(Puma::Server).to receive(:new).and_wrap_original do |method, app, events, options|
|
107
|
+
# If #clamp is not called on the puma config then this will be a Proc
|
108
|
+
expect(options.fetch(:environment)).to be_a(String)
|
109
|
+
method.call(app, events, options)
|
110
|
+
end
|
111
|
+
described_class.new(app_proc).boot
|
112
|
+
expect(Puma::Server).to have_received(:new)
|
113
|
+
ensure
|
114
|
+
Capybara.server = :default
|
115
|
+
end
|
113
116
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
117
|
+
it 'should support SSL' do
|
118
|
+
key = File.join(Dir.pwd, 'spec', 'fixtures', 'key.pem')
|
119
|
+
cert = File.join(Dir.pwd, 'spec', 'fixtures', 'certificate.pem')
|
120
|
+
Capybara.server = :puma, { Host: "ssl://#{Capybara.server_host}?key=#{key}&cert=#{cert}" }
|
121
|
+
app = proc { |_env| [200, {}, ['Hello SSL Server!']] }
|
122
|
+
server = described_class.new(app).boot
|
119
123
|
|
120
|
-
|
121
|
-
|
122
|
-
|
124
|
+
expect do
|
125
|
+
Net::HTTP.start(server.host, server.port, max_retries: 0) { |http| http.get('/__identify__') }
|
126
|
+
end.to(raise_error do |e|
|
127
|
+
expect(e.is_a?(EOFError) || e.is_a?(Net::ReadTimeout)).to be true
|
128
|
+
end)
|
123
129
|
|
124
|
-
|
125
|
-
|
126
|
-
expect(uri.to_hash).to include(scheme: 'https', host: server.host, port: server.port)
|
127
|
-
ensure
|
128
|
-
Capybara.server = :default
|
130
|
+
res = Net::HTTP.start(server.host, server.port, use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE) do |https|
|
131
|
+
https.get('/')
|
129
132
|
end
|
133
|
+
|
134
|
+
expect(res.body).to include('Hello SSL Server!')
|
135
|
+
uri = ::Addressable::URI.parse(server.base_url)
|
136
|
+
expect(uri.to_hash).to include(scheme: 'https', host: server.host, port: server.port)
|
137
|
+
ensure
|
138
|
+
Capybara.server = :default
|
130
139
|
end
|
131
140
|
|
132
141
|
context 'When Capybara.reuse_server is true' do
|
@@ -224,19 +233,17 @@ RSpec.describe Capybara::Server do
|
|
224
233
|
end
|
225
234
|
|
226
235
|
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
|
236
|
+
Capybara.register_server :kaboom do
|
237
|
+
sleep 0.1
|
238
|
+
raise 'kaboom'
|
239
239
|
end
|
240
|
+
Capybara.server = :kaboom
|
241
|
+
|
242
|
+
expect do
|
243
|
+
described_class.new(proc { |e| }).boot
|
244
|
+
end.to raise_error(RuntimeError, 'kaboom')
|
245
|
+
ensure
|
246
|
+
Capybara.server = :default
|
240
247
|
end
|
241
248
|
|
242
249
|
it 'should raise an error when there are pending requests' do
|
@@ -27,6 +27,24 @@ RSpec.shared_examples 'Capybara::Node' do |session, _mode|
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
describe '#[]' do
|
31
|
+
it 'should work for spellcheck' do
|
32
|
+
session.visit('/with_html')
|
33
|
+
expect(session.find('//input[@spellcheck="TRUE"]')[:spellcheck]).to eq('true')
|
34
|
+
expect(session.find('//input[@spellcheck="FALSE"]')[:spellcheck]).to eq('false')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#set' do
|
39
|
+
it 'respects maxlength when using rapid set' do
|
40
|
+
session.visit('/form')
|
41
|
+
inp = session.find(:css, '#long_length')
|
42
|
+
value = (0...50).map { |i| ((i % 26) + 65).chr }.join
|
43
|
+
inp.set(value, rapid: true)
|
44
|
+
expect(inp.value).to eq value[0...35]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
30
48
|
describe '#visible?' do
|
31
49
|
let(:bridge) do
|
32
50
|
session.driver.browser.send(:bridge)
|
@@ -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
|
@@ -205,6 +214,26 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
205
214
|
end
|
206
215
|
end
|
207
216
|
|
217
|
+
describe '#fill_in with Emoji' do
|
218
|
+
it 'sends emojis' do
|
219
|
+
session.visit('/form')
|
220
|
+
session.fill_in('form_first_name', with: 'a😀cd😴 🛌🏽🇵🇹 e🤾🏽♀️f')
|
221
|
+
expect(session.find(:fillable_field, 'form_first_name').value).to eq('a😀cd😴 🛌🏽🇵🇹 e🤾🏽♀️f')
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
describe '#send_keys' do
|
226
|
+
it 'defaults to sending keys to the document.activeElement' do
|
227
|
+
session.visit('/form')
|
228
|
+
|
229
|
+
expect(session.evaluate_script('document.activeElement')).to eq(session.find('//body'))
|
230
|
+
|
231
|
+
session.send_keys(:tab)
|
232
|
+
|
233
|
+
expect(session.evaluate_script('document.activeElement')).to eq(session.first(:field))
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
208
237
|
describe '#path' do
|
209
238
|
it 'returns xpath' do
|
210
239
|
# this is here because it is testing for an XPath that is specific to the algorithm used in the selenium driver
|
@@ -360,15 +389,50 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
360
389
|
|
361
390
|
it 'should disable CSS animations (set to 0s)' do
|
362
391
|
@animation_session.visit('with_animation')
|
392
|
+
sleep 1
|
363
393
|
@animation_session.click_link('animate me away')
|
364
394
|
expect(@animation_session).to have_no_link('animate me away', wait: 0.5)
|
365
395
|
end
|
366
396
|
|
367
397
|
it 'should disable CSS animations on pseudo elements (set to 0s)' do
|
368
398
|
@animation_session.visit('with_animation')
|
399
|
+
sleep 1
|
369
400
|
@animation_session.find_link('animate me away').right_click
|
370
401
|
expect(@animation_session).to have_content('Animation Ended', wait: 0.1)
|
371
402
|
end
|
403
|
+
|
404
|
+
it 'should scroll the page instantly', requires: [:js] do
|
405
|
+
@animation_session.visit('with_animation')
|
406
|
+
scroll_y = @animation_session.evaluate_script(<<~JS)
|
407
|
+
(function(){
|
408
|
+
window.scrollTo(0,500);
|
409
|
+
return window.scrollY;
|
410
|
+
})()
|
411
|
+
JS
|
412
|
+
expect(scroll_y).to eq 500
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
context 'when set to `false`' do
|
417
|
+
before(:context) do # rubocop:disable RSpec/BeforeAfterAll
|
418
|
+
skip "Safari doesn't support multiple sessions" if safari?(session)
|
419
|
+
# NOTE: Although Capybara.SpecHelper.reset! sets Capybara.disable_animation to false,
|
420
|
+
# it doesn't affect any of these tests because the settings are applied per-session
|
421
|
+
Capybara.disable_animation = false
|
422
|
+
@animation_session = Capybara::Session.new(session.mode, TestApp.new)
|
423
|
+
end
|
424
|
+
|
425
|
+
it 'should scroll the page with a smooth animation', requires: [:js] do
|
426
|
+
@animation_session.visit('with_animation')
|
427
|
+
scroll_y = @animation_session.evaluate_script(<<~JS)
|
428
|
+
(function(){
|
429
|
+
window.scrollTo(0,500);
|
430
|
+
return window.scrollY;
|
431
|
+
})()
|
432
|
+
JS
|
433
|
+
# measured over 0.5 seconds: 0, 75, 282, 478, 500
|
434
|
+
expect(scroll_y).to be < 500
|
435
|
+
end
|
372
436
|
end
|
373
437
|
|
374
438
|
context 'if we pass in css that matches elements' do
|
@@ -382,12 +446,14 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
382
446
|
|
383
447
|
it 'should disable CSS transitions' do
|
384
448
|
@animation_session_with_matching_css.visit('with_animation')
|
449
|
+
sleep 1
|
385
450
|
@animation_session_with_matching_css.click_link('transition me away')
|
386
451
|
expect(@animation_session_with_matching_css).to have_no_link('transition me away', wait: 0.5)
|
387
452
|
end
|
388
453
|
|
389
454
|
it 'should disable CSS animations' do
|
390
455
|
@animation_session_with_matching_css.visit('with_animation')
|
456
|
+
sleep 1
|
391
457
|
@animation_session_with_matching_css.click_link('animate me away')
|
392
458
|
expect(@animation_session_with_matching_css).to have_no_link('animate me away', wait: 0.5)
|
393
459
|
end
|
@@ -404,6 +470,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
404
470
|
|
405
471
|
it 'should not disable CSS transitions' do
|
406
472
|
@animation_session_without_matching_css.visit('with_animation')
|
473
|
+
sleep 1
|
407
474
|
@animation_session_without_matching_css.click_link('transition me away')
|
408
475
|
sleep 0.5 # Wait long enough for click to have been processed
|
409
476
|
expect(@animation_session_without_matching_css).to have_link('transition me away', wait: false)
|
@@ -412,6 +479,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
412
479
|
|
413
480
|
it 'should not disable CSS animations' do
|
414
481
|
@animation_session_without_matching_css.visit('with_animation')
|
482
|
+
sleep 1
|
415
483
|
@animation_session_without_matching_css.click_link('animate me away')
|
416
484
|
sleep 0.5 # Wait long enough for click to have been processed
|
417
485
|
expect(@animation_session_without_matching_css).to have_link('animate me away', wait: false)
|
@@ -425,7 +493,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
425
493
|
it 'can find html5 svg elements' do
|
426
494
|
session.visit('with_html5_svg')
|
427
495
|
expect(session).to have_selector(:element, :svg)
|
428
|
-
expect(session).to have_selector(:element, :rect, visible:
|
496
|
+
expect(session).to have_selector(:element, :rect, visible: :visible)
|
429
497
|
expect(session).to have_selector(:element, :circle)
|
430
498
|
expect(session).to have_selector(:element, :linearGradient, visible: :all)
|
431
499
|
end
|
@@ -441,21 +509,30 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
|
|
441
509
|
context 'controlled components' do
|
442
510
|
it 'can set and clear a text field' do
|
443
511
|
skip "This test doesn't support older browsers" if ie?(session)
|
444
|
-
|
445
|
-
# session.all(:css, 'h2#controlled-components ~ p a', text: 'Try it on CodePen')[0].click
|
446
|
-
# copied into local view
|
512
|
+
|
447
513
|
session.visit 'react'
|
448
|
-
|
449
|
-
# session.within_frame(:css, 'iframe.result-iframe:not([src=""])', wait: 10) do
|
514
|
+
|
450
515
|
session.fill_in('Name:', with: 'abc')
|
451
516
|
session.accept_prompt 'A name was submitted: abc' do
|
452
517
|
session.click_button('Submit')
|
453
518
|
end
|
519
|
+
|
454
520
|
session.fill_in('Name:', with: '')
|
455
521
|
session.accept_prompt(/A name was submitted: $/) do
|
456
522
|
session.click_button('Submit')
|
457
523
|
end
|
458
|
-
|
524
|
+
end
|
525
|
+
|
526
|
+
it 'works with rapid fill' do
|
527
|
+
skip "This test doesn't support older browsers" if ie?(session)
|
528
|
+
|
529
|
+
session.visit 'react'
|
530
|
+
long_string = (0...60).map { |i| ((i % 26) + 65).chr }.join
|
531
|
+
|
532
|
+
session.fill_in('Name:', with: long_string)
|
533
|
+
session.accept_prompt "A name was submitted: #{long_string}" do
|
534
|
+
session.click_button('Submit')
|
535
|
+
end
|
459
536
|
end
|
460
537
|
end
|
461
538
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.34.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Walpole
|
8
8
|
- Jonas Nicklas
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain:
|
12
12
|
- gem-public_cert.pem
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -270,14 +270,14 @@ dependencies:
|
|
270
270
|
requirements:
|
271
271
|
- - "~>"
|
272
272
|
- !ruby/object:Gem::Version
|
273
|
-
version:
|
273
|
+
version: 1.1.0
|
274
274
|
type: :development
|
275
275
|
prerelease: false
|
276
276
|
version_requirements: !ruby/object:Gem::Requirement
|
277
277
|
requirements:
|
278
278
|
- - "~>"
|
279
279
|
- !ruby/object:Gem::Version
|
280
|
-
version:
|
280
|
+
version: 1.1.0
|
281
281
|
- !ruby/object:Gem::Dependency
|
282
282
|
name: rubocop-performance
|
283
283
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,16 +296,16 @@ dependencies:
|
|
296
296
|
name: rubocop-rspec
|
297
297
|
requirement: !ruby/object:Gem::Requirement
|
298
298
|
requirements:
|
299
|
-
- - "
|
299
|
+
- - "~>"
|
300
300
|
- !ruby/object:Gem::Version
|
301
|
-
version:
|
301
|
+
version: 2.0.0.pre
|
302
302
|
type: :development
|
303
303
|
prerelease: false
|
304
304
|
version_requirements: !ruby/object:Gem::Requirement
|
305
305
|
requirements:
|
306
|
-
- - "
|
306
|
+
- - "~>"
|
307
307
|
- !ruby/object:Gem::Version
|
308
|
-
version:
|
308
|
+
version: 2.0.0.pre
|
309
309
|
- !ruby/object:Gem::Dependency
|
310
310
|
name: sauce_whisk
|
311
311
|
requirement: !ruby/object:Gem::Requirement
|
@@ -321,33 +321,33 @@ dependencies:
|
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: '0'
|
323
323
|
- !ruby/object:Gem::Dependency
|
324
|
-
name:
|
324
|
+
name: selenium_statistics
|
325
325
|
requirement: !ruby/object:Gem::Requirement
|
326
326
|
requirements:
|
327
|
-
- - "
|
327
|
+
- - ">="
|
328
328
|
- !ruby/object:Gem::Version
|
329
|
-
version: '
|
329
|
+
version: '0'
|
330
330
|
type: :development
|
331
331
|
prerelease: false
|
332
332
|
version_requirements: !ruby/object:Gem::Requirement
|
333
333
|
requirements:
|
334
|
-
- - "
|
334
|
+
- - ">="
|
335
335
|
- !ruby/object:Gem::Version
|
336
|
-
version: '
|
336
|
+
version: '0'
|
337
337
|
- !ruby/object:Gem::Dependency
|
338
|
-
name:
|
338
|
+
name: selenium-webdriver
|
339
339
|
requirement: !ruby/object:Gem::Requirement
|
340
340
|
requirements:
|
341
|
-
- - "
|
341
|
+
- - "~>"
|
342
342
|
- !ruby/object:Gem::Version
|
343
|
-
version: '
|
343
|
+
version: '3.5'
|
344
344
|
type: :development
|
345
345
|
prerelease: false
|
346
346
|
version_requirements: !ruby/object:Gem::Requirement
|
347
347
|
requirements:
|
348
|
-
- - "
|
348
|
+
- - "~>"
|
349
349
|
- !ruby/object:Gem::Version
|
350
|
-
version: '
|
350
|
+
version: '3.5'
|
351
351
|
- !ruby/object:Gem::Dependency
|
352
352
|
name: sinatra
|
353
353
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -528,6 +529,7 @@ files:
|
|
528
529
|
- lib/capybara/selenium/nodes/firefox_node.rb
|
529
530
|
- lib/capybara/selenium/nodes/ie_node.rb
|
530
531
|
- lib/capybara/selenium/nodes/safari_node.rb
|
532
|
+
- lib/capybara/selenium/patches/action_pauser.rb
|
531
533
|
- lib/capybara/selenium/patches/atoms.rb
|
532
534
|
- lib/capybara/selenium/patches/is_displayed.rb
|
533
535
|
- lib/capybara/selenium/patches/logs.rb
|
@@ -623,7 +625,6 @@ files:
|
|
623
625
|
- lib/capybara/spec/session/select_spec.rb
|
624
626
|
- lib/capybara/spec/session/selectors_spec.rb
|
625
627
|
- lib/capybara/spec/session/sibling_spec.rb
|
626
|
-
- lib/capybara/spec/session/source_spec.rb
|
627
628
|
- lib/capybara/spec/session/text_spec.rb
|
628
629
|
- lib/capybara/spec/session/title_spec.rb
|
629
630
|
- lib/capybara/spec/session/uncheck_spec.rb
|
@@ -729,7 +730,7 @@ licenses:
|
|
729
730
|
metadata:
|
730
731
|
changelog_uri: https://github.com/teamcapybara/capybara/blob/master/History.md
|
731
732
|
source_code_uri: https://github.com/teamcapybara/capybara
|
732
|
-
post_install_message:
|
733
|
+
post_install_message:
|
733
734
|
rdoc_options: []
|
734
735
|
require_paths:
|
735
736
|
- lib
|
@@ -737,15 +738,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
737
738
|
requirements:
|
738
739
|
- - ">="
|
739
740
|
- !ruby/object:Gem::Version
|
740
|
-
version: 2.
|
741
|
+
version: 2.5.0
|
741
742
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
742
743
|
requirements:
|
743
744
|
- - ">="
|
744
745
|
- !ruby/object:Gem::Version
|
745
746
|
version: '0'
|
746
747
|
requirements: []
|
747
|
-
rubygems_version: 3.1.
|
748
|
-
signing_key:
|
748
|
+
rubygems_version: 3.1.4
|
749
|
+
signing_key:
|
749
750
|
specification_version: 4
|
750
751
|
summary: Capybara aims to simplify the process of integration testing Rack applications,
|
751
752
|
such as Rails, Sinatra or Merb
|