From 2d41fece43d87c4b8b995dbd161a44c091e30fe5 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Wed, 26 Jun 2024 14:49:34 +0800 Subject: [PATCH] DEV: Fix flaky system spec with hardcoded username (#27619) The auto-generated username has a sequence number after it that may be different from the hard-coded one. Use user.username instead. --- spec/system/user_page/user_preferences_profile_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/system/user_page/user_preferences_profile_spec.rb b/spec/system/user_page/user_preferences_profile_spec.rb index f1ad6f8ba3d..ebe39df9569 100644 --- a/spec/system/user_page/user_preferences_profile_spec.rb +++ b/spec/system/user_page/user_preferences_profile_spec.rb @@ -22,7 +22,7 @@ describe "User preferences | Profile", type: :system do it "redirects to the profile page to fill up required fields" do visit("/") - expect(page).to have_current_path("/u/bruce0/preferences/profile") + expect(page).to have_current_path("/u/#{user.username}/preferences/profile") expect(page).to have_selector( ".alert-error", @@ -35,7 +35,7 @@ describe "User preferences | Profile", type: :system do find("#site-logo").click - expect(page).to have_current_path("/u/bruce0/preferences/profile") + expect(page).to have_current_path("/u/#{user.username}/preferences/profile") end it "allows user to fill up required fields" do