e2e path for account role

This commit is contained in:
Carlos Jimenez Ruiz 2021-03-05 16:25:09 +01:00
parent f03de39433
commit 5908dea010
4 changed files with 109 additions and 2 deletions

View File

@ -61,6 +61,26 @@ export default {
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: {
createClientButton: `vn-float-button`
},

View File

@ -34,7 +34,7 @@ describe('Account Alias create and basic data path', () => {
await page.waitForState('account.alias.card.basicData');
});
it('should edit alias the basic data', async() => {
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);

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": "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}})",
"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"
}