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.
This commit is contained in:
Ted Johansson 2024-06-26 14:49:34 +08:00 committed by GitHub
parent 8be2f0ab70
commit 2d41fece43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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