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.
- checksums.yaml +4 -4
- data/.rubocop.yml +12 -6
- data/CHANGES.md +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +11 -87
- data/Rakefile +8 -6
- data/lib/sauce_bindings/capybara_session.rb +0 -3
- data/lib/sauce_bindings/errors.rb +7 -0
- data/lib/sauce_bindings/logger.rb +20 -0
- data/lib/sauce_bindings/options.rb +22 -4
- data/lib/sauce_bindings/session.rb +92 -18
- data/lib/sauce_bindings/version.rb +1 -1
- data/lib/sauce_bindings.rb +8 -0
- data/sauce_bindings.gemspec +6 -6
- data/spec/integration/desktop_spec.rb +25 -5
- data/spec/spec_helper.rb +39 -1
- data/spec/unit/capybara_session_spec.rb +10 -20
- data/spec/unit/deprecated_options_spec.rb +479 -456
- data/spec/unit/options_spec.rb +120 -153
- data/spec/unit/session_spec.rb +437 -84
- metadata +30 -28
@@ -14,36 +14,23 @@ module SauceBindings
|
|
14
14
|
{browserName: 'chrome',
|
15
15
|
browserVersion: 'latest',
|
16
16
|
platformName: 'Windows 10',
|
17
|
-
'sauce:options': {
|
17
|
+
'sauce:options': {username: 'foo',
|
18
|
+
accessKey: '123',
|
19
|
+
build: 'TEMP BUILD: 11'}}
|
18
20
|
end
|
19
21
|
|
20
22
|
def expect_request
|
21
|
-
|
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
|
-
|
56
|
-
|
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
|