@@ -69,7 +69,11 @@ class MultifactorAuthsTest < ApplicationSystemTestCase
6969 end
7070
7171 should "user with mfa disabled gets redirected back to new api keys pages after setting up mfa" do
72- redirect_test_mfa_disabled ( new_profile_api_key_path ) { verify_password }
72+ redirect_test_mfa_disabled ( new_profile_api_key_path ) do
73+ verify_password
74+
75+ assert page . has_content? ( "New API key" )
76+ end
7377 end
7478
7579 should "user with mfa disabled gets redirected back to notifier pages after setting up mfa" do
@@ -78,7 +82,11 @@ class MultifactorAuthsTest < ApplicationSystemTestCase
7882
7983 should "user with mfa disabled gets redirected back to profile api keys pages after setting up mfa" do
8084 create ( :api_key , scopes : %i[ push_rubygem ] , owner : @user , ownership : @ownership )
81- redirect_test_mfa_disabled ( profile_api_keys_path ) { verify_password }
85+ redirect_test_mfa_disabled ( profile_api_keys_path ) do
86+ verify_password
87+
88+ assert page . has_content? ( "API keys" )
89+ end
8290 end
8391
8492 should "user with mfa disabled gets redirected back to verify session pages after setting up mfa" do
@@ -100,7 +108,11 @@ class MultifactorAuthsTest < ApplicationSystemTestCase
100108 end
101109
102110 should "user gets redirected back to new api keys pages after setting up mfa" do
103- redirect_test_mfa_weak_level ( new_profile_api_key_path ) { verify_password }
111+ redirect_test_mfa_weak_level ( new_profile_api_key_path ) do
112+ verify_password
113+
114+ assert page . has_content? ( "New API key" )
115+ end
104116 end
105117
106118 should "user gets redirected back to notifier pages after setting up mfa" do
@@ -109,7 +121,11 @@ class MultifactorAuthsTest < ApplicationSystemTestCase
109121
110122 should "user gets redirected back to profile api keys pages after setting up mfa" do
111123 create ( :api_key , scopes : %i[ push_rubygem ] , owner : @user , ownership : @ownership )
112- redirect_test_mfa_weak_level ( profile_api_keys_path ) { verify_password }
124+ redirect_test_mfa_weak_level ( profile_api_keys_path ) do
125+ verify_password
126+
127+ assert page . has_content? ( "API keys" )
128+ end
113129 end
114130
115131 should "user gets redirected back to verify session pages after setting up mfa" do
@@ -157,7 +173,7 @@ class MultifactorAuthsTest < ApplicationSystemTestCase
157173 end
158174
159175 def redirect_test_mfa_disabled ( path )
160- sign_in
176+ sign_in ( wait_for : "For protection of your account and your gems, you are required to set up multi-factor authentication." )
161177 visit path
162178
163179 assert ( page . has_content? ( "you are required to set up multi-factor authentication" ) )
@@ -175,7 +191,7 @@ def redirect_test_mfa_disabled(path)
175191 end
176192
177193 def redirect_test_mfa_weak_level ( path )
178- sign_in
194+ sign_in ( wait_for : "For protection of your account and your gems, you are required to set up multi-factor authentication." )
179195 @user . enable_totp! ( @seed , :ui_only )
180196 visit path
181197
@@ -186,16 +202,20 @@ def redirect_test_mfa_weak_level(path)
186202
187203 click_button "Authenticate"
188204
205+ assert page . has_content? ( "You have successfully updated your multi-factor authentication level." )
206+
189207 yield if block_given?
190208
191209 assert_equal path , current_path , "was not redirected back to original destination: #{ path } "
192210 end
193211
194- def sign_in
212+ def sign_in ( wait_for : "Dashboard" )
195213 visit sign_in_path
196214 fill_in "Email or Username" , with : @user . reload . email
197215 fill_in "Password" , with : @user . password
198216 click_button "Sign in"
217+
218+ assert page . has_content? ( wait_for )
199219 end
200220
201221 def otp_key
0 commit comments