@@ -116,7 +116,7 @@ test.describe('severity-1 #smoke', () => {
116116 credentials . password = newPassword ;
117117 } ) ;
118118
119- test ( 'can reset password with recovery key and 2FA enabled but not prompted ' , async ( {
119+ test ( 'can reset password with recovery key without 2FA prompt ' , async ( {
120120 target,
121121 pages : { signin, resetPassword, settings, totp, recoveryKey } ,
122122 testAccountTracker,
@@ -183,6 +183,82 @@ test.describe('severity-1 #smoke', () => {
183183 credentials . password = newPassword ;
184184 } ) ;
185185
186+ test ( 'can reset password with recovery key then delete account' , async ( {
187+ target,
188+ pages : {
189+ page,
190+ signin,
191+ resetPassword,
192+ settings,
193+ totp,
194+ recoveryKey,
195+ deleteAccount,
196+ } ,
197+ testAccountTracker,
198+ } ) => {
199+ const credentials = await testAccountTracker . signUp ( ) ;
200+ const newPassword = testAccountTracker . generatePassword ( ) ;
201+
202+ await signin . goto ( ) ;
203+ await signin . fillOutEmailFirstForm ( credentials . email ) ;
204+ await signin . fillOutPasswordForm ( credentials . password ) ;
205+
206+ // Enable 2FA
207+ await expect ( settings . settingsHeading ) . toBeVisible ( ) ;
208+ await expect ( settings . totp . status ) . toHaveText ( 'Disabled' ) ;
209+
210+ await settings . totp . addButton . click ( ) ;
211+ await totp . setUpTwoStepAuthWithQrAndBackupCodesChoice ( ) ;
212+
213+ await expect ( settings . settingsHeading ) . toBeVisible ( ) ;
214+ await expect ( settings . alertBar ) . toHaveText (
215+ 'Two-step authentication has been enabled'
216+ ) ;
217+ await expect ( settings . totp . status ) . toHaveText ( 'Enabled' ) ;
218+
219+ // Create recovery key
220+ await settings . recoveryKey . createButton . click ( ) ;
221+ const key = await recoveryKey . createRecoveryKey (
222+ credentials . password ,
223+ 'hint'
224+ ) ;
225+
226+ // Verify status as 'enabled'
227+ await expect ( settings . settingsHeading ) . toBeVisible ( ) ;
228+ await expect ( settings . recoveryKey . status ) . toHaveText ( 'Enabled' ) ;
229+
230+ await settings . signOut ( ) ;
231+
232+ await resetPassword . goto ( ) ;
233+
234+ await resetPassword . fillOutEmailForm ( credentials . email ) ;
235+
236+ const code = await target . emailClient . getResetPasswordCode (
237+ credentials . email
238+ ) ;
239+ await resetPassword . fillOutResetPasswordCodeForm ( code ) ;
240+
241+ // Not prompted for 2FA during reset password
242+ await resetPassword . fillOutRecoveryKeyForm ( key ) ;
243+ await resetPassword . fillOutNewPasswordForm ( newPassword ) ;
244+
245+ await expect ( resetPassword . passwordResetPasswordSaved ) . toBeVisible ( ) ;
246+
247+ await resetPassword . continueWithoutDownloadingRecoveryKey ( ) ;
248+ await resetPassword . recoveryKeyFinishButton . click ( ) ;
249+
250+ await expect ( settings . settingsHeading ) . toBeVisible ( ) ;
251+
252+ // Recovery key has been consumed and a new one created
253+ await expect ( settings . recoveryKey . status ) . toHaveText ( 'Enabled' ) ;
254+
255+ // Account deletion requires AAL match
256+ // If AAL does not match, account deletion fails with 'unconfirmed session' error
257+ await settings . deleteAccountButton . click ( ) ;
258+ await deleteAccount . deleteAccount ( newPassword ) ;
259+ await expect ( page . getByText ( 'Account deleted successfully' ) ) . toBeVisible ( ) ;
260+ } ) ;
261+
186262 test ( 'can reset password with 2FA and forgot recovery key' , async ( {
187263 page,
188264 target,
0 commit comments