Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2832-summary_validate_h4
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
jorgebl 2021-03-08 13:17:38 +01:00
commit 43dc158d7c
6 changed files with 290 additions and 1 deletions

View File

@ -28,6 +28,59 @@ export default {
firstModulePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="push_pin"]', firstModulePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="push_pin"]',
firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]' firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]'
}, },
accountIndex: {
addAccount: 'vn-user-index button vn-icon[icon="add"]',
newName: 'vn-user-create vn-textfield[ng-model="$ctrl.user.name"]',
newNickname: 'vn-user-create vn-textfield[ng-model="$ctrl.user.nickname"]',
newEmail: 'vn-user-create vn-textfield[ng-model="$ctrl.user.email"]',
newRole: 'vn-user-create vn-autocomplete[ng-model="$ctrl.user.roleFk"]',
newPassword: 'vn-user-create vn-textfield[ng-model="$ctrl.user.password"]',
createAccountButton: 'vn-user-create button[type="submit"]',
},
accountBasicData: {
name: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.name"]',
nickname: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.nickname"]',
email: 'vn-user-basic-data vn-textfield[ng-model="$ctrl.user.email"]',
language: 'vn-user-basic-data vn-autocomplete[ng-model="$ctrl.user.lang"]',
save: 'vn-user-basic-data button[type="submit"]'
},
accountRoles: {
anyResult: 'vn-user-roles > vn-data-viewer vn-list > a'
},
accountAliasIndex: {
addAlias: 'vn-alias-index button vn-icon[icon="add"]',
newName: 'vn-alias-create vn-textfield[ng-model="$ctrl.alias.alias"]',
newDescription: 'vn-alias-create vn-textfield[ng-model="$ctrl.alias.description"]',
createAliasButton: 'vn-alias-create button[type="submit"]',
},
accountAliasBasicData: {
name: 'vn-alias-basic-data vn-textfield[ng-model="$ctrl.alias.alias"]',
description: 'vn-alias-basic-data vn-textfield[ng-model="$ctrl.alias.description"]',
save: 'vn-alias-basic-data button[type="submit"]'
},
accountAliasUsers: {
anyResult: 'vn-alias-users > vn-data-viewer vn-tr'
},
accountRoleIndex: {
addRole: 'vn-role-index button vn-icon[icon="add"]',
newName: 'vn-role-create vn-textfield[ng-model="$ctrl.role.name"]',
newDescription: 'vn-role-create vn-textfield[ng-model="$ctrl.role.description"]',
createRoleButton: 'vn-role-create button[type="submit"]',
},
accountRoleBasicData: {
name: 'vn-role-basic-data vn-textfield[ng-model="$ctrl.role.name"]',
description: 'vn-role-basic-data vn-textfield[ng-model="$ctrl.role.description"]',
save: 'vn-role-basic-data button[type="submit"]'
},
accountSubroles: {
addSubrole: 'vn-role-subroles button vn-icon[icon="add"]',
role: 'vn-autocomplete[ng-model="$ctrl.addData.inheritsFrom"]',
save: 'button[response="accept"]',
anyResult: 'vn-role-subroles > vn-data-viewer > div > div > vn-card > vn-list > a'
},
accountRoleInheritance: {
anyResult: 'vn-role-inherited > vn-data-viewer > div > div > vn-card > vn-list > a'
},
clientsIndex: { clientsIndex: {
createClientButton: `vn-float-button` createClientButton: `vn-float-button`
}, },

View File

@ -0,0 +1,82 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
// #2833 Refactor account.basicData
xdescribe('Account create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account form by clicking the add button', async() => {
await page.waitToClick(selectors.accountIndex.addAccount);
await page.waitForState('account.create');
});
it('should fill the form and then save it by clicking the create button', async() => {
await page.write(selectors.accountIndex.newName, 'Remy');
await page.write(selectors.accountIndex.newNickname, 'Gambit');
await page.write(selectors.accountIndex.newEmail, 'RemyEtienneLeBeau@verdnatura.es');
await page.autocompleteSearch(selectors.accountIndex.newRole, 'Trainee');
await page.write(selectors.accountIndex.newPassword, 'cestlavie');
await page.waitToClick(selectors.accountIndex.createAccountButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created account basic data section', async() => {
await page.waitForState('account.card.basicData');
});
it('should edit the basic data', async() => {
await page.overwrite(selectors.accountBasicData.name, 'Anna');
await page.overwrite(selectors.accountBasicData.nickname, 'Rogue');
await page.overwrite(selectors.accountBasicData.email, 'AnnaMarieLeBeau@verdnatura.es');
await page.autocompleteSearch(selectors.accountBasicData.language, 'english');
await page.waitToClick(selectors.accountBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the section and check the name was edited successfully', async() => {
await page.reloadSection('account.card.basicData');
const result = await page.waitToGetProperty(selectors.accountBasicData.name, 'value');
expect(result).toEqual('Anna');
});
it('should check the nickname was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.nickname, 'value');
expect(result).toEqual('Rogue');
});
it('should check the email was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.email, 'value');
expect(result).toEqual('AnnaMarieLeBeau@verdnatura.es');
});
it('should check the language was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountBasicData.language, 'value');
expect(result).toEqual('English');
});
it('should navigate to the roles section to check the roles are correct', async() => {
await page.accessToSection('account.card.roles');
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
expect(rolesCount).toEqual(3);
});
});

View File

@ -0,0 +1,66 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account Alias create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
await page.accessToSection('account.alias');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account alias form by clicking the add button', async() => {
await page.waitToClick(selectors.accountAliasIndex.addAlias);
await page.waitForState('account.alias.create');
});
it('should fill the form and then save it by clicking the create alias button', async() => {
await page.write(selectors.accountAliasIndex.newName, 'Boring alias');
await page.write(selectors.accountAliasIndex.newDescription, 'Boring description');
await page.waitToClick(selectors.accountAliasIndex.createAliasButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created account alias basic data section', async() => {
await page.waitForState('account.alias.card.basicData');
});
it('should edit the alias basic data', async() => {
await page.overwrite(selectors.accountAliasBasicData.name, 'Psykers');
await page.overwrite(selectors.accountAliasBasicData.description, 'Email group for psykers');
await page.waitToClick(selectors.accountAliasBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the basicData section and check the name was edited successfully', async() => {
await page.reloadSection('account.alias.card.basicData');
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.name, 'value');
expect(result).toEqual('Psykers');
});
it('should check the alias description was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountAliasBasicData.description, 'value');
expect(result).toContain('psykers');
});
it('should search for the IT alias group then access to the users section then check the role listed is the expected one', async() => {
await page.accessToSearchResult('IT');
await page.accessToSection('account.alias.card.users');
const rolesCount = await page.countElement(selectors.accountAliasUsers.anyResult);
expect(rolesCount).toEqual(1);
});
});

View File

@ -0,0 +1,86 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Account Role create and basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'account');
await page.accessToSection('account.role');
});
afterAll(async() => {
await browser.close();
});
it('should open the new account role form by clicking the add button', async() => {
await page.waitToClick(selectors.accountRoleIndex.addRole);
await page.waitForState('account.role.create');
});
it('should fill the form and then save it by clicking the create role button', async() => {
await page.write(selectors.accountRoleIndex.newName, 'boringRole');
await page.write(selectors.accountRoleIndex.newDescription, 'Boring description');
await page.waitToClick(selectors.accountRoleIndex.createRoleButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should redirect the user to the created role basic data section', async() => {
await page.waitForState('account.role.card.basicData');
});
it('should edit the role basic data', async() => {
await page.overwrite(selectors.accountRoleBasicData.name, 'psyker');
await page.overwrite(selectors.accountRoleBasicData.description, 'A role just for psykers');
await page.waitToClick(selectors.accountRoleBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should reload the role basicData section and check the name was edited successfully', async() => {
await page.reloadSection('account.role.card.basicData');
const result = await page.waitToGetProperty(selectors.accountRoleBasicData.name, 'value');
expect(result).toEqual('psyker');
});
it('should check the role description was edited successfully', async() => {
const result = await page.waitToGetProperty(selectors.accountRoleBasicData.description, 'value');
expect(result).toContain('psykers');
});
it('should navigate to the subroles section', async() => {
await page.accessToSection('account.role.card.subroles');
});
it('should asign a subrole', async() => {
await page.waitToClick(selectors.accountSubroles.addSubrole);
await page.autocompleteSearch(selectors.accountSubroles.role, 'teamManager');
await page.waitToClick(selectors.accountSubroles.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Role added!');
});
it('should reload the subroles section and check a role was added', async() => {
await page.reloadSection('account.role.card.subroles');
const subrolesCount = await page.countElement(selectors.accountSubroles.anyResult);
expect(subrolesCount).toEqual(1);
});
it('should search for the employee role group then access to the roles inheritance section then check the roles listed are the expected ones', async() => {
await page.accessToSearchResult('employee');
await page.accessToSection('account.role.card.inherited');
const rolesCount = await page.countElement(selectors.accountRoleInheritance.anyResult);
expect(rolesCount).toEqual(6);
});
});

View File

@ -92,5 +92,6 @@
"New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*", "New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
"New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*", "New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
"There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})", "There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty" "Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
"Role name must be written in camelCase": "Role name must be written in camelCase"
} }

View File

@ -75,6 +75,7 @@ class Controller extends Component {
set shipped(value) { set shipped(value) {
this.ticket.shipped = value; this.ticket.shipped = value;
this.ticket.shipped.setHours(0, 0, 0, 0);
this.getLanded({ this.getLanded({
shipped: value, shipped: value,
addressFk: this.ticket.addressFk, addressFk: this.ticket.addressFk,