capybara 3.7.2 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69837ab6d5097f6be64bc1010b230653cce9bdd318634c6efb19903a4cbb1f34
4
- data.tar.gz: 6db7692bb7609c9d2ae488eb10dd3472c32071a473a0524e87265afe3a03ac6d
3
+ metadata.gz: 814367062843328d421eb8c9db0476cabe5a16405866951855507dd63250bfb9
4
+ data.tar.gz: 2b6605e124b8eed5d4efbc7f2e06d56dcf2ddaa8775d2ec7f42b18aca4144f3a
5
5
  SHA512:
6
- metadata.gz: 4088bda8abff78614b6b93e61bd3e239e2e9de857ce34fe104d62a195cacf66f8512da44a26f1646aee9a4114e5d3f2eca6ebc4d54b8fc5ed3362b845e15f6b9
7
- data.tar.gz: 2194129a44a0b636d09b1ae36639ebf893bb8816f3de6361b938f2ac281e8d2ecc045d9d862545df90d5b8827082f066fa0aef324b0a5b598f780b975a268da2
6
+ metadata.gz: 76d6d964d8e204497e9f57b61e96ecf32631325c6c4b600ead18009817f45e324f241520d134881bfa62bba754d820f5e1d91710e4c78ca98ccdd06325a206fb
7
+ data.tar.gz: ee215bc20878dcce34e1df44f2081e3867528358bd1c7cae542b5996e945ca1f6c16decba834ec3c13bd46052873c6988ef7c141674648eae8f5894fec405f38
data/History.md CHANGED
@@ -1,3 +1,15 @@
1
+ # Version 3.8.0
2
+ Release date: 2018-09-20
3
+
4
+ ### Added
5
+
6
+ * Workaround gecodriver 0.22 issue with undefined pause durations
7
+ * :element selector ignores XML namespaces
8
+
9
+ ### Fixed
10
+
11
+ * Added Errno::ECONNRESET to the errors which will allows https server detection
12
+
1
13
  # Version 3.7.2
2
14
  Release date: 2018-09-12
3
15
 
@@ -28,7 +40,6 @@ Release date: 2018-09-02
28
40
 
29
41
  * All CSS styles applied by the `Element#attach_file` `:make_visible` option will now have `!important` priority set to ensure they override any other specified style.
30
42
  * Firefox file inputs are only manually cleared when necessary.
31
- *
32
43
 
33
44
  # Version 3.6.0
34
45
  Release date: 2018-08-14
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=capybara&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
8
8
 
9
9
  **Note** You are viewing the README for the development version of Capybara. If you are using the current release version
10
- you can find the README at https://github.com/teamcapybara/capybara/blob/3.7_stable/README.md
10
+ you can find the README at https://github.com/teamcapybara/capybara/blob/3.8_stable/README.md
11
11
 
12
12
 
13
13
  Capybara helps you test web applications by simulating how a real user would
@@ -430,7 +430,6 @@ module Capybara
430
430
  require 'capybara/rack_test/css_handlers.rb'
431
431
 
432
432
  require 'capybara/selenium/node'
433
- require 'capybara/selenium/nodes/marionette_node'
434
433
  require 'capybara/selenium/driver'
435
434
  end
436
435
 
@@ -448,6 +447,10 @@ Capybara.register_server :puma do |app, port, host, **options|
448
447
  require 'rack/handler/puma'
449
448
  rescue LoadError
450
449
  raise LoadError, 'Capybara is unable to load `puma` for its server, please add `puma` to your project or specify a different server via something like `Capybara.server = :webrick`.'
450
+ else
451
+ unless Rack::Handler::Puma.respond_to?(:config)
452
+ raise LoadError, 'Capybara requires `puma` version 3.8.0 or higher, please upgrade `puma` or register and specify your own server block'
453
+ end
451
454
  end
452
455
  # If we just run the Puma Rack handler it installs signal handlers which prevent us from being able to interrupt tests.
453
456
  # Therefore construct and run the Server instance ourselves.
@@ -86,6 +86,7 @@ module Capybara
86
86
  end
87
87
 
88
88
  def expired?
89
+ raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead' if stalled?
89
90
  current - @start >= @expire_in
90
91
  end
91
92
 
@@ -64,8 +64,12 @@ module Capybara
64
64
  # The field can be found via its name, id, Capybara.test_id attribute, or label text.
65
65
  # If no locator is provided will operate on self or a descendant
66
66
  #
67
+ # # will fill in a descendant fillable field with name, id, or label text matching 'Name'
67
68
  # page.fill_in 'Name', with: 'Bob'
68
69
  #
70
+ # # will fill in `el` if it's a fillable field
71
+ # el.fill_in with: 'Tom'
72
+ #
69
73
  #
70
74
  # @overload fill_in([locator], with:, **options)
71
75
  # @param [String] locator Which field to fill in
@@ -96,8 +100,12 @@ module Capybara
96
100
  # via name, id or label text. If no locator is provided this will match against self or
97
101
  # a descendant.
98
102
  #
103
+ # # will choose a descendant radio button with a name, id, or label text matching 'Male'
99
104
  # page.choose('Male')
100
105
  #
106
+ # # will choose `el` if it's a radio button element
107
+ # el.choose()
108
+ #
101
109
  # @overload choose([locator], **options)
102
110
  # @param [String] locator Which radio button to choose
103
111
  #
@@ -119,8 +127,12 @@ module Capybara
119
127
  # via name, id or label text. If no locator is provided this will match against
120
128
  # self or a descendant.
121
129
  #
130
+ # # will check a descendant checkbox with a name, id, or label text matching 'German'
122
131
  # page.check('German')
123
132
  #
133
+ # # will check `el` if it's a checkbox element
134
+ # el.check()
135
+ #
124
136
  #
125
137
  # @overload check([locator], **options)
126
138
  # @param [String] locator Which check box to check
@@ -139,12 +151,16 @@ module Capybara
139
151
 
140
152
  ##
141
153
  #
142
- # Find a descendant check box and mark uncheck it. The check box can be found
154
+ # Find a descendant check box and uncheck it. The check box can be found
143
155
  # via name, id or label text. If no locator is provided this will match against
144
156
  # self or a descendant.
145
157
  #
158
+ # # will uncheck a descendant checkbox with a name, id, or label text matching 'German'
146
159
  # page.uncheck('German')
147
160
  #
161
+ # # will uncheck `el` if it's a checkbox element
162
+ # el.uncheck()
163
+ #
148
164
  #
149
165
  # @overload uncheck([locator], **options)
150
166
  # @param [String] locator Which check box to uncheck
@@ -215,7 +231,11 @@ module Capybara
215
231
  # the file field, attach the file, and then revert the CSS back to original. If no locator is
216
232
  # passed this will match self or a descendant.
217
233
  #
218
- # page.attach_file(locator, '/path/to/file.png')
234
+ # # will attach file to a descendant file input element that has a name, id, or label_text matching 'My File'
235
+ # page.attach_file('My File', '/path/to/file.png')
236
+ #
237
+ # # will attach file to el if it's a file input element
238
+ # el.attach_file('/path/to/file.png')
219
239
  #
220
240
  # @overload attach_file([locator], paths, **options)
221
241
  # @macro waiting_behavior
@@ -85,7 +85,6 @@ module Capybara
85
85
  raise err unless driver.wait? && catch_error?(err, errors)
86
86
  raise err if timer.expired?
87
87
  sleep(0.05)
88
- raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead' if timer.stalled?
89
88
  reload if session_options.automatic_reload
90
89
  retry
91
90
  ensure
@@ -309,6 +309,10 @@ module Capybara
309
309
  def options_include_minimum?(opts)
310
310
  %i[count minimum between].any? { |key| opts.key?(key) }
311
311
  end
312
+
313
+ def parent
314
+ first(:xpath, './parent::*', minimum: 0)
315
+ end
312
316
  end
313
317
  end
314
318
  end
@@ -713,7 +713,7 @@ module Capybara
713
713
  query_args = _set_query_session_options(*query_args)
714
714
  query = Capybara::Queries::MatchQuery.new(*query_args, &optional_filter_block)
715
715
  synchronize(query.wait) do
716
- yield query.resolve_for(first(:xpath, './parent::*', minimum: 0) || session&.document || query_scope)
716
+ yield query.resolve_for(parent || session&.document || query_scope)
717
717
  end
718
718
  true
719
719
  end
@@ -468,7 +468,7 @@ end
468
468
 
469
469
  Capybara.add_selector(:element) do
470
470
  xpath do |locator, **|
471
- locator ? XPath.descendant(locator.to_sym) : XPath.descendant
471
+ XPath.descendant.where(locator ? XPath.local_name == locator.to_s : nil)
472
472
  end
473
473
 
474
474
  expression_filter(:attributes, matcher: /.+/) do |xpath, name, val|
@@ -28,6 +28,7 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
28
28
  setup_exit_handler
29
29
  end
30
30
  end
31
+ @browser
31
32
  end
32
33
 
33
34
  def initialize(app, **options)
@@ -143,11 +144,8 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
143
144
  handles.clear
144
145
  browser.switch_to.default_content
145
146
  when :parent
146
- # would love to use browser.switch_to.parent_frame here
147
- # but it has an issue if the current frame is removed from within it
148
147
  handles.pop
149
- browser.switch_to.default_content
150
- handles.each { |fh| browser.switch_to.frame(fh) }
148
+ browser.switch_to.parent_frame
151
149
  else
152
150
  handles << frame.native
153
151
  browser.switch_to.frame(frame.native)
@@ -363,6 +361,7 @@ private
363
361
  when :chrome
364
362
  extend ChromeDriver
365
363
  when :firefox
364
+ require 'capybara/selenium/patches/pause_duration_fix' if sel_driver.capabilities['moz:geckodriverVersion']&.start_with?('0.22.')
366
365
  extend MarionetteDriver if sel_driver.capabilities.is_a?(::Selenium::WebDriver::Remote::W3C::Capabilities)
367
366
  end
368
367
  end
@@ -32,6 +32,15 @@ module Capybara::Selenium::Driver::MarionetteDriver
32
32
  # No modal was opened - page has refreshed - ignore
33
33
  end
34
34
 
35
+ def switch_to_frame(frame)
36
+ return super unless frame == :parent
37
+ # geckodriver/firefox has an issue if the current frame is removed from within it
38
+ # so we have to move to the default_content and iterate back through the frames
39
+ handles = @frame_handles[current_window_handle]
40
+ browser.switch_to.default_content
41
+ handles.tap(&:pop).each { |fh| browser.switch_to.frame(fh) }
42
+ end
43
+
35
44
  private
36
45
 
37
46
  def build_node(native_node)
@@ -11,20 +11,19 @@ class Capybara::Selenium::Node
11
11
  element.scroll_if_needed { browser_action.move_to(element.native).release.perform }
12
12
  else
13
13
  driver.execute_script HTML5_DRAG_DROP_SCRIPT, self, element
14
+ browser_action.release.perform
14
15
  end
15
16
  end
16
17
 
17
- def draggable?
18
+ def html5_draggable?
18
19
  # Workaround https://github.com/SeleniumHQ/selenium/issues/6396
19
- driver.evaluate_script('arguments[0]["draggable"]', self) == true
20
+ native.property('draggable')
20
21
  end
21
22
 
22
23
  MOUSEDOWN_TRACKER = <<~JS
23
- if (!window.hasOwnProperty('capybara_mousedown_prevented')){
24
- document.addEventListener('mousedown', function(ev){
25
- window.capybara_mousedown_prevented = ev.defaultPrevented;
26
- })
27
- }
24
+ document.addEventListener('mousedown', ev => {
25
+ window.capybara_mousedown_prevented = ev.defaultPrevented;
26
+ }, { once: true, passive: true })
28
27
  JS
29
28
 
30
29
  HTML5_DRAG_DROP_SCRIPT = <<~JS
@@ -15,7 +15,7 @@ class Capybara::Selenium::ChromeNode < Capybara::Selenium::Node
15
15
  end
16
16
 
17
17
  def drag_to(element)
18
- return super unless draggable?
18
+ return super unless html5_draggable?
19
19
  html5_drag_to(element)
20
20
  end
21
21
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'capybara/selenium/extensions/html5_drag'
3
4
 
4
5
  class Capybara::Selenium::MarionetteNode < Capybara::Selenium::Node
@@ -57,7 +58,7 @@ class Capybara::Selenium::MarionetteNode < Capybara::Selenium::Node
57
58
  end
58
59
 
59
60
  def drag_to(element)
60
- return super unless (browser_version >= 62.0) && draggable?
61
+ return super unless (browser_version >= 62.0) && html5_draggable?
61
62
  html5_drag_to(element)
62
63
  end
63
64
 
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PauseDurationFix
4
+ def encode
5
+ super.tap { |output| output[:duration] ||= 0 }
6
+ end
7
+ end
8
+
9
+ if defined?(::Selenium::WebDriver::Interactions::Pause)
10
+ ::Selenium::WebDriver::Interactions::Pause.prepend PauseDurationFix
11
+ end
@@ -3,6 +3,8 @@
3
3
  module Capybara
4
4
  class Server
5
5
  class Checker
6
+ TRY_HTTPS_ERRORS = [EOFError, Net::ReadTimeout, Errno::ECONNRESET].freeze
7
+
6
8
  def initialize(host, port)
7
9
  @host, @port = host, port
8
10
  @ssl = false
@@ -10,7 +12,7 @@ module Capybara
10
12
 
11
13
  def request(&block)
12
14
  ssl? ? https_request(&block) : http_request(&block)
13
- rescue EOFError, Net::ReadTimeout
15
+ rescue *TRY_HTTPS_ERRORS
14
16
  res = https_request(&block)
15
17
  @ssl = true
16
18
  res
@@ -72,7 +72,7 @@ Capybara::SpecHelper.spec '#assert_selector' do
72
72
  end
73
73
  end
74
74
 
75
- Capybara::SpecHelper.spec '#refute_selector' do
75
+ Capybara::SpecHelper.spec '#refute_selector', requires: [:driver] do
76
76
  it 'should warn not to use' do
77
77
  @session.visit('/with_html')
78
78
  doc = @session.document
@@ -96,7 +96,7 @@ Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do
96
96
  expect(@session.current_path).to eq('/replaced')
97
97
  end
98
98
 
99
- it "doesn't raise exception on a nil current_url" do
99
+ it "doesn't raise exception on a nil current_url", requires: [:driver] do
100
100
  allow(@session.driver).to receive(:current_url).and_return(nil)
101
101
  @session.visit('/')
102
102
  expect { @session.current_url }.not_to raise_exception
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Namespace</title>
5
+ </head>
6
+ <body id="body">
7
+ <div>
8
+ <svg viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice"
9
+ style="width:100%; height:100%; position:absolute; top:0; left:0; z-index:-1;">
10
+ <linearGradient id="gradient">
11
+ <stop class="begin" offset="0%"/>
12
+ <stop class="end" offset="100%"/>
13
+ </linearGradient>
14
+ <rect x="0" y="0" width="100" height="100" style="fill:url(#gradient)" />
15
+ <rect x="150" y="150" width="25" height="25" style="fill:url(#gradient)" />
16
+ <circle cx="50" cy="50" r="30" style="fill:url(#gradient)" />
17
+ </svg>
18
+ <div>
19
+ </body>
20
+ </html>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.7.2'
4
+ VERSION = '3.8.0'
5
5
  end
@@ -129,14 +129,12 @@ module Capybara
129
129
 
130
130
  def wait_for_stable_size(seconds = session.config.default_max_wait_time)
131
131
  res = yield if block_given?
132
- prev_size = size
133
- start_time = Capybara::Helpers.monotonic_time
132
+ timer = Capybara::Helpers.timer(expire_in: seconds)
134
133
  loop do
134
+ prev_size = size
135
135
  sleep 0.05
136
- cur_size = size
137
- return res if cur_size == prev_size
138
- prev_size = cur_size
139
- break if (Capybara::Helpers.monotonic_time - start_time) >= seconds
136
+ return res if prev_size == size
137
+ break if timer.expired?
140
138
  end
141
139
  raise Capybara::WindowError, "Window size not stable within #{seconds} seconds."
142
140
  end
@@ -8,14 +8,8 @@ class TestClass
8
8
  end
9
9
 
10
10
  Capybara::SpecHelper.run_specs TestClass.new, 'DSL', capybara_skip: %i[
11
- js modals screenshot frames windows send_keys server hover about_scheme psc download css
12
- ] do |example|
13
- case example.metadata[:full_description]
14
- when /doesn't raise exception on a nil current_url$/,
15
- /#refute_selector should warn not to use$/
16
- skip 'Only makes sense when there is a real driver'
17
- end
18
- end
11
+ js modals screenshot frames windows send_keys server hover about_scheme psc download css driver
12
+ ]
19
13
 
20
14
  RSpec.describe Capybara::DSL do
21
15
  after do
@@ -45,7 +45,12 @@ skipped_tests << :windows if ENV['TRAVIS'] && (ENV['SKIP_WINDOW'] || ENV['HEADLE
45
45
 
46
46
  $stdout.puts `#{Selenium::WebDriver::Chrome.driver_path} --version` if ENV['CI']
47
47
 
48
- Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybara_skip: skipped_tests
48
+ Capybara::SpecHelper.run_specs TestSessions::Chrome, CHROME_DRIVER.to_s, capybara_skip: skipped_tests do |example|
49
+ case example.metadata[:full_description]
50
+ when /#click_link can download a file$/
51
+ skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
52
+ end
53
+ end
49
54
 
50
55
  RSpec.describe 'Capybara::Session with chrome' do
51
56
  include Capybara::SpecHelper
@@ -61,14 +61,14 @@ skipped_tests << :windows if ENV['TRAVIS'] && (ENV['SKIP_WINDOW'] || ENV['HEADLE
61
61
  Capybara::SpecHelper.run_specs TestSessions::RemoteFirefox, FIREFOX_REMOTE_DRIVER.to_s, capybara_skip: skipped_tests do |example|
62
62
  case example.metadata[:full_description]
63
63
  when 'Capybara::Session selenium_firefox_remote node #click should allow multiple modifiers'
64
- pending "Firefox doesn't generate an event for shift+control+click" if marionette_gte?(62, @session)
65
- when /^Capybara::Session selenium node #double_click/
66
- pending "selenium-webdriver/geckodriver doesn't generate double click event" if marionette_lt?(59, @session)
64
+ skip "Firefox doesn't generate an event for shift+control+click" if marionette_gte?(62, @session)
67
65
  when 'Capybara::Session selenium_firefox_remote #accept_prompt should accept the prompt with a blank response when there is a default'
68
66
  pending "Geckodriver doesn't set a blank response in FF < 63 - https://bugzilla.mozilla.org/show_bug.cgi?id=1486485" if marionette_lt?(63, @session)
69
- when 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once for each set of files uploaded',
70
- 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
71
- pending 'Due to having to work around selenium remote lack of multiple file upload support the change event count is off'
67
+ when 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once for each set of files uploaded'
68
+ pending 'Gekcodriver appends files so we have to first call clear for multiple files which creates an extra change ' \
69
+ 'if files are already set'
70
+ when 'Capybara::Session selenium_firefox_remote #attach_file with multipart form should fire change once when uploading multiple files from empty'
71
+ pending "FF < 62 doesn't support setting all files at once" if marionette_lt?(62, @session)
72
72
  end
73
73
  end
74
74
 
@@ -51,7 +51,7 @@ $stdout.puts `#{Selenium::WebDriver::Firefox.driver_path} --version` if ENV['CI'
51
51
  Capybara::SpecHelper.run_specs TestSessions::SeleniumMarionette, 'selenium', capybara_skip: skipped_tests do |example|
52
52
  case example.metadata[:full_description]
53
53
  when 'Capybara::Session selenium node #click should allow multiple modifiers'
54
- pending "Firefox doesn't generate an event for shift+control+click" if marionette_gte?(62, @session)
54
+ pending "Firefox doesn't generate an event for shift+control+click" if marionette_gte?(62, @session) && !Gem.win_platform?
55
55
  when /^Capybara::Session selenium node #double_click/
56
56
  pending "selenium-webdriver/geckodriver doesn't generate double click event" if marionette_lt?(59, @session)
57
57
  when 'Capybara::Session selenium #accept_prompt should accept the prompt with a blank response when there is a default'
@@ -61,6 +61,10 @@ Capybara::SpecHelper.run_specs TestSessions::SeleniumMarionette, 'selenium', cap
61
61
  'if files are already set'
62
62
  when 'Capybara::Session selenium #attach_file with multipart form should fire change once when uploading multiple files from empty'
63
63
  pending "FF < 62 doesn't support setting all files at once" if marionette_lt?(62, @session)
64
+ when 'Capybara::Session selenium #accept_confirm should work with nested modals'
65
+ skip 'Broken in FF 63 - https://bugzilla.mozilla.org/show_bug.cgi?id=1487358' if marionette_gte?(63, @session)
66
+ when 'Capybara::Session selenium #click_link can download a file'
67
+ skip 'Need to figure out testing of file downloading on windows platform' if Gem.win_platform?
64
68
  end
65
69
  end
66
70
 
@@ -202,7 +202,7 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
202
202
  expect(element.path).to eq('/HTML/BODY/DIV[2]/A[1]')
203
203
  end
204
204
 
205
- it 'handles namespaces' do
205
+ it 'handles namespaces in xhtml' do
206
206
  pending "IE 11 doesn't handle all XPath querys (namespace-uri, etc)" if ie?(session)
207
207
  session.visit '/with_namespace'
208
208
  rect = session.find(:css, 'div svg rect:first-of-type')
@@ -210,6 +210,14 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
210
210
  expect(session.find(:xpath, rect.path)).to eq rect
211
211
  end
212
212
 
213
+ it 'handles default namespaces in html5' do
214
+ pending "IE 11 doesn't handle all XPath querys (namespace-uri, etc)" if ie?(session)
215
+ session.visit '/with_html5_svg'
216
+ rect = session.find(:css, 'div svg rect:first-of-type')
217
+ expect(rect.path).to eq("/HTML/BODY/DIV/./*[((local-name(.) = 'svg') and (namespace-uri(.) = 'http://www.w3.org/2000/svg'))]/./*[((local-name(.) = 'rect') and (namespace-uri(.) = 'http://www.w3.org/2000/svg'))][1]")
218
+ expect(session.find(:xpath, rect.path)).to eq rect
219
+ end
220
+
213
221
  it 'handles case sensitive element names' do
214
222
  pending "IE 11 doesn't handle all XPath querys (namespace-uri, etc)" if ie?(session)
215
223
  session.visit '/with_namespace'
@@ -286,8 +294,12 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
286
294
  end
287
295
 
288
296
  describe 'Element#drag_to' do
297
+ before do
298
+ skip "Firefox < 62 doesn't support a DataTransfer constuctor" if marionette_lt?(62.0, session)
299
+ skip "IE doesn't support a DataTransfer constuctor" if ie?(session)
300
+ end
301
+
289
302
  it 'should HTML5 drag and drop an object' do
290
- pending "Firefox < 62 doesn't support a DataTransfer constuctor" if marionette_lt?(62.0, session)
291
303
  session.visit('/with_js')
292
304
  element = session.find('//div[@id="drag_html5"]')
293
305
  target = session.find('//div[@id="drop_html5"]')
@@ -306,7 +318,6 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
306
318
  end
307
319
 
308
320
  it 'should HTML5 drag and drop when scrolling needed' do
309
- pending "Firefox < 62 doesn't support a DataTransfer constuctor" if marionette_lt?(62.0, session)
310
321
  session.visit('/with_js')
311
322
  element = session.find('//div[@id="drag_html5_scroll"]')
312
323
  target = session.find('//div[@id="drop_html5_scroll"]')
@@ -315,7 +326,6 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
315
326
  end
316
327
 
317
328
  it 'should drag HTML5 default draggable elements' do
318
- pending "Firefox < 62 doesn't support a DataTransfer constuctor" if marionette_lt?(62.0, session)
319
329
  session.visit('/with_js')
320
330
  link = session.find_link('drag_link_html5')
321
331
  target = session.find(:id, 'drop_html5')
@@ -412,6 +422,16 @@ RSpec.shared_examples 'Capybara::Session' do |session, mode|
412
422
  end
413
423
  end
414
424
  end
425
+
426
+ describe ':element selector' do
427
+ it 'can find html5 svg elements' do
428
+ session.visit('with_html5_svg')
429
+ expect(session).to have_selector(:element, :svg)
430
+ expect(session).to have_selector(:element, :rect, visible: true)
431
+ expect(session).to have_selector(:element, :circle)
432
+ expect(session).to have_selector(:element, :linearGradient, visible: :all)
433
+ end
434
+ end
415
435
  end
416
436
 
417
437
  def headless_or_remote?
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.7.2
4
+ version: 3.8.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-09-12 00:00:00.000000000 Z
13
+ date: 2018-09-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -315,6 +315,7 @@ files:
315
315
  - lib/capybara/selenium/node.rb
316
316
  - lib/capybara/selenium/nodes/chrome_node.rb
317
317
  - lib/capybara/selenium/nodes/marionette_node.rb
318
+ - lib/capybara/selenium/patches/pause_duration_fix.rb
318
319
  - lib/capybara/server.rb
319
320
  - lib/capybara/server/animation_disabler.rb
320
321
  - lib/capybara/server/checker.rb
@@ -438,6 +439,7 @@ files:
438
439
  - lib/capybara/spec/views/with_fixed_header_footer.erb
439
440
  - lib/capybara/spec/views/with_hover.erb
440
441
  - lib/capybara/spec/views/with_html.erb
442
+ - lib/capybara/spec/views/with_html5_svg.erb
441
443
  - lib/capybara/spec/views/with_html_entities.erb
442
444
  - lib/capybara/spec/views/with_js.erb
443
445
  - lib/capybara/spec/views/with_namespace.erb