From 8d9d64b49d016d25cd12b0e9c638ecca1c0821ea Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 20 Jun 2022 07:31:10 +0200 Subject: [PATCH 1/2] feat(client_web-access): add email field --- e2e/helpers/selectors.js | 1 + e2e/paths/02-client/07_edit_web_access.spec.js | 10 ++++++++++ modules/client/back/methods/client/getCard.js | 2 +- .../client/back/methods/client/updateUser.js | 5 +++++ modules/client/front/web-access/index.html | 18 ++++++++++++++++++ modules/client/front/web-access/index.js | 1 + modules/client/front/web-access/locale/es.yml | 4 +++- 7 files changed, 39 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 2cebffe02..0972e3463 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -276,6 +276,7 @@ export default { clientWebAccess: { enableWebAccessCheckbox: 'vn-check[label="Enable web access"]', userName: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.name"]', + email: 'vn-client-web-access vn-textfield[ng-model="$ctrl.account.email"]', saveButton: 'button[type=submit]' }, clientNotes: { diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index 70ec4b5ea..e5aa44a26 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -1,3 +1,4 @@ +/* eslint max-len: ["error", { "code": 150 }]*/ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; @@ -33,6 +34,15 @@ describe('Client Edit web access path', () => { expect(message.text).toContain('Data saved!'); }); + it(`should update the email`, async() => { + await page.clearInput(selectors.clientWebAccess.email); + await page.write(selectors.clientWebAccess.email, 'hulk@marvel.com'); + await page.waitToClick(selectors.clientWebAccess.saveButton); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + it('should reload the section and confirm web access is now unchecked', async() => { await page.reloadSection('client.card.webAccess'); const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index f7f8c505b..21b3140bd 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -62,7 +62,7 @@ module.exports = function(Self) { { relation: 'account', scope: { - fields: ['id', 'name', 'active'] + fields: ['id', 'name', 'email', 'active'] } }, { diff --git a/modules/client/back/methods/client/updateUser.js b/modules/client/back/methods/client/updateUser.js index dd5b9f9fe..ef23b92fd 100644 --- a/modules/client/back/methods/client/updateUser.js +++ b/modules/client/back/methods/client/updateUser.js @@ -13,6 +13,11 @@ module.exports = Self => { type: 'string', description: 'the user name' }, + { + arg: 'email', + type: 'string', + description: 'the user email' + }, { arg: 'active', type: 'boolean', diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index c807489d6..6fb50cfd9 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -5,6 +5,11 @@ data="$ctrl.account" form="form"> + +
@@ -28,6 +33,18 @@ rule> + + + + { diff --git a/modules/client/front/web-access/locale/es.yml b/modules/client/front/web-access/locale/es.yml index 4a3ac0ab4..74f789f8f 100644 --- a/modules/client/front/web-access/locale/es.yml +++ b/modules/client/front/web-access/locale/es.yml @@ -4,4 +4,6 @@ New password: Nueva contraseña Repeat password: Repetir contraseña Change password: Cambiar contraseña Passwords don't match: Las contraseñas no coinciden -You must enter a new password: Debes introducir una nueva contraseña \ No newline at end of file +You must enter a new password: Debes introducir una nueva contraseña +Recovery email: Correo de recuperación +This email is used for user to regain access to an account you're unable to sign in to.: Este correo electrónico se usa para que el usuario recupere el acceso a una cuenta en la que no puede iniciar sesión. \ No newline at end of file From 20f886e93358bf7ab1283a58f700bd2009774208 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 21 Jun 2022 13:58:47 +0200 Subject: [PATCH 2/2] change email and text info in email field --- e2e/paths/02-client/07_edit_web_access.spec.js | 10 ++++++++-- modules/client/front/web-access/index.html | 3 +-- modules/client/front/web-access/locale/es.yml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index e5aa44a26..8d8036373 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -9,7 +9,7 @@ describe('Client Edit web access path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'client'); - await page.accessToSearchResult('1105'); + await page.accessToSearchResult('max'); await page.accessToSection('client.card.webAccess'); }); @@ -36,7 +36,7 @@ describe('Client Edit web access path', () => { it(`should update the email`, async() => { await page.clearInput(selectors.clientWebAccess.email); - await page.write(selectors.clientWebAccess.email, 'hulk@marvel.com'); + await page.write(selectors.clientWebAccess.email, 'legion@marvel.com'); await page.waitToClick(selectors.clientWebAccess.saveButton); const message = await page.waitForSnackbar(); @@ -56,6 +56,12 @@ describe('Client Edit web access path', () => { expect(result).toEqual('Legion'); }); + it('should confirm web access email have been updated', async() => { + const result = await page.waitToGetProperty(selectors.clientWebAccess.email, 'value'); + + expect(result).toEqual('legion@marvel.com'); + }); + it(`should navigate to the log section`, async() => { await page.accessToSection('client.card.log'); }); diff --git a/modules/client/front/web-access/index.html b/modules/client/front/web-access/index.html index 6fb50cfd9..b776fa577 100644 --- a/modules/client/front/web-access/index.html +++ b/modules/client/front/web-access/index.html @@ -37,11 +37,10 @@ diff --git a/modules/client/front/web-access/locale/es.yml b/modules/client/front/web-access/locale/es.yml index 74f789f8f..5090ed020 100644 --- a/modules/client/front/web-access/locale/es.yml +++ b/modules/client/front/web-access/locale/es.yml @@ -6,4 +6,4 @@ Change password: Cambiar contraseña Passwords don't match: Las contraseñas no coinciden You must enter a new password: Debes introducir una nueva contraseña Recovery email: Correo de recuperación -This email is used for user to regain access to an account you're unable to sign in to.: Este correo electrónico se usa para que el usuario recupere el acceso a una cuenta en la que no puede iniciar sesión. \ No newline at end of file +This email is used for user to regain access their account.: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta. \ No newline at end of file