frameworks-capybara 0.0.43 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile CHANGED
@@ -10,4 +10,9 @@ group :development do
10
10
  gem "bundler", "~> 1.0.0"
11
11
  gem "jeweler", "~> 1.5.2"
12
12
  gem "rcov", ">= 0"
13
+ gem "rspec", ">= 0"
14
+ gem "capybara", "< 1.0.0"
15
+ gem "capybara-mechanize", ">=0"
16
+ gem "cucumber", ">= 0"
17
+ gem "selenium-webdriver", ">= 0"
13
18
  end
data/Gemfile.lock CHANGED
@@ -1,20 +1,78 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ builder (3.0.0)
5
+ capybara (0.4.1.2)
6
+ celerity (>= 0.7.9)
7
+ culerity (>= 0.2.4)
8
+ mime-types (>= 1.16)
9
+ nokogiri (>= 1.3.3)
10
+ rack (>= 1.0.0)
11
+ rack-test (>= 0.5.4)
12
+ selenium-webdriver (>= 0.0.27)
13
+ xpath (~> 0.1.3)
14
+ capybara-mechanize (0.2.7)
15
+ capybara (~> 0.4.0)
16
+ mechanize (~> 1.0.0)
17
+ celerity (0.9.0)
18
+ childprocess (0.2.2)
19
+ ffi (~> 1.0.6)
20
+ cucumber (1.1.0)
21
+ builder (>= 2.1.2)
22
+ diff-lcs (>= 1.1.2)
23
+ gherkin (~> 2.5.0)
24
+ json (>= 1.4.6)
25
+ term-ansicolor (>= 1.0.6)
26
+ culerity (0.2.15)
27
+ diff-lcs (1.1.3)
28
+ ffi (1.0.9)
29
+ gherkin (2.5.1)
30
+ json (>= 1.4.6)
4
31
  git (1.2.5)
5
32
  jeweler (1.5.2)
6
33
  bundler (~> 1.0.0)
7
34
  git (>= 1.2.5)
8
35
  rake
36
+ json (1.6.1)
37
+ json_pure (1.6.1)
38
+ mechanize (1.0.0)
39
+ nokogiri (>= 1.2.1)
40
+ mime-types (1.16)
41
+ nokogiri (1.5.0)
42
+ rack (1.3.3)
43
+ rack-test (0.6.1)
44
+ rack (>= 1.0)
9
45
  rake (0.8.7)
10
46
  rcov (0.9.9)
47
+ rspec (2.6.0)
48
+ rspec-core (~> 2.6.0)
49
+ rspec-expectations (~> 2.6.0)
50
+ rspec-mocks (~> 2.6.0)
51
+ rspec-core (2.6.4)
52
+ rspec-expectations (2.6.0)
53
+ diff-lcs (~> 1.1.2)
54
+ rspec-mocks (2.6.0)
55
+ rubyzip (0.9.4)
56
+ selenium-webdriver (2.7.0)
57
+ childprocess (>= 0.2.1)
58
+ ffi (>= 1.0.7)
59
+ json_pure
60
+ rubyzip
11
61
  shoulda (2.11.3)
62
+ term-ansicolor (1.0.6)
63
+ xpath (0.1.4)
64
+ nokogiri (~> 1.3)
12
65
 
13
66
  PLATFORMS
14
67
  ruby
15
68
 
16
69
  DEPENDENCIES
17
70
  bundler (~> 1.0.0)
71
+ capybara (< 1.0.0)
72
+ capybara-mechanize
73
+ cucumber
18
74
  jeweler (~> 1.5.2)
19
75
  rcov
76
+ rspec
77
+ selenium-webdriver
20
78
  shoulda
data/Rakefile CHANGED
@@ -24,26 +24,10 @@ Jeweler::Tasks.new do |gem|
24
24
  gem.add_runtime_dependency 'capybara', '>=0'
25
25
  gem.add_runtime_dependency 'capybara-mechanize', '>=0'
26
26
  gem.add_runtime_dependency 'headless', '>=0'
27
- # gem.add_development_dependency 'rspec', '> 1.2.3'
27
+ gem.add_development_dependency 'rspec', '>=2.6.0'
28
28
  end
29
29
  Jeweler::RubygemsDotOrgTasks.new
30
30
 
31
- require 'rake/testtask'
32
- Rake::TestTask.new(:test) do |test|
33
- test.libs << 'lib' << 'test'
34
- test.pattern = 'test/**/test_*.rb'
35
- test.verbose = true
36
- end
37
-
38
- require 'rcov/rcovtask'
39
- Rcov::RcovTask.new do |test|
40
- test.libs << 'test'
41
- test.pattern = 'test/**/test_*.rb'
42
- test.verbose = true
43
- end
44
-
45
- task :default => :test
46
-
47
31
  require 'rake/rdoctask'
48
32
  Rake::RDocTask.new do |rdoc|
49
33
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
@@ -53,3 +37,8 @@ Rake::RDocTask.new do |rdoc|
53
37
  rdoc.rdoc_files.include('README*')
54
38
  rdoc.rdoc_files.include('lib/**/*.rb')
55
39
  end
40
+
41
+ require 'rspec/core/rake_task'
42
+ RSpec::Core::RakeTask.new(:spec)
43
+
44
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.43
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{frameworks-capybara}
8
- s.version = "0.0.43"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcrmfc"]
12
- s.date = %q{2011-09-26}
12
+ s.date = %q{2011-10-10}
13
13
  s.description = %q{gem to aid setup of Capybara for testing bbc sites}
14
14
  s.email = %q{mcrobbins@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ ".rspec",
21
22
  "Gemfile",
22
23
  "Gemfile.lock",
23
24
  "LICENSE.txt",
@@ -40,8 +41,9 @@ Gem::Specification.new do |s|
40
41
  "schemas/xhtml-symbol.ent",
41
42
  "schemas/xhtml1-strict.dtd",
42
43
  "schemas/xhtml1-transitional.dtd",
43
- "test/helper.rb",
44
- "test/test_frameworks-capybara.rb"
44
+ "spec/frameworks_capybara_spec.rb",
45
+ "spec/frameworks_cucumber_spec.rb",
46
+ "spec/spec_helper.rb"
45
47
  ]
46
48
  s.homepage = %q{http://github.com/mcrmfc/frameworks-capybara}
47
49
  s.licenses = ["MIT"]
@@ -49,8 +51,9 @@ Gem::Specification.new do |s|
49
51
  s.rubygems_version = %q{1.6.0}
50
52
  s.summary = %q{gem to aid setup of Capybara for testing bbc sites}
51
53
  s.test_files = [
52
- "test/helper.rb",
53
- "test/test_frameworks-capybara.rb"
54
+ "spec/frameworks_capybara_spec.rb",
55
+ "spec/frameworks_cucumber_spec.rb",
56
+ "spec/spec_helper.rb"
54
57
  ]
55
58
 
56
59
  if s.respond_to? :specification_version then
@@ -61,26 +64,44 @@ Gem::Specification.new do |s|
61
64
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
62
65
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
63
66
  s.add_development_dependency(%q<rcov>, [">= 0"])
67
+ s.add_development_dependency(%q<rspec>, [">= 0"])
68
+ s.add_development_dependency(%q<capybara>, ["< 1.0.0"])
69
+ s.add_development_dependency(%q<capybara-mechanize>, [">= 0"])
70
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
71
+ s.add_development_dependency(%q<selenium-webdriver>, [">= 0"])
64
72
  s.add_runtime_dependency(%q<capybara>, [">= 0"])
65
73
  s.add_runtime_dependency(%q<capybara-mechanize>, [">= 0"])
66
74
  s.add_runtime_dependency(%q<headless>, [">= 0"])
75
+ s.add_development_dependency(%q<rspec>, [">= 2.6.0"])
67
76
  else
68
77
  s.add_dependency(%q<shoulda>, [">= 0"])
69
78
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
79
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
71
80
  s.add_dependency(%q<rcov>, [">= 0"])
81
+ s.add_dependency(%q<rspec>, [">= 0"])
82
+ s.add_dependency(%q<capybara>, ["< 1.0.0"])
83
+ s.add_dependency(%q<capybara-mechanize>, [">= 0"])
84
+ s.add_dependency(%q<cucumber>, [">= 0"])
85
+ s.add_dependency(%q<selenium-webdriver>, [">= 0"])
72
86
  s.add_dependency(%q<capybara>, [">= 0"])
73
87
  s.add_dependency(%q<capybara-mechanize>, [">= 0"])
74
88
  s.add_dependency(%q<headless>, [">= 0"])
89
+ s.add_dependency(%q<rspec>, [">= 2.6.0"])
75
90
  end
76
91
  else
77
92
  s.add_dependency(%q<shoulda>, [">= 0"])
78
93
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
79
94
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
80
95
  s.add_dependency(%q<rcov>, [">= 0"])
96
+ s.add_dependency(%q<rspec>, [">= 0"])
97
+ s.add_dependency(%q<capybara>, ["< 1.0.0"])
98
+ s.add_dependency(%q<capybara-mechanize>, [">= 0"])
99
+ s.add_dependency(%q<cucumber>, [">= 0"])
100
+ s.add_dependency(%q<selenium-webdriver>, [">= 0"])
81
101
  s.add_dependency(%q<capybara>, [">= 0"])
82
102
  s.add_dependency(%q<capybara-mechanize>, [">= 0"])
83
103
  s.add_dependency(%q<headless>, [">= 0"])
104
+ s.add_dependency(%q<rspec>, [">= 2.6.0"])
84
105
  end
85
106
  end
86
107
 
@@ -9,25 +9,24 @@ require 'capybara/mechanize/cucumber'
9
9
 
10
10
  class CapybaraSetup
11
11
 
12
- ERROR_MSG1 = 'Please ensure following environment variables are set ENVIRONMENT [int|test|stage|live], BROWSER[headless|ie|chrome|firefox] and PROXY_URL'
13
- ERROR_MSG2 = 'Please ensure the following environment variables are set PLATFORM, REMOTE_URL, REMOTE_BROWSER (browser to use on remote machine), PROXY_URL (if required), REMOTE_BROWSER_PROXY (if required) and BROWSER_VERSION (if required)'
14
-
15
-
16
- attr_accessor :driver
12
+ attr_reader :driver
17
13
 
18
14
  def initialize
15
+ capybara_opts = {:environment => ENV['ENVIRONMENT'], :proxy => ENV['PROXY_URL'], :profile => ENV['FIREFOX_PROFILE'], :browser => ENV['BROWSER'], :javascript_enabled => ENV['CELERITY_JS_ENABLED'], :proxy_on => ENV['PROXY_ON'],:url => ENV['REMOTE_URL']}
16
+ selenium_remote_opts = {:platform => ENV['PLATFORM'], :browser_name => ENV['REMOTE_BROWSER'], :version => ENV['REMOTE_BROWSER_VERSION'], :url => ENV['REMOTE_URL']}
17
+ custom_opts = {:job_name => ENV['SAUCE_JOB_NAME'], :max_duration => ENV['SAUCE_MAX_DURATION']}
19
18
 
20
- capybara_opts = {:environment => ENV['ENVIRONMENT'], :proxy => ENV['PROXY_URL'], :remote_browser_proxy_url => ENV['REMOTE_BROWSER_PROXY_URL'], :platform => ENV['PLATFORM'], :browser_name => ENV['REMOTE_BROWSER'], :version => ENV['REMOTE_BROWSER_VERSION'], :url => ENV['REMOTE_URL'], :profile => ENV['FIREFOX_PROFILE'], :browser => ENV['BROWSER'], :javascript_enabled => ENV['CELERITY_JS_ENABLED'], :job_name => ENV['SAUCE_JOB_NAME'], :max_duration => ENV['SAUCE_MAX_DURATION'], :proxy_on => ENV['PROXY_ON']}
21
-
22
- validate_env_vars(capybara_opts) #validate environment variables set using cucumber.yml or passed via command line
19
+ validate_env_vars(capybara_opts.merge(selenium_remote_opts)) #validate environment variables set using cucumber.yml or passed via command line
23
20
 
24
21
  @proxy_host = capybara_opts[:proxy].gsub(/http:\/\//,'').gsub(/:80/,'') unless capybara_opts[:proxy].nil?
25
22
  capybara_opts[:browser] = capybara_opts[:browser].intern #update :browser value to be a symbol, required for Selenium
26
- capybara_opts[:browser_name] = capybara_opts[:browser_name].intern if capybara_opts[:browser_name]
23
+ 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
27
24
 
28
25
  Capybara.run_server = false #Disable rack server
29
26
 
30
- capybara_opts.delete_if {|k,v| v.nil?}
27
+ [capybara_opts, selenium_remote_opts, custom_opts].each do |opts| #delete nil options and environment (which is only used for validation)
28
+ opts.delete_if {|k,v| (v.nil? or k == :environment)}
29
+ end
31
30
 
32
31
  case capybara_opts[:browser]
33
32
  when :headless then
@@ -35,82 +34,81 @@ class CapybaraSetup
35
34
  when :mechanize then
36
35
  @driver = register_mechanize_driver(capybara_opts)
37
36
  else
38
- @driver = register_selenium_driver(capybara_opts)
37
+ @driver = register_selenium_driver(capybara_opts, selenium_remote_opts, custom_opts)
39
38
  end
40
39
 
41
- Capybara.default_driver = @driver
42
40
 
43
- if capybara_opts[:browser] == :mechanize
44
- Capybara.current_session.driver.agent.set_proxy(@proxy_host, 80) if capybara_opts[:proxy]
45
- Capybara.current_session.driver.agent.set_ssl_client_certification(ENV['CERT_LOCATION'], ENV['CERT_LOCATION'], ENV['CA_CERT_LOCATION']) if ENV['CERT_LOCATION']
46
- end
41
+ Capybara.default_driver = @driver
47
42
  end
48
43
 
49
44
  private
50
45
 
51
46
  def validate_env_vars(opts)
52
- [:environment, :browser].each do |item|
53
- opts.has_key?(item) && opts[item]==nil ? abort(ERROR_MSG1) : ''
54
- end
55
47
 
56
- opts.delete(:environment) #delete environment, only add to opts for conveniance when validating
48
+ msg1 = 'Please ensure following environment variables are set ENVIRONMENT [int|test|stage|live], BROWSER[headless|ie|chrome|firefox] and PROXY_URL (if required)'
49
+ msg2 = 'Please ensure the following environment variables are set PLATFORM, REMOTE_URL, REMOTE_BROWSER (browser to use on remote machine), PROXY_URL (if required), REMOTE_BROWSER_PROXY (if required) and BROWSER_VERSION (if required)'
57
50
 
51
+ [:environment, :browser].each do |item|
52
+ !opts.has_key?(item) or opts[item]==nil ? raise(msg1) : ''
53
+ end
58
54
 
59
55
  if opts[:browser]=='remote'
60
- [:remote_url, :browser_name].each do |item|
61
- opts.has_key?(item) && opts[item]==nil ? abort(ERROR_MSG2) : ''
56
+ [:url, :browser_name].each do |item|
57
+ !opts.has_key?(item) or opts[item]==nil ? raise(msg2) : ''
62
58
  end
63
59
  end
64
60
  end
65
61
 
66
- def register_selenium_driver(opts)
62
+ def register_selenium_driver(opts,remote_opts,custom_opts)
67
63
  Capybara.register_driver :selenium do |app|
68
64
 
69
- if(opts[:profile] == 'BBC_INTERNAL')
70
- profile = Selenium::WebDriver::Firefox::Profile.new
71
- profile["network.proxy.type"] = 1
72
- profile["network.proxy.no_proxies_on"] = "*.sandbox.dev.bbc.co.uk"
73
- profile["network.proxy.http"] = @proxy_host
74
- profile["network.proxy.ssl"] = @proxy_host
75
- profile["network.proxy.http_port"] = 80
76
- profile["network.proxy.ssl_port"] = 80
77
- profile.native_events = true
78
- opts[:profile] = profile
79
- elsif(opts[:profile])
80
- profile = Selenium::WebDriver::Firefox::Profile.from_name opts[:profile]
81
- profile.native_events = true
82
- opts[:profile] = profile
83
- end
65
+ opts[:profile] = create_profile(opts[:profile]) if(opts[:profile])
84
66
 
85
67
  if opts[:browser] == :remote
86
68
  client = Selenium::WebDriver::Remote::Http::Default.new
69
+ client.proxy = set_client_proxy(opts)
87
70
 
88
- #set proxy on client connection if required, note you may use ENV['PROXY_URL'] for setting in browser (ff profile) but not for client conection, hence allow for PROXY_ON=false
89
- if opts[:proxy] && opts[:proxy_on] != 'false'
90
- client.proxy = Selenium::WebDriver::Proxy.new(:http => opts[:proxy])
91
- end
92
- opts.delete_if {|k,v| [:proxy, :proxy_on].include? k}
93
-
94
- #TODO: temp workaround - needs refactoring
95
- cap_opts = opts.clone
96
- cap_opts[:firefox_profile] = cap_opts.delete :profile
97
- cap_opts.delete :browser
98
- caps = Selenium::WebDriver::Remote::Capabilities.new(cap_opts)
99
- caps.custom_capabilities({:'job-name' => opts.delete(:job_name) || 'frameworks-unamed-job', :'max-duration' => opts.delete(:max_duration) || 1800}) if opts[:url].include? 'saucelabs' #set sauce specific parameters - will this scupper other on sauce remote jobs?
71
+ remote_opts[:firefox_profile] = opts.delete :profile
72
+ caps = Selenium::WebDriver::Remote::Capabilities.new(remote_opts)
100
73
 
101
- opts.delete_if {|k,v| [:browser_name, :platform, :profile, :version].include? k} #remove options that would have been added to caps
74
+ add_custom_caps(caps, custom_opts) if remote_opts[:url].include? 'saucelabs' #set sauce specific parameters - will this scupper other on sauce remote jobs?
102
75
 
103
76
  opts[:desired_capabilities] = caps
104
77
  opts[:http_client] = client
105
- else
106
- opts.delete_if {|k,v| [:proxy, :proxy_on].include? k} #may want to pass env variables that are not relevant for in browser 'non-remote' tests e.g. proxy, so delete these before setting up driver
107
78
  end
79
+ clean_opts(opts, :proxy, :proxy_on)
108
80
  Capybara::Driver::Selenium.new(app,opts)
109
81
  end
110
82
  :selenium
111
83
  end
112
84
 
113
- def register_celerity_driver (opts)
85
+ def add_custom_caps(caps, custom_opts)
86
+ sauce_time_limit = custom_opts.delete(:max_duration).to_i #note nil.to_i == 0
87
+ 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)})
88
+ end
89
+
90
+ def set_client_proxy(opts)
91
+ Selenium::WebDriver::Proxy.new(:http => opts[:proxy]) if opts[:proxy] && opts[:proxy_on] != 'false' #set proxy on client connection if required, note you may use ENV['PROXY_URL'] for setting in browser (ff profile) but not for client conection, hence allow for PROXY_ON=false
92
+ end
93
+
94
+ def create_profile(profile_name)
95
+ if(profile_name == 'BBC_INTERNAL')
96
+ profile = Selenium::WebDriver::Firefox::Profile.new
97
+ profile["network.proxy.type"] = 1
98
+ profile["network.proxy.no_proxies_on"] = "*.sandbox.dev.bbc.co.uk"
99
+ profile["network.proxy.http"] = @proxy_host
100
+ profile["network.proxy.ssl"] = @proxy_host
101
+ profile["network.proxy.http_port"] = 80
102
+ profile["network.proxy.ssl_port"] = 80
103
+ profile.native_events = true
104
+ else
105
+ profile = Selenium::WebDriver::Firefox::Profile.from_name profile_name
106
+ profile.native_events = true
107
+ end
108
+ profile
109
+ end
110
+
111
+ def register_celerity_driver(opts)
114
112
  Capybara.register_driver :celerity do |app|
115
113
  opts.delete :browser #delete browser from options as value with be 'headless'
116
114
  opts[:javascript_enabled] == 'true' ? opts[:javascript_enabled] = true : opts[:javascript_enabled] = false
@@ -120,13 +118,21 @@ class CapybaraSetup
120
118
  :celerity
121
119
  end
122
120
 
123
- def register_mechanize_driver (opts)
121
+ def register_mechanize_driver(opts)
124
122
  Capybara.register_driver :mechanize do |app|
125
- opts.delete :browser #delete browser from options as value with be 'headless'
126
123
  Capybara.app_host = "http://www.int.bbc.co.uk"
127
- Capybara::Driver::Mechanize.new(app)
124
+ driver = Capybara::Driver::Mechanize.new(app)
125
+ driver.agent.set_proxy(@proxy_host, 80) unless opts[:proxy].nil?
126
+ driver.agent.set_ssl_client_certification(ENV['CERT_LOCATION'], ENV['CERT_LOCATION'], ENV['CA_CERT_LOCATION']) if ENV['CERT_LOCATION']
127
+ driver
128
128
  end
129
129
  :mechanize
130
130
  end
131
131
 
132
+ def clean_opts(opts, *args)
133
+ args.each do |arg|
134
+ opts.delete arg
135
+ end
136
+ end
137
+
132
138
  end
@@ -13,39 +13,38 @@ end
13
13
 
14
14
  module Frameworks
15
15
  module EnvHelper
16
-
17
- ENV['SCHEME']=='https' ? scheme = 'https' : scheme = 'http'
18
-
19
- WWW_PREFIX = "#{scheme}://www."
20
- STATIC_PREFIX = "#{scheme}://static."
21
- OPEN_PREFIX = "#{scheme}://open."
22
- BBC_DOMAIN = '.bbc.co.uk'
23
- STATIC_BBC_DOMAIN = '.bbc.co.uk'
24
- SANDBOX = "#{scheme}://pal.sandbox.dev"
25
- STATIC_SANDBOX = "#{scheme}://static.sandbox.dev"
26
-
27
16
  #Generate base urls to use in Cucumber step defs
28
17
  def generate_base_urls
18
+ set_scheme
29
19
  if(ENV['ENVIRONMENT']=='sandbox')
30
- @base_url = SANDBOX + BBC_DOMAIN
31
- @static_base_url = STATIC_SANDBOX + BBC_DOMAIN
20
+ @base_url = @sandbox + @bbc_domain
21
+ @static_base_url = @static_sandbox + @bbc_domain
32
22
  elsif (ENV['ENVIRONMENT']=='live' && ENV['WWW_LIVE']=='false')
33
- @base_url = WWW_PREFIX + BBC_DOMAIN
34
- @static_base_url = STATIC_PREFIX + BBC_DOMAIN
35
- @open_base_url = OPEN_PREFIX + BBC_DOMAIN
23
+ @base_url = @www_prefix.chop + @bbc_domain
24
+ @static_base_url = @static_prefix.chop + @bbc_domain
25
+ @open_base_url = @open_prefix.chop + @bbc_domain
36
26
  elsif (ENV['ENVIRONMENT'].split('.')[0].include? 'pal') #address specific box
37
27
  @base_url = "#{scheme}://#{ENV['ENVIRONMENT']}"
38
28
  else
39
- @base_url = WWW_PREFIX + ENV['ENVIRONMENT'] + BBC_DOMAIN
40
- @static_base_url = STATIC_PREFIX + ENV['ENVIRONMENT'] + BBC_DOMAIN
41
- @open_base_url = OPEN_PREFIX + ENV['ENVIRONMENT'] + BBC_DOMAIN
29
+ @base_url = @www_prefix + ENV['ENVIRONMENT'] + @bbc_domain
30
+ @static_base_url = @static_prefix + ENV['ENVIRONMENT'] + @bbc_domain
31
+ @open_base_url = @open_prefix + ENV['ENVIRONMENT'] + @bbc_domain
42
32
  end
43
33
  end
44
34
 
35
+ def set_scheme
36
+ ENV['SCHEME']=='https' ? scheme = 'https' : scheme = 'http'
37
+ @www_prefix = "#{scheme}://www."
38
+ @static_prefix = "#{scheme}://static."
39
+ @open_prefix = "#{scheme}://open."
40
+ @bbc_domain = '.bbc.co.uk'
41
+ @sandbox = "#{scheme}://pal.sandbox.dev"
42
+ @static_sandbox = "#{scheme}://static.sandbox.dev"
43
+ end
44
+
45
45
  end #EnvHelper
46
46
  end #Frameworks
47
47
 
48
- CapybaraSetup.new unless ENV['CAPYBARA_DISABLED']
49
48
 
50
49
  #Add module into world to ensure visibility of instance variables within Cucumber
51
50
  World(Frameworks::EnvHelper)
@@ -1,2 +1,4 @@
1
1
  require 'frameworks/cucumber'
2
2
  require 'frameworks/capybara'
3
+
4
+ CapybaraSetup.new unless ENV['CAPYBARA_DISABLED']
@@ -1,6 +1,7 @@
1
1
  require 'selenium-webdriver'
2
2
  require 'capybara/cucumber'
3
3
 
4
+
4
5
  ##
5
6
  #Monkey Patch's - Use with care!
6
7
  #
@@ -0,0 +1,336 @@
1
+ require 'spec_helper'
2
+ ##
3
+ #Monkey Patch
4
+ #This is required because Capybara has module methods (singletons) which create
5
+ #a session and then re-use this whenever Capybara is referenced in the current process.
6
+ #Therefore even creating new instances of CapybaraSetup will use the same session and driver instance
7
+ #...not picking up changes in the different tests below.
8
+ #Hence the only option is to clean out the session before each test.
9
+ module Capybara
10
+ class << self
11
+ def delete_session
12
+ @session_pool = {}
13
+ end
14
+ end
15
+ end
16
+
17
+ shared_examples_for "Selenium Driver Options Array" do
18
+ it "should contain no nil values for unset options" do
19
+ #TODO: Test for nil elements in options - there shouldn't be any that we insert
20
+ #i.e. anything in our ENV options should not end up being nil in Selenium
21
+
22
+ Capybara.current_session.driver.options[:environment].should == nil
23
+ Capybara.current_session.driver.options[:proxy].should == nil
24
+ Capybara.current_session.driver.options[:proxy_on].should == nil
25
+ Capybara.current_session.driver.options[:platform].should == nil
26
+ Capybara.current_session.driver.options[:browser_name].should == nil
27
+ Capybara.current_session.driver.options[:version].should == nil
28
+ Capybara.current_session.driver.options[:job_name].should == nil
29
+ Capybara.current_session.driver.options[:max_duration].should == nil
30
+ Capybara.current_session.driver.options[:profile].should_not be_a_kind_of String
31
+ Capybara.current_session.driver.options[:browser].should_not be_a_kind_of String
32
+ end
33
+ end
34
+
35
+ describe CapybaraSetup do
36
+
37
+ before(:each) do
38
+ home = ENV['HOME']
39
+ ENV.clear
40
+ ENV['HOME'] = home #Want to clear some env variables but HOME is used by Webdriver, therefore need to preserve it
41
+ end
42
+
43
+ describe "should validate options" do
44
+ before(:each) do
45
+ Capybara.delete_session
46
+ end
47
+
48
+ it "should require as a minimum ENVIRONMENT and BROWSER" do
49
+ lambda {CapybaraSetup.new}.should raise_error(RuntimeError,'Please ensure following environment variables are set ENVIRONMENT [int|test|stage|live], BROWSER[headless|ie|chrome|firefox] and PROXY_URL (if required)')
50
+ end
51
+
52
+ it "should require as a minimum ENVIRONMENT, BROWSER and REMOTE_BROWSER if running a Remote Selenium Instance" do
53
+ ENV['BROWSER'] = 'remote'
54
+ ENV['ENVIRONMENT'] = 'test'
55
+ lambda {CapybaraSetup.new}.should raise_error(RuntimeError,'Please ensure the following environment variables are set PLATFORM, REMOTE_URL, REMOTE_BROWSER (browser to use on remote machine), PROXY_URL (if required), REMOTE_BROWSER_PROXY (if required) and BROWSER_VERSION (if required)')
56
+ end
57
+
58
+ it "should not error if ENVIRONMENT and BROWSER are provided" do
59
+ ENV['BROWSER'] = 'headless'
60
+ ENV['ENVIRONMENT'] = 'test'
61
+ lambda {CapybaraSetup.new}.should_not raise_error
62
+ end
63
+
64
+ it "should not error if ENVIRONMENT, BROWSER and REMOTE_BROSWER are provided if running a Remote Selenium Instance" do
65
+ ENV['BROWSER'] = 'remote'
66
+ ENV['ENVIRONMENT'] = 'test'
67
+ ENV['REMOTE_BROWSER'] = 'test'
68
+ ENV['REMOTE_URL'] = 'test'
69
+ lambda {CapybaraSetup.new}.should_not raise_error
70
+ end
71
+ end
72
+
73
+ describe "should allow Capybara drivers to be created" do
74
+ before do
75
+ ENV['ENVIRONMENT'] = 'test'
76
+ end
77
+
78
+ describe "should allow Selenium driver to be created" do
79
+ context "with minimal Selenium driver" do
80
+ before do
81
+ ENV['BROWSER'] = 'firefox'
82
+ end
83
+
84
+ it "should be initialized correctly" do
85
+ Capybara.delete_session
86
+ CapybaraSetup.new.driver.should == :selenium
87
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
88
+ Capybara.current_session.driver.options[:browser].should == :firefox
89
+ end
90
+
91
+ it_behaves_like "Selenium Driver Options Array"
92
+ end
93
+
94
+ context "with Selenium driver and default firefox profile (from profiles.ini)" do
95
+ before do
96
+ ENV['BROWSER'] = 'firefox'
97
+ ENV['FIREFOX_PROFILE'] = 'default'
98
+ end
99
+
100
+ it "should be initialized correctly" do
101
+ Capybara.delete_session
102
+ CapybaraSetup.new.driver.should == :selenium
103
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
104
+ Capybara.current_session.driver.options[:browser].should == :firefox
105
+ Capybara.current_session.driver.options[:profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
106
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@model).should include "default"
107
+ end
108
+ it_behaves_like "Selenium Driver Options Array"
109
+
110
+ end
111
+
112
+ context "with Selenium driver and programtically cretated profile" do
113
+ before do
114
+ ENV['BROWSER'] = 'firefox'
115
+ ENV['FIREFOX_PROFILE'] = 'BBC_INTERNAL'
116
+ ENV['PROXY_URL'] = 'http://example.cache.co.uk:80'
117
+ ENV['PROXY_ON'] = 'false'
118
+ end
119
+
120
+ it "should be initialized correctly" do
121
+ Capybara.delete_session
122
+ CapybaraSetup.new.driver.should == :selenium
123
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
124
+ Capybara.current_session.driver.options[:browser].should == :firefox
125
+ Capybara.current_session.driver.options[:profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
126
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.type'].should == '1'
127
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.no_proxies_on'].should == '"*.sandbox.dev.bbc.co.uk"'
128
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.http'].should == '"example.cache.co.uk"'
129
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.http_port'].should == '80'
130
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.ssl'].should == '"example.cache.co.uk"'
131
+ Capybara.current_session.driver.options[:profile].instance_variable_get(:@additional_prefs)['network.proxy.ssl_port'].should == '80'
132
+ end
133
+ it_behaves_like "Selenium Driver Options Array"
134
+ end
135
+
136
+
137
+ context "with Remote Selenium driver" do
138
+ before do
139
+ ENV['BROWSER'] = 'remote'
140
+ ENV['REMOTE_BROWSER'] = 'firefox'
141
+ ENV['FIREFOX_PROFILE'] = 'default'
142
+ ENV['REMOTE_URL'] = 'http://example.com'
143
+ end
144
+
145
+ it "should be initialized correctly" do
146
+ Capybara.delete_session
147
+ CapybaraSetup.new.driver.should == :selenium
148
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
149
+ Capybara.current_session.driver.options[:browser].should == :remote
150
+ Capybara.current_session.driver.options[:url].should == 'http://example.com'
151
+ Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
152
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
153
+ Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
154
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :firefox
155
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
156
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@model).should include 'default'
157
+ end
158
+ it_behaves_like "Selenium Driver Options Array"
159
+ end
160
+
161
+ context "with Remote Selenium driver and client proxy" do
162
+ before do
163
+ ENV['BROWSER'] = 'remote'
164
+ ENV['REMOTE_BROWSER'] = 'firefox'
165
+ ENV['FIREFOX_PROFILE'] = 'default'
166
+ ENV['REMOTE_URL'] = 'http://example.com'
167
+ ENV['PROXY_URL'] = 'http://example.cache.co.uk:80'
168
+ end
169
+
170
+ it "should be initialized correctly" do
171
+ Capybara.delete_session
172
+ CapybaraSetup.new.driver.should == :selenium
173
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
174
+ Capybara.current_session.driver.options[:browser].should == :remote
175
+ Capybara.current_session.driver.options[:url].should == 'http://example.com'
176
+ Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
177
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should be_a_kind_of Selenium::WebDriver::Proxy
178
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).instance_variable_get(:@http).should == 'http://example.cache.co.uk:80'
179
+ end
180
+ it_behaves_like "Selenium Driver Options Array"
181
+ end
182
+
183
+ context "with Remote Selenium driver, programtically cretated Firefox profile using proxy but client not using proxy" do
184
+ before do
185
+ ENV['BROWSER'] = 'remote'
186
+ ENV['REMOTE_BROWSER'] = 'firefox'
187
+ ENV['FIREFOX_PROFILE'] = 'BBC_INTERNAL'
188
+ ENV['REMOTE_URL'] = 'http://example.cache.co.uk:80'
189
+ ENV['PROXY_URL'] = 'http://example.cache.co.uk:80'
190
+ ENV['PROXY_ON'] = 'false'
191
+ end
192
+
193
+ it "should be initialized correctly" do
194
+ Capybara.delete_session
195
+ CapybaraSetup.new.driver.should == :selenium
196
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
197
+ Capybara.current_session.driver.options[:browser].should == :remote
198
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
199
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.type'].should == '1'
200
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.no_proxies_on'].should == '"*.sandbox.dev.bbc.co.uk"'
201
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.http'].should == '"example.cache.co.uk"'
202
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.http_port'].should == '80'
203
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.ssl'].should == '"example.cache.co.uk"'
204
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@additional_prefs)['network.proxy.ssl_port'].should == '80'
205
+ Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
206
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
207
+ end
208
+ it_behaves_like "Selenium Driver Options Array"
209
+ end
210
+
211
+ context "with Remote Selenium driver (specifying platform and browser version) and default Custom Capabilites (e.g. for Sauce Labs)" do
212
+ before do
213
+ ENV['BROWSER'] = 'remote'
214
+ ENV['REMOTE_BROWSER'] = 'firefox'
215
+ ENV['PLATFORM'] = 'windows'
216
+ ENV['REMOTE_BROWSER_VERSION'] = '4'
217
+ ENV['FIREFOX_PROFILE'] = 'default'
218
+ ENV['REMOTE_URL'] = 'http://saucelabs.com'
219
+ end
220
+
221
+ it "should be initialized correctly" do
222
+ Capybara.delete_session
223
+ CapybaraSetup.new.driver.should == :selenium
224
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
225
+ Capybara.current_session.driver.options[:browser].should == :remote
226
+ Capybara.current_session.driver.options[:url].should == 'http://saucelabs.com'
227
+ Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
228
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
229
+ Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
230
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'frameworks-unamed-job'
231
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 1800
232
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :firefox
233
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:version].should == '4'
234
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:platform].should == 'windows'
235
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
236
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@model).should include 'default'
237
+ end
238
+ it_behaves_like "Selenium Driver Options Array"
239
+ end
240
+
241
+ context "with Remote Selenium driver and specified Custom Capabilites (e.g. for Sauce Labs)" do
242
+ before do
243
+ ENV['BROWSER'] = 'remote'
244
+ ENV['REMOTE_BROWSER'] = 'firefox'
245
+ ENV['SAUCE_JOB_NAME'] = 'myjobname'
246
+ ENV['SAUCE_MAX_DURATION'] = '2000'
247
+ ENV['REMOTE_BROWSER_VERSION'] = '4'
248
+ ENV['FIREFOX_PROFILE'] = 'default'
249
+ ENV['REMOTE_URL'] = 'http://saucelabs.com'
250
+ end
251
+
252
+ it "should be initialized correctly" do
253
+ Capybara.delete_session
254
+ CapybaraSetup.new.driver.should == :selenium
255
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Selenium
256
+ Capybara.current_session.driver.options[:browser].should == :remote
257
+ Capybara.current_session.driver.options[:url].should == 'http://saucelabs.com'
258
+ Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
259
+ Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
260
+ Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
261
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'myjobname'
262
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'max-duration'].should == 2000
263
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :firefox
264
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
265
+ Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@model).should include 'default'
266
+ end
267
+ it_behaves_like "Selenium Driver Options Array"
268
+ end
269
+ end
270
+
271
+ describe "should allow Mechanize driver to be created" do
272
+ context "with minimal Mechanize driver" do
273
+ before do
274
+ ENV['BROWSER'] = 'mechanize'
275
+ end
276
+
277
+ it "should be initialized correctly" do
278
+ Capybara.delete_session
279
+ CapybaraSetup.new.driver.should == :mechanize
280
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Mechanize
281
+ end
282
+ context "with maximal Mechanize driver" do
283
+ before do
284
+ ENV['BROWSER'] = 'mechanize'
285
+ ENV['ENVIRONMENT'] = 'test'
286
+ ENV['PROXY_URL'] = 'http://example.cache.co.uk:80'
287
+ end
288
+
289
+ it "should be initialized correctly" do
290
+ Capybara.delete_session
291
+ CapybaraSetup.new.driver.should == :mechanize
292
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Mechanize
293
+ Capybara.current_session.driver.agent.proxy_addr.should == 'example.cache.co.uk'
294
+ Capybara.current_session.driver.agent.proxy_port.should == 80
295
+ end
296
+ end
297
+ end
298
+
299
+ describe "should allow Celerity driver to be created" do
300
+
301
+ context "with minimal Celerity driver" do
302
+ before do
303
+ ENV['BROWSER'] = 'headless'
304
+ end
305
+
306
+ it "should be initialized correctly" do
307
+ Capybara.delete_session
308
+ CapybaraSetup.new.driver.should == :celerity
309
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Celerity
310
+ Capybara.current_session.driver.options[:javascript_enabled].should == false
311
+ Capybara.current_session.driver.options[:environment].should == nil
312
+ Capybara.current_session.driver.options[:browser].should == nil
313
+ end
314
+ end
315
+
316
+ context "with maximal Celerity driver" do
317
+ before do
318
+ ENV['BROWSER'] = 'headless'
319
+ ENV['CELERITY_JS_ENABLED'] = 'true'
320
+ ENV['PROXY_URL'] = 'http://example.cache.co.uk:80'
321
+ end
322
+
323
+ it "should be initialized correctly" do
324
+ Capybara.delete_session
325
+ CapybaraSetup.new.driver.should == :celerity
326
+ Capybara.current_session.driver.should be_a_kind_of Capybara::Driver::Celerity
327
+ Capybara.current_session.driver.options[:javascript_enabled].should == true
328
+ Capybara.current_session.driver.options[:proxy].should == 'example.cache.co.uk:80'
329
+ Capybara.current_session.driver.options[:environment].should == nil
330
+ Capybara.current_session.driver.options[:browser].should == nil
331
+ end
332
+ end
333
+ end
334
+ end
335
+ end
336
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Frameworks::EnvHelper do
4
+
5
+ before do
6
+ ENV['BROWSER'] = 'test' #mandatory data to prevent validation exception
7
+ end
8
+
9
+ describe "set base url correctly" do
10
+ include Frameworks::EnvHelper
11
+
12
+ it "should be able to set a local url" do
13
+ ENV['ENVIRONMENT'] = 'sandbox'
14
+ generate_base_urls
15
+ @base_url.should == 'http://pal.sandbox.dev.bbc.co.uk'
16
+ @static_base_url.should == 'http://static.sandbox.dev.bbc.co.uk'
17
+ end
18
+
19
+ it "should be able to set a base url" do
20
+ ENV['ENVIRONMENT'] = 'foo'
21
+ generate_base_urls
22
+ @base_url.should == 'http://www.foo.bbc.co.uk'
23
+ @static_base_url.should == 'http://static.foo.bbc.co.uk'
24
+ @open_base_url.should == 'http://open.foo.bbc.co.uk'
25
+ end
26
+
27
+ it "should be able to set a 'classic' live url" do
28
+ ENV['ENVIRONMENT'] = 'live'
29
+ ENV['WWW_LIVE'] = 'false'
30
+ generate_base_urls
31
+ @base_url.should == 'http://www.bbc.co.uk'
32
+ @static_base_url.should == 'http://static.bbc.co.uk'
33
+ @open_base_url.should == 'http://open.bbc.co.uk'
34
+ end
35
+
36
+ it "should be able to set scheme to ssl" do
37
+ ENV['SCHEME'] = 'https'
38
+ ENV['ENVIRONMENT'] = 'foo'
39
+ generate_base_urls
40
+ @base_url.should == 'https://www.foo.bbc.co.uk'
41
+ @static_base_url.should == 'https://static.foo.bbc.co.uk'
42
+ @open_base_url.should == 'https://open.foo.bbc.co.uk'
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'gherkin'
4
+ require 'cucumber/language_support/language_methods'
5
+ require 'cucumber/rb_support/rb_language'
6
+ require 'cucumber/runtime'
7
+ require 'rspec'
8
+ require 'capybara'
9
+
10
+ dir = File.dirname(__FILE__)
11
+ $LOAD_PATH.unshift "#{dir}/../lib"
12
+ Cucumber::RbSupport::RbLanguage.new(Cucumber::Runtime.new) #Need to load Cucumber runtime, so World is available
13
+
14
+ require 'frameworks/capybara'
15
+ require 'frameworks/cucumber'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameworks-capybara
3
3
  version: !ruby/object:Gem::Version
4
- hash: 73
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 0
9
- - 43
10
- version: 0.0.43
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - mcrmfc
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-26 00:00:00 +01:00
18
+ date: 2011-10-10 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -79,7 +79,7 @@ dependencies:
79
79
  name: rcov
80
80
  prerelease: false
81
81
  - !ruby/object:Gem::Dependency
82
- type: :runtime
82
+ type: :development
83
83
  requirement: &id005 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
@@ -90,11 +90,83 @@ dependencies:
90
90
  - 0
91
91
  version: "0"
92
92
  version_requirements: *id005
93
+ name: rspec
94
+ prerelease: false
95
+ - !ruby/object:Gem::Dependency
96
+ type: :development
97
+ requirement: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - <
101
+ - !ruby/object:Gem::Version
102
+ hash: 23
103
+ segments:
104
+ - 1
105
+ - 0
106
+ - 0
107
+ version: 1.0.0
108
+ version_requirements: *id006
109
+ name: capybara
110
+ prerelease: false
111
+ - !ruby/object:Gem::Dependency
112
+ type: :development
113
+ requirement: &id007 !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ hash: 3
119
+ segments:
120
+ - 0
121
+ version: "0"
122
+ version_requirements: *id007
123
+ name: capybara-mechanize
124
+ prerelease: false
125
+ - !ruby/object:Gem::Dependency
126
+ type: :development
127
+ requirement: &id008 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
135
+ version: "0"
136
+ version_requirements: *id008
137
+ name: cucumber
138
+ prerelease: false
139
+ - !ruby/object:Gem::Dependency
140
+ type: :development
141
+ requirement: &id009 !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ hash: 3
147
+ segments:
148
+ - 0
149
+ version: "0"
150
+ version_requirements: *id009
151
+ name: selenium-webdriver
152
+ prerelease: false
153
+ - !ruby/object:Gem::Dependency
154
+ type: :runtime
155
+ requirement: &id010 !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ hash: 3
161
+ segments:
162
+ - 0
163
+ version: "0"
164
+ version_requirements: *id010
93
165
  name: capybara
94
166
  prerelease: false
95
167
  - !ruby/object:Gem::Dependency
96
168
  type: :runtime
97
- requirement: &id006 !ruby/object:Gem::Requirement
169
+ requirement: &id011 !ruby/object:Gem::Requirement
98
170
  none: false
99
171
  requirements:
100
172
  - - ">="
@@ -103,12 +175,12 @@ dependencies:
103
175
  segments:
104
176
  - 0
105
177
  version: "0"
106
- version_requirements: *id006
178
+ version_requirements: *id011
107
179
  name: capybara-mechanize
108
180
  prerelease: false
109
181
  - !ruby/object:Gem::Dependency
110
182
  type: :runtime
111
- requirement: &id007 !ruby/object:Gem::Requirement
183
+ requirement: &id012 !ruby/object:Gem::Requirement
112
184
  none: false
113
185
  requirements:
114
186
  - - ">="
@@ -117,9 +189,25 @@ dependencies:
117
189
  segments:
118
190
  - 0
119
191
  version: "0"
120
- version_requirements: *id007
192
+ version_requirements: *id012
121
193
  name: headless
122
194
  prerelease: false
195
+ - !ruby/object:Gem::Dependency
196
+ type: :development
197
+ requirement: &id013 !ruby/object:Gem::Requirement
198
+ none: false
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ hash: 23
203
+ segments:
204
+ - 2
205
+ - 6
206
+ - 0
207
+ version: 2.6.0
208
+ version_requirements: *id013
209
+ name: rspec
210
+ prerelease: false
123
211
  description: gem to aid setup of Capybara for testing bbc sites
124
212
  email: mcrobbins@gmail.com
125
213
  executables: []
@@ -131,6 +219,7 @@ extra_rdoc_files:
131
219
  - README.rdoc
132
220
  files:
133
221
  - .document
222
+ - .rspec
134
223
  - Gemfile
135
224
  - Gemfile.lock
136
225
  - LICENSE.txt
@@ -153,8 +242,9 @@ files:
153
242
  - schemas/xhtml-symbol.ent
154
243
  - schemas/xhtml1-strict.dtd
155
244
  - schemas/xhtml1-transitional.dtd
156
- - test/helper.rb
157
- - test/test_frameworks-capybara.rb
245
+ - spec/frameworks_capybara_spec.rb
246
+ - spec/frameworks_cucumber_spec.rb
247
+ - spec/spec_helper.rb
158
248
  has_rdoc: true
159
249
  homepage: http://github.com/mcrmfc/frameworks-capybara
160
250
  licenses:
@@ -190,5 +280,6 @@ signing_key:
190
280
  specification_version: 3
191
281
  summary: gem to aid setup of Capybara for testing bbc sites
192
282
  test_files:
193
- - test/helper.rb
194
- - test/test_frameworks-capybara.rb
283
+ - spec/frameworks_capybara_spec.rb
284
+ - spec/frameworks_cucumber_spec.rb
285
+ - spec/spec_helper.rb
data/test/helper.rb DELETED
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'frameworks-capybara'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestFrameworksCapybara < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end