|
1 | 1 | require 'rspec/core/shared_context'
|
2 |
| -require File.join(Dir.getwd, 'config', 'phone_home') |
| 2 | +require File.join(Dir.getwd, 'config', 'requires') |
3 | 3 |
|
4 | 4 | module ChemistryKit
|
5 | 5 | module SharedContext
|
6 | 6 | extend RSpec::Core::SharedContext
|
7 | 7 |
|
8 | 8 | before(:each) do
|
9 |
| -# if CHEMISTRY_CONFIG['webdriver']['local_server'] |
10 |
| -# capabilities = Selenium::WebDriver.for(CHEMISTRY_CONFIG['webdriver']['browser'].to_sym) |
11 |
| -# else |
| 9 | + if CHEMISTRY_CONFIG['chemistrykit']['run_locally'] |
| 10 | + @driver = Selenium::WebDriver.for(CHEMISTRY_CONFIG['webdriver']['browser'].to_sym) |
| 11 | + else |
12 | 12 | capabilities = Selenium::WebDriver::Remote::Capabilities.send(CHEMISTRY_CONFIG['webdriver']['browser'])
|
13 |
| -# end |
14 |
| -# |
15 |
| -# if CHEMISTRY_CONFIG['saucelabs']['ondemand'] |
16 |
| -# MAGIC_KEYS = [ |
17 |
| -# :caller, |
18 |
| -# :description, |
19 |
| -# :description_args, |
20 |
| -# :example_group, |
21 |
| -# :example_group_block, |
22 |
| -# :execution_result, |
23 |
| -# :file_path, |
24 |
| -# :full_description, |
25 |
| -# :line_number, |
26 |
| -# :location |
27 |
| -# ] |
28 |
| -# executor = "http://#{SAUCE_CONFIG['username']}:#{SAUCE_CONFIG['key']}@ondemand.saucelabs.com:80/wd/hub" |
29 |
| -# if CHEMISTRY_CONFIG['webdriver']['browser'] != 'chrome' |
30 |
| -# capabilities[:version] = CHEMISTRY_CONFIG['saucelabs']['version'] |
31 |
| -# end |
32 |
| -# capabilities[:platform] = CHEMISTRY_CONFIG['saucelabs']['platform'] |
33 |
| -# else |
34 |
| - executor = 'http://' + CHEMISTRY_CONFIG['webdriver']['server_host'] + ":" + CHEMISTRY_CONFIG['webdriver']['server_port'].to_s + '/wd/hub' |
35 |
| -# end |
36 | 13 |
|
37 |
| -# @driver = ChemistryKit::PhoneHome::Driver.new(:url => executor, :desired_capabilities => capabilities) |
38 |
| - @driver = ChemistryKit::WebDriver::Driver.new(:url => executor, :desired_capabilities => capabilities) |
39 |
| - puts @driver.inspect |
40 |
| - puts @driver.object_id |
| 14 | + if CHEMISTRY_CONFIG['saucelabs']['ondemand'] |
| 15 | + MAGIC_KEYS = [ |
| 16 | + :caller, |
| 17 | + :description, |
| 18 | + :description_args, |
| 19 | + :example_group, |
| 20 | + :example_group_block, |
| 21 | + :execution_result, |
| 22 | + :file_path, |
| 23 | + :full_description, |
| 24 | + :line_number, |
| 25 | + :location |
| 26 | + ] |
| 27 | + executor = "http://#{SAUCE_CONFIG['username']}:#{SAUCE_CONFIG['key']}@ondemand.saucelabs.com:80/wd/hub" |
| 28 | + if CHEMISTRY_CONFIG['webdriver']['browser'] != 'chrome' |
| 29 | + capabilities[:version] = CHEMISTRY_CONFIG['saucelabs']['version'] |
| 30 | + end |
| 31 | + capabilities[:platform] = CHEMISTRY_CONFIG['saucelabs']['platform'] |
| 32 | + else |
| 33 | + executor = 'http://' + CHEMISTRY_CONFIG['webdriver']['server_host'] + ":" + CHEMISTRY_CONFIG['webdriver']['server_port'].to_s + '/wd/hub' |
| 34 | + end |
| 35 | + |
| 36 | + @driver = ChemistryKit::WebDriver::Driver.new(:url => executor, :desired_capabilities => capabilities) |
| 37 | + end |
41 | 38 | end
|
42 | 39 |
|
43 | 40 | after(:each) do
|
|
0 commit comments