From d57dbe222417eae5082fee7f0de7afb87c0a9c43 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Thu, 22 Mar 2018 15:01:36 +0100 Subject: [PATCH] #208 ticket expedition e2e path plus some ticket volume files preparation and refactors --- client/ticket/routes.json | 2 +- client/ticket/src/volume/ticket-volume.html | 10 ++++ e2e/helpers/selectors.js | 5 ++ .../01_create_ticket_observations.spec.js | 2 +- .../02_delete_ticket_expeditions.spec.js | 59 +++++++++++++++++++ services/db/04-fixtures.sql | 5 +- .../common/methods/expedition/filter.js | 4 -- 7 files changed, 80 insertions(+), 7 deletions(-) create mode 100644 client/ticket/src/volume/ticket-volume.html create mode 100644 e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js diff --git a/client/ticket/routes.json b/client/ticket/routes.json index b9ee8a7f1..7115a0a39 100644 --- a/client/ticket/routes.json +++ b/client/ticket/routes.json @@ -71,7 +71,7 @@ } }, { - "url": "/expedition", + "url": "/Expedition", "state": "ticket.card.expedition", "component": "vn-ticket-expedition", "params": { diff --git a/client/ticket/src/volume/ticket-volume.html b/client/ticket/src/volume/ticket-volume.html new file mode 100644 index 000000000..17ee5c9ed --- /dev/null +++ b/client/ticket/src/volume/ticket-volume.html @@ -0,0 +1,10 @@ +
\ No newline at end of file diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ad7aa9b8b..15bde1e72 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -288,6 +288,11 @@ export default { firstDescriptionInput: `vn-textfield[label="Description"] > div > input`, submitNotesButton: `${components.vnSubmit}` }, + ticketExpedition: { + expeditionButton: `${components.vnMenuItem}[ui-sref="ticket.card.expedition"]`, + secondExpeditionRemoveButton: `body > vn-app > vn-vertical > vn-vertical > ui-view > vn-ticket-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-ticket-expedition > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(2) > vn-none > i`, + secondExpeditionText: `body > vn-app > vn-vertical > vn-vertical > ui-view > vn-ticket-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-ticket-expedition > vn-vertical > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(2)` + }, ticketPackages: { packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package"]`, firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input` diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js index dfc7053b2..9cb787642 100644 --- a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js +++ b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -describe('create item niche path', () => { +describe('create ticket notes path', () => { const nightmare = createNightmare(); beforeAll(() => { diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js new file mode 100644 index 000000000..554aa6c07 --- /dev/null +++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js @@ -0,0 +1,59 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/helpers'; + +describe('delete ticket expeditions path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + return nightmare + .waitForLogin('developer'); + }); + + it('should access to the tickets index by clicking the tickets button', () => { + return nightmare + .click(selectors.moduleAccessView.ticketsSectionButton) + .wait(selectors.ticketsIndex.createTicketButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/ticket/list'); + }); + }); + + it('should search for the ticket with id 1', () => { + return nightmare + .wait(selectors.ticketsIndex.searchTicketInput) + .type(selectors.ticketsIndex.searchTicketInput, '1') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countSearchResults(selectors.ticketsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the ticket expeditions`, () => { + return nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketExpedition.expeditionButton) + .waitForURL('Expedition') + .url() + .then(url => { + expect(url).toContain('Expedition'); + }); + }); + + it(`should delete a former expedition and confirm the remaining expedition is the expected one`, () => { + return nightmare + .waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton) + .click(selectors.ticketPackages.packagesButton) + .wait(selectors.ticketPackages.firstPackageSelect) + .click(selectors.ticketExpedition.expeditionButton) + .wait(selectors.ticketExpedition.secondExpeditionText) + .getInnerText(selectors.ticketExpedition.secondExpeditionText) + .then(value => { + expect(value).toContain('Iron Patriot'); + expect(value).toContain('root'); + }); + }); +}); diff --git a/services/db/04-fixtures.sql b/services/db/04-fixtures.sql index 5800aa9c1..de256b73f 100644 --- a/services/db/04-fixtures.sql +++ b/services/db/04-fixtures.sql @@ -401,7 +401,10 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `create VALUES ( 1, 1, 1, 0, CURDATE(), 1, 0, 2, 1), ( 2, 1, 1, 1, CURDATE(), 2, 1, 0, 2), - ( 3, 2, 2, 2, CURDATE(), 3, 2, 0, NULL); + ( 3, 2, 1, 2, CURDATE(), 3, 2, 0, NULL), + ( 4, 1, 1, 0, CURDATE(), 1, 0, 2, 1), + ( 5, 1, 1, 1, CURDATE(), 2, 1, 0, 2), + ( 6, 2, 1, 2, CURDATE(), 3, 2, 0, NULL); INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPackageReturnable`, `created`, `itemFk`, `price`) VALUES diff --git a/services/ticket/common/methods/expedition/filter.js b/services/ticket/common/methods/expedition/filter.js index 6d74c3dd8..c728c8703 100644 --- a/services/ticket/common/methods/expedition/filter.js +++ b/services/ticket/common/methods/expedition/filter.js @@ -16,10 +16,6 @@ module.exports = Self => { { relation: 'worker', scope: {fields: ['firstName', 'name']} - }, - { - relation: 'package', - scope: {fields: ['name']} }] }; }