From dbc5c6105031216c1e080c21f844fa4f0ce1a338 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 2 May 2022 14:53:03 +0200 Subject: [PATCH 01/16] fix(diver-route): supplierAgencyTerm --- print/templates/reports/driver-route/sql/routes.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/print/templates/reports/driver-route/sql/routes.sql b/print/templates/reports/driver-route/sql/routes.sql index 3fbe59b0d..4b6f6a318 100644 --- a/print/templates/reports/driver-route/sql/routes.sql +++ b/print/templates/reports/driver-route/sql/routes.sql @@ -14,5 +14,6 @@ FROM route r LEFT JOIN account.user u ON u.id = w.userFk LEFT JOIN agencyMode am ON am.id = r.agencyModeFk LEFT JOIN agency a ON a.id = am.agencyFk - LEFT JOIN supplier s ON s.id = a.supplierFk + LEFT JOIN supplierAgencyTerm sa ON sa.agencyFk = a.id + LEFT JOIN supplier s ON s.id = sa.supplierFk WHERE r.id IN(?) \ No newline at end of file From f364c19c70c704137ae592ddf2d3febd6bd131ee Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 3 May 2022 14:08:46 +0200 Subject: [PATCH 02/16] fix(monitor_client): fix scroll --- front/core/components/smart-table/index.html | 12 +++++++----- front/core/components/smart-table/index.js | 3 ++- modules/monitor/front/index/clients/index.html | 12 ++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/front/core/components/smart-table/index.html b/front/core/components/smart-table/index.html index c2af9b41e..a3295c47e 100644 --- a/front/core/components/smart-table/index.html +++ b/front/core/components/smart-table/index.html @@ -46,11 +46,13 @@
- - +
+ + +
- - +
+ + + + + Date: Wed, 4 May 2022 10:32:14 +0200 Subject: [PATCH 03/16] fix(monitor_client): clientsFilter refactor --- .../monitor/back/methods/sales-monitor/clientsFilter.js | 9 ++++----- .../methods/sales-monitor/specs/clientsFilter.spec.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js index 3d8edf608..daddf04fc 100644 --- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js +++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js @@ -43,11 +43,8 @@ module.exports = Self => { TIME(v.stamp) AS hour, DATE(v.stamp) AS dated, wtc.workerFk - FROM hedera.userSession s - JOIN hedera.visitUser v ON v.id = s.userVisitFk + FROM hedera.visitUser v JOIN client c ON c.id = v.userFk - LEFT JOIN account.user u ON c.salesPersonFk = u.id - LEFT JOIN worker w ON c.salesPersonFk = w.id LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk AND CURDATE() BETWEEN sc.started AND sc.ended LEFT JOIN workerTeamCollegues wtc @@ -58,7 +55,9 @@ module.exports = Self => { const where = filter.where; where['wtc.workerFk'] = userId; - stmt.merge(conn.makeSuffix(filter)); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(`GROUP BY clientFk, v.stamp`); + stmt.merge(conn.makePagination(filter)); return conn.executeStmt(stmt, myOptions); }; diff --git a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js index 3fcc6c91a..e7510e848 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js @@ -11,7 +11,7 @@ describe('SalesMonitor clientsFilter()', () => { const filter = {order: 'dated DESC'}; const result = await models.SalesMonitor.clientsFilter(ctx, filter, options); - expect(result.length).toEqual(9); + expect(result.length).toEqual(3); await tx.rollback(); } catch (e) { From ac4d4e6db10952ce85580b451606b5d7bd8edfc0 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 4 May 2022 10:59:37 +0200 Subject: [PATCH 04/16] test and fixtures --- db/dump/fixtures.sql | 80 ++++++++++--------- .../methods/sales-monitor/clientsFilter.js | 1 + .../sales-monitor/specs/clientsFilter.spec.js | 41 +++++++++- 3 files changed, 84 insertions(+), 38 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0849e6708..da2b12588 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1640,51 +1640,59 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) INSERT INTO `hedera`.`visit`(`id`, `firstAgentFk`) VALUES - (1, NULL), - (2, NULL), - (3, NULL), - (4, NULL), - (5, NULL), - (6, NULL), - (7, NULL), - (8, NULL), - (9, NULL); + (1, NULL), + (2, NULL), + (3, NULL), + (4, NULL), + (5, NULL), + (6, NULL), + (7, NULL), + (8, NULL), + (9, NULL), + (10, NULL), + (11, NULL); INSERT INTO `hedera`.`visitAgent`(`id`, `visitFk`) VALUES - (1, 1), - (2, 2), - (3, 3), - (4, 4), - (5, 5), - (6, 6), - (7, 7), - (8, 8), - (9, 9); + (1, 1), + (2, 2), + (3, 3), + (4, 4), + (5, 5), + (6, 6), + (7, 7), + (8, 8), + (9, 9), + (10, 10), + (11, 11); INSERT INTO `hedera`.`visitAccess`(`id`, `agentFk`, `stamp`) VALUES - (1, 1, CURDATE()), - (2, 2, CURDATE()), - (3, 3, CURDATE()), - (4, 4, CURDATE()), - (5, 5, CURDATE()), - (6, 6, CURDATE()), - (7, 7, CURDATE()), - (8, 8, CURDATE()), - (9, 9, CURDATE()); + (1, 1, CURDATE()), + (2, 2, CURDATE()), + (3, 3, CURDATE()), + (4, 4, CURDATE()), + (5, 5, CURDATE()), + (6, 6, CURDATE()), + (7, 7, CURDATE()), + (8, 8, CURDATE()), + (9, 9, CURDATE()), + (10, 10, CURDATE()), + (11, 11, CURDATE()); INSERT INTO `hedera`.`visitUser`(`id`, `accessFk`, `userFk`, `stamp`) VALUES - (1, 1, 1101, CURDATE()), - (2, 2, 1101, CURDATE()), - (3, 3, 1101, CURDATE()), - (4, 4, 1102, CURDATE()), - (5, 5, 1102, CURDATE()), - (6, 6, 1102, CURDATE()), - (7, 7, 1103, CURDATE()), - (8, 8, 1103, CURDATE()), - (9, 9, 1103, CURDATE()); + (1, 1, 1101, CURDATE()), + (2, 2, 1101, CURDATE()), + (3, 3, 1101, CURDATE()), + (4, 4, 1102, CURDATE()), + (5, 5, 1102, CURDATE()), + (6, 6, 1102, CURDATE()), + (7, 7, 1103, CURDATE()), + (8, 8, 1103, CURDATE()), + (9, 9, 1103, CURDATE()), + (10, 10, 1102, DATE_SUB(CURDATE(), INTERVAL 1 DAY)), + (11, 11, 1103, DATE_SUB(CURDATE(), INTERVAL 1 DAY)); INSERT INTO `hedera`.`userSession`(`created`, `lastUpdate`, `ssid`, `data`, `userVisitFk`) VALUES diff --git a/modules/monitor/back/methods/sales-monitor/clientsFilter.js b/modules/monitor/back/methods/sales-monitor/clientsFilter.js index daddf04fc..a08125551 100644 --- a/modules/monitor/back/methods/sales-monitor/clientsFilter.js +++ b/modules/monitor/back/methods/sales-monitor/clientsFilter.js @@ -45,6 +45,7 @@ module.exports = Self => { wtc.workerFk FROM hedera.visitUser v JOIN client c ON c.id = v.userFk + JOIN account.user u ON c.salesPersonFk = u.id LEFT JOIN sharingCart sc ON sc.workerFk = c.salesPersonFk AND CURDATE() BETWEEN sc.started AND sc.ended LEFT JOIN workerTeamCollegues wtc diff --git a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js index e7510e848..bcb37830c 100644 --- a/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js +++ b/modules/monitor/back/methods/sales-monitor/specs/clientsFilter.spec.js @@ -6,9 +6,18 @@ describe('SalesMonitor clientsFilter()', () => { try { const options = {transaction: tx}; - const ctx = {req: {accessToken: {userId: 18}}, args: {}}; - const filter = {order: 'dated DESC'}; + + const from = new Date(); + const to = new Date(); + from.setHours(0, 0, 0, 0); + to.setHours(23, 59, 59, 59); + + const filter = { + where: { + 'v.stamp': {between: [from, to]} + } + }; const result = await models.SalesMonitor.clientsFilter(ctx, filter, options); expect(result.length).toEqual(3); @@ -19,4 +28,32 @@ describe('SalesMonitor clientsFilter()', () => { throw e; } }); + + it('should return the clients web activity filtered', async() => { + const tx = await models.SalesMonitor.beginTransaction({}); + + try { + const options = {transaction: tx}; + const ctx = {req: {accessToken: {userId: 18}}, args: {}}; + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + const today = new Date(); + yesterday.setHours(0, 0, 0, 0); + today.setHours(23, 59, 59, 59); + + const filter = { + where: { + 'v.stamp': {between: [yesterday, today]} + } + }; + const result = await models.SalesMonitor.clientsFilter(ctx, filter, options); + + expect(result.length).toEqual(5); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); }); From 70aca5d11adfe7c3e54c9cb14e518b0e2a4a975a Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 5 May 2022 13:25:57 +0200 Subject: [PATCH 05/16] fix(worker): fix getMonth --- modules/worker/back/methods/worker/createAbsence.js | 3 ++- modules/worker/back/methods/worker/deleteAbsence.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index 44bda5627..fbbd97762 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -135,7 +135,8 @@ module.exports = Self => { function formatDate(date) { let day = date.getDate(); if (day < 10) day = `0${day}`; - let month = date.getMonth(); + let month = date.getMonth() + 1; + console.log(month); if (month < 10) month = `0${month}`; let year = date.getFullYear(); diff --git a/modules/worker/back/methods/worker/deleteAbsence.js b/modules/worker/back/methods/worker/deleteAbsence.js index 72e9243d9..45dc04b2d 100644 --- a/modules/worker/back/methods/worker/deleteAbsence.js +++ b/modules/worker/back/methods/worker/deleteAbsence.js @@ -87,7 +87,7 @@ module.exports = Self => { function formatDate(date) { let day = date.getDate(); if (day < 10) day = `0${day}`; - let month = date.getMonth(); + let month = date.getMonth() + 1; if (month < 10) month = `0${month}`; let year = date.getFullYear(); From 1e3b05a95dfaba4668899c7f4fb5c13f012e4ece Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 5 May 2022 13:32:34 +0200 Subject: [PATCH 06/16] remove console.log --- modules/worker/back/methods/worker/createAbsence.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index fbbd97762..957bcc15f 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -136,7 +136,6 @@ module.exports = Self => { let day = date.getDate(); if (day < 10) day = `0${day}`; let month = date.getMonth() + 1; - console.log(month); if (month < 10) month = `0${month}`; let year = date.getFullYear(); From 798147ea99731408f0bdd16ffa2d252e876c4166 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 5 May 2022 14:40:13 +0200 Subject: [PATCH 07/16] jenkins error --- modules/worker/back/methods/worker/createAbsence.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/worker/back/methods/worker/createAbsence.js b/modules/worker/back/methods/worker/createAbsence.js index 957bcc15f..82cb5038e 100644 --- a/modules/worker/back/methods/worker/createAbsence.js +++ b/modules/worker/back/methods/worker/createAbsence.js @@ -135,6 +135,7 @@ module.exports = Self => { function formatDate(date) { let day = date.getDate(); if (day < 10) day = `0${day}`; + let month = date.getMonth() + 1; if (month < 10) month = `0${month}`; let year = date.getFullYear(); From d34a8629f74e54760cdeae95ba1bd11139547b44 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 6 May 2022 13:09:37 +0200 Subject: [PATCH 08/16] fix(setSaleQuantity): save originalQuantity --- back/methods/collection/setSaleQuantity.js | 12 +++++++----- .../methods/collection/spec/setSaleQuantity.spec.js | 11 ++--------- modules/ticket/back/models/sale.json | 13 ++++++++----- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/back/methods/collection/setSaleQuantity.js b/back/methods/collection/setSaleQuantity.js index 82451b8be..644c44a60 100644 --- a/back/methods/collection/setSaleQuantity.js +++ b/back/methods/collection/setSaleQuantity.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('setSaleQuantity', { + Self.remoteMethod('setSaleQuantity', { description: 'Update sale quantity', accessType: 'WRITE', accepts: [{ @@ -24,11 +24,13 @@ module.exports = Self => { } }); - Self.setSaleQuantity = async ctx => { - const args = ctx.args; + Self.setSaleQuantity = async(saleId, quantity) => { const models = Self.app.models; - const sale = await models.Sale.findById(args.saleId,); - return await sale.updateAttribute('quantity', args.quantity); + const sale = await models.Sale.findById(saleId); + return await sale.updateAttributes({ + originalQuantity: sale.quantity, + quantity: quantity + }); }; }; diff --git a/back/methods/collection/spec/setSaleQuantity.spec.js b/back/methods/collection/spec/setSaleQuantity.spec.js index 4e3c8c4aa..5d06a4383 100644 --- a/back/methods/collection/spec/setSaleQuantity.spec.js +++ b/back/methods/collection/spec/setSaleQuantity.spec.js @@ -5,19 +5,12 @@ describe('setSaleQuantity()', () => { const saleId = 30; const newQuantity = 10; - const ctx = { - args: { - saleId: saleId, - quantity: newQuantity - } - }; - const originalSale = await models.Sale.findById(saleId); - await models.Collection.setSaleQuantity(ctx); + await models.Collection.setSaleQuantity(saleId, newQuantity); const updateSale = await models.Sale.findById(saleId); - expect(updateSale.quantity).toBeLessThan(originalSale.quantity); + expect(updateSale.originalQuantity).toEqual(originalSale.quantity); expect(updateSale.quantity).toEqual(newQuantity); }); }); diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json index 767a3e59e..14a6bc2cf 100644 --- a/modules/ticket/back/models/sale.json +++ b/modules/ticket/back/models/sale.json @@ -14,7 +14,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "concept": { @@ -22,22 +22,25 @@ "required": true }, "quantity": { - "type": "Number" + "type": "number" }, "price": { - "type": "Number" + "type": "number" }, "discount": { - "type": "Number" + "type": "number" }, "reserved": { "type": "boolean" }, "isPicked": { - "type": "Number" + "type": "number" }, "created": { "type": "date" + }, + "originalQuantity":{ + "type": "number" } }, "relations": { From 4a9c5742c035e78229b9a764727390859c16f7b2 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 17 May 2022 13:50:06 +0200 Subject: [PATCH 09/16] fix(entry_latest-buys): fix multi_check --- .../core/components/multi-check/multi-check.js | 7 ++++--- .../back/methods/entry/latestBuysFilter.js | 3 --- modules/entry/front/latest-buys/index.html | 4 ++-- modules/entry/front/latest-buys/index.js | 18 ++++++++++++++++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 077c93360..041603f13 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -146,16 +146,17 @@ export default class MultiCheck extends FormInput { if (!this.model || !this.model.data) return; const data = this.model.data; - const modelParams = this.model.userParams; const params = { filter: { - modelParams: modelParams, limit: null } }; + if (this.model.userFilter) + Object.assign(params.filter, this.model.userFilter); + if (this.model.userParams) + Object.assign(params, this.model.userParams); this.rows = data.length; - this.$http.get(this.model.url, {params}) .then(res => { this.allRowsCount = res.data.length; diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 9693670c8..6399faa52 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -98,9 +98,6 @@ module.exports = Self => { Self.latestBuysFilter = async(ctx, filter, options) => { const myOptions = {}; - if (filter && filter.modelParams) - ctx.args = filter.modelParams; - if (typeof options == 'object') Object.assign(myOptions, options); diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index a4d6f7e83..adeda5e56 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -148,12 +148,12 @@ - {{::buy.packing | dashIfEmpty}} + {{::buy.packing | dashIfEmpty}} - {{::buy.grouping | dashIfEmpty}} + {{::buy.grouping | dashIfEmpty}} {{::buy.quantity}} diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index 44c29cb11..ec1109b81 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -159,8 +159,22 @@ export default class Controller extends Section { lines: rowsToEdit }; - if (this.checkedDummyCount && this.checkedDummyCount > 0) - data.filter = this.$.model.userParams; + if (this.checkedDummyCount && this.checkedDummyCount > 0) { + const params = {}; + if (this.$.model.userParams) { + const userParams = this.$.model.userParams; + for (let param in userParams) { + let newParam = this.exprBuilder(param, userParams[param]); + if (!newParam) + newParam = {[param]: userParams[param]}; + Object.assign(params, newParam); + } + } + if (this.$.model.userFilter) + Object.assign(params, this.$.model.userFilter.where); + + data.filter = params; + } return this.$http.post('Buys/editLatestBuys', data) .then(() => { From 89baf636467786cc40e63255cf0e191309ce1795 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 17 May 2022 15:19:54 +0200 Subject: [PATCH 10/16] feat(account): add e2e acl --- e2e/helpers/selectors.js | 12 ++++ e2e/paths/14-account/04_acl.spec.js | 92 +++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 e2e/paths/14-account/04_acl.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 29176489c..343a88f5c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -101,6 +101,18 @@ export default { email: 'vn-user-mail-forwarding vn-textfield[ng-model="data.forwardTo"]', save: 'vn-user-mail-forwarding vn-submit' }, + accountAcl: { + addAcl: 'vn-acl-index button vn-icon[icon="add"]', + firstAcl: 'vn-acl-index vn-list:nth-child(1)', + firstAclName: 'vn-acl-index vn-list:nth-child(1) > vn-item-section > h6', + 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"]', + model: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.model"]', + property: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.property"]', + accessType: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.accessType"]', + permission: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.permission"]', + save: 'vn-acl-create vn-submit' + }, clientsIndex: { createClientButton: `vn-float-button` }, diff --git a/e2e/paths/14-account/04_acl.spec.js b/e2e/paths/14-account/04_acl.spec.js new file mode 100644 index 000000000..f745f8114 --- /dev/null +++ b/e2e/paths/14-account/04_acl.spec.js @@ -0,0 +1,92 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +fdescribe('Account ACL path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSection('account.acl'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should go to create new acl', async() => { + await page.waitToClick(selectors.accountAcl.addAcl); + await page.waitForState('account.acl.create'); + }); + + it('should create new acl', async() => { + await page.autocompleteSearch(selectors.accountAcl.role, 'trainee'); + await page.autocompleteSearch(selectors.accountAcl.model, 'ACL'); + await page.autocompleteSearch(selectors.accountAcl.accessType, 'WRITE'); + await page.autocompleteSearch(selectors.accountAcl.permission, 'DENY'); + await page.waitToClick(selectors.accountAcl.save); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it('should navigate to edit', async() => { + await page.doSearch(); + await page.waitToClick(selectors.accountAcl.firstAcl); + await page.waitForState('account.acl.edit'); + }); + + it('should edit the acl', async() => { + await page.autocompleteSearch(selectors.accountAcl.model, 'AccessToken'); + await page.autocompleteSearch(selectors.accountAcl.accessType, 'READ'); + await page.waitToClick(selectors.accountAcl.save); + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); + + it('should delete the first result', async() => { + const firstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value'); + await page.waitToClick(selectors.accountAcl.deleteFirstAcl); + await page.reloadSection('account.acl'); + const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value'); + + 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); + });*/ +}); From 34bcdf1bd33b9c0fcedf64ed0976dc5844efc059 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 18 May 2022 14:01:30 +0200 Subject: [PATCH 11/16] test(account): acl, connections and accounts secctions --- back/methods/chat/sendCheckingPresence.js | 2 +- db/dump/fixtures.sql | 4 ++ e2e/helpers/selectors.js | 17 +++++-- e2e/paths/14-account/04_acl.spec.js | 56 +++++---------------- e2e/paths/14-account/05_connections.spec.js | 33 ++++++++++++ e2e/paths/14-account/06_accounts.spec.js | 49 ++++++++++++++++++ 6 files changed, 113 insertions(+), 48 deletions(-) create mode 100644 e2e/paths/14-account/05_connections.spec.js create mode 100644 e2e/paths/14-account/06_accounts.spec.js diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 6560240c6..2217aaee2 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -46,7 +46,7 @@ module.exports = Self => { const {data} = await Self.getUserStatus(recipient.name); if (data) { - if (data.status === 'offline' || data.status === 'busy') { + if (data.status === 'offline' || data.status === 'busy') { // Send message to department room const workerDepartment = await models.WorkerDepartment.findById(recipientId, { include: { diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c329e4c6e..0da3a7a31 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2544,3 +2544,7 @@ INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackage (3, 2, 0, 15.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); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES + ('UserAccount', '*', '*', 'ALLOW', 'ROLE', 'sysadmin'); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 343a88f5c..44facb13b 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -103,9 +103,8 @@ export default { }, accountAcl: { addAcl: 'vn-acl-index button vn-icon[icon="add"]', - firstAcl: 'vn-acl-index vn-list:nth-child(1)', - firstAclName: 'vn-acl-index vn-list:nth-child(1) > vn-item-section > h6', - deleteFirstAcl: 'vn-acl-index vn-list:nth-child(1) vn-icon-button[icon="delete"]', + thirdAcl: 'vn-acl-index vn-list> a:nth-child(3)', + deleteThirdAcl: 'vn-acl-index vn-list > a:nth-child(3) > vn-item-section > vn-icon-button[icon="delete"]', role: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.principalId"]', model: 'vn-acl-create vn-autocomplete[ng-model="$ctrl.acl.model"]', 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"]', 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: { createClientButton: `vn-float-button` }, diff --git a/e2e/paths/14-account/04_acl.spec.js b/e2e/paths/14-account/04_acl.spec.js index f745f8114..f86267d25 100644 --- a/e2e/paths/14-account/04_acl.spec.js +++ b/e2e/paths/14-account/04_acl.spec.js @@ -1,14 +1,14 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Account ACL path', () => { +describe('Account ACL path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('sysadmin', 'account'); + await page.loginAndModule('developer', 'account'); await page.accessToSection('account.acl'); }); @@ -23,7 +23,7 @@ fdescribe('Account ACL path', () => { it('should create new acl', async() => { 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.permission, 'DENY'); await page.waitToClick(selectors.accountAcl.save); @@ -34,11 +34,11 @@ fdescribe('Account ACL path', () => { it('should navigate to edit', async() => { await page.doSearch(); - await page.waitToClick(selectors.accountAcl.firstAcl); + await page.waitToClick(selectors.accountAcl.thirdAcl); 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.accessType, 'READ'); await page.waitToClick(selectors.accountAcl.save); @@ -47,46 +47,14 @@ fdescribe('Account ACL path', () => { expect(message.text).toContain('Data saved!'); }); - it('should delete the first result', async() => { - const firstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value'); - await page.waitToClick(selectors.accountAcl.deleteFirstAcl); - await page.reloadSection('account.acl'); - const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.firstAclName, 'value'); + it('should delete the third result', async() => { + const firstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); + await page.waitToClick(selectors.accountAcl.deleteThirdAcl); + await page.waitToClick(selectors.globalItems.acceptButton); + 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); }); - /* - 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); - });*/ }); diff --git a/e2e/paths/14-account/05_connections.spec.js b/e2e/paths/14-account/05_connections.spec.js new file mode 100644 index 000000000..e0282639a --- /dev/null +++ b/e2e/paths/14-account/05_connections.spec.js @@ -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'); + }); +}); diff --git a/e2e/paths/14-account/06_accounts.spec.js b/e2e/paths/14-account/06_accounts.spec.js new file mode 100644 index 000000000..eab32c81b --- /dev/null +++ b/e2e/paths/14-account/06_accounts.spec.js @@ -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'); + }); +}); From 68c94ec3c13e89b2e916b68ca3e240c17a59628c Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 18 May 2022 15:02:06 +0200 Subject: [PATCH 12/16] typo --- e2e/paths/14-account/06_accounts.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/14-account/06_accounts.spec.js b/e2e/paths/14-account/06_accounts.spec.js index eab32c81b..83893e0cf 100644 --- a/e2e/paths/14-account/06_accounts.spec.js +++ b/e2e/paths/14-account/06_accounts.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('Account Connections path', () => { +describe('Account Accounts path', () => { let browser; let page; From 3650567caf3896a4a61b7b731da8df6c8928b9a3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 19 May 2022 15:02:39 +0200 Subject: [PATCH 13/16] test(account): e2e for ldap and samba --- e2e/helpers/selectors.js | 18 +++++++++++++++ e2e/paths/14-account/07_ldap.spec.js | 32 +++++++++++++++++++++++++++ e2e/paths/14-account/08_samba.spec.js | 32 +++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 e2e/paths/14-account/07_ldap.spec.js create mode 100644 e2e/paths/14-account/08_samba.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 44facb13b..770911d0e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -124,6 +124,24 @@ export default { syncUserPassword: 'vn-textfield[ng-model="$ctrl.syncPassword"]', buttonAccept: 'button[response="accept"]' }, + accountLdap: { + checkEnable: 'vn-account-ldap vn-check[ng-model="watcher.hasData"]', + server: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.server"]', + rdn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.rdn"]', + password: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.password"]', + userDn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.userDn"]', + groupDn: 'vn-account-ldap vn-textfield[ng-model="$ctrl.config.groupDn"]', + save: 'vn-account-ldap vn-submit' + }, + accountSamba: { + checkEnable: 'vn-account-samba vn-check[ng-model="watcher.hasData"]', + adDomain: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adDomain"]', + adController: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adController"]', + adUser: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adUser"]', + adPassword: 'vn-account-samba vn-textfield[ng-model="$ctrl.config.adPassword"]', + verifyCert: 'vn-account-samba vn-check[ng-model="$ctrl.config.verifyCert"]', + save: 'vn-account-samba vn-submit' + }, clientsIndex: { createClientButton: `vn-float-button` }, diff --git a/e2e/paths/14-account/07_ldap.spec.js b/e2e/paths/14-account/07_ldap.spec.js new file mode 100644 index 000000000..a3b8137d3 --- /dev/null +++ b/e2e/paths/14-account/07_ldap.spec.js @@ -0,0 +1,32 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Account LDAP path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSection('account.ldap'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should set data and save', async() => { + await page.waitToClick(selectors.accountLdap.checkEnable); + await page.write(selectors.accountLdap.server, '1234'); + await page.write(selectors.accountLdap.rdn, '1234'); + await page.write(selectors.accountLdap.password, 'nightmare'); + await page.write(selectors.accountLdap.userDn, 'sysadmin'); + await page.write(selectors.accountLdap.groupDn, '1234'); + await page.waitToClick(selectors.accountLdap.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); +}); diff --git a/e2e/paths/14-account/08_samba.spec.js b/e2e/paths/14-account/08_samba.spec.js new file mode 100644 index 000000000..c3db026dc --- /dev/null +++ b/e2e/paths/14-account/08_samba.spec.js @@ -0,0 +1,32 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Account Samba path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('sysadmin', 'account'); + await page.accessToSection('account.samba'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should set data and save', async() => { + await page.waitToClick(selectors.accountSamba.checkEnable); + await page.write(selectors.accountSamba.adDomain, '1234'); + await page.write(selectors.accountSamba.adController, '1234'); + await page.write(selectors.accountSamba.adUser, 'nightmare'); + await page.write(selectors.accountSamba.adPassword, 'sysadmin'); + await page.waitToClick(selectors.accountSamba.verifyCert); + await page.waitToClick(selectors.accountSamba.save); + + const message = await page.waitForSnackbar(); + + expect(message.text).toContain('Data saved!'); + }); +}); From 7a69d53642eb2e2d0274a8afb65953d8a30daa94 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 24 May 2022 14:50:33 +0200 Subject: [PATCH 14/16] fix(changes): add reference table --- db/changes/10451-april/00-invoiceOut_queue.sql | 14 -------------- .../00-ClientUnpaid.sql | 2 +- db/changes/10461-mother/00-invoiceOut_queue.sql | 8 ++++++++ 3 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 db/changes/10451-april/00-invoiceOut_queue.sql rename db/changes/{10451-april => 10461-mother}/00-ClientUnpaid.sql (87%) create mode 100644 db/changes/10461-mother/00-invoiceOut_queue.sql diff --git a/db/changes/10451-april/00-invoiceOut_queue.sql b/db/changes/10451-april/00-invoiceOut_queue.sql deleted file mode 100644 index f60bcab77..000000000 --- a/db/changes/10451-april/00-invoiceOut_queue.sql +++ /dev/null @@ -1,14 +0,0 @@ -create table `vn`.`invoiceOut_queue` -( - invoiceFk int(10) unsigned not null, - queued datetime default now() not null, - printed datetime null, - `status` VARCHAR(50) default '' null, - constraint invoiceOut_queue_pk - primary key (invoiceFk), - constraint invoiceOut_queue_invoiceOut_id_fk - foreign key (invoiceFk) references invoiceOut (id) - on update cascade on delete cascade -) - comment 'Queue for PDF invoicing'; - diff --git a/db/changes/10451-april/00-ClientUnpaid.sql b/db/changes/10461-mother/00-ClientUnpaid.sql similarity index 87% rename from db/changes/10451-april/00-ClientUnpaid.sql rename to db/changes/10461-mother/00-ClientUnpaid.sql index d84fe494a..9b30bb8fc 100644 --- a/db/changes/10451-april/00-ClientUnpaid.sql +++ b/db/changes/10461-mother/00-ClientUnpaid.sql @@ -3,7 +3,7 @@ CREATE TABLE `vn`.`clientUnpaid` ( `dated` date NOT NULL, `amount` double DEFAULT 0, PRIMARY KEY (`clientFk`), - CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE + CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE ); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) diff --git a/db/changes/10461-mother/00-invoiceOut_queue.sql b/db/changes/10461-mother/00-invoiceOut_queue.sql new file mode 100644 index 000000000..013e3b784 --- /dev/null +++ b/db/changes/10461-mother/00-invoiceOut_queue.sql @@ -0,0 +1,8 @@ +CREATE TABLE `vn`.`invoiceOut_queue` ( + `invoiceFk` int(10) unsigned not null, + `queued` datetime default now() not null, + `printed` datetime null, + `status` VARCHAR(50) DEFAULT '' NULL, + CONSTRAINT `invoiceOut_queue_pk` PRIMARY KEY (`invoiceFk`), + CONSTRAINT `invoiceOut_queue_invoiceOut_id_fk` FOREIGN KEY (`invoiceFk`) REFERENCES `vn`.`invoiceOut` (`id`) ON UPDATE CASCADE ON DELETE CASCADE +) comment 'Queue for PDF invoicing'; \ No newline at end of file From 47ab4fc2c111b97daa6df244ef85c6762b691232 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 24 May 2022 14:52:26 +0200 Subject: [PATCH 15/16] intro --- db/changes/10461-mother/00-ClientUnpaid.sql | 2 +- db/changes/10461-mother/00-invoiceOut_queue.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/changes/10461-mother/00-ClientUnpaid.sql b/db/changes/10461-mother/00-ClientUnpaid.sql index 9b30bb8fc..16deedace 100644 --- a/db/changes/10461-mother/00-ClientUnpaid.sql +++ b/db/changes/10461-mother/00-ClientUnpaid.sql @@ -7,4 +7,4 @@ CREATE TABLE `vn`.`clientUnpaid` ( ); INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) - VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative'); \ No newline at end of file + VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative'); diff --git a/db/changes/10461-mother/00-invoiceOut_queue.sql b/db/changes/10461-mother/00-invoiceOut_queue.sql index 013e3b784..2b9f45e0f 100644 --- a/db/changes/10461-mother/00-invoiceOut_queue.sql +++ b/db/changes/10461-mother/00-invoiceOut_queue.sql @@ -5,4 +5,4 @@ CREATE TABLE `vn`.`invoiceOut_queue` ( `status` VARCHAR(50) DEFAULT '' NULL, CONSTRAINT `invoiceOut_queue_pk` PRIMARY KEY (`invoiceFk`), CONSTRAINT `invoiceOut_queue_invoiceOut_id_fk` FOREIGN KEY (`invoiceFk`) REFERENCES `vn`.`invoiceOut` (`id`) ON UPDATE CASCADE ON DELETE CASCADE -) comment 'Queue for PDF invoicing'; \ No newline at end of file +) comment 'Queue for PDF invoicing'; From 1b061852d2e97c1a943d4e8697b8cb786e4ff991 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 25 May 2022 08:27:26 +0200 Subject: [PATCH 16/16] fix e2e --- e2e/paths/14-account/04_acl.spec.js | 16 ++++++++-------- e2e/paths/14-account/05_connections.spec.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e/paths/14-account/04_acl.spec.js b/e2e/paths/14-account/04_acl.spec.js index f86267d25..c400dbfb2 100644 --- a/e2e/paths/14-account/04_acl.spec.js +++ b/e2e/paths/14-account/04_acl.spec.js @@ -22,10 +22,10 @@ describe('Account ACL path', () => { }); it('should create new acl', async() => { - await page.autocompleteSearch(selectors.accountAcl.role, 'trainee'); - await page.autocompleteSearch(selectors.accountAcl.model, 'Campaign'); - await page.autocompleteSearch(selectors.accountAcl.accessType, 'WRITE'); - await page.autocompleteSearch(selectors.accountAcl.permission, 'DENY'); + await page.autocompleteSearch(selectors.accountAcl.role, 'sysadmin'); + await page.autocompleteSearch(selectors.accountAcl.model, 'UserAccount'); + await page.autocompleteSearch(selectors.accountAcl.accessType, '*'); + await page.autocompleteSearch(selectors.accountAcl.permission, 'ALLOW'); await page.waitToClick(selectors.accountAcl.save); const message = await page.waitForSnackbar(); @@ -39,7 +39,7 @@ describe('Account ACL path', () => { }); it('should edit the third acl', async() => { - await page.autocompleteSearch(selectors.accountAcl.model, 'AccessToken'); + await page.autocompleteSearch(selectors.accountAcl.model, 'Supplier'); await page.autocompleteSearch(selectors.accountAcl.accessType, 'READ'); await page.waitToClick(selectors.accountAcl.save); const message = await page.waitForSnackbar(); @@ -48,13 +48,13 @@ describe('Account ACL path', () => { }); it('should delete the third result', async() => { - const firstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); + const result = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); await page.waitToClick(selectors.accountAcl.deleteThirdAcl); await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar(); - const newFirstResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); + const newResult = await page.waitToGetProperty(selectors.accountAcl.thirdAcl, 'innerText'); expect(message.text).toContain('ACL removed'); - expect(firstResult).not.toEqual(newFirstResult); + expect(result).not.toEqual(newResult); }); }); diff --git a/e2e/paths/14-account/05_connections.spec.js b/e2e/paths/14-account/05_connections.spec.js index e0282639a..89b286101 100644 --- a/e2e/paths/14-account/05_connections.spec.js +++ b/e2e/paths/14-account/05_connections.spec.js @@ -23,7 +23,7 @@ describe('Account Connections path', () => { expect(firstResult).toContain(account); }); - it('should kill this connection', async() => { + it('should kill this connection and then get redirected to the login page', async() => { await page.waitToClick(selectors.accountConnections.deleteFirstConnection); await page.waitToClick(selectors.globalItems.acceptButton); const message = await page.waitForSnackbar();