From 1d04ca1c8a09e357ec81aa41649e1c8f83e2540c Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 23 May 2024 22:32:30 +0200 Subject: [PATCH] test(salix): refs #6427 improve test --- e2e/paths/01-salix/04_recoverPassword.spec.js | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/e2e/paths/01-salix/04_recoverPassword.spec.js b/e2e/paths/01-salix/04_recoverPassword.spec.js index 955877681..b04f7d690 100644 --- a/e2e/paths/01-salix/04_recoverPassword.spec.js +++ b/e2e/paths/01-salix/04_recoverPassword.spec.js @@ -21,27 +21,17 @@ fdescribe('RecoverPassword path', async() => { await page.write(selectors.recoverPassword.email, 'fakeEmail@mydomain.com'); await page.waitToClick(selectors.recoverPassword.emailOption); await page.waitToClick(selectors.recoverPassword.sendEmailButton); + const httpDataResponse = await page.waitForResponse(response => { + return response.status() === 204 && response.url().includes(`VnUsers/recoverPassword`); + }); + const code = await httpDataResponse.ok(); + expect(code).toBeTrue(); const message = await page.waitForSnackbar(); expect(message.text).toContain('Notification sent!'); }); - it('should not throw error if not exist user when select sms option', async() => { - await page.waitForState('login'); - await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); - await page.write(selectors.recoverPassword.email, 'fakeEmail@mydomain.com'); - await page.waitToClick(selectors.recoverPassword.emailOption); - // await page.waitToClick(selectors.recoverPassword.smsOption); - await page.waitToClick(selectors.recoverPassword.sendEmailButton); - - const message = await page.waitForSnackbar(); - // await page.waitForState('login'); - - expect(message.text).toContain('Credentials not valid'); - expect(await page.getState()).toContain('recover-password'); - }); - it('should send email using email', async() => { await page.waitForState('login'); await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); @@ -68,9 +58,21 @@ fdescribe('RecoverPassword path', async() => { expect(message.text).toContain('Notification sent!'); }); - it('should send sms using username', async() => { + it('should not throw error if not exist user when select sms option', async() => { await page.waitForState('login'); await page.waitToClick(selectors.recoverPassword.recoverPasswordButton); + await page.write(selectors.recoverPassword.email, 'fakeEmail@mydomain.com'); + await page.waitToClick(selectors.recoverPassword.smsOption); + await page.waitToClick(selectors.recoverPassword.sendEmailButton); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Credentials not valid'); + expect(await page.getState()).toContain('recover-password'); + }); + + it('should send sms using username', async() => { + await page.clearInput(selectors.recoverPassword.email); await page.write(selectors.recoverPassword.email, 'BruceWayne'); await page.waitToClick(selectors.recoverPassword.smsOption);