frameworks-capybara 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +20 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/lib/frameworks-capybara.rb +84 -0
- data/test/helper.rb +18 -0
- data/test/test_frameworks-capybara.rb +7 -0
- metadata +151 -0
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "shoulda", ">= 0"
|
10
|
+
gem "bundler", "~> 1.0.0"
|
11
|
+
gem "jeweler", "~> 1.5.2"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.5.2)
|
6
|
+
bundler (~> 1.0.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.8.7)
|
10
|
+
rcov (0.9.9)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
bundler (~> 1.0.0)
|
18
|
+
jeweler (~> 1.5.2)
|
19
|
+
rcov
|
20
|
+
shoulda
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 mcrmfc
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= frameworks-capybara
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to frameworks-capybara
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 mcrmfc. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
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 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "frameworks-capybara"
|
16
|
+
gem.homepage = "http://github.com/mcrmfc/frameworks-capybara"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{gem to aid setup of Capybara for testing bbc sites}
|
19
|
+
gem.description = %Q{gem ti aid setup of Capybara for testing bbc sites}
|
20
|
+
gem.email = "mcrobbins@gmail.com"
|
21
|
+
gem.authors = ["mcrmfc"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
gem.add_runtime_dependency 'capybara', '>=0'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rake/rdoctask'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "frameworks-capybara #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'selenium-webdriver'
|
2
|
+
|
3
|
+
class CapybaraSetup
|
4
|
+
|
5
|
+
attr_accessor :driver
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
#validate environment variables set using cucumber.yml or passed via command line
|
9
|
+
validate_env_vars
|
10
|
+
|
11
|
+
#Disable rack server
|
12
|
+
Capybara.run_server = false
|
13
|
+
|
14
|
+
case ENV['BROWSER']
|
15
|
+
when 'headless' then
|
16
|
+
@driver = register_celerity_driver(false,ENV['PROXY_URL'])
|
17
|
+
when 'remote' then
|
18
|
+
@driver = register_remote_driver(ENV['PROXY_URL'], ENV['PLATFORM'],ENV['BROWSER_VM'],ENV['REMOTE_URL'], ENV['FIREFOX_PROFILE'])
|
19
|
+
else
|
20
|
+
@driver = register_selenium_driver
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def validate_env_vars
|
27
|
+
#v basic check for correct env variables
|
28
|
+
env_vars = [ENV['ENVIRONMENT'],ENV['BROWSER']]
|
29
|
+
|
30
|
+
env_vars.each { |var|
|
31
|
+
if(var==nil)
|
32
|
+
abort 'Please ensure following environment variables are set ENVIRONMENT [int|test|stage|live], BROWSER[headless|ie|chrome|firefox] and PROXY_URL'
|
33
|
+
end
|
34
|
+
}
|
35
|
+
|
36
|
+
#if running remote test check for correct env variables
|
37
|
+
if(ENV['BROWSER']=='remote')
|
38
|
+
env_vars_remote = [ENV['PLATFORM'],ENV['REMOTE_URL'], ENV['BROWSER_VM']]
|
39
|
+
env_vars_remote.each{ |var|
|
40
|
+
if(var==nil)
|
41
|
+
abort 'Please ensure the following environment variables are set PLATFORM, REMOTE_URL, BROWSER_VM (browser to use on remote machine) and PROXY_URL (if required)'
|
42
|
+
end
|
43
|
+
}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def register_remote_driver(proxy, platform, browser, remote_url, profile)
|
48
|
+
Capybara.register_driver :remote do |app|
|
49
|
+
#create remote driver client instance
|
50
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
51
|
+
|
52
|
+
#set proxy on client connection if required
|
53
|
+
if(proxy)
|
54
|
+
client.proxy = Selenium::WebDriver::Proxy.new(:http => proxy)
|
55
|
+
end
|
56
|
+
|
57
|
+
caps = Selenium::WebDriver::Remote::Capabilities.new({:platform => platform, :browser_name => browser, :proxy => Selenium::WebDriver::Proxy.new(:http => proxy)})
|
58
|
+
|
59
|
+
Capybara::Driver::Selenium.new(app,
|
60
|
+
:browser => :remote,
|
61
|
+
:http_client => client,
|
62
|
+
:url => remote_url,
|
63
|
+
:desired_capabilities => caps)
|
64
|
+
end
|
65
|
+
:remote
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def register_celerity_driver (js_enabled, proxy)
|
70
|
+
Capybara.register_driver :celerity do |app|
|
71
|
+
Capybara::Driver::Celerity.new(app, {:javascript_enabled=>js_enabled,:proxy=>proxy})
|
72
|
+
end
|
73
|
+
:celerity
|
74
|
+
end
|
75
|
+
|
76
|
+
def register_selenium_driver
|
77
|
+
Capybara.register_driver :selenium do |app|
|
78
|
+
#need to convert string to label to set browser for Selenium - hence .intern
|
79
|
+
Capybara::Driver::Selenium.new(app,:browser => ENV['BROWSER'].intern)
|
80
|
+
end
|
81
|
+
:selenium
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: frameworks-capybara
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 0.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- mcrmfc
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-08 00:00:00 +00:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
type: :development
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
requirement: *id001
|
33
|
+
prerelease: false
|
34
|
+
name: shoulda
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
type: :development
|
37
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ~>
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
hash: 23
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
version: 1.0.0
|
48
|
+
requirement: *id002
|
49
|
+
prerelease: false
|
50
|
+
name: bundler
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
type: :development
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 7
|
59
|
+
segments:
|
60
|
+
- 1
|
61
|
+
- 5
|
62
|
+
- 2
|
63
|
+
version: 1.5.2
|
64
|
+
requirement: *id003
|
65
|
+
prerelease: false
|
66
|
+
name: jeweler
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
type: :development
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
requirement: *id004
|
79
|
+
prerelease: false
|
80
|
+
name: rcov
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
type: :runtime
|
83
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
requirement: *id005
|
93
|
+
prerelease: false
|
94
|
+
name: capybara
|
95
|
+
description: gem ti aid setup of Capybara for testing bbc sites
|
96
|
+
email: mcrobbins@gmail.com
|
97
|
+
executables: []
|
98
|
+
|
99
|
+
extensions: []
|
100
|
+
|
101
|
+
extra_rdoc_files:
|
102
|
+
- LICENSE.txt
|
103
|
+
- README.rdoc
|
104
|
+
files:
|
105
|
+
- .document
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.rdoc
|
110
|
+
- Rakefile
|
111
|
+
- VERSION
|
112
|
+
- lib/frameworks-capybara.rb
|
113
|
+
- test/helper.rb
|
114
|
+
- test/test_frameworks-capybara.rb
|
115
|
+
has_rdoc: true
|
116
|
+
homepage: http://github.com/mcrmfc/frameworks-capybara
|
117
|
+
licenses:
|
118
|
+
- MIT
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
hash: 3
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
requirements: []
|
143
|
+
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.4.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 3
|
148
|
+
summary: gem to aid setup of Capybara for testing bbc sites
|
149
|
+
test_files:
|
150
|
+
- test/helper.rb
|
151
|
+
- test/test_frameworks-capybara.rb
|