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..8d8036373 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'; @@ -8,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'); }); @@ -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, 'legion@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); @@ -46,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/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..b776fa577 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,17 @@ rule> + + + + { diff --git a/modules/client/front/web-access/locale/es.yml b/modules/client/front/web-access/locale/es.yml index 4a3ac0ab4..5090ed020 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 their account.: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta. \ No newline at end of file