frameworks-capybara 1.1.1 → 2.0.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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTA2NDkzZDc2NDc1ZmJiMmI0MGY2ODJiMGNmODA0NjI0Y2ZhYWQxYQ==
5
+ data.tar.gz: !binary |-
6
+ YTY4OGNkMjA2OGVhNjNiMmJjYjY0M2E5YTYwNGYwMzkwMzUyOGY2Mw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZjdmMjFmMGNkZjBlMDQwYjI3OTY2ZWQ4M2NiNWMzNmJmODE4ZTQ4MjhhZDU1
10
+ NTllNTAxMzZiNWY2NWRhYjFhZmQyZjQ0NTcxNmIxZWY3NDNiMzVhNWM2NWU2
11
+ M2NlODZhNWYzYjI2MTMzNGY2MWUwMTA5MTg5ZTY2NTUwNGYwZGM=
12
+ data.tar.gz: !binary |-
13
+ NWRhYmZlN2VhMDg4YWM0NTc3MTViNGEzMjY5ODA3YTEwMzMxMTkxOTkwOGY2
14
+ NzdlZTQzYjIwMzNjN2I5ZmNmMWI3MGU4NDQ0NDBhYWY1MzgzZDY3MTMyYWRh
15
+ ZmRkMWFjNTg1ZTgxNDI2YmZhNmViYzI2MWJkZDIxMzhjZGRiN2U=
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ 2.0.0
2
+ Upgraded to Capybara 2.0+ and the latest versions of remaining gems.
3
+ Removed monkey patches, reclassifying some as "extensions".
4
+ Disabled the setting of SauceLabs custom capabilities.
5
+ Dropped celerity driver support.
6
+
1
7
  1.1.1
2
8
  Handover release, no code changes
3
9
 
data/Gemfile CHANGED
@@ -1,9 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- platforms :jruby do
4
- gem "jruby-openssl"
5
- end
6
-
7
- gem "rspec-mocks", "<2.14.0"
8
-
9
3
  gemspec
data/Gemfile.lock CHANGED
@@ -1,17 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- frameworks-capybara (1.1.1)
5
- capybara (~> 1.1.2)
6
- capybara-celerity
7
- capybara-mechanize (>= 0.3.0, < 1.0.0)
8
- cucumber (>= 0.10.5)
9
- headless
4
+ frameworks-capybara (2.0.0)
5
+ capybara
6
+ capybara-mechanize
7
+ cucumber
10
8
  json
11
- mechanize (= 2.7.2)
12
- mime-types
13
- nokogiri
14
- rubyzip
9
+ mechanize
15
10
  selenium-webdriver
16
11
  w3c_validators
17
12
 
@@ -19,20 +14,15 @@ GEM
19
14
  remote: https://rubygems.org/
20
15
  specs:
21
16
  builder (3.2.2)
22
- capybara (1.1.4)
17
+ capybara (2.4.4)
23
18
  mime-types (>= 1.16)
24
19
  nokogiri (>= 1.3.3)
25
20
  rack (>= 1.0.0)
26
21
  rack-test (>= 0.5.4)
27
- selenium-webdriver (~> 2.0)
28
- xpath (~> 0.1.4)
29
- capybara-celerity (0.0.1)
30
- capybara (>= 0.4.1)
31
- celerity (>= 0.7.9)
32
- capybara-mechanize (0.3.0)
33
- capybara (~> 1.1)
34
- mechanize (~> 2.3)
35
- celerity (0.9.2)
22
+ xpath (~> 2.0)
23
+ capybara-mechanize (1.4.0)
24
+ capybara (~> 2.4.4)
25
+ mechanize (~> 2.7.0)
36
26
  childprocess (0.5.5)
37
27
  ffi (~> 1.0, >= 1.0.11)
38
28
  cucumber (1.3.17)
@@ -42,25 +32,24 @@ GEM
42
32
  multi_json (>= 1.7.5, < 2.0)
43
33
  multi_test (>= 0.1.1)
44
34
  diff-lcs (1.2.5)
45
- domain_name (0.5.21)
35
+ domain_name (0.5.22)
46
36
  unf (>= 0.0.5, < 1.0.0)
47
- ffi (1.9.5)
37
+ ffi (1.9.6)
48
38
  gherkin (2.12.2)
49
39
  multi_json (~> 1.3)
50
- headless (1.0.2)
51
40
  http-cookie (1.0.2)
52
41
  domain_name (~> 0.5)
53
42
  json (1.8.1)
54
- mechanize (2.7.2)
43
+ mechanize (2.7.3)
55
44
  domain_name (~> 0.5, >= 0.5.1)
56
- http-cookie (~> 1.0.0)
57
- mime-types (~> 1.17, >= 1.17.2)
45
+ http-cookie (~> 1.0)
46
+ mime-types (~> 2.0)
58
47
  net-http-digest_auth (~> 1.1, >= 1.1.1)
59
48
  net-http-persistent (~> 2.5, >= 2.5.2)
60
49
  nokogiri (~> 1.4)
61
50
  ntlm-http (~> 0.1, >= 0.1.1)
62
51
  webrobots (>= 0.0.9, < 0.2)
63
- mime-types (1.25.1)
52
+ mime-types (2.4.3)
64
53
  mini_portile (0.6.0)
65
54
  multi_json (1.10.1)
66
55
  multi_test (0.1.1)
@@ -95,7 +84,7 @@ GEM
95
84
  nokogiri
96
85
  webrobots (0.1.1)
97
86
  websocket (1.2.1)
98
- xpath (0.1.4)
87
+ xpath (2.0.0)
99
88
  nokogiri (~> 1.3)
100
89
 
101
90
  PLATFORMS
@@ -103,7 +92,5 @@ PLATFORMS
103
92
 
104
93
  DEPENDENCIES
105
94
  frameworks-capybara!
106
- jruby-openssl
107
95
  rake
108
- rspec (>= 1.0.0)
109
- rspec-mocks (< 2.14.0)
96
+ rspec
data/README.rdoc CHANGED
@@ -15,8 +15,6 @@ Below are the current drivers that can be registered:
15
15
 
16
16
  * Selenium-Webdriver (Selenium2) - REMOTE: This can be used to drive 'in-browser' tests on a remote macine, this could be another macine on your local network which is running a Selenium-Webdriver server or indeed a cloud service such as 'Sauce Labs'
17
17
 
18
- * Celerity: This can be used to drive 'headless' tests. Celerity is a ruby wrapper for HTMLUnit and as such provides support for Javascript, though this is commonly quite fragile.
19
-
20
18
  * Mechanize-Caybara: This can be used, by setting BROWSER=mechanize
21
19
 
22
20
  How to use this gem in your project:
@@ -40,7 +38,6 @@ The following environment variables can be set to configure your tests:
40
38
  FIREFOX_CERT_PATH - specify optional directory containing Firefox profile certificate (.db) files
41
39
  FIREFOX_CERT_PREFIX - specify optional prefix for locating Firefox profile certificate files (e.g. <prefix>-<file>.db)
42
40
  CREATE_NEW_FF_PROFILE - create a new Firefox profile with name provided by FIREFOX_PROFILE
43
- CELERITY_JS_ENABLED (string - 'true', 'false') - determines whether Celerity (HTMLUnit) attempts to execute javascript
44
41
  XVFB - (string - 'true', 'false') - determines whether XVFB is used to run browser (i.e. headless Firefox on *nix platform)
45
42
  FW_CERT_LOCATION - path to client certificate (combined pem)
46
43
  CHROME_SWITCHES - pass in any allowed switches for the Selenium chrome driver (http://peter.sh/experiments/chromium-command-line-switches/) e.g. CHROME_SWITCHES="--user-agent=Mozilla/5.0 (PLAYSTATION 3; 3.55)"
@@ -15,23 +15,18 @@ Gem::Specification.new do |s|
15
15
  s.files = Dir.glob("{features,lib,bin,config,vendor,.bundle}/**/*") + %w(Gemfile Gemfile.lock)
16
16
 
17
17
  s.require_paths = ["lib"]
18
- s.rubygems_version = "1.3.6"
18
+ s.rubygems_version = "2.4.2"
19
19
  s.summary = "Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches"
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
22
22
 
23
- s.add_runtime_dependency("mime-types")
24
- s.add_runtime_dependency("nokogiri")
25
- s.add_runtime_dependency("rubyzip")
26
23
  s.add_runtime_dependency("selenium-webdriver")
27
- s.add_runtime_dependency("capybara", ["~>1.1.2"])
28
- s.add_runtime_dependency("mechanize", ["2.7.2"])
29
- s.add_runtime_dependency("capybara-mechanize", [">=0.3.0"], ["<1.0.0"])
24
+ s.add_runtime_dependency("capybara")
25
+ s.add_runtime_dependency("mechanize")
26
+ s.add_runtime_dependency("capybara-mechanize")
30
27
  s.add_runtime_dependency("json")
31
- s.add_runtime_dependency("headless")
32
- s.add_runtime_dependency("capybara-celerity")
33
- s.add_runtime_dependency("w3c_validators")
34
- s.add_runtime_dependency("cucumber", [">= 0.10.5"])
28
+ s.add_runtime_dependency("cucumber")
29
+ s.add_runtime_dependency("w3c_validators")
35
30
  s.add_development_dependency("rake")
36
- s.add_development_dependency("rspec", [">=1.0.0"])
31
+ s.add_development_dependency("rspec")
37
32
  end
@@ -1,39 +1,8 @@
1
1
  require 'capybara/mechanize/cucumber'
2
- require 'uri'
3
- class Capybara::Mechanize::Browser
4
- #patch to remove catching all Mechanize exceptions (which are nice and specific) and throwing a useless RuntimeError
5
- #patch to add Referer (Mechanize@0.3.0 won't add Referer for urls starting with http(s)://.)
6
- def process_remote_request(method, url, attributes, headers)
7
- if remote?(url)
8
- uri = URI.parse(url)
9
- uri = resolve_relative_url(url) if uri.host.nil?
10
- @last_remote_uri = uri
11
- url = uri.to_s
12
-
13
- referer = nil
14
- referer_candidate = current_url
15
- unless referer_candidate.empty? or (referer_candidate.start_with?('https://') and url.start_with?('http://'))
16
- referer = referer_candidate
17
- end
18
-
19
- reset_cache!
20
- args = []
21
- args << attributes unless attributes.empty?
22
- args << headers unless headers.empty?
23
-
24
- if method == :get
25
- agent.send(method, url, attributes, referer, headers)
26
- else
27
- agent.send(method, url, *args)
28
- end
29
-
30
- @last_request_remote = true
31
- end
32
- end
33
- end
34
2
 
3
+ # Cookie handling extensions
35
4
  class Capybara::Mechanize::Driver
36
- #Patch for friendly cookie handling api
5
+
37
6
  def cookies
38
7
  cookies = []
39
8
 
@@ -1,13 +1,9 @@
1
+ require 'capybara'
1
2
  require 'capybara/cucumber'
2
- require 'monkey-patches/webdriver-patches'
3
- require 'monkey-patches/capybara-patches'
4
- require 'monkey-patches/capybara-mechanize-patches'
5
- require 'monkey-patches/mechanize-patches'
6
- require 'monkey-patches/send-keys'
7
- require 'monkey-patches/net-http-persistent-patches'
3
+ require 'capybara/mechanize'
4
+ #require 'capybara/mechanize/cucumber'
8
5
  require 'selenium-webdriver'
9
- require 'capybara/mechanize/cucumber'
10
- require 'capybara/celerity'
6
+ require 'extensions/capybara-mechanize-extensions'
11
7
 
12
8
  class CapybaraSetup
13
9
 
@@ -21,7 +17,6 @@ class CapybaraSetup
21
17
  :http_proxy => http_proxy,
22
18
  :profile => ENV['FIREFOX_PROFILE'],
23
19
  :browser => ENV['BROWSER'],
24
- :javascript_enabled => ENV['CELERITY_JS_ENABLED'],
25
20
  :webdriver_proxy_on => ENV['PROXY_ON'],
26
21
  :url => ENV['REMOTE_URL'],
27
22
  :chrome_switches => ENV['CHROME_SWITCHES'],
@@ -52,6 +47,7 @@ class CapybaraSetup
52
47
  selenium_remote_opts[:browser_name] = selenium_remote_opts[:browser_name].intern if selenium_remote_opts[:browser_name]#update :browser value to be a symbol, required for Selenium
53
48
 
54
49
  Capybara.run_server = false #Disable rack server
50
+ Capybara.ignore_hidden_elements = false
55
51
 
56
52
  [capybara_opts, selenium_remote_opts, custom_opts].each do |opts| #delete nil options and environment (which is only used for validation)
57
53
 
@@ -59,8 +55,6 @@ class CapybaraSetup
59
55
  end
60
56
 
61
57
  case capybara_opts[:browser]
62
- when :headless then
63
- @driver = register_celerity_driver(capybara_opts)
64
58
  when :mechanize then
65
59
  @driver = register_mechanize_driver(capybara_opts)
66
60
  else
@@ -147,7 +141,8 @@ class CapybaraSetup
147
141
 
148
142
  def add_custom_caps(caps, custom_opts)
149
143
  sauce_time_limit = custom_opts.delete(:max_duration).to_i #note nil.to_i == 0
150
- caps.custom_capabilities({:'job-name' => (custom_opts[:job_name] or 'frameworks-unamed-job'), :'max-duration' => ((sauce_time_limit if sauce_time_limit != 0) or 1800)})
144
+ # This no longer works with the latest selenium-webdriver release
145
+ #caps.custom_capabilities({:'job-name' => (custom_opts[:job_name] or 'frameworks-unamed-job'), :'max-duration' => ((sauce_time_limit if sauce_time_limit != 0) or 1800)})
151
146
  end
152
147
 
153
148
  def set_client_proxy(opts)
@@ -184,17 +179,13 @@ class CapybaraSetup
184
179
  profile
185
180
  end
186
181
 
187
- def register_celerity_driver(opts)
188
- Capybara.register_driver :celerity do |app|
189
- opts.delete :browser #delete browser from options as value with be 'headless'
190
- opts[:javascript_enabled] == 'true' ? opts[:javascript_enabled] = true : opts[:javascript_enabled] = false
191
- opts[:http_proxy] = "#{@proxy_host}:80" unless opts[:http_proxy].nil?
192
- Capybara::Driver::Celerity.new(app,opts)
193
- end
194
- :celerity
195
- end
196
-
197
182
  def register_mechanize_driver(opts)
183
+ # Mechanize needs a Rack application: create a dummy one
184
+ app = Proc.new do |env|
185
+ ['200', {'Content-Type' => 'text/html'}, ['A barebones rack app.']]
186
+ end
187
+ Capybara.app = app
188
+ Capybara.run_server = false
198
189
  Capybara.register_driver :mechanize do |app|
199
190
  Capybara.app_host = "http://www.bbc.co.uk"
200
191
  Capybara::Mechanize::Driver.new(app)
@@ -1,17 +1,5 @@
1
1
  require 'frameworks/capybara'
2
2
  require 'w3c_validators'
3
- require 'monkey-patches/cucumber-patches'
4
-
5
- #This is hackish but means we only run once in cucumber and not every scenario
6
- if(ENV['XVFB']=='true')
7
- puts "You have chosen to use XVFB - ensure you have yum installed Xvfb Xorg and firefox"
8
- require 'headless'
9
- headless = Headless.new
10
- headless.start
11
- at_exit do
12
- headless.destroy
13
- end
14
- end
15
3
 
16
4
  module Frameworks
17
5
  module EnvHelper
@@ -143,12 +131,8 @@ end #Frameworks
143
131
  #Add module into world to ensure visibility of instance variables within Cucumber
144
132
  World(Frameworks::EnvHelper)
145
133
 
146
- #Call generate method in Before hook
147
134
  Before do
148
- #This is ugly but unavoidable since Capybara::RackTest::Driver.reset_host! does @browser = nil and wipes all brower level settings
149
- #it was either this or a monkey patch - need to think about pushing a softer reset change to capybara-mechanize to override this
150
135
  setup_mechanize(page.driver.browser.agent) if page.driver.class == Capybara::Mechanize::Driver
151
-
152
136
  generate_base_urls
153
137
  end
154
138
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FrameworksCapybara
2
- VERSION = '1.1.1'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -247,8 +247,8 @@ describe CapybaraSetup do
247
247
  Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
248
248
  Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
249
249
  Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
250
- Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'frameworks-unamed-job'
251
- Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 1800
250
+ #Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'frameworks-unamed-job'
251
+ #Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 1800
252
252
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :firefox
253
253
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:version].should == '4'
254
254
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:platform].should == 'windows'
@@ -358,8 +358,8 @@ describe CapybaraSetup do
358
358
  Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
359
359
  Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
360
360
  Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
361
- Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'myjobname'
362
- Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 2000
361
+ #Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'myjobname'
362
+ #Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 2000
363
363
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :firefox
364
364
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
365
365
  Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@model).should include 'default'
@@ -401,53 +401,7 @@ describe CapybaraSetup do
401
401
  end
402
402
  end
403
403
 
404
- describe "should allow Celerity driver to be created" do
405
-
406
- context "with minimal Celerity driver" do
407
- before do
408
- ENV['BROWSER'] = 'headless'
409
- end
410
-
411
- it "should be initialized correctly" do
412
- Capybara.delete_session
413
- CapybaraSetup.new.driver.should == :celerity
414
- Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Celerity
415
- Capybara.current_session.driver.options[:javascript_enabled].should == false
416
- Capybara.current_session.driver.options[:environment].should == nil
417
- Capybara.current_session.driver.options[:browser].should == nil
418
- end
419
- end
420
-
421
- context "with maximal Celerity driver" do
422
- before do
423
- ENV['BROWSER'] = 'headless'
424
- ENV['CELERITY_JS_ENABLED'] = 'true'
425
- ENV['HTTP_PROXY'] = 'http://example.cache.co.uk:80'
426
- end
427
-
428
- it "should be initialized correctly" do
429
- Capybara.delete_session
430
- CapybaraSetup.new.driver.should == :celerity
431
- Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Celerity
432
- Capybara.current_session.driver.options[:javascript_enabled].should == true
433
- Capybara.current_session.driver.options[:http_proxy].should == 'example.cache.co.uk:80'
434
- Capybara.current_session.driver.options[:environment].should == nil
435
- Capybara.current_session.driver.options[:browser].should == nil
436
- end
437
- end
438
-
439
- context "with maximal Celerity driver" do
440
- before do
441
- ENV['BROWSER'] = 'headless'
442
- ENV['CELERITY_JS_ENABLED'] = 'true'
443
- ENV['http_proxy'] = 'http://example.cache.co.uk:80'
444
- end
445
-
446
- it "should cope with http_proxy and HTTP_PROXY " do
447
- Capybara.delete_session
448
- Capybara.current_session.driver.options[:http_proxy].should == 'example.cache.co.uk:80'
449
- end
450
- end
404
+ describe "should permit certificate files to be incorporated into firefox profiles" do
451
405
 
452
406
  context "integration tests for update_firefox_profile_with_certificates() method" do
453
407
  before do
data/spec/spec_helper.rb CHANGED
@@ -13,5 +13,4 @@ Cucumber::RbSupport::RbLanguage.new(Cucumber::Runtime.new) #Need to load Cucumbe
13
13
 
14
14
  require 'frameworks/capybara'
15
15
  require 'frameworks/cucumber'
16
- require 'monkey-patches/capybara-mechanize-patches'
17
16
  require 'unit_test_monkeypatches.rb'
@@ -1,3 +1,6 @@
1
+ # This patch overrides the normal mechanism for searching for Firefox profiles
2
+ # causing named profiles to be created in the local directory (rather than be referenced)
3
+ # for unit/integration testing purposes
1
4
  module Selenium
2
5
  module WebDriver
3
6
  module Firefox