diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d06e9c75d..25f50af93 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -790,10 +790,11 @@ export default { saveButton: 'vn-route-basic-data button[type=submit]' }, routeTickets: { - firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-textfield[ng-model="ticket.priority"]', + firstTicketPriority: 'vn-route-tickets vn-tr:nth-child(1) vn-input-number[ng-model="ticket.priority"]', firstTicketCheckbox: 'vn-route-tickets vn-tr:nth-child(1) vn-check', buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', + anyTicket: 'vn-route-tickets vn-tbody > vn-tr', confirmButton: '.vn-confirm.shown button[response="accept"]' }, workerSummary: { diff --git a/e2e/paths/08-route/04_tickets.spec.js b/e2e/paths/08-route/04_tickets.spec.js index f1357404a..950e11d3e 100644 --- a/e2e/paths/08-route/04_tickets.spec.js +++ b/e2e/paths/08-route/04_tickets.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #1528 e2e claim/detail -xdescribe('Route basic Data path', () => { +describe('Route tickets path', () => { let browser; let page; @@ -10,7 +9,7 @@ xdescribe('Route basic Data path', () => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('delivery', 'route'); - await page.accessToSearchResult('3'); + await page.accessToSearchResult('2'); await page.accessToSection('route.card.tickets'); }); @@ -19,40 +18,32 @@ xdescribe('Route basic Data path', () => { }); it('should modify the first ticket priority', async() => { - await page.write(selectors.routeTickets.firstTicketPriority, '2'); + await page.clearInput(selectors.routeTickets.firstTicketPriority); + await page.type(selectors.routeTickets.firstTicketPriority, '9'); await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); - it('should confirm the buscamanButton is disabled', async() => { - const result = await page.evaluate(selector => { - return document.querySelector(selector); - }, `${selectors.routeTickets.buscamanButton} :disabled`); - - expect(result).toBeTruthy(); + it('should confirm the buscaman button is disabled', async() => { + await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`); }); it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => { - await page.waitToClick(selectors.routeTickets.firstTicketCheckbox); - const result = await page.evaluate(selector => { - return document.querySelector(selector); - }, `${selectors.routeTickets.buscamanButton} :disabled`); - - expect(result).toBeFalsy(); + await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`, {visible: false}); }); it('should check the route volume on the descriptor', async() => { const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); - expect(result).toEqual('1.1 / 18 m³'); + expect(result).toEqual('0.2 / 50 m³'); }); it('should count how many tickets are in route', async() => { - const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); + const result = await page.countElement(selectors.routeTickets.anyTicket); - expect(result).toEqual(11); + expect(result).toEqual(1); }); it('should delete the first ticket in route', async() => { @@ -63,23 +54,14 @@ xdescribe('Route basic Data path', () => { expect(message.text).toContain('Ticket removed from route'); }); - it('should again delete the first ticket in route', async() => { - await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton); - await page.waitToClick(selectors.routeTickets.confirmButton); - const message = await page.waitForSnackbar(); - - expect(message.text).toContain('Ticket removed from route'); - }); - it('should now count how many tickets are in route to find one less', async() => { - const result = await page.countElement('vn-route-tickets vn-textfield[ng-model="ticket.priority"]'); - - expect(result).toEqual(9); + await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0); }); - it('should confirm the route volume on the descriptor has been updated by the changes made', async() => { + // #2862 updateVolume() route descriptor no actualiza volumen + xit('should confirm the route volume on the descriptor has been updated by the changes made', async() => { const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); - expect(result).toEqual('0.9 / 18 m³'); + expect(result).toEqual('0 / 50 m³'); }); }); diff --git a/modules/route/front/tickets/index.html b/modules/route/front/tickets/index.html index 784a0b78e..92a112747 100644 --- a/modules/route/front/tickets/index.html +++ b/modules/route/front/tickets/index.html @@ -80,7 +80,7 @@