Added basic browser profiles to make sure english is used as the browser locale.

This commit is contained in:
Thorsten Eckel 2015-07-16 15:14:06 +02:00
parent 24a4965bf1
commit 82190dba82

View file

@ -9,6 +9,22 @@ class TestCase < Test::Unit::TestCase
ENV['BROWSER'] || 'firefox'
end
def profile
browser_profile = nil
if browser == 'firefox'
browser_profile = Selenium::WebDriver::Firefox::Profile.new
browser_profile['intl.locale.matchOS'] = false
browser_profile['intl.accept_languages'] = 'en-US'
browser_profile['general.useragent.locale'] = 'en-US'
elsif browser == 'chrome'
browser_profile = Selenium::WebDriver::Chrome::Profile.new
browser_profile["intl.accept_languages"] = "en"
end
browser_profile
end
def browser_support_cookies
if browser =~ /(internet_explorer|ie)/i
return false
@ -25,7 +41,7 @@ class TestCase < Test::Unit::TestCase
@browsers = {}
end
if !ENV['REMOTE_URL'] || ENV['REMOTE_URL'].empty?
local_browser = Selenium::WebDriver.for( browser.to_sym )
local_browser = Selenium::WebDriver.for( browser.to_sym, profile: profile )
browser_instance_preferences(local_browser)
@browsers[local_browser.hash] = local_browser
return local_browser