Project

General

Profile

Actions

Defect #44321

closed

Random test failure in OauthProviderSystemTest due to incomplete sign out

Added by Mizuki ISHIKAWA 22 days ago. Updated 10 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Code cleanup/refactoring
Target version:
Resolution:
Fixed
Affected version:

Description

OauthProviderSystemTest#test_application_creation_and_authorization fails randomly.

Failure:
OauthProviderSystemTest#test_application_creation_and_authorization [test/application_system_test_case.rb:76]:
expected "/" to equal "/login" 

bin/rails test test/system/oauth_provider_test.rb:10

The failing assertion is assert_current_path '/login' in log_user (test/application_system_test_case.rb:76).
This test signs in as a different user after calling sign_out_user, but in rare cases the sign out has not completed by the time log_user starts, which seems to be what makes the test fail.

Actions #1

Updated by Mizuki ISHIKAWA 22 days ago

I think this can be resolved by waiting for the redirection to complete before proceeding to the next step, as shown below.

diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
index a03768908..d3cf229d0 100644
--- a/test/application_system_test_case.rb
+++ b/test/application_system_test_case.rb
@@ -85,6 +85,8 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
   def sign_out_user
     find('#account .dropdown-trigger').click
     click_link 'Sign out'
+    # Make sure the redirection after the sign out has completed
+    assert_current_path '/', :ignore_query => true
   end

   def wait_for_ajax

Actions #2

Updated by Go MAEDA 12 days ago

  • Target version set to 7.0.1

Setting the target version to 7.0.1.

Actions #3

Updated by Go MAEDA 11 days ago

  • Status changed from New to Resolved
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix in r24891. Thank you.

Actions #4

Updated by Go MAEDA 10 days ago

  • Status changed from Resolved to Closed

Merged the fix into 7.0-stable branch in r24896.

Actions

Also available in: Atom PDF