diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 83b6f446f..f95adc1cf 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -415,11 +415,12 @@ export default { ticketService: { serviceButton: 'vn-left-menu a[ui-sref="ticket.card.service"]', addServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(3) > vn-icon-button > button > vn-icon', - descriptionInput: 'vn-ticket-service vn-textfield[label="Description"] input', - quantityInput: 'vn-ticket-service vn-textfield[label="Quantity"] input', - priceInput: 'vn-ticket-service vn-textfield[label="Price"] input', - vatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]', + firstDescriptionInput: 'vn-ticket-service vn-textfield[label="Description"] input', + firstQuantityInput: 'vn-ticket-service vn-textfield[label="Quantity"] input', + firstPriceInput: 'vn-ticket-service vn-textfield[label="Price"] input', + firstVatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]', fistDeleteServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(2) > vn-horizontal > vn-auto > vn-icon', + serviceLine: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(2) > vn-horizontal', saveServiceButton: `${components.vnSubmit}` }, createStateView: { diff --git a/e2e/paths/ticket-module/13_create_ticket_services.spec.js b/e2e/paths/ticket-module/13_create_ticket_services.spec.js index 29cdd543d..8f75e7389 100644 --- a/e2e/paths/ticket-module/13_create_ticket_services.spec.js +++ b/e2e/paths/ticket-module/13_create_ticket_services.spec.js @@ -11,47 +11,49 @@ describe('Ticket services path', () => { .accessToSection('ticket.card.service'); }); - it('should create a new service', async() => { + it('should edit the first service', async() => { const result = await nightmare - .waitToClick(selectors.ticketService.addServiceButton) - .write(selectors.ticketService.descriptionInput, 'my service') - .clearInput(selectors.ticketService.quantityInput) - .write(selectors.ticketService.quantityInput, 99) - .write(selectors.ticketService.priceInput, 999) - .autocompleteSearch(selectors.ticketService.vatTypeAutocomplete, 'Reduced VAT') + .clearInput(selectors.ticketService.firstDescriptionInput) + .write(selectors.ticketService.firstDescriptionInput, 'my service') + .clearInput(selectors.ticketService.firstQuantityInput) + .write(selectors.ticketService.firstQuantityInput, 99) + .clearInput(selectors.ticketService.firstPriceInput) + .write(selectors.ticketService.firstPriceInput, 999) + .autocompleteSearch(selectors.ticketService.firstVatTypeAutocomplete, 'Reduced VAT') + .waitForTextInInput(`${selectors.ticketService.firstVatTypeAutocomplete} Input`, 'Reduced VAT') .waitToClick(selectors.ticketService.saveServiceButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); - it('should confirm the service description was created correctly', async() => { + it('should confirm the service description was edited correctly', async() => { const result = await nightmare .waitToClick(selectors.ticketBasicData.basicDataButton) .wait(selectors.ticketBasicData.clientAutocomplete) .click(selectors.ticketService.serviceButton) - .waitToGetProperty(selectors.ticketService.descriptionInput, 'value'); + .waitToGetProperty(selectors.ticketService.firstDescriptionInput, 'value'); expect(result).toEqual('my service'); }); - it('should confirm the service quantity was created correctly', async() => { + it('should confirm the service quantity was edited correctly', async() => { const result = await nightmare - .waitToGetProperty(selectors.ticketService.quantityInput, 'value'); + .waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value'); expect(result).toEqual('99'); }); - it('should confirm the service price was created correctly', async() => { + it('should confirm the service price was edited correctly', async() => { const result = await nightmare - .waitToGetProperty(selectors.ticketService.priceInput, 'value'); + .waitToGetProperty(selectors.ticketService.firstPriceInput, 'value'); expect(result).toEqual('999'); }); - it('should confirm the service VAT was created correctly', async() => { + it('should confirm the service VAT was edited correctly', async() => { const result = await nightmare - .waitToGetProperty(`${selectors.ticketService.vatTypeAutocomplete} input`, 'value'); + .waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value'); expect(result).toEqual('Reduced VAT'); }); @@ -70,9 +72,9 @@ describe('Ticket services path', () => { .waitToClick(selectors.ticketBasicData.basicDataButton) .wait(selectors.ticketBasicData.clientAutocomplete) .click(selectors.ticketService.serviceButton) - .waitForNumberOfElements(selectors.ticketService.descriptionInput, 0) - .countElement(selectors.ticketService.descriptionInput); + .waitForNumberOfElements(selectors.ticketService.serviceLine, 2) + .countElement(selectors.ticketService.serviceLine); - expect(result).toEqual(0); + expect(result).toEqual(2); }); }); diff --git a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js index 492ce265d..0070d0573 100644 --- a/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js +++ b/modules/client/back/methods/client/specs/activeWorkersWithRole.spec.js @@ -17,7 +17,7 @@ describe('Client activeWorkersWithRole', () => { let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer'); - expect(result.length).toEqual(9); + expect(result.length).toEqual(10); expect(isBuyer).toBeTruthy(); }); }); diff --git a/services/db/install/changes/1.2-CHECK/02-ticketService.sql b/services/db/install/changes/1.2-CHECK/02-ticketService.sql new file mode 100644 index 000000000..408506c3d --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/02-ticketService.sql @@ -0,0 +1,12 @@ +ALTER TABLE `vn`.`ticketService` +ADD COLUMN `ticketFk` INT(11) NOT NULL AFTER `taxClassFk`; + + +ALTER TABLE `vn`.`ticketService` +ADD INDEX `fgn_ticketFk_idx` (`ticketFk` ASC); +ALTER TABLE `vn`.`ticketService` +ADD CONSTRAINT `fgn_ticketFk` + FOREIGN KEY (`ticketFk`) + REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) + ON DELETE CASCADE + ON UPDATE CASCADE; diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index e2a0e3cb4..62f8ac43d 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -1037,8 +1037,8 @@ INSERT INTO `vn`.`ticketRequest`(`id`, `description`, `requesterFk`, `atenderFk` (3, 'Object4 Armor2 2', 18, 35, 20, 3.06, 0, NULL, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY)), (4, 'Object2 Gem2 3', 18, 35, 15, 1.30, NULL, NULL, 11, CURDATE()); - - -delete from `account`.`roleRole` where role =52 and inheritsFrom = 35; - -delete from `account`.`roleInherit` where role =52 and inheritsFrom = 35; \ No newline at end of file +INSERT INTO `vn`.`ticketService`(`id`, `description`, `quantity`, `price`, `taxClassFk`, `ticketFk`) + VALUES + (1, 'delivery charge', 1, 2.00, 1, 1), + (2, 'training course', 1, 10.00, 1, 2), + (3, 'delivery charge', 1, 5.50, 1, 11); \ No newline at end of file