sauce_bindings 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,36 +14,23 @@ module SauceBindings
14
14
  {browserName: 'chrome',
15
15
  browserVersion: 'latest',
16
16
  platformName: 'Windows 10',
17
- 'sauce:options': {build: 'TEMP BUILD: 11'}}
17
+ 'sauce:options': {username: 'foo',
18
+ accessKey: '123',
19
+ build: 'TEMP BUILD: 11'}}
18
20
  end
19
21
 
20
22
  def expect_request
21
- se3 = {desiredCapabilities: default_capabilities,
22
- capabilities: {firstMatch: [default_capabilities]}}.to_json
23
- se4 = {capabilities: {alwaysMatch: default_capabilities}}.to_json
24
-
25
- body = Selenium::WebDriver::VERSION[0] == '3' ? se3 : se4
23
+ body = {capabilities: {alwaysMatch: default_capabilities}}.to_json
26
24
 
27
25
  endpoint = 'https://ondemand.us-west-1.saucelabs.com/wd/hub/session'
28
26
  stub_request(:post, endpoint).with(body: body).to_return(valid_response)
29
27
  end
30
28
 
31
- before do
32
- allow_any_instance_of(Net::HTTP).to receive(:proxy_uri)
33
- allow_any_instance_of(Selenium::WebDriver::Remote::Http::Default).to receive(:use_proxy?).and_return(false)
34
- allow(ENV).to receive(:[]).with('DISABLE_CAPYBARA_SELENIUM_OPTIMIZATIONS')
35
- allow(ENV).to receive(:[]).with('BUILD_TAG').and_return('')
36
- allow(ENV).to receive(:[]).with('BUILD_NAME').and_return('TEMP BUILD')
37
- allow(ENV).to receive(:[]).with('BUILD_NUMBER').and_return('11')
38
- allow(ENV).to receive(:[]).with('SAUCE_USERNAME').and_return('foo')
39
- allow(ENV).to receive(:[]).with('SAUCE_ACCESS_KEY').and_return('123')
40
- end
41
-
42
29
  describe '#new' do
43
30
  it 'registers a Capybara Driver' do
44
31
  CapybaraSession.new
45
32
 
46
- expect(Capybara.drivers).to include(:sauce)
33
+ expect(Capybara.drivers.names).to include(:sauce)
47
34
  expect(Capybara.current_driver).to eq :sauce
48
35
  end
49
36
  end
@@ -52,8 +39,11 @@ module SauceBindings
52
39
  it 'starts the session with Capybara driver' do
53
40
  expect_request
54
41
 
55
- driver = CapybaraSession.new.start
56
- expect(driver).to eq Capybara.current_session.driver.browser
42
+ ClimateControl.modify(**SAUCE_ACCESS, **BUILD_ENV) do
43
+ @driver = CapybaraSession.new.start
44
+ end
45
+
46
+ expect(@driver).to eq Capybara.current_session.driver.browser
57
47
 
58
48
  Capybara.current_session.driver.instance_variable_set('@browser', nil)
59
49
  end