frameworks-capybara 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +10 -1
- data/lib/frameworks/capybara.rb +21 -3
- data/lib/version.rb +1 -1
- data/spec/frameworks_capybara_spec.rb +58 -2
- metadata +4 -4
data/CHANGES
CHANGED
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -29,8 +29,8 @@ The following environment variables can be set to configure your tests:
|
|
29
29
|
BROWSER - this must be one of either 'ie', 'firefox', 'chrome', 'headless', 'remote'
|
30
30
|
HTTP_PROXY - url of proxy if required e.g. 'http://proxyhost:80', when running a headless browser this sets the proxy for the browser itself, when running a remote browser this sets the proxy for the client which will connect to the remote selenium server
|
31
31
|
PLATFORM - used when specifying remote test on a grid that provides a choice of platforms, this must be one of either 'WINDOWS' or 'LINUX'
|
32
|
+
PLATFORM_VERSION - used to specify the OS version of the specified platform e.g. '7', '8.1'
|
32
33
|
REMOTE_BROWSER - used when specifying remote test, must be one of either 'ie', 'firefox', 'chrome', 'headless', 'remote':w
|
33
|
-
|
34
34
|
REMOTE_BROWSER_VERSION - used when specifying remote test on a grid the provides a choice of browser versions for a given browser
|
35
35
|
REMOTE_URL - URL of remote Selenium-Webdriver server e.g. http://yourremotehost:4444/wd/hub
|
36
36
|
FIREFOX_PROFILE - specify a firefox profile to use when running in-browser tests (local or remote)
|
@@ -45,6 +45,15 @@ The following environment variables can be set to configure your tests:
|
|
45
45
|
TEAM_NAME - optional team name description which gets displayed in Cucumber html reports
|
46
46
|
BROWSER_CLI_ARGS - optional additional arguments to pass to local browser processes
|
47
47
|
|
48
|
+
The following environment variables are specific to running tests against a BrowserStack remote grid:
|
49
|
+
|
50
|
+
BS_BUILD - allows the user to specify a name for a logical group of tests e.g. 'Component A Tests'
|
51
|
+
BS_DEBUG - set to 'false' to disable screenshot generation ('true' by default)
|
52
|
+
BS_DEVICE - specify a mobile/tablet device e.g. 'iPhone 5C'
|
53
|
+
BS_DEVICE_ORIENTATION - specify to force the device orientation ('portrait' or 'landscape')
|
54
|
+
BS_PROJECT - allows the user to specify a name for a logical group of builds e.g. 'Project X'
|
55
|
+
BS_RESOLUTION - set the browser resolution e.g. '1024x768'
|
56
|
+
|
48
57
|
Here is a sample cucumber.yml:
|
49
58
|
|
50
59
|
<%intenv='ENVIRONMENT=int'%>
|
data/lib/frameworks/capybara.rb
CHANGED
@@ -24,16 +24,23 @@ class CapybaraSetup
|
|
24
24
|
:args => ENV['BROWSER_CLI_ARGS']
|
25
25
|
}
|
26
26
|
|
27
|
-
selenium_remote_opts = {:
|
27
|
+
selenium_remote_opts = {:os => ENV['PLATFORM'],
|
28
|
+
:os_version => ENV['PLATFORM_VERSION'],
|
28
29
|
:browser_name => ENV['REMOTE_BROWSER'],
|
29
|
-
:
|
30
|
+
:browser_version => ENV['REMOTE_BROWSER_VERSION'],
|
30
31
|
:url => ENV['REMOTE_URL']
|
31
32
|
}
|
32
33
|
|
33
34
|
custom_opts = {:job_name => ENV['SAUCE_JOB_NAME'],
|
34
35
|
:max_duration => ENV['SAUCE_MAX_DURATION'],
|
35
36
|
:firefox_cert_path => ENV['FIREFOX_CERT_PATH'],
|
36
|
-
:firefox_cert_prefix => ENV['FIREFOX_CERT_PREFIX']
|
37
|
+
:firefox_cert_prefix => ENV['FIREFOX_CERT_PREFIX'],
|
38
|
+
:browserstack_build => ENV['BS_BUILD'],
|
39
|
+
:browserstack_debug => ENV['BS_DEBUG'] || 'true', # BrowserStack debug mode on by default
|
40
|
+
:browserstack_device => ENV['BS_DEVICE'],
|
41
|
+
:browserstack_device_orientation => ENV['BS_DEVICE_ORIENTATION'],
|
42
|
+
:browserstack_project => ENV['BS_PROJECT'],
|
43
|
+
:browserstack_resolution => ENV['BS_RESOLUTION']
|
37
44
|
}
|
38
45
|
|
39
46
|
validate_env_vars(capybara_opts.merge(selenium_remote_opts)) #validate environment variables set using cucumber.yml or passed via command line
|
@@ -129,6 +136,8 @@ class CapybaraSetup
|
|
129
136
|
|
130
137
|
add_custom_caps(caps, custom_opts) if remote_opts[:url].include? 'saucelabs' #set sauce specific parameters - will this scupper other on sauce remote jobs?
|
131
138
|
|
139
|
+
add_browserstack_caps(caps, custom_opts) if remote_opts[:url].include? 'browserstack' #set browserstack specific parameters
|
140
|
+
|
132
141
|
opts[:desired_capabilities] = caps
|
133
142
|
opts[:http_client] = client
|
134
143
|
end
|
@@ -145,6 +154,15 @@ class CapybaraSetup
|
|
145
154
|
#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)})
|
146
155
|
end
|
147
156
|
|
157
|
+
def add_browserstack_caps(caps, custom_opts)
|
158
|
+
caps[:'build'] = custom_opts[:browserstack_build] if custom_opts[:browserstack_build]
|
159
|
+
caps[:'browserstack.debug'] = custom_opts[:browserstack_debug] if custom_opts[:browserstack_debug]
|
160
|
+
caps[:'device'] = custom_opts[:browserstack_device] if custom_opts[:browserstack_device]
|
161
|
+
caps[:'deviceOrientation'] = custom_opts[:browserstack_device_orientation] if custom_opts[:browserstack_device_orientation]
|
162
|
+
caps[:'project'] = custom_opts[:browserstack_project] if custom_opts[:browserstack_project]
|
163
|
+
caps[:'resolution'] = custom_opts[:browserstack_resolution] if custom_opts[:browserstack_resolution]
|
164
|
+
end
|
165
|
+
|
148
166
|
def set_client_proxy(opts)
|
149
167
|
Selenium::WebDriver::Proxy.new(:http => opts[:http_proxy]) if opts[:http_proxy] && opts[:webdriver_proxy_on] != 'false' #set proxy on client connection if required, note you may use ENV['HTTP_PROXY'] for setting in browser (ff profile) but not for client conection, hence allow for PROXY_ON=false
|
150
168
|
end
|
data/lib/version.rb
CHANGED
@@ -250,8 +250,8 @@ describe CapybaraSetup do
|
|
250
250
|
#Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@custom_capabilities)[:'job-name'].should == 'frameworks-unamed-job'
|
251
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
|
-
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:
|
254
|
-
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:
|
253
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_version].should == '4'
|
254
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:os].should == 'windows'
|
255
255
|
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].should be_a_kind_of Selenium::WebDriver::Firefox::Profile
|
256
256
|
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:firefox_profile].instance_variable_get(:@model).should include 'default'
|
257
257
|
end
|
@@ -367,7 +367,63 @@ describe CapybaraSetup do
|
|
367
367
|
it_behaves_like "Selenium Driver Options Array"
|
368
368
|
end
|
369
369
|
|
370
|
+
context "with Remote Selenium driver and most minimal Capabilites for BrowserStack" do
|
371
|
+
before do
|
372
|
+
ENV['BROWSER'] = 'remote'
|
373
|
+
ENV['REMOTE_BROWSER'] = 'ie'
|
374
|
+
ENV['REMOTE_URL'] = 'http://hub.browserstack.com'
|
375
|
+
end
|
376
|
+
|
377
|
+
it "should be initialized correctly" do
|
378
|
+
Capybara.delete_session
|
379
|
+
CapybaraSetup.new.driver.should == :selenium
|
380
|
+
Capybara.current_session.driver.should be_a_kind_of Capybara::Selenium::Driver
|
381
|
+
Capybara.current_session.driver.options[:browser].should == :remote
|
382
|
+
Capybara.current_session.driver.options[:url].should == ENV['REMOTE_URL']
|
383
|
+
Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
|
384
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:'browserstack.debug'].should == 'true'
|
385
|
+
end
|
386
|
+
it_behaves_like "Selenium Driver Options Array"
|
387
|
+
end
|
370
388
|
|
389
|
+
context "with Remote Selenium driver and specified Custom Capabilites for BrowserStack" do
|
390
|
+
before do
|
391
|
+
ENV['BROWSER'] = 'remote'
|
392
|
+
ENV['BS_BUILD'] = 'browserstack build 1'
|
393
|
+
ENV['BS_DEBUG'] = 'false'
|
394
|
+
ENV['BS_DEVICE'] = 'iPhone 5C'
|
395
|
+
ENV['BS_DEVICE_ORIENTATION'] = 'landscape'
|
396
|
+
ENV['BS_PROJECT'] = 'Test BrowserStack Project'
|
397
|
+
ENV['BS_RESOLUTION'] = '1024x768'
|
398
|
+
ENV['PLATFORM'] = 'MAC'
|
399
|
+
ENV['PLATFORM_VERSION'] = '7'
|
400
|
+
ENV['REMOTE_BROWSER'] = 'iPhone'
|
401
|
+
ENV['REMOTE_BROWSER_VERSION'] = '7.1.2'
|
402
|
+
ENV['REMOTE_URL'] = 'http://hub.browserstack.com'
|
403
|
+
end
|
404
|
+
|
405
|
+
it "should be initialized correctly" do
|
406
|
+
Capybara.delete_session
|
407
|
+
CapybaraSetup.new.driver.should == :selenium
|
408
|
+
Capybara.current_session.driver.should be_a_kind_of Capybara::Selenium::Driver
|
409
|
+
Capybara.current_session.driver.options[:browser].should == :remote
|
410
|
+
Capybara.current_session.driver.options[:url].should == ENV['REMOTE_URL']
|
411
|
+
Capybara.current_session.driver.options[:http_client].should be_a_kind_of Selenium::WebDriver::Remote::Http::Default
|
412
|
+
Capybara.current_session.driver.options[:http_client].instance_variable_get(:@proxy).should == nil
|
413
|
+
Capybara.current_session.driver.options[:desired_capabilities].should be_a_kind_of Selenium::WebDriver::Remote::Capabilities
|
414
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:build].should == ENV['BS_BUILD']
|
415
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:'browserstack.debug'].should == ENV['BS_DEBUG']
|
416
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:device].should == ENV['BS_DEVICE']
|
417
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:deviceOrientation].should == ENV['BS_DEVICE_ORIENTATION']
|
418
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:project].should == ENV['BS_PROJECT']
|
419
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:resolution].should == ENV['BS_RESOLUTION']
|
420
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:os].should == ENV['PLATFORM']
|
421
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:os_version].should == ENV['PLATFORM_VERSION']
|
422
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_name].should == :iPhone
|
423
|
+
Capybara.current_session.driver.options[:desired_capabilities].instance_variable_get(:@capabilities)[:browser_version].should == ENV['REMOTE_BROWSER_VERSION']
|
424
|
+
end
|
425
|
+
it_behaves_like "Selenium Driver Options Array"
|
426
|
+
end
|
371
427
|
end
|
372
428
|
|
373
429
|
describe "should allow Mechanize driver to be created" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frameworks-capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: selenium-webdriver
|
@@ -203,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
segments:
|
205
205
|
- 0
|
206
|
-
hash:
|
206
|
+
hash: 4601413897972678254
|
207
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
208
|
none: false
|
209
209
|
requirements:
|
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: '0'
|
213
213
|
segments:
|
214
214
|
- 0
|
215
|
-
hash:
|
215
|
+
hash: 4601413897972678254
|
216
216
|
requirements: []
|
217
217
|
rubyforge_project:
|
218
218
|
rubygems_version: 1.8.23.2
|