2469-e2e_account_module #616
|
@ -10,6 +10,13 @@ module.exports = Self => {
|
|||
|
||||
// Validations
|
||||
|
||||
Self.validatesFormatOf('email', {
|
||||
message: 'Invalid email',
|
||||
allowNull: true,
|
||||
allowBlank: true,
|
||||
with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/
|
||||
});
|
||||
|
||||
Self.validatesUniquenessOf('name', {
|
||||
message: `A client with that Web User name already exists`
|
||||
});
|
||||
|
|
|
@ -47,6 +47,20 @@ export default {
|
|||
accountRoles: {
|
||||
anyResult: 'vn-user-roles > vn-data-viewer vn-list > a'
|
||||
},
|
||||
accountDescriptor: {
|
||||
menuButton: 'vn-user-descriptor vn-icon-button[icon="more_vert"]',
|
||||
deleteAccount: '.vn-menu [name="deleteUser"]',
|
||||
changeRole: '.vn-menu [name="changeRole"]',
|
||||
setPassword: '.vn-menu [name="setPassword"]',
|
||||
activateAccount: '.vn-menu [name="enableAccount"]',
|
||||
activateUser: '.vn-menu [name="activateUser"]',
|
||||
newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]',
|
||||
repeatPassword: 'vn-textfield[ng-model="$ctrl.repeatPassword"]',
|
||||
newRole: 'vn-autocomplete[ng-model="$ctrl.newRole"]',
|
||||
activeAccountIcon: 'vn-icon[icon="contact_mail"]',
|
||||
activeUserIcon: 'vn-icon[icon="icon-disabled"]',
|
||||
acceptButton: 'button[response="accept"]',
|
||||
},
|
||||
accountAliasIndex: {
|
||||
addAlias: 'vn-alias-index button vn-icon[icon="add"]',
|
||||
newName: 'vn-alias-create vn-textfield[ng-model="$ctrl.alias.alias"]',
|
||||
|
@ -81,6 +95,11 @@ export default {
|
|||
accountRoleInheritance: {
|
||||
anyResult: 'vn-role-inherited > vn-data-viewer > div > div > vn-card > vn-list > a'
|
||||
},
|
||||
accountMailForwarding: {
|
||||
mailForwardingCheckbox: 'vn-user-mail-forwarding vn-check[ng-model="watcher.hasData"]',
|
||||
email: 'vn-user-mail-forwarding vn-textfield[ng-model="data.forwardTo"]',
|
||||
save: 'vn-user-mail-forwarding vn-submit'
|
||||
},
|
||||
clientsIndex: {
|
||||
createClientButton: `vn-float-button`
|
||||
},
|
||||
|
|
|
@ -61,4 +61,110 @@ describe('Account create and basic data path', () => {
|
|||
|
||||
expect(rolesCount).toEqual(4);
|
||||
});
|
||||
|
||||
describe('Descriptor option', () => {
|
||||
describe('Edit role', () => {
|
||||
it('should edit the role using the descriptor menu', async() => {
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.changeRole);
|
||||
await page.autocompleteSearch(selectors.accountDescriptor.newRole, 'adminBoss');
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Role changed succesfully!');
|
||||
});
|
||||
|
||||
it('should reload the roles section to see now there are more roles', async() => {
|
||||
// when role updated the db takes a while to return the changes, without this timeout the result would have been 4
|
||||
await page.waitForTimeout(1000);
|
||||
await page.reloadSection('account.card.roles');
|
||||
const rolesCount = await page.countElement(selectors.accountRoles.anyResult);
|
||||
|
||||
expect(rolesCount).toEqual(34);
|
||||
});
|
||||
});
|
||||
|
||||
describe('activate account', () => {
|
||||
it(`should check the active account icon isn't present in the descriptor`, async() => {
|
||||
await page.waitForNumberOfElements(selectors.accountDescriptor.activeAccountIcon, 0);
|
||||
});
|
||||
|
||||
it('should activate the account using the descriptor menu', async() => {
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.activateAccount);
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Account enabled!');
|
||||
});
|
||||
|
||||
it('should check the active account icon is now present in the descriptor', async() => {
|
||||
await page.waitForSelector(selectors.accountDescriptor.activeAccountIcon, {visible: false});
|
||||
});
|
||||
});
|
||||
|
||||
// creating the account without the active property set to true seems to be creating an active user anyways
|
||||
// describe('activate user', () => {
|
||||
// it(`should check the inactive user icon is present in the descriptor`, async() => {
|
||||
// await page.waitForSelector(selectors.accountDescriptor.activeUserIcon, {visible: true});
|
||||
// });
|
||||
|
||||
// it('should activate the user using the descriptor menu', async() => {
|
||||
// await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
// await page.waitToClick(selectors.accountDescriptor.activateUser);
|
||||
// await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
// const message = await page.waitForSnackbar();
|
||||
|
||||
// expect(message.text).toContain('user enabled?');
|
||||
// });
|
||||
|
||||
// it('should check the inactive user icon is not present anymore', async() => {
|
||||
// await page.waitForNumberOfElements(selectors.accountDescriptor.activeUserIcon, 0);
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('mail forwarding', () => {
|
||||
it('should activate the mail forwarding and set the recipent email', async() => {
|
||||
await page.accessToSection('account.card.mailForwarding');
|
||||
await page.waitToClick(selectors.accountMailForwarding.mailForwardingCheckbox);
|
||||
await page.write(selectors.accountMailForwarding.email, 'someEmail@someDomain.es');
|
||||
await page.waitToClick(selectors.accountMailForwarding.save);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Set password', () => {
|
||||
it('should set the password using the descriptor menu', async() => {
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.setPassword);
|
||||
await page.write(selectors.accountDescriptor.newPassword, 'quantum.crypt0graphy');
|
||||
await page.write(selectors.accountDescriptor.repeatPassword, 'quantum.crypt0graphy');
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Password changed succesfully!');
|
||||
});
|
||||
|
||||
// cant log into created account for unknown reasons
|
||||
// it('should login into the created account with the new password', async() => {
|
||||
// await page.loginAndModule('Remy', 'quantum.crypt0graphy');
|
||||
// });
|
||||
});
|
||||
|
||||
describe('delete account', () => {
|
||||
// it('should navigate to the account basic data section', async() => {
|
||||
// });
|
||||
|
||||
it('should delete the account using the descriptor menu', async() => {
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.deleteAccount);
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('User removed');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue