Merge branch 'dev' into 2240-salix-version-refresh
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-06-22 05:09:48 +00:00
commit 6d6b248202
7 changed files with 45 additions and 3 deletions

View File

@ -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: {

View File

@ -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');
});

View File

@ -62,7 +62,7 @@ module.exports = function(Self) {
{
relation: 'account',
scope: {
fields: ['id', 'name', 'active']
fields: ['id', 'name', 'email', 'active']
}
},
{

View File

@ -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',

View File

@ -5,6 +5,11 @@
data="$ctrl.account"
form="form">
</vn-watcher>
<vn-crud-model
auto-load="true"
url="UserPasswords"
data="$ctrl.passRequirements">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
<vn-horizontal>
@ -28,6 +33,17 @@
rule>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-id="email"
disabled="watcher.orgData.active != $ctrl.account.active"
vn-one
label="Recovery email"
ng-model="$ctrl.account.email"
info="This email is used for user to regain access their account."
rule>
</vn-textfield>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit
@ -55,6 +71,7 @@
<vn-textfield
type="password"
label="New password"
info="{{'Password requirements' | translate:$ctrl.passRequirements[0]}}"
ng-model="$ctrl.newPassword">
</vn-textfield>
<vn-textfield

View File

@ -63,6 +63,7 @@ export default class Controller extends Section {
onSubmit() {
const data = {
name: this.account.name,
email: this.account.email,
active: this.account.active
};
this.$http.patch(`Clients/${this.client.id}/updateUser`, data).then(() => {

View File

@ -5,3 +5,5 @@ 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
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.