]> git.openstreetmap.org Git - rails.git/commitdiff
Don't visit profile page after tested profile location update
authorAnton Khorev <tony29@yandex.ru>
Sat, 26 Apr 2025 16:01:02 +0000 (19:01 +0300)
committerAnton Khorev <tony29@yandex.ru>
Sat, 26 Apr 2025 16:01:02 +0000 (19:01 +0300)
The visit after clicking "Update Profile" is unnecessary because updating redirects to  the profile page. Instead, assert that there's a "Profile updated" message.

test/system/user_location_change_test.rb

index 5524c98f5636bfce5992f0cb104c2b2ce1a765f5..d35ac434d28a7c359ea91339fb0a32636204c269 100644 (file)
@@ -10,13 +10,19 @@ class UserLocationChangeTest < ApplicationSystemTestCase
     sign_in_as(user)
 
     visit user_path(user)
-    assert_no_selector ".bi.bi-geo-alt-fill"
+
+    within_content_heading do
+      assert_no_selector ".bi.bi-geo-alt-fill"
+    end
 
     visit edit_profile_path
+
     fill_in "Home location name", :with => "Test Location"
     click_on "Update Profile"
 
-    visit user_path(user)
-    assert_text "Test Location"
+    assert_text "Profile updated"
+    within_content_heading do
+      assert_text "Test Location"
+    end
   end
 end