sauce 3.3.2 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTRjZmYwYjIzOWJlNThiNWRhOTQ2ZjE1NmFkMjNhYmI5ZGQxZmE1OQ==
4
+ OWIzMDNhNjYzZGQ5ZmMyMDY0YmEzYzY4NTE1NjRlYWQxMDk0NGVlMw==
5
5
  data.tar.gz: !binary |-
6
- MjI5MjliMzM0OTI1YjU0ZWY0OGFmYzZlYzBmMTIzZDkwZDE5NTc5ZQ==
6
+ ZWVjMDM0NjE2MTQzYmRmMzFmOGNhY2U0MDJmMzI2MmFlNzI3YmRjMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzJiM2ExNTAyZGE2YzJmYjIwMzkwYWQxYTdhODljYzE4NDcyOTRlZWRmZGE3
10
- ODM4MTJjYTUxMGMyY2RkZjZmYzJkMGZkMjc2ZTU1ODA5NDkyZjY5OWM2MGMz
11
- YTJiZmIyNmI5OWI2MWFkNDkyMTZjODVkZTJlMzMzM2U1ZTBmNGU=
9
+ YWM4NTFiZDg1MzQ2OTQ1M2E4MzQyNjYzYzlhZjJiZjNmNzQxNTYxNDdhNzRl
10
+ N2U5MDdiZDY5Mjg5MjQ0ODM0MWQ3MmYyMjk0MDRhNWMyM2U1ZjEyNDY1NzBi
11
+ N2U2M2E4Y2FjYjA0YjIwMTRjZjA3NmEwMzljMDQ3MzAwNzA2ODE=
12
12
  data.tar.gz: !binary |-
13
- NDRjMWQwOThkYjliZWRkZGJiODFiNzhlNTljODgzNzJmYzczY2ZiODMzYzFm
14
- MWFlNjJkMmRhMWQ5YzRkODA1MmI5Y2VlM2QxMWRiYzMzYjEwZTQ4MGY1MTVi
15
- MTFkNGU1NjJhOTMyMjcwMmEwOTk2Mjg2YmViNWY4NTZkNTUwZDc=
13
+ NjhlNmRlNDk5Y2IzMzdhZGJhZTAwYjc3NDU2ZTU1NzEzMmYwN2IwMTlkOGU1
14
+ MTg0NGVhY2NkYzZjNjEzOWVjZDM1MjUyOWVlNGI5MGRlYjhhMTI0YzY4OGE3
15
+ MDM4OWZjYWZmMWM1ZmQxODczZDIwYzI2OWE2OTVjZGI0OTlhNjQ=
@@ -129,13 +129,15 @@ module Sauce
129
129
  require "rspec/core"
130
130
  ::RSpec.configure do |config|
131
131
  config.before :suite do
132
- ::Capybara.configure do |config|
132
+ ::Capybara.configure do |capy_config|
133
133
  sauce_config = Sauce::Config.new
134
- if sauce_config[:start_local_application]
135
- host = sauce_config[:application_host] || "127.0.0.1"
136
- port = sauce_config[:application_port]
137
- config.app_host = "http://#{host}:#{port}"
138
- config.run_server = false
134
+ if capy_config.app_host.nil?
135
+ if sauce_config[:start_local_application]
136
+ host = sauce_config[:application_host] || "127.0.0.1"
137
+ port = sauce_config[:application_port]
138
+ capy_config.app_host = "http://#{host}:#{port}"
139
+ capy_config.run_server = false
140
+ end
139
141
  end
140
142
  end
141
143
  end
@@ -167,4 +169,4 @@ module Sauce
167
169
  Sauce::Capybara.configure_capybara_for_rspec
168
170
  end
169
171
  end
170
- end
172
+ end
@@ -28,7 +28,11 @@ module Sauce
28
28
  browsers[file] << test_groups[file].next_platform
29
29
  end
30
30
 
31
- return {:SAUCE_PERFILE_BROWSERS => "'" + JSON.generate(browsers) + "'"}
31
+ on_windows = RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
32
+ format_string = on_windows ? "%s" : "'%s'"
33
+ perfile_browsers = format_string % [JSON.generate(browsers)]
34
+
35
+ return {:SAUCE_PERFILE_BROWSERS => perfile_browsers}
32
36
  end
33
37
  end
34
38
 
@@ -62,20 +62,101 @@ rescue LoadError
62
62
  # User doesn't have RSpec 1.x installed
63
63
  rescue => e
64
64
  STDERR.puts "Exception occured: #{e.to_s}"
65
+ exit 1
65
66
  end
66
67
 
67
68
  begin
68
69
  require 'rspec/core'
69
70
  module Sauce
70
71
  module RSpec
72
+ @@server = nil
73
+
74
+ def self.server
75
+ return @@server
76
+ end
77
+
78
+ def self.server=(s)
79
+ @@server = s
80
+ end
81
+
82
+ def self.setup_environment
83
+ ::RSpec.configuration.before(:all, :sauce => true) do
84
+ Sauce::RSpec.start_tools_for_sauce_tag
85
+ end
86
+
87
+ ::RSpec.configuration.before :all do
88
+ Sauce::RSpec.start_tools_for_selenium_directory
89
+ end
90
+ ::RSpec.configuration.after :suite do
91
+ Sauce::RSpec.stop_tools
92
+ end
93
+ end
94
+
95
+ def self.start_tools_for_sauce_tag
96
+ config = Sauce::Config.new
97
+ if config[:start_tunnel]
98
+ Sauce::Utilities::Connect.start_from_config(config)
99
+ end
100
+
101
+ unless self.server
102
+ self.server= Sauce::Utilities::RailsServer.start_if_required(config)
103
+ end
104
+ end
105
+
106
+ def self.start_tools_for_selenium_directory
107
+ config = Sauce::Config.new
108
+ # TODO: Check which rspec version this changed in -- If < 2, change.
109
+ files_to_run = ::RSpec.configuration.respond_to?(:files_to_run) ? ::RSpec.configuration.files_to_run :
110
+ ::RSpec.configuration.settings[:files_to_run]
111
+
112
+ running_selenium_specs = files_to_run.any? {|file| file =~ /spec\/selenium\//}
113
+ need_tunnel = running_selenium_specs && config[:application_host]
114
+
115
+ if need_tunnel && config[:start_tunnel]
116
+ Sauce::Utilities::Connect.start_from_config(config)
117
+ end
118
+
119
+ if running_selenium_specs
120
+ unless self.server
121
+ self.server= Sauce::Utilities::RailsServer.start_if_required(config)
122
+ end
123
+ end
124
+ end
125
+
126
+ def self.stop_tools
127
+ Sauce::Utilities::Connect.close
128
+ server.stop if self.server
129
+ Sauce::Utilities.warn_if_suspect_misconfiguration
130
+ end
131
+
71
132
  module SeleniumExampleGroup
72
133
  attr_reader :selenium
73
134
  alias_method :s, :selenium
74
135
 
136
+ def self.rspec_current_example
137
+ lambda { |context| ::RSpec.current_example }
138
+ end
139
+
140
+ def self.context_example
141
+ lambda { |context| context.example }
142
+ end
143
+
144
+ def self.find_example_method
145
+ ::RSpec.respond_to?(:current_example) ? rspec_current_example : context_example
146
+ end
147
+
148
+ def self.current_example
149
+ @@current_example_fetcher ||= find_example_method
150
+ end
151
+
75
152
  # TODO V4 -- Remove this entirely
76
153
  def page
77
- warn Sauce::Utilities.page_deprecation_message
78
- @selenium
154
+ if self.class.included_modules.any? {|m| m.name == 'Capybara::DSL'}
155
+ ::Capybara.current_session
156
+ else
157
+ warn Sauce::Utilities.page_deprecation_message
158
+ @selenium
159
+ end
79
160
  end
80
161
 
81
162
  def self.included(othermod)
@@ -89,6 +170,7 @@ begin
89
170
  :browser_version => version,
90
171
  :job_name => description})
91
172
  Sauce.driver_pool[Thread.current.object_id] = @selenium
173
+ example = SeleniumExampleGroup.current_example.call(self)
92
174
  example.metadata[:sauce_public_link] = SauceWhisk.public_link(@selenium.session_id)
93
175
 
94
176
  begin
@@ -107,40 +189,7 @@ begin
107
189
  })
108
190
  ::RSpec.configuration.include(self, :sauce => true)
109
191
 
110
- ::RSpec.configuration.before(:suite, :sauce => true) do
111
- config = Sauce::Config.new
112
- if config[:application_host]
113
- Sauce::Utilities::Connect.start_from_config(config)
114
- end
115
-
116
- @@server = Sauce::Utilities::RailsServer.start_if_required(config)
117
- end
118
-
119
- ::RSpec.configuration.before :suite do
120
- config = Sauce::Config.new
121
- # TODO: Check which rspec version this changed in -- If < 2, change.
122
- files_to_run = ::RSpec.configuration.respond_to?(:files_to_run) ? ::RSpec.configuration.files_to_run :
123
- ::RSpec.configuration.settings[:files_to_run]
124
-
125
- running_selenium_specs = files_to_run.any? {|file| file =~ /spec\/selenium\//}
126
- need_tunnel = running_selenium_specs && config[:application_host]
127
-
128
- if need_tunnel || config[:start_tunnel]
129
- Sauce::Utilities::Connect.start_from_config(config)
130
- end
131
-
132
- if running_selenium_specs
133
- @@server = Sauce::Utilities::RailsServer.start_if_required(config)
134
- end
135
- end
136
-
137
- ::RSpec.configuration.after :suite do
138
- Sauce::Utilities::Connect.close
139
- if (defined? @@server) && @@server
140
- @@server.stop
141
- end
142
- Sauce::Utilities.warn_if_suspect_misconfiguration
143
- end
192
+ Sauce::RSpec.setup_environment
144
193
  end
145
194
  end
146
195
  end
@@ -148,6 +197,7 @@ rescue LoadError, TypeError
148
197
  # User doesn't have RSpec 2.x installed
149
198
  rescue => e
150
199
  STDERR.puts "Exception caught: #{e.to_s}"
200
+ exit 1
151
201
  end
152
202
 
153
203
  begin
@@ -1,6 +1,6 @@
1
1
  module Sauce
2
- MAJOR_VERSION = '3.3'
3
- PATCH_VERSION = '2'
2
+ MAJOR_VERSION = '3.4'
3
+ PATCH_VERSION = '0'
4
4
 
5
5
  def version
6
6
  "#{MAJOR_VERSION}.#{PATCH_VERSION}"
@@ -0,0 +1,18 @@
1
+ require "spec_helper"
2
+
3
+ describe "Capybara Examples where Capybara is included last", :type => :feature, :sauce => true do
4
+ context "When calling the #page method" do
5
+ it "should get access to a Capybara Session object" do
6
+ page.should be_a_kind_of Capybara::Session
7
+ end
8
+
9
+ it "should not output a deprecation message" do
10
+ self.should_not_receive(:warn).with(page_deprecation_warning)
11
+ end
12
+ end
13
+
14
+ it "should not create a new driver" do
15
+ ::Sauce::Selenium2.should_not_receive(:new)
16
+ visit "http://wwww.google.com"
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+
3
+ describe "Capybara examples", :js => true, :sauce => true, :type => :feature do
4
+ it "should not create a new driver" do
5
+ ::Sauce::Selenium2.should_not_receive(:new)
6
+ visit "http://wwww.google.com"
7
+ end
8
+
9
+ it "should get access to a Capybara Session object" do
10
+ page.should be_a_kind_of Capybara::Session
11
+ visit "http://www.google.com"
12
+ end
13
+
14
+ it "should have the same driver as stock webdriver" do
15
+ Capybara.current_session.driver.browser.should eq @selenium
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+
3
+ describe "Sauce::Config", :sauce => true do
4
+ it "should have rspec in its tool set", :sauce => true do
5
+ capabilities = Sauce.get_config.to_desired_capabilities
6
+ capabilities[:client_version].should include "Rspec"
7
+ end
8
+
9
+ it "should have Capybara in its tool set", :sauce => true do
10
+ capabilities = Sauce.get_config.to_desired_capabilities
11
+ capabilities[:client_version].should include "Capybara"
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "spec_helper"
2
+
3
+ describe "Capybarad Examples where Sauce is included second", :js => true do
4
+ include Capybara::DSL
5
+ include Sauce::RSpec::SeleniumExampleGroup
6
+
7
+ context "When calling the #page method" do
8
+ it "should get access to a Capybara Session object" do
9
+ page.should be_a_kind_of Capybara::Session
10
+ end
11
+
12
+ it "should not output a deprecation message" do
13
+ self.should_not_receive(:warn).with(page_deprecation_warning)
14
+ end
15
+ end
16
+
17
+ it "should not create a new driver" do
18
+ ::Sauce::Selenium2.should_not_receive(:new)
19
+ visit "http://wwww.google.com"
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+
3
+ describe "The Selenium Directory with Capybara", :js => true do
4
+ it "should have the same driver as stock webdriver", :js => true do
5
+ Capybara.current_session.driver.browser.should eq @selenium
6
+ end
7
+
8
+ it "should not create a new driver" do
9
+ ::Sauce::Selenium2.should_not_receive(:new)
10
+ visit "http://wwww.google.com"
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ require "simplecov"
2
+
3
+ SimpleCov.start do
4
+ SimpleCov.root "#{Dir.pwd}/../../../"
5
+ command_name 'RSpec Integration'
6
+ use_merging true
7
+ merge_timeout 6000
8
+ end
9
+
10
+ require "rspec"
11
+ require "capybara/rspec"
12
+ require "sauce"
13
+ require "sauce/capybara"
14
+
15
+ class MyRackApp
16
+ def self.call(env)
17
+ [200, {}, ["Hello"]]
18
+ end
19
+ end
20
+
21
+ Capybara.app = MyRackApp
22
+
23
+ Sauce.config do |c|
24
+ c[:browsers] = [
25
+ ["Windows 2008", "iexplore", "9"]
26
+ ]
27
+
28
+ c[:application_host] = "localhost"
29
+ end
30
+
31
+ def page_deprecation_warning
32
+ return <<-MESSAGE
33
+ [DEPRECATED] Using the #page method is deprecated for RSpec tests without Capybara. Please use the #s or #selenium method instead.
34
+ If you are using Capybara and are seeing this message, check the Capybara README for information on how to include the Capybara DSL in your tests.
35
+ MESSAGE
36
+ end
@@ -8,7 +8,6 @@ SimpleCov.start do
8
8
  end
9
9
 
10
10
  require "rspec"
11
- require "capybara/rspec"
12
11
  require "sauce"
13
12
 
14
13
  def page_deprecation_warning
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauce
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Lacey
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2014-02-20 00:00:00.000000000 Z
17
+ date: 2014-03-16 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rspec
@@ -280,9 +280,14 @@ files:
280
280
  - spec/integration/connect/spec/start_tunnel_spec.rb
281
281
  - spec/integration/connect/spec/with_capybara_spec.rb
282
282
  - spec/integration/connect_integration_spec.rb
283
+ - spec/integration/rspec-capybara/spec/capybara_required_last_spec.rb
284
+ - spec/integration/rspec-capybara/spec/integration_spec.rb
285
+ - spec/integration/rspec-capybara/spec/sauce_config_spec.rb
286
+ - spec/integration/rspec-capybara/spec/sauce_required_last_spec.rb
287
+ - spec/integration/rspec-capybara/spec/selenium/selenium_with_capybara.rb
288
+ - spec/integration/rspec-capybara/spec/spec_helper.rb
283
289
  - spec/integration/rspec/spec/integration_spec.rb
284
290
  - spec/integration/rspec/spec/selenium/selenium_directory_spec.rb
285
- - spec/integration/rspec/spec/selenium/selenium_with_capybara_spec.rb
286
291
  - spec/integration/rspec/spec/spec_helper.rb
287
292
  - spec/integration/rspec/spec/tagging/selenium_tagging_spec.rb
288
293
  - spec/integration/testunit/test/capybara_integration_test.rb
@@ -341,9 +346,14 @@ test_files:
341
346
  - spec/integration/connect_integration_spec.rb
342
347
  - spec/integration/rspec/spec/integration_spec.rb
343
348
  - spec/integration/rspec/spec/selenium/selenium_directory_spec.rb
344
- - spec/integration/rspec/spec/selenium/selenium_with_capybara_spec.rb
345
349
  - spec/integration/rspec/spec/spec_helper.rb
346
350
  - spec/integration/rspec/spec/tagging/selenium_tagging_spec.rb
351
+ - spec/integration/rspec-capybara/spec/capybara_required_last_spec.rb
352
+ - spec/integration/rspec-capybara/spec/integration_spec.rb
353
+ - spec/integration/rspec-capybara/spec/sauce_config_spec.rb
354
+ - spec/integration/rspec-capybara/spec/sauce_required_last_spec.rb
355
+ - spec/integration/rspec-capybara/spec/selenium/selenium_with_capybara.rb
356
+ - spec/integration/rspec-capybara/spec/spec_helper.rb
347
357
  - spec/integration/testunit/test/capybara_integration_test.rb
348
358
  - spec/integration/testunit/test/integration_test.rb
349
359
  - spec/integration/testunit/test/test_helper.rb
@@ -1,36 +0,0 @@
1
- require "rspec"
2
- require "rspec/mocks"
3
- require "spec_helper"
4
- require "sauce/capybara"
5
-
6
- class MyRackApp
7
- def self.call(env)
8
- [200, {}, ["Hello"]]
9
- end
10
- end
11
-
12
- Sauce.config do |c|
13
- c.browsers = [
14
- ["Windows 2008", "iexplore", "9"],
15
- ["Linux", "opera", 12]
16
- ]
17
- end
18
-
19
- Capybara.app = MyRackApp
20
-
21
- describe "The Selenium Directory with Capybara", :js => true do
22
-
23
- include Capybara::DSL
24
- it "should get run on every defined browser", :js => true do
25
- visit "http://www.google.com"
26
- end
27
-
28
- it "should have the same driver as stock webdriver", :js => true do
29
- Capybara.current_session.driver.browser.should eq @selenium
30
- end
31
-
32
- it "should not create a new driver" do
33
- ::Sauce::Selenium2.should_not_receive(:new)
34
- visit "http://wwww.google.com"
35
- end
36
- end