capybara 2.17.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f913df68a0c00ede749cba87a0b229ff28e9e6b8f8f45bbbbd07577729f1c6a
4
- data.tar.gz: 37a3fdfec9dc3cab859eae2300819d4691c1f20ccb05acf98807e7e287796c98
3
+ metadata.gz: fb46b7bc5ae7408ca3870b781d015a84bd84abd0a9c7e3ea2bcdf3d8fff85ce8
4
+ data.tar.gz: 1865dc1efa384c3792161a134bc536c56dca3aa0670ca298ad9f3aa12b49830d
5
5
  SHA512:
6
- metadata.gz: 1edbf3df7b7357bbb96937c10eecffa5afa6ead2c119b0607bae820973702197de1536ec540968100d00355d07227c1f531f793156d645124d9f1a0250802996
7
- data.tar.gz: e5a51fbceb1d26ddf7a101712bb407bc835ab701038b6e103c9f25c7677308fbda93ec515701862b297810b962dffac3b0e3ed35032296a6cf1f78c4adb4b79e
6
+ metadata.gz: 9bc2cb739af408323d977b7ca829aa0862ef68ab7d1778c5ae67fb127a47a09258c1f5b53f9d7955bcfcd2892c869a136d7a5346b9115a9e55713ea47c95ebb3
7
+ data.tar.gz: e8d234ded45305e026b615c60e4eb8597e31fd67b7daefff51d13ab3d79868745e21668a6b45452366ac5a552b38e8c01dc669e73dbe45a9b38ecf8363b54e83
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ #Version 2.18.0
2
+ Release date: 2018-02-12
3
+
4
+ ### Fixed
5
+
6
+ * Firefox/geckodriver setting of contenteditable childs contents
7
+ * Ignore Selenium::WebDriver::Error::SessionNotCreatedError when quitting driver [Tim Connor]
8
+
9
+ ### Removed
10
+
11
+ * Headless chrome modal JS injection that is no longer needed for Chrome 64+/chromedriver 2.35+
12
+
1
13
  # Version 2.17.0
2
14
  Release date: 2018-01-02
3
15
 
@@ -232,41 +232,27 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
232
232
  end
233
233
 
234
234
  def accept_modal(_type, options={})
235
- if headless_chrome?
236
- raise ArgumentError, "Block that triggers the system modal is missing" unless block_given?
237
- insert_modal_handlers(true, options[:with])
238
- yield
239
- find_headless_modal(options)
240
- else
241
- yield if block_given?
242
- modal = find_modal(options)
235
+ yield if block_given?
236
+ modal = find_modal(options)
243
237
 
244
- modal.send_keys options[:with] if options[:with]
238
+ modal.send_keys options[:with] if options[:with]
245
239
 
246
- message = modal.text
247
- modal.accept
248
- message
249
- end
240
+ message = modal.text
241
+ modal.accept
242
+ message
250
243
  end
251
244
 
252
245
  def dismiss_modal(_type, options={})
253
- if headless_chrome?
254
- raise ArgumentError, "Block that triggers the system modal is missing" unless block_given?
255
- insert_modal_handlers(false, options[:with])
256
- yield
257
- find_headless_modal(options)
258
- else
259
- yield if block_given?
260
- modal = find_modal(options)
261
- message = modal.text
262
- modal.dismiss
263
- message
264
- end
246
+ yield if block_given?
247
+ modal = find_modal(options)
248
+ message = modal.text
249
+ modal.dismiss
250
+ message
265
251
  end
266
252
 
267
253
  def quit
268
254
  @browser.quit if @browser
269
- rescue Errno::ECONNREFUSED
255
+ rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED
270
256
  # Browser must have already gone
271
257
  rescue Selenium::WebDriver::Error::UnknownError => e
272
258
  unless silenced_unknown_error_message?(e.message) # Most likely already gone
@@ -308,18 +294,6 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
308
294
  browser_name == "chrome"
309
295
  end
310
296
 
311
- # @api private
312
- def headless_chrome?
313
- if chrome?
314
- caps = @processed_options[:desired_capabilities]
315
- chrome_options = caps[:chrome_options] || caps[:chromeOptions] || {}
316
- args = chrome_options['args'] || chrome_options[:args] || []
317
- return args.include?("--headless") || args.include?("headless")
318
- end
319
- return false
320
- end
321
-
322
-
323
297
  # @deprecated This method is being removed
324
298
  def browser_initialized?
325
299
  super && !@browser.nil?
@@ -78,7 +78,7 @@ class Capybara::Selenium::Node < Capybara::Driver::Node
78
78
  JS
79
79
  driver.execute_script script, self
80
80
 
81
- if (driver.chrome?) || (driver.firefox? && !driver.marionette?)
81
+ if driver.chrome? || driver.firefox?
82
82
  # chromedriver raises a can't focus element for child elements if we use native.send_keys
83
83
  # we've already focused it so just use action api
84
84
  driver.browser.action.send_keys(value.to_s).perform
@@ -0,0 +1,10 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
2
+ <body>
3
+ <div>
4
+ Initial alert page
5
+ </div>
6
+ <script>
7
+ window.alert("Initial alert");
8
+ </script>
9
+ </body>
10
+ </html>
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Capybara
3
- VERSION = '2.17.0'
3
+ VERSION = '2.18.0'
4
4
  end
@@ -58,16 +58,16 @@ RSpec.shared_examples "Capybara::Session" do |session, mode|
58
58
  describe "#accept_alert" do
59
59
  it "supports a blockless mode" do
60
60
  @session.visit('/with_js')
61
- skip "Headless Chrome doesn't support blockless modal methods" if @session.driver.send(:headless_chrome?)
62
61
  @session.click_link('Open alert')
63
62
  @session.accept_alert
64
63
  expect{@session.driver.browser.switch_to.alert}.to raise_error(@session.driver.send(:modal_error))
65
64
  end
66
65
 
67
- it "raises if block is missing" do
68
- @session.visit('/with_js')
69
- skip "Only Headless Chrome requires the block due to system modal JS injection" unless @session.driver.send(:headless_chrome?)
70
- expect { @session.accept_alert }.to raise_error(ArgumentError)
66
+ it "can be called before visiting" do
67
+ @session.accept_alert "Initial alert" do
68
+ @session.visit('/initial_alert')
69
+ end
70
+ expect(@session).to have_text('Initial alert page')
71
71
  end
72
72
  end
73
73
 
@@ -205,9 +205,6 @@ RSpec.shared_examples "Capybara::Session" do |session, mode|
205
205
 
206
206
  describe "Element#click" do
207
207
  it "should handle fixed headers/footers" do
208
- if mode == :selenium_marionette && !(ENV['TRAVIS_ALLOW_FAILURE']=='true')
209
- pending "geckodriver/firefox/marionette just fail to click without reporting an error - no way for us to detect/catch"
210
- end
211
208
  @session.visit('/with_fixed_header_footer')
212
209
  # @session.click_link('Go to root')
213
210
  @session.find(:link, 'Go to root').click
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: 2.17.0
4
+ version: 2.18.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: 2018-01-02 00:00:00.000000000 Z
13
+ date: 2018-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -449,6 +449,7 @@ files:
449
449
  - lib/capybara/spec/views/frame_two.erb
450
450
  - lib/capybara/spec/views/header_links.erb
451
451
  - lib/capybara/spec/views/host_links.erb
452
+ - lib/capybara/spec/views/initial_alert.erb
452
453
  - lib/capybara/spec/views/path.erb
453
454
  - lib/capybara/spec/views/popup_one.erb
454
455
  - lib/capybara/spec/views/popup_two.erb
@@ -516,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
516
517
  version: '0'
517
518
  requirements: []
518
519
  rubyforge_project:
519
- rubygems_version: 2.7.3
520
+ rubygems_version: 2.7.4
520
521
  signing_key:
521
522
  specification_version: 4
522
523
  summary: Capybara aims to simplify the process of integration testing Rack applications,