From a7a4bfd892f13074f8df181c6f9e6af675b75ad5 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 15:12:33 +0200 Subject: [PATCH 1/4] Added additional check. --- app/models/locale.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/locale.rb b/app/models/locale.rb index 5635f7ae6..6381e3b9f 100644 --- a/app/models/locale.rb +++ b/app/models/locale.rb @@ -13,6 +13,7 @@ class Locale < ApplicationModel } ) + fail "Can't load locales from #{url}" if !result fail "Can't load locales from #{url}: #{result.error}" if !result.success? ActiveRecord::Base.transaction do From 24a4965bf18f7a99d1f0292844b51820e4fa1cf9 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 15:13:24 +0200 Subject: [PATCH 2/4] Added test environment env and rake calls. --- script/local_browser_tests.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/local_browser_tests.sh b/script/local_browser_tests.sh index 1591b48fa..5e00b6a98 100755 --- a/script/local_browser_tests.sh +++ b/script/local_browser_tests.sh @@ -50,6 +50,15 @@ sleep 15 #export REMOTE_URL='http://192.168.178.32:4444/wd/hub' #export REMOTE_URL='http://192.168.178.45:4444/wd/hub' +export RAILS_ENV=test + +echo "rake db:drop" +time rake db:drop +echo "rake db:create" +time rake db:create +echo "rake db:migrate" +time rake db:migrate + rake test:browser["BROWSER_URL=http://localhost:4444"] #rake test:browser["BROWSER_URL=http://localhost:4444 BROWSER=chrome"] #rake test:browser["BROWSER_URL=http://192.168.178.28:4444"] From 82190dba829c90f341f42f492067c3da97850c92 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 15:14:06 +0200 Subject: [PATCH 3/4] 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 From f7a84ef0e602292cb8d81337a33fb606c3cabb94 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Thu, 16 Jul 2015 15:14:47 +0200 Subject: [PATCH 4/4] Fixed broken test: Position of table columns has changed. --- test/browser/agent_ticket_overview_level0_test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/browser/agent_ticket_overview_level0_test.rb b/test/browser/agent_ticket_overview_level0_test.rb index d2824bde8..4120eaeda 100644 --- a/test/browser/agent_ticket_overview_level0_test.rb +++ b/test/browser/agent_ticket_overview_level0_test.rb @@ -104,11 +104,11 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is shown match( - css: '.active table th:nth-child(3)', + css: '.active table th:nth-child(7)', value: '#', ) match( - css: '.active table th:nth-child(8)', + css: '.active table th:nth-child(4)', value: 'Article#', ) @@ -118,11 +118,11 @@ class AgentTicketOverviewLevel0Test < TestCase # check if number and article count is shown match( - css: '.active table th:nth-child(3)', + css: '.active table th:nth-child(7)', value: '#', ) match( - css: '.active table th:nth-child(8)', + css: '.active table th:nth-child(4)', value: 'Article#', )