Defect #31074

TimelogTest#test_default_query_setting fails depending on the language of the browser

Added by Go MAEDA 9 months ago. Updated 8 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Code cleanup/refactoring
Target version:4.1.0
Resolution:Fixed Affected version:

Description

The test fails in some environment.

Failure:
TimelogTest#test_default_query_setting [/Users/maeda/redmines/redmine-trunk/test/system/timelog_test.rb:82]:
Expected false to be truthy.

bin/rails test test/system/timelog_test.rb:77

This is because the test expects the current language is always English, but actually the language is auto-selected depending on the test environment. For example, Japanese is the default language in my environment. The test looks for a table header "Comment" and fails because there is a Japanese text "コメント" instead of "Comment".

test_default_query_setting-fails@2x.png (65.1 KB) Go MAEDA, 2019-03-21 03:55

Associated revisions

Revision 18032
Added by Go MAEDA 8 months ago

TimelogTest#test_default_query_setting fails depending on the language of the browser (#31074).

Patch by Go MAEDA.

History

#1 Updated by Go MAEDA 8 months ago

  • Target version set to 4.1.0

Forcing the English language for anonymous users fixes the issue.

diff --git a/test/system/timelog_test.rb b/test/system/timelog_test.rb
index 58886c050..7c637d6cd 100644
--- a/test/system/timelog_test.rb
+++ b/test/system/timelog_test.rb
@@ -75,11 +75,13 @@ class TimelogTest < ApplicationSystemTestCase
   end

   def test_default_query_setting
-    # Display the list with the default settings
-    visit '/time_entries'
-    within 'table.time-entries thead' do
-      assert page.has_no_link?('Tracker')
-      assert page.has_text?('Comment')
+    with_settings :default_language => 'en', :force_default_language_for_anonymous => '1' do
+      # Display the list with the default settings
+      visit '/time_entries'
+      within 'table.time-entries thead' do
+        assert page.has_no_link?('Tracker')
+        assert page.has_text?('Comment')
+      end
     end

     # Change the default columns

#2 Updated by Go MAEDA 8 months ago

  • Subject changed from TimelogTest#test_default_query_setting fails to TimelogTest#test_default_query_setting fails depending on the language of the browser
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed.

Also available in: Atom PDF