diff --git a/back/methods/image/specs/upload.spec.js b/back/methods/image/specs/upload.spec.js index 144770bcf..63c5cfb65 100644 --- a/back/methods/image/specs/upload.spec.js +++ b/back/methods/image/specs/upload.spec.js @@ -95,10 +95,7 @@ describe('image upload()', () => { spyOn(containerModel, 'upload'); const ctx = {req: {accessToken: {userId: hhrrId}}, - args: { - id: itemId, - collection: 'user' - } + args: {id: itemId, collection: 'user'} }; try { @@ -109,7 +106,7 @@ describe('image upload()', () => { }); it('should try to upload a file for the collection "catalog" and throw a privilege error', async() => { - const ctx = {req: {accessToken: {userId: hhrrId}}, + const ctx = {req: {accessToken: {userId: 1}}, args: { id: workerId, collection: 'catalog' diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 39e7008ca..3a416d7e3 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -79,10 +79,10 @@ module.exports = function(Self) { Self.getRoles = async(userId, options) => { const result = await Self.rawSql( `SELECT r.name - FROM account.user u - JOIN account.roleRole rr ON rr.role = u.role - JOIN account.role r ON r.id = rr.inheritsFrom - WHERE u.id = ?`, [userId], options); + FROM account.user u + JOIN account.roleRole rr ON rr.role = u.role + JOIN account.role r ON r.id = rr.inheritsFrom + WHERE u.id = ?`, [userId], options); const roles = []; for (const role of result) @@ -142,7 +142,7 @@ module.exports = function(Self) { ip: ctx.req.ip, owner: isOwner }); - throw new UserError('Try again'); + throw new UserError('Try again'); } }; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 3e12659af..33f047854 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -180,11 +180,13 @@ INSERT INTO `vn`.`warehouse`(`id`, `name`, `code`, `isComparative`, `isInventory (13, 'Inventory', 'inv', 1, 1, 1, 0, 0, 0, 2, 1, 0), (60, 'Algemesi', NULL, 1, 1, 1, 0, 0, 0, 2, 1, 0); +INSERT INTO `vn`.`sectorType` (id,description) + VALUES (1,'First type'); -INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPreparedByPacking`, `code`) +INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `code`, `typeFk`) VALUES - (1, 'First sector', 1, 1, 'FIRST'), - (2, 'Second sector', 2, 0, 'SECOND'); + (1, 'First sector', 1, 'FIRST', 1), + (2, 'Second sector', 2, 'SECOND',1); INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAddress`) VALUES @@ -194,6 +196,7 @@ INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAd UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1; + INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`) VALUES (1106, 'LGN', 'David Charles', 'Haller', 19, 432978106), @@ -659,19 +662,20 @@ INSERT INTO `vn`.`invoiceOutExpense`(`id`, `invoiceOutFk`, `amount`, `expenseFk` INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`) VALUES - (1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), - (2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), + (1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100), + (2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100), (3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), (4, 'Zone 247 B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), (5, 'Zone expensive A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), (6, 'Zone expensive B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 8, 1, 1000, 0, 100), - (7, 'Zone refund', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 23, 0, 0, 0, 100), - (8, 'Zone others', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 10, 0, 0, 0, 100), - (9, 'Zone superMan', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 2, 0, 0, 0, 100), - (10, 'Zone teleportation', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 3, 0, 0, 0, 100), - (11, 'Zone pickup C', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), - (12, 'Zone entanglement', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 4, 0, 0, 0, 100), - (13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100); + (7, 'Zone refund', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 23, 0, 1, 0, 100), + (8, 'Zone others', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 10, 0, 1, 0, 100), + (9, 'Zone superMan', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 2, 0, 1, 0, 100), + (10, 'Zone teleportation', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 3, 0, 1, 0, 100), + (11, 'Zone pickup C', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 1, 0, 100), + (12, 'Zone entanglement', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 4, 0, 1, 0, 100), + (13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 1, 0, 100); + INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) VALUES @@ -2935,7 +2939,7 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`) VALUES - (24, 7); + (24, 8); INSERT INTO `vn`.`deviceProductionModels` (`code`) VALUES diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index 992ec051f..adb2f8f72 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -49,6 +49,20 @@ async function test() { random: false, }); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + jasmine.addReporter(new SpecReporter({ + spec: { + displaySuccessful: false, + displayPending: false, + displayDuration: false, + displayFailed: true, + displayErrorMessages: true, + }, + summary: { + displayPending: false, + } + })); + await backendStatus(); jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js index 8be307269..21dbc01da 100644 --- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js +++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js @@ -8,7 +8,7 @@ describe('Ticket Edit sale path', () => { beforeAll(async() => { browser = await getBrowser(); page = browser.page; - await page.loginAndModule('salesPerson', 'ticket'); + await page.loginAndModule('developer', 'ticket'); await page.accessToSearchResult('16'); await page.accessToSection('ticket.card.sale'); }); @@ -225,7 +225,8 @@ describe('Ticket Edit sale path', () => { }); it('should show error trying to delete a ticket with a refund', async() => { - await page.accessToSearchResult('7'); + await page.loginAndModule('production', 'ticket'); + await page.accessToSearchResult('8'); await page.waitToClick(selectors.ticketDescriptor.moreMenu); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket); await page.waitToClick(selectors.globalItems.acceptButton); diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js index e6c601d7d..701e6b1b4 100644 --- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js +++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js @@ -22,17 +22,6 @@ describe('Travel basic data path', () => { await page.waitForState('travel.card.basicData'); }); - it('should throw error if try move a travel with entries', async() => { - const lastMonth = Date.vnNew(); - lastMonth.setMonth(lastMonth.getMonth() - 1); - - await page.pickDate(selectors.travelBasicData.deliveryDate, lastMonth); - await page.waitToClick(selectors.travelBasicData.save); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Cannot past travels with entries'); - }); - it('should set a wrong delivery date then receive an error on submit', async() => { await page.loginAndModule('buyer', 'travel'); await page.write(selectors.travelIndex.generalSearchFilter, '4'); diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js index c9a13b4cc..f176efd8e 100644 --- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js +++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js @@ -75,6 +75,12 @@ describe('ticket componentUpdate()', () => { } }; + console.log('entra'); + const state = await models.TicketState.findOne({ + where: {ticketFk: 11} + }); + console.log('state: ', state); + console.log('ctx: ', ctx.args); await models.Ticket.componentUpdate(ctx, options); [componentValue] = await models.SaleComponent.rawSql(componentOfSaleSeven, null, options); diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 43bc2c2d9..7931935b7 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -117,7 +117,7 @@ describe('ticket setDeleted()', () => { return value; }; - const ticketId = 7; + const ticketId = 8; await models.Ticket.setDeleted(ctx, ticketId, options); await tx.rollback(); diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index 92c01792f..97f100501 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -247,6 +247,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { const start = new Date(dated - 1); start.setHours(0, 0, 0); + await models.WorkerTimeControl.rawSql('CALL vn.timeControl_calculateByUser(?, ?, ?)', [ hankPymId, start, @@ -255,7 +256,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { let [timeControlCalculateTable] = await models.WorkerTimeControl.rawSql('SELECT * FROM tmp.timeControlCalculate', null, options); - expect(timeControlCalculateTable.timeWorkSeconds).toEqual(26400); + expect(timeControlCalculateTable.timeWorkSeconds).toEqual(25200); await tx.rollback(); } catch (e) { await tx.rollback();