capybara 2.4.1 → 2.4.2

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
  SHA1:
3
- metadata.gz: c0365cf5370925d2493a5f2775405ca28fec3357
4
- data.tar.gz: 20c8699f963a8597a8b63c202e5d20d019ef7b4d
3
+ metadata.gz: 04bb73ad4dc0bb8787750353e8f3977f7c4f36bb
4
+ data.tar.gz: a030257e516a4db73443415ee779ea31338cbdd1
5
5
  SHA512:
6
- metadata.gz: c8be660aff9a2e47051ee58174ffa948306e0a1d81bab10580294078d1bd7fa696232a2e8cf2dd2d5c3f174f82ad678e74da81bab000dc4b34e9690ea7225056
7
- data.tar.gz: e65771d62d170306d8fe42844d93b0b4520bab7fa40bec3bdd63b3e03b0abc66a53286fd029b499daadbfa4991821ea153bcb0fe0bf3f79a89299a146cc87ff0
6
+ metadata.gz: 4f640db24f67cb96877b9e08e73d43b725bfac2c4a82da8ce8ab269eb8e98f3b4b5d05ca6a5321a96c87b2e8b2616a4bee1ce91a61d412af35a5410c94258a78
7
+ data.tar.gz: 3ae37dfdb9e84be5ff42b750441393134c249febbbc254d0217ce233c252b0738dd7954be48c8458d7b112a9629cde31cd7ef89fe0b6a8d37bc2f131db8b3e3e
data/History.md CHANGED
@@ -1,6 +1,16 @@
1
+ # Version 2.4.2
2
+ Release date: 2014-09-20
3
+
4
+ ### Fixed
5
+ * Prevent concurrency issue when testing Rails app with default test environment [Thomas Walpole]
6
+ * Tags for windows API tests fixed [Dmitry Vorotilin]
7
+ * Documentation Fixes [Andrey Botalov]
8
+ * Always convert visit url to string, fixes issue with visit when always_include_port was enabled [Jake Goulding]
9
+ * Check correct rspec version before including ::RSpec::Matchers::Composable in Capybara RSpec matchers [Thomas Walpole, Justin Ko]
10
+
1
11
  # Version 2.4.1
2
12
 
3
- Release data: 2014-07-03
13
+ Release date: 2014-07-03
4
14
 
5
15
  ### Added
6
16
 
@@ -76,7 +86,7 @@ Release date: 2013-11-21
76
86
  instead of `about:blank`, fixing hanging issues in JRuby. [Jonas Nicklas]
77
87
  * Fixed cookies not being set when path is blank under RackTest [Thomas Walpole]
78
88
  * Clearing fields now correctly causes change events [Jonas Nicklas]
79
- * Navigating to an absolut URI without trailing slash now works as expected
89
+ * Navigating to an absolute URI without trailing slash now works as expected
80
90
  under RackTest [Jonas Nicklas]
81
91
  * Checkboxes without assigned value default to `on` under RackTest [Nigel Sheridan-Smith]
82
92
  * Clicks on buttons with no form associated with them are ignored in RackTest
@@ -2,6 +2,12 @@ require 'capybara'
2
2
  require 'capybara/dsl'
3
3
 
4
4
  Capybara.app = Rack::Builder.new do
5
+ # Work around an issue where rails allows concurrency in test mode even though eager_load
6
+ # is false which can cause an issue with constant loading
7
+ if Gem::Version.new(Rails.version) >= Gem::Version.new("4.0")
8
+ use Rack::Lock unless Rails.application.config.eager_load || Rails.application.middleware.include?(Rack::Lock)
9
+ end
10
+
5
11
  map "/" do
6
12
  if Gem::Version.new(Rails.version) >= Gem::Version.new("3.0")
7
13
  run Rails.application
@@ -1,7 +1,7 @@
1
1
  module Capybara
2
2
  module RSpecMatchers
3
3
  class Matcher
4
- include ::RSpec::Matchers::Composable if defined?(::RSpec::Version) && ::RSpec::Version::STRING.to_f >= 3.0
4
+ include ::RSpec::Matchers::Composable if defined?(::RSpec::Expectations::Version) && RSpec::Expectations::Version::STRING.to_f >= 3.0
5
5
 
6
6
  def wrap(actual)
7
7
  if actual.respond_to?("has_selector?")
@@ -199,22 +199,23 @@ module Capybara
199
199
  #
200
200
  # Will actually navigate to `http://google.com:4567/test`.
201
201
  #
202
- # @param [String] url The URL to navigate to
202
+ # @param [#to_s] url The URL to navigate to. The parameter will be cast to a String.
203
203
  #
204
204
  def visit(url)
205
205
  raise_server_error!
206
206
 
207
+ url = url.to_s
207
208
  @touched = true
208
209
 
209
- url_relative = URI.parse(url.to_s).scheme.nil?
210
+ url_relative = URI.parse(url).scheme.nil?
210
211
 
211
212
  if url_relative && Capybara.app_host
212
- url = Capybara.app_host + url.to_s
213
+ url = Capybara.app_host + url
213
214
  url_relative = false
214
215
  end
215
216
 
216
217
  if @server
217
- url = "http://#{@server.host}:#{@server.port}" + url.to_s if url_relative
218
+ url = "http://#{@server.host}:#{@server.port}" + url if url_relative
218
219
 
219
220
  if Capybara.always_include_port
220
221
  uri = URI.parse(url)
@@ -8,7 +8,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
8
8
  end
9
9
 
10
10
  after(:each) do
11
- @session.document.synchronize(3, errors: [Capybara::CapybaraError]) do
11
+ @session.document.synchronize(5, errors: [Capybara::CapybaraError]) do
12
12
  raise Capybara::CapybaraError if @session.windows.size != 1
13
13
  end
14
14
  @session.switch_to_window(@window)
@@ -20,7 +20,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
20
20
  @session.execute_script('setTimeout(function(){ window.close(); }, 500);')
21
21
  end
22
22
  Capybara.using_wait_time 0.1 do
23
- expect(@other_window).to become_closed(wait: 0.7)
23
+ expect(@other_window).to become_closed(wait: 2)
24
24
  end
25
25
  end
26
26
 
@@ -41,7 +41,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
41
41
  @session.within_window @other_window do
42
42
  @session.execute_script('setTimeout(function(){ window.close(); }, 500);')
43
43
  end
44
- Capybara.using_wait_time 0.7 do
44
+ Capybara.using_wait_time 1.5 do
45
45
  expect(@other_window).to become_closed
46
46
  end
47
47
  end
@@ -16,10 +16,11 @@ Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
16
16
 
17
17
  context 'with :wait option' do
18
18
  it 'should raise error if value of :wait is less than timeout' do
19
- Capybara.using_wait_time 1 do
19
+ # So large value is used as `driver.window_handles` takes up to 800 ms on Travis
20
+ Capybara.using_wait_time 2 do
20
21
  expect do
21
- @session.window_opened_by(wait: 0.4) do
22
- @session.find(:css, '#openWindowWithTimeout').click
22
+ @session.window_opened_by(wait: 0.8) do
23
+ @session.find(:css, '#openWindowWithLongerTimeout').click
23
24
  end
24
25
  end.to raise_error(Capybara::WindowError, zero_windows_message)
25
26
  end
@@ -85,7 +85,7 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
85
85
  end
86
86
 
87
87
  describe '#size' do
88
- it 'should return size of whole window', requires: [:js] do
88
+ it 'should return size of whole window', requires: [:windows, :js] do
89
89
  expect(@session.current_window.size).to eq @session.evaluate_script("[window.outerWidth, window.outerHeight];")
90
90
  end
91
91
 
@@ -103,7 +103,7 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
103
103
  end
104
104
 
105
105
  describe '#resize_to' do
106
- it 'should be able to resize window', requires: [:js] do
106
+ it 'should be able to resize window', requires: [:windows, :js] do
107
107
  width, height = @session.evaluate_script("[window.outerWidth, window.outerHeight];")
108
108
  @session.current_window.resize_to(width-10, height-10)
109
109
  expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([width-10, height-10])
@@ -120,16 +120,17 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
120
120
  end
121
121
 
122
122
  describe '#maximize' do
123
- it 'should be able to maximize window', requires: [:js] do
123
+ it 'should be able to maximize window', requires: [:windows, :js] do
124
124
  screen_width, screen_height = @session.evaluate_script("[window.screen.availWidth, window.screen.availHeight];")
125
125
  window = @session.current_window
126
126
  window.resize_to(screen_width-100, screen_height-100)
127
127
  expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width-100, screen_height-100])
128
128
  window.maximize
129
+ sleep 0.5 # The timing on maximize is finicky on Travis -- wait a bit for maximize to occur
129
130
  expect(@session.evaluate_script("[window.outerWidth, window.outerHeight];")).to eq([screen_width, screen_height])
130
131
  end
131
132
 
132
- it 'should switch to original window if invoked not for current window' do
133
+ it 'should switch to original window if invoked not for current window', requires: [:windows, :js] do
133
134
  @other_window = @session.window_opened_by do
134
135
  @session.find(:css, '#openWindow').click
135
136
  end
@@ -16,6 +16,13 @@
16
16
  return false;
17
17
  });
18
18
 
19
+ $('#openWindowWithLongerTimeout').click(function(){
20
+ setTimeout(function(){
21
+ window.open('/popup_one', 'firstPopup');
22
+ }, 1400);
23
+ return false;
24
+ });
25
+
19
26
  $('#openTwoWindows').click(function() {
20
27
  window.open('/popup_one', 'firstPopup');
21
28
  window.open('/popup_two', 'secondPopup');
@@ -29,6 +36,8 @@
29
36
 
30
37
  <button id="openWindowWithTimeout">Open new window with timeout</button>
31
38
 
39
+ <button id="openWindowWithLongerTimeout">Open new window with longer timeout</button>
40
+
32
41
  <button id="openTwoWindows">Open two windows</button>
33
42
 
34
43
  <button id="doesNotOpenWindows">Does not open windows</button>
@@ -1,3 +1,3 @@
1
1
  module Capybara
2
- VERSION = '2.4.1'
2
+ VERSION = '2.4.2'
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'rspec/expectations'
1
2
  require "capybara/spec/spec_helper"
2
3
  require "pry"
3
4
 
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.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - gem-public_cert.pem
12
- date: 2014-07-03 00:00:00.000000000 Z
12
+ date: 2014-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri