From 82190dba829c90f341f42f492067c3da97850c92 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 15:14:06 +0200 Subject: [PATCH] Added basic browser profiles to make sure english is used as the browser locale. --- test/browser_test_helper.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 3defb2aa9..a4d89f6aa 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -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