test(account): acl, connections and accounts secctions
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
89baf63646
commit
34bcdf1bd3
|
@ -46,7 +46,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const {data} = await Self.getUserStatus(recipient.name);
|
const {data} = await Self.getUserStatus(recipient.name);
|
||||||
if (data) {
|
if (data) {
|
||||||
if (data.status === 'offline' || data.status === 'busy') {
|
if (data.status === 'offline' || data.status === 'busy') {
|
||||||
// Send message to department room
|
// Send message to department room
|
||||||
const workerDepartment = await models.WorkerDepartment.findById(recipientId, {
|
const workerDepartment = await models.WorkerDepartment.findById(recipientId, {
|
||||||
include: {
|
include: {
|
||||||
|
|
|
@ -2544,3 +2544,7 @@ INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackage
|
||||||
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
||||||
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
||||||
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('UserAccount', '*', '*', 'ALLOW', 'ROLE', 'sysadmin');
|
||||||
|
|
|
@ -103,9 +103,8 @@ export default {
|
||||||
},
|
},
|
||||||
accountAcl: {
|
accountAcl: {
|
||||||
addAcl: 'vn-acl-index button vn-icon[icon="add"]',
|
addAcl: 'vn-acl-index button vn-icon[icon="add"]',
|
||||||
firstAcl: 'vn-acl-index vn-list:nth-child(1)',
|
thirdAcl: 'vn-acl-index vn-list> a:nth-child(3)',
|
||||||
firstAclName: 'vn-acl-index vn-list:nth-child(1) > vn-item-section > h6',
|
deleteThirdAcl: 'vn-acl-index vn-list > a:nth-child(3) > vn-item-section > vn-icon-button[icon="delete"]',
|
||||||
deleteFirstAcl: 'vn-acl-index vn-list:nth-child(1) vn-icon-button[icon="delete"]',
|
|
||||||
role: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.principalId"]',
|
role: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.principalId"]',
|
||||||
model: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.model"]',
|
model: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.model"]',
|
||||||
property: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.property"]',
|
property: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.property"]',
|
||||||
|
@ -113,6 +112,18 @@ export default {
|
||||||
permission: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.permission"]',
|
permission: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.permission"]',
|
||||||
save: 'vn-acl-create vn-submit'
|
save: 'vn-acl-create vn-submit'
|
||||||
},
|
},
|
||||||
|
accountConnections: {
|
||||||
|
firstConnection: 'vn-connections vn-list > a:nth-child(1)',
|
||||||
|
deleteFirstConnection: 'vn-connections vn-list > a:nth-child(1) > vn-item-section > vn-icon-button[icon="exit_to_app"]'
|
||||||
|
},
|
||||||
|
accountAccounts: {
|
||||||
|
syncRoles: 'vn-account-accounts vn-button[label="Synchronize roles"]',
|
||||||
|
syncUser: 'vn-account-accounts vn-button[label="Synchronize user"]',
|
||||||
|
syncAll: 'vn-account-accounts vn-button[label="Synchronize all"]',
|
||||||
|
syncUserName: 'vn-textfield[ng-model="$ctrl.syncUser"]',
|
||||||
|
syncUserPassword: 'vn-textfield[ng-model="$ctrl.syncPassword"]',
|
||||||
|
buttonAccept: 'button[response="accept"]'
|
||||||
|
},
|
||||||
clientsIndex: {
|
clientsIndex: {
|
||||||
createClientButton: `vn-float-button`
|
createClientButton: `vn-float-button`
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
fdescribe('Account ACL path', () => {
|
describe('Account ACL path', () => {
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('sysadmin', 'account');
|
await page.loginAndModule('developer', 'account');
|
||||||
await page.accessToSection('account.acl');
|
await page.accessToSection('account.acl');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ fdescribe('Account ACL path', () => {
|
||||||
|
|
||||||
it('should create new acl', async() => {
|
it('should create new acl', async() => {
|
||||||
await page.autocompleteSearch(selectors.accountAcl.role, 'trainee');
|
await page.autocompleteSearch(selectors.accountAcl.role, 'trainee');
|
||||||
await page.autocompleteSearch(selectors.accountAcl.model, 'ACL');
|
await page.autocompleteSearch(selectors.accountAcl.model, 'Campaign');
|
||||||
await page.autocompleteSearch(selectors.accountAcl.accessType, 'WRITE');
|
await page.autocompleteSearch(selectors.accountAcl.accessType, 'WRITE');
|
||||||
await page.autocompleteSearch(selectors.accountAcl.permission, 'DENY');
|
await page.autocompleteSearch(selectors.accountAcl.permission, 'DENY');
|
||||||
await page.waitToClick(selectors.accountAcl.save);
|
await page.waitToClick(selectors.accountAcl.save);
|
||||||
|
@ -34,11 +34,11 @@ fdescribe('Account ACL path', () => {
|
||||||
|
|
||||||
it('should navigate to edit', async() => {
|
it('should navigate to edit', async() => {
|
||||||
await page.doSearch();
|
await page.doSearch();
|
||||||
await page.waitToClick(selectors.accountAcl.firstAcl);
|
await page.waitToClick(selectors.accountAcl.thirdAcl);
|
||||||
await page.waitForState('account.acl.edit');
|
await page.waitForState('account.acl.edit');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the acl', async() => {
|
it('should edit the third acl', async() => {
|
||||||
await page.autocompleteSearch(selectors.accountAcl.model, 'AccessToken');
|
await page.autocompleteSearch(selectors.accountAcl.model, 'AccessToken');
|
||||||
await page.autocompleteSearch(selectors.accountAcl.accessType, 'READ');
|
await page.autocompleteSearch(selectors.accountAcl.accessType, 'READ');
|
||||||
await page.waitToClick(selectors.accountAcl.save);
|
await page.waitToClick(selectors.accountAcl.save);
|
||||||
|
@ -47,46 +47,14 @@ fdescribe('Account ACL path', () => {
|
||||||
expect(message.text).toContain('Data saved!');
|
expect(message.text).toContain('Data saved!');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should delete the first result', async() => {
|
it('should delete the third result', async() => {
|
||||||
const firstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value');
|
const firstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText');
|
||||||
await page.waitToClick(selectors.accountAcl.deleteFirstAcl);
|
await page.waitToClick(selectors.accountAcl.deleteThirdAcl);
|
||||||
await page.reloadSection('account.acl');
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
||||||
const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value');
|
const message = await page.waitForSnackbar();
|
||||||
|
const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText');
|
||||||
|
|
||||||
|
expect(message.text).toContain('ACL removed');
|
||||||
expect(firstResult).not.toEqual(newFirstResult);
|
expect(firstResult).not.toEqual(newFirstResult);
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
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 access the employee roles inheritance 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);
|
|
||||||
});*/
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Account Connections path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
const account = 'sysadmin';
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule(account, 'account');
|
||||||
|
await page.accessToSection('account.connections');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check this is the last connection', async() => {
|
||||||
|
const firstResult = await page.waitToGetProperty(selectors.accountConnections.firstConnection, 'innerText');
|
||||||
|
|
||||||
|
expect(firstResult).toContain(account);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should kill this connection', async() => {
|
||||||
|
await page.waitToClick(selectors.accountConnections.deleteFirstConnection);
|
||||||
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Your session has expired, please login again');
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,49 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Account Connections path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('sysadmin', 'account');
|
||||||
|
await page.accessToSection('account.accounts');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should sync roles', async() => {
|
||||||
|
await page.waitToClick(selectors.accountAccounts.syncRoles);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Roles synchronized!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should sync user', async() => {
|
||||||
|
await page.waitToClick(selectors.accountAccounts.syncUser);
|
||||||
|
await page.write(selectors.accountAccounts.syncUserName, 'sysadmin');
|
||||||
|
await page.write(selectors.accountAccounts.syncUserPassword, 'nightmare');
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.accountAccounts.buttonAccept);
|
||||||
|
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('User synchronized!');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should relogin', async() => {
|
||||||
|
await page.loginAndModule('sysadmin', 'account');
|
||||||
|
await page.accessToSection('account.accounts');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should sync all', async() => {
|
||||||
|
await page.waitToClick(selectors.accountAccounts.syncAll);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain('Synchronizing in the background');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue