Project

General

Profile

Actions

Patch #43985

open

IssuesSystemTest#test_issue_list_with_default_totalable_columns fails randomly

Added by Mizuki ISHIKAWA about 16 hours ago. Updated about 11 hours ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:

Description

IssuesSystemTest#test_issue_list_with_default_totalable_columns in test/system/issues_test.rb fails intermittently with the following error

Failure:
IssuesSystemTest#test_issue_list_with_default_totalable_columns [test/system/issues_test.rb:551]:
Expected false to be truthy.

bin/rails test test/system/issues_test.rb:536

The cause is the use of !page.has_css?('p.query-totals') to assert the absence of an element after clicking Apply. With Capybara, has_css? returns true immediately when the element is still present (before page reload completes), so negating it with ! gives false and the assertion fails.
The fix is to use has_no_css? instead, which waits until the element disappears (up to default_max_wait_time).
Reference: https://github.com/teamcapybara/capybara#asynchronous-javascript-ajax-and-friends

Patch:

diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb
index 561118d573..1d18f27581 100644
--- a/test/system/issues_test.rb
+++ b/test/system/issues_test.rb
@@ -548,8 +548,8 @@ class IssuesSystemTest < ApplicationSystemTestCase
         click_link 'Apply'
       end
       # Check that Totals are not present in the reloaded page
-      assert !page.has_css?('p.query-totals')
-      assert !page.has_css?('span.total-for-estimated-hours')
+      assert page.has_no_css?('p.query-totals')
+      assert page.has_no_css?('span.total-for-estimated-hours')
     end
   end

Actions

Also available in: Atom PDF