Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Merged pull request #12 from raelik/capture_network_traffic.
Browse files Browse the repository at this point in the history
Support for setting captureNetworkTraffic option on selenium.start_new_browser_session method
  • Loading branch information
epall committed Apr 29, 2011
2 parents af34522 + a6efdd5 commit fc8a369
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion lib/sauce/config.rb
Expand Up @@ -23,7 +23,8 @@ class Config
:browser => "firefox",
:browser_version => "3.6.",
:job_name => "Unnamed Ruby job",
:local_application_port => "3001"
:local_application_port => "3001",
:capture_traffic => false
}

ENVIRONMENT_VARIABLES = %w{SAUCE_HOST SAUCE_PORT SAUCE_BROWSER_URL SAUCE_USERNAME
Expand Down
14 changes: 7 additions & 7 deletions lib/sauce/integrations.rb
Expand Up @@ -21,7 +21,7 @@ def self.inherited(subclass)
end
if Sauce::Utilities::RailsServer.is_rails_app?
@@server = Sauce::Utilities::RailsServer.new
@@server.start
@@server.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
end
end
end
Expand Down Expand Up @@ -54,7 +54,7 @@ def execute(*args)
@selenium = Sauce::Selenium.new({:os => os, :browser => browser, :browser_version => version,
:job_name => "#{description}"})
end
@selenium.start
@selenium.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
super(*args)
@selenium.stop
end
Expand Down Expand Up @@ -95,7 +95,7 @@ def self.included(othermod)
@selenium = Sauce::Selenium.new({:os => os, :browser => browser, :browser_version => version,
:job_name => "#{description}"})
end
@selenium.start
@selenium.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
begin
the_test.run
ensure
Expand All @@ -122,7 +122,7 @@ def self.included(othermod)
if ::RSpec.configuration.settings[:files_to_run].any? {|file| file =~ /spec\/selenium\//} &&
Sauce::Utilities::RailsServer.is_rails_app?
@@server = Sauce::Utilities::RailsServer.new
@@server.start
@@server.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
end
end
::RSpec.configuration.after :suite do
Expand Down Expand Up @@ -162,7 +162,7 @@ def run(*args, &blk)
unless ENV['TEST_ENV_NUMBER'].to_i > 1
if Sauce::Utilities::RailsServer.is_rails_app?
@@server = Sauce::Utilities::RailsServer.new
@@server.start
@@server.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
at_exit do
@@server.stop
end
Expand Down Expand Up @@ -195,9 +195,9 @@ def run(*args, &blk)
@browser = Sauce::Selenium.new(options)
end
if self.class.selenium_flags
@browser.start_new_browser_session(self.class.selenium_flags)
@browser.start_new_browser_session(self.class.selenium_flags.merge(:captureNetworkTraffic => config.capture_traffic?))
else
@browser.start_new_browser_session
@browser.start_new_browser_session(:captureNetworkTraffic => config.capture_traffic?)
end
super(*args, &blk)
@browser.stop
Expand Down

0 comments on commit fc8a369

Please sign in to comment.