RSpec.configure do |config|
config.before(:all) do
###############################################################################################################################################
####Running in Multiple browsers
###############################################################################################################################################
def firefox()
puts "begin firefox"
path = File.dirname(__FILE__) + "/driver/geckodriver"
begin
@driver = Selenium::WebDriver.for :firefox
puts "Starting tests, initializing " + @driver.inspect()
rescue Exception=>e
puts "Start Exception"
puts e.message
puts e.backtrace.inspect
raise e
end
@base_url = @test_env['url']
@driver.manage.window.maximize
@accept_next_alert = true
@driver.manage.timeouts.implicit_wait = DEFAULT_WAIT_TIME
end
def chrome
puts "begin chrome"
path = File.dirname(__FILE__) + "/../driver/chromedriver"
prefs = {:download => {:prompt_for_download => false, :default_directory => "#{ENV['PATH']}", :url => @base_url} }
@driver = Selenium::WebDriver.for :chrome, :prefs => prefs
@base_url = @test_env['url']
@accept_next_alert = true
end
begin
puts "begin firefox"
firefox
rescue Exception=>e
# Exception already displayed, exiting
puts "Exception Found: #{e}"
raise e
@driver.quit
end
config.after(:all) do
puts "Finishing tests, killing " + @driver.inspect()
@driver.quit
end