From 63febf8bd0d491ff87545363e654b28d81d07e50 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 19 Jun 2019 09:03:45 +0200 Subject: [PATCH] #1537 refactor fixtures + e2e fixes --- db/dump/fixtures.sql | 28 +++---- e2e/helpers/extensions.js | 2 +- e2e/helpers/nightmare.js | 2 - e2e/helpers/selectors.js | 12 ++- .../05-ticket-module/01_observations.spec.js | 16 +++- e2e/paths/05-ticket-module/03_sale.spec.js | 10 +-- e2e/paths/05-ticket-module/11_diary.spec.js | 15 ++-- .../05-ticket-module/12_descriptor.spec.js | 32 ++++---- .../01_edit_basic_data.spec.js | 24 ++++-- e2e/paths/08-route-module/03_tickets.spec.js | 20 +---- .../01_descriptor.spec.js | 22 ++--- gulpfile.js | 9 ++ loopback/locale/en.json | 4 +- modules/ticket/front/sale/index.html | 2 +- package-lock.json | 82 +++++++++++++------ package.json | 2 +- 16 files changed, 152 insertions(+), 130 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index ae1838ef3..01a8420fe 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -424,28 +424,28 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) VALUES (1 , 3, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Bat cave', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (2 , 1, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (3 , 1, 2, 2, 1, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), (4 , 3, 2, 2, 1, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (5 , 3, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (6 , 1, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (7 , NULL, 4, 4, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, 'T4444444', 0, CURDATE()), + (5 , 3, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 104, 'Stark tower', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (6 , 1, 3, 3, 1, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 101, 'Mountain Drive Gotham', 1, 'A1111111', 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), + (7 , NULL, 4, 4, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Mountain Drive Gotham', 1, NULL, 0, CURDATE()), (8 , NULL, 1, 1, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 101, 'Bat cave', 121, NULL, 0, CURDATE()), - (9 , NULL, 1, 5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, 'A1111111', 0, CURDATE()), - (10, 1, 1, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, 'A1111111', 0, CURDATE()), + (9 , NULL, 1, 5, 2, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Stark tower', 124, NULL, 0, CURDATE()), + (10, 1, 1, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'Ingram Street', 2, NULL, 0, CURDATE()), (11, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 102, 'NY roofs', 122, NULL, 0, CURDATE()), - (12, 1, 1, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Clinton Street', 3, NULL, 0, CURDATE()), - (13, 1, 2, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, CURDATE()), + (12, 1, 1, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, CURDATE()), + (13, 1, 1, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 103, 'Phone Box', 123, NULL, 0, CURDATE()), (14, 1, 2, 2, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 104, 'Malibu Point', 4, NULL, 0, CURDATE()), (15, 1, 3, 3, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 105, 'Plastic Cell', 125, NULL, 0, CURDATE()), (16, 1, 7, 1, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 106, 'Many Places', 126, NULL, 0, CURDATE()), (17, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 107, 'Your pocket', 127, NULL, 0, CURDATE()), (18, 1, 4, 4, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 108, 'Cerebro', 128, NULL, 0, CURDATE()), - (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Luke Cage Bar', 129, NULL, 0, CURDATE()), - (20, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere Thailand', 101, NULL, 0, CURDATE()), - (21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere Holland', 102, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), - (22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere Japan', 103, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); - + (19, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, CURDATE()), + (20, 1, 5, 5, 3, CURDATE(), DATE_ADD(CURDATE(), INTERVAL + 1 DAY), 109, 'Somewhere in Thailand', 129, NULL, 0, CURDATE()), + (21, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Holland', 102, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)), + (22, NULL, 5, 5, NULL, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(DATE_ADD(CURDATE(),INTERVAL +1 MONTH), INTERVAL +1 DAY), 109, 'Somewhere in Japan', 103, NULL, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)); +ccc INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`) VALUES (1, 1, 1, 'ready'), @@ -482,7 +482,7 @@ INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `crea INSERT INTO `vn`.`stowaway`(`id`, `shipFk`, `created`) VALUES - (19, 20, CURDATE()); + (12, 13, CURDATE()); INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`) VALUES diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 2b53d88b2..19a579127 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -398,7 +398,7 @@ let actions = { }, autocompleteSearch: function(autocompleteSelector, searchValue, done) { - this.wait(autocompleteSelector) + this.wait(`${autocompleteSelector} input`) .waitToClick(`${autocompleteSelector} input`) .write(`${autocompleteSelector} vn-drop-down input`, searchValue) .waitToClick(`${autocompleteSelector} li.active`) diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js index 664af43c9..7b579eb08 100644 --- a/e2e/helpers/nightmare.js +++ b/e2e/helpers/nightmare.js @@ -1,6 +1,4 @@ -/* eslint no-console: 0 */ const Nightmare = require('nightmare'); - let nightmare; module.exports = function createNightmare(width = 1280, height = 720) { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index e96f57714..9201c90ec 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -9,7 +9,7 @@ export default { ticketsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="ticket.index"]', invoiceOutButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="invoiceOut.index"]', claimsButton: 'vn-main-menu [vn-id="apps-menu"] ul > li[ui-sref="claim.index"]', - returnToModuleIndexButton: `a[translate-attr="{title: 'Return to module index'}"]`, + returnToModuleIndexButton: 'a[ui-sref="order.index"]', userMenuButton: 'vn-topbar #user', userLocalWarehouse: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localWarehouseFk"]', userLocalBank: 'vn-topbar vn-popover vn-autocomplete[field="$ctrl.localBankFk"]', @@ -19,7 +19,7 @@ export default { userConfigFirstAutocompleteClear: '#localWarehouse > div > div > div > vn-icon.clear', userConfigSecondAutocompleteClear: '#localBank > div > div > div > vn-icon.clear', userConfigThirdAutocompleteClear: '#localCompany > div > div > div > vn-icon.clear', - acceptVnConfirm: 'vn-confirm button[response=ACCEPT]' + acceptButton: 'vn-confirm button[response=ACCEPT]' }, clientsIndex: { searchClientInput: `${components.vnTextfield}`, @@ -290,9 +290,9 @@ export default { barcode: 'vn-item-summary [name="barcode"]' }, itemDiary: { - thirdTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(3) > vn-td:nth-child(2) > span', + secondTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > span', firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance', - fifthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(5) > vn-td.balance', + thirdBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(3) > vn-td.balance', warehouseAutocomplete: 'vn-item-diary vn-autocomplete[field="$ctrl.warehouseFk"]', }, itemLog: { @@ -338,10 +338,8 @@ export default { moreMenuAddToTurn: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Add turn"]', moreMenuDeleteTicket: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Delete ticket"]', moreMenuMakeInvoice: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Make invoice"]', - addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', - shipSelectButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks > vn-button-menu[icon="icon-stowaway"]', + addStowawayDialogFirstTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tbody vn-tr', shipButton: 'vn-ticket-descriptor > div > div.body > div.quicklinks vn-icon[icon="icon-stowaway"]', - shipMenuSecondTicket: 'vn-ticket-descriptor div.quicklinks vn-drop-down li:nth-child(2)', thursdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)', saturdayButton: 'vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(6)', closeStowawayDialog: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog > div > button[class="close"]', diff --git a/e2e/paths/05-ticket-module/01_observations.spec.js b/e2e/paths/05-ticket-module/01_observations.spec.js index 3430a6771..42193ea57 100644 --- a/e2e/paths/05-ticket-module/01_observations.spec.js +++ b/e2e/paths/05-ticket-module/01_observations.spec.js @@ -7,13 +7,12 @@ describe('Ticket Create notes path', () => { beforeAll(() => { return nightmare .loginAndModule('employee', 'ticket') - .accessToSearchResult('id:1') + .accessToSearchResult(1) .accessToSection('ticket.card.observation'); }); - it(`should click create a new note and delete a former one`, async() => { + it('should create a new note', async() => { let result = await nightmare - .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) .waitToClick(selectors.ticketNotes.addNoteButton) .autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one') .write(selectors.ticketNotes.firstDescriptionInput, 'description') @@ -23,7 +22,7 @@ describe('Ticket Create notes path', () => { expect(result).toEqual('Data saved!'); }); - it(`should confirm the note is the expected one`, async() => { + it('should confirm the note is the expected one', async() => { let result = await nightmare .reloadSection('ticket.card.observation') .waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value'); @@ -35,4 +34,13 @@ describe('Ticket Create notes path', () => { expect(firstDescription).toEqual('description'); }); + + it('should delete the note', async() => { + let result = await nightmare + .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) + .waitToClick(selectors.ticketNotes.submitNotesButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); }); diff --git a/e2e/paths/05-ticket-module/03_sale.spec.js b/e2e/paths/05-ticket-module/03_sale.spec.js index 8cf591d75..0bf1baad7 100644 --- a/e2e/paths/05-ticket-module/03_sale.spec.js +++ b/e2e/paths/05-ticket-module/03_sale.spec.js @@ -1,13 +1,13 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -fdescribe('Ticket List sale path', () => { +describe('Ticket List sale path', () => { const nightmare = createNightmare(); beforeAll(() => { return nightmare .loginAndModule('employee', 'ticket') - .accessToSearchResult(8) + .accessToSearchResult(12) .accessToSection('ticket.card.sale'); }); @@ -15,7 +15,7 @@ fdescribe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); - expect(value).toContain('Silver'); + expect(value).toContain('Black'); }); it('should confirm the first ticket sale contains the lenght', async() => { @@ -29,7 +29,7 @@ fdescribe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); - expect(value).toContain('1.30'); + expect(value).toContain('3.00'); }); it('should confirm the first ticket sale contains the discount', async() => { @@ -43,7 +43,7 @@ fdescribe('Ticket List sale path', () => { const value = await nightmare .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); - expect(value).toContain('19.50'); + expect(value).toContain('60.00'); }); it('should navigate to the catalog by pressing the new item button', async() => { diff --git a/e2e/paths/05-ticket-module/11_diary.spec.js b/e2e/paths/05-ticket-module/11_diary.spec.js index 933628e5d..152c660e0 100644 --- a/e2e/paths/05-ticket-module/11_diary.spec.js +++ b/e2e/paths/05-ticket-module/11_diary.spec.js @@ -12,7 +12,7 @@ describe('Ticket diary path', () => { it('should search for a specific ticket', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:1') + .write(selectors.ticketsIndex.searchTicketInput, 1) .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -22,7 +22,7 @@ describe('Ticket diary path', () => { it(`should click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); @@ -31,26 +31,27 @@ describe('Ticket diary path', () => { }); it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => { + const itemId = 2; const url = await nightmare .waitToClick(selectors.ticketSummary.firstSaleItemId) .waitToClick(selectors.ticketSummary.popoverDiaryButton) .waitForLogin('employee') - .goto(`${config.url}#!/item/1/diary?warehouseFk=1&ticketFk=1`) + .goto(`${config.url}#!/item/${itemId}/diary?warehouseFk=1&ticketFk=1`) .parsedUrl(); expect(url.hash).toContain('/diary'); }); - it(`should check the seventh line id is marked as counter`, async() => { + it(`should check the second line id is marked as counter`, async() => { const result = await nightmare - .waitToGetProperty(selectors.itemDiary.thirdTicketId, 'className'); + .waitToGetProperty(selectors.itemDiary.secondTicketId, 'className'); expect(result).toContain('counter'); }); - it(`should check the fifth line balance is marked as counter`, async() => { + it(`should check the third line balance is marked as counter`, async() => { const result = await nightmare - .waitToGetProperty(`${selectors.itemDiary.fifthBalance} > span`, 'className'); + .waitToGetProperty(`${selectors.itemDiary.thirdBalance} > span`, 'className'); expect(result).toContain('counter'); }); diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index 5d47d504d..23c952af3 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -12,7 +12,7 @@ describe('Ticket descriptor path', () => { describe('Delete ticket', () => { it('should search for an specific ticket', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, '17') + .write(selectors.ticketsIndex.searchTicketInput, 17) .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -22,7 +22,7 @@ describe('Ticket descriptor path', () => { it(`should click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26') + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Your pocket') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); @@ -71,9 +71,9 @@ describe('Ticket descriptor path', () => { expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket summary`, async() => { + it(`should now click on the search result to access to the ticket summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 28') + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Somewhere in Thailand') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') .parsedUrl(); @@ -85,16 +85,16 @@ describe('Ticket descriptor path', () => { const isVisible = await nightmare .waitToClick(selectors.ticketDescriptor.moreMenu) .waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway) - .wait(selectors.ticketDescriptor.addStowawayDialogSecondTicket) - .isVisible(selectors.ticketDescriptor.addStowawayDialogSecondTicket); + .wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket) + .isVisible(selectors.ticketDescriptor.addStowawayDialogFirstTicket); expect(isVisible).toBeTruthy(); }); - it('should add the second ticket as stowaway', async() => { + it('should add a ticket as stowaway', async() => { const result = await nightmare - .waitToClick(selectors.ticketDescriptor.addStowawayDialogSecondTicket) + .waitToClick(selectors.ticketDescriptor.addStowawayDialogFirstTicket) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); @@ -103,12 +103,11 @@ describe('Ticket descriptor path', () => { it(`should navigate to the added ticket using the descriptors ship button`, async() => { const url = await nightmare .waitToClick(selectors.ticketDescriptor.closeStowawayDialog) - .waitToClick(selectors.ticketDescriptor.shipSelectButton) - .waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket) - .waitForURL('#!/ticket/22/sale') + .waitToClick(selectors.ticketDescriptor.shipButton) + .waitForURL('#!/ticket/19/summary') .parsedUrl(); - expect(url.hash).toContain('#!/ticket/22/sale'); + expect(url.hash).toContain('#!/ticket/19/summary'); }); it(`should navigate to the ship ticket using the descriptors ship button`, async() => { @@ -123,12 +122,11 @@ describe('Ticket descriptor path', () => { it(`should navigate back to the added ticket using the descriptors ship button`, async() => { const url = await nightmare .waitToClick(selectors.ticketDescriptor.closeStowawayDialog) - .waitToClick(selectors.ticketDescriptor.shipSelectButton) - .waitToClick(selectors.ticketDescriptor.shipMenuSecondTicket) - .waitForURL('#!/ticket/22/sale') + .waitToClick(selectors.ticketDescriptor.shipButton) + .waitForURL('#!/ticket/19/summary') .parsedUrl(); - expect(url.hash).toContain('#!/ticket/22/sale'); + expect(url.hash).toContain('#!/ticket/19/summary'); }); it('should delete the stowaway', async() => { @@ -151,7 +149,7 @@ describe('Ticket descriptor path', () => { describe('Make invoice', () => { it('should login as adminBoss role then search for a ticket', async() => { - const invoiceableTicketId = 11; + const invoiceableTicketId = 18; const url = await nightmare .loginAndModule('adminBoss', 'ticket') diff --git a/e2e/paths/07-order-module/01_edit_basic_data.spec.js b/e2e/paths/07-order-module/01_edit_basic_data.spec.js index 8925d5cc7..973697e9c 100644 --- a/e2e/paths/07-order-module/01_edit_basic_data.spec.js +++ b/e2e/paths/07-order-module/01_edit_basic_data.spec.js @@ -3,6 +3,8 @@ import createNightmare from '../../helpers/nightmare'; describe('Order edit basic data path', () => { const nightmare = createNightmare(); + const today = new Date().getDate(); + describe('when confirmed order', () => { beforeAll(() => { nightmare @@ -27,7 +29,7 @@ describe('Order edit basic data path', () => { const orderId = 16; const url = await nightmare .waitToClick(selectors.globalItems.returnToModuleIndexButton) - .waitToClick(selectors.globalItems.acceptVnConfirm) + .waitToClick(selectors.globalItems.acceptButton) .wait(selectors.ordersIndex.createOrderButton) .accessToSearchResult(orderId) .accessToSection('order.card.basicData') @@ -48,13 +50,20 @@ describe('Order edit basic data path', () => { }); describe('when new order', () => { - const today = new Date().getDate(); - it('should navigate to order index and create a new one', async() => { + it('should navigate to the order index and click the new order button', async() => { const url = await nightmare .waitToClick(selectors.globalItems.returnToModuleIndexButton) - .waitToClick(selectors.globalItems.acceptVnConfirm) + .waitToClick(selectors.globalItems.acceptButton) .waitToClick(selectors.ordersIndex.createOrderButton) - .autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Bruce Wayne') + .waitForURL('#!/order/create') + .parsedUrl(); + + expect(url.hash).toContain('#!/order/create'); + }); + + it('should now create a new one', async() => { + const url = await nightmare + .autocompleteSearch(selectors.createOrderView.clientAutocomplete, 'Jessica Jones') .datePicker(selectors.createOrderView.landedDatePicker, 0, today) .autocompleteSearch(selectors.createOrderView.agencyAutocomplete, 'inhouse pickup') .waitToClick(selectors.createOrderView.createButton) @@ -78,8 +87,7 @@ describe('Order edit basic data path', () => { .autocompleteSearch(selectors.orderBasicData.clientAutocomplete, 'Tony Stark') .autocompleteSearch(selectors.orderBasicData.addressAutocomplete, 'Tony Stark') .autocompleteSearch(selectors.orderBasicData.agencyAutocomplete, 'Silla247') - .clearTextarea(selectors.orderBasicData.observationInput) - .write(selectors.orderBasicData.observationInput, 'Observation modified') + .write(selectors.orderBasicData.observationInput, 'my observation') .waitToClick(selectors.orderBasicData.saveButton) .waitForLastSnackbar(); @@ -105,7 +113,7 @@ describe('Order edit basic data path', () => { const result = await nightmare .waitToGetProperty(selectors.orderBasicData.observationInput, 'value'); - expect(result).toEqual('Observation modified'); + expect(result).toEqual('my observation'); }); }); }); diff --git a/e2e/paths/08-route-module/03_tickets.spec.js b/e2e/paths/08-route-module/03_tickets.spec.js index 18d54ff4a..935efdad1 100644 --- a/e2e/paths/08-route-module/03_tickets.spec.js +++ b/e2e/paths/08-route-module/03_tickets.spec.js @@ -11,15 +11,6 @@ describe('Route basic Data path', () => { .accessToSection('route.card.tickets'); }); - it('should now modify the first ticket priority', async() => { - const result = await nightmare - .write(selectors.routeTickets.firstTicketPriority, 4) - .write('body', '\u000d') // simulates enter - .waitForLastSnackbar(); - - expect(result).toEqual('Data saved!'); - }); - it('should next modify the first ticket priority', async() => { const result = await nightmare .write(selectors.routeTickets.firstTicketPriority, 3) @@ -69,13 +60,6 @@ describe('Route basic Data path', () => { expect(result).toEqual('3'); }); - it('should confirm the fourth ticket priority', async() => { - const result = await nightmare - .waitToGetProperty(selectors.routeTickets.fourthTicketPriority, 'value'); - - expect(result).toEqual('4'); - }); - it('should confirm the buscamanButton is disabled', async() => { const result = await nightmare .evaluate(selector => { @@ -99,7 +83,7 @@ describe('Route basic Data path', () => { const result = await nightmare .countElement('vn-route-tickets vn-textfield[model="ticket.priority"]'); - expect(result).toEqual(4); + expect(result).toEqual(3); }); it('should delete the first ticket in route', async() => { @@ -115,6 +99,6 @@ describe('Route basic Data path', () => { const result = await nightmare .countElement('vn-route-tickets vn-textfield[model="ticket.priority"]'); - expect(result).toEqual(3); + expect(result).toEqual(2); }); }); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js index fd3e4b24e..e1f408409 100644 --- a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js +++ b/e2e/paths/09-invoice-out-module/01_descriptor.spec.js @@ -15,10 +15,10 @@ describe('InvoiceOut descriptor path', () => { .waitToClick(selectors.ticketsIndex.openAdvancedSearchButton) .write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222') .waitToClick(selectors.ticketsIndex.advancedSearchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 2) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); - expect(result).toEqual(2); + expect(result).toEqual(1); }); it('should navigate to the invoiceOut index', async() => { @@ -44,8 +44,7 @@ describe('InvoiceOut descriptor path', () => { it(`should click on the search result to access to the invoiceOut summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.invoiceOutIndex.searchResult, 'T2222222') - .waitToClick(selectors.invoiceOutIndex.searchResult) + .accessToSearchResult('T2222222') .waitForURL('/summary') .parsedUrl(); @@ -112,20 +111,9 @@ describe('InvoiceOut descriptor path', () => { expect(url.hash).toEqual('#!/invoice-out/index'); }); - it('should search for a new target invoiceOut', async() => { - const result = await nightmare - .write(selectors.invoiceOutIndex.searchInvoiceOutInput, 'A1111111') - .waitToClick(selectors.invoiceOutIndex.searchButton) - .waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 1) - .countElement(selectors.invoiceOutIndex.searchResult); - - expect(result).toEqual(1); - }); - - it(`should now click on the search result to access to the invoiceOut summary`, async() => { + it(`should search and access to the invoiceOut summary`, async() => { const url = await nightmare - .waitForTextInElement(selectors.invoiceOutIndex.searchResult, 'A1111111') - .waitToClick(selectors.invoiceOutIndex.searchResult) + .accessToSearchResult('A1111111') .waitForURL('/summary') .parsedUrl(); diff --git a/gulpfile.js b/gulpfile.js index 6f1dd5521..fa38d5bea 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -153,6 +153,15 @@ function e2eOnly() { const specFiles = [ + `${__dirname}/e2e/paths/01*/*[sS]pec.js`, + `${__dirname}/e2e/paths/02*/*[sS]pec.js`, + `${__dirname}/e2e/paths/03*/*[sS]pec.js`, + `${__dirname}/e2e/paths/04*/*[sS]pec.js`, + `${__dirname}/e2e/paths/05*/*[sS]pec.js`, + `${__dirname}/e2e/paths/06*/*[sS]pec.js`, + `${__dirname}/e2e/paths/07*/*[sS]pec.js`, + `${__dirname}/e2e/paths/08*/*[sS]pec.js`, + `${__dirname}/e2e/paths/09*/*[sS]pec.js`, `${__dirname}/e2e/paths/**/*[sS]pec.js`, `${__dirname}/e2e/helpers/extensions.js` ]; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 62551ff18..31ba033dd 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -46,5 +46,7 @@ "The value should be a number": "The value should be a number", "The current ticket can't be modified": "The current ticket can't be modified", "Extension format is invalid": "Extension format is invalid", - "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS" + "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", + "This client can't be invoiced": "This client can't be invoiced", + "The introduced hour already exists": "The introduced hour already exists" } \ No newline at end of file diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 454bab75c..682c60aeb 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -134,7 +134,7 @@ {{sale.price | currency: 'EUR':2}} - + diff --git a/package-lock.json b/package-lock.json index 1e59772ed..e0846e3bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3938,7 +3938,7 @@ "dot-prop": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "integrity": "sha1-HxngwuGqDjJ5fEl5nyg3rGr2nFc=", "requires": { "is-obj": "^1.0.0" } @@ -4116,7 +4116,7 @@ }, "jsonfile": { "version": "2.4.0", - "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", "dev": true, "requires": { @@ -6688,9 +6688,34 @@ "kind-of": "^1.1.0" } }, + "glob": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "jasmine": { + "version": "2.99.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz", + "integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=", + "dev": true, + "requires": { + "exit": "^0.1.2", + "glob": "^7.0.6", + "jasmine-core": "~2.99.0" + } + }, "kind-of": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -8086,20 +8111,19 @@ } }, "jasmine": { - "version": "2.99.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-2.99.0.tgz", - "integrity": "sha1-jKctEC5jm4Z8ZImFbg4YqceqQrc=", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.4.0.tgz", + "integrity": "sha512-sR9b4n+fnBFDEd7VS2el2DeHgKcPiMVn44rtKFumq9q7P/t8WrxsVIZPob4UDdgcDNCwyDqwxCt4k9TDRmjPoQ==", "dev": true, "requires": { - "exit": "^0.1.2", - "glob": "^7.0.6", - "jasmine-core": "~2.99.0" + "glob": "^7.1.3", + "jasmine-core": "~3.4.0" }, "dependencies": { "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "dev": true, "requires": { "fs.realpath": "^1.0.0", @@ -8109,12 +8133,18 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "jasmine-core": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.4.0.tgz", + "integrity": "sha512-HU/YxV4i6GcmiH4duATwAbJQMlE0MsDIR5XmSVxURxKHn3aGAdbY1/ZJFmVRbKtnLwIxxMJD7gYaPsypcbYimg==", + "dev": true } } }, "jasmine-core": { "version": "2.99.1", - "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -8145,14 +8175,6 @@ "requires": { "indent-string": "^2.1.0", "pluralize": "^1.2.1" - }, - "dependencies": { - "pluralize": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", - "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", - "dev": true - } } }, "jayson": { @@ -8405,7 +8427,7 @@ "karma-chrome-launcher": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-2.2.0.tgz", - "integrity": "sha512-uf/ZVpAabDBPvdPdveyk1EPgbnloPvFFGgmRhYLTDH7gEB4nZdSBk8yTU47w1g/drLSx5uMOkjKk7IWKfWg/+w==", + "integrity": "sha1-zxudBxNswY/iOTJ9JGVMPbw2is8=", "dev": true, "requires": { "fs-access": "^1.0.0", @@ -10406,7 +10428,7 @@ "dependencies": { "commander": { "version": "1.0.4", - "resolved": "http://registry.npmjs.org/commander/-/commander-1.0.4.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.0.4.tgz", "integrity": "sha1-Xt6xruI8T7VBprcNaSq+8ZZpotM=", "dev": true, "requires": { @@ -12874,6 +12896,12 @@ "extend-shallow": "^3.0.2" } }, + "pluralize": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, "portfinder": { "version": "1.0.20", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz", @@ -13077,7 +13105,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -13089,7 +13117,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true }, @@ -14372,7 +14400,7 @@ }, "string-width": { "version": "1.0.2", - "resolved": "http://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "requires": { @@ -15967,7 +15995,7 @@ "touch": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", + "integrity": "sha1-/jZfX3XsntTlaCXgu3bSSrdK+Ds=", "dev": true, "requires": { "nopt": "~1.0.10" diff --git a/package.json b/package.json index 8265f2711..5d0315e59 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "gulp-yaml": "^1.0.1", "html-loader": "^0.4.5", "html-webpack-plugin": "^4.0.0-beta.5", - "jasmine": "^2.99.0", + "jasmine": "^3.4.0", "jasmine-reporters": "^2.3.2", "jasmine-spec-reporter": "^4.2.1", "json-loader": "^0.5.7",