diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 060fb2439f..d25b036b4d 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -355,12 +355,16 @@ 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"]', + moreMenuChangeShippedHour: 'vn-ticket-descriptor vn-drop-down > vn-popover ul > li[name="Change shipped hour"]', + changeShippedHourInput: 'vn-ticket-descriptor > vn-dialog.ng-isolate-scope.vn-dialog.shown vn-input-time input', 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"]', 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"]', acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', + acceptChangeHourButton: 'vn-ticket-descriptor vn-dialog[vn-id="changeShippedDialog"] button[response="ACCEPT"]', + descriptorDeliveryDate: 'vn-ticket-descriptor > div > div.body > div.attributes > vn-label-value:nth-child(6) > section > span', acceptInvoiceOutButton: 'vn-ticket-descriptor vn-confirm[vn-id="makeInvoiceConfirmation"] button[response="ACCEPT"]', acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' }, diff --git a/e2e/paths/05-ticket-module/12_descriptor.spec.js b/e2e/paths/05-ticket-module/12_descriptor.spec.js index bfc6ad5013..7819ec5466 100644 --- a/e2e/paths/05-ticket-module/12_descriptor.spec.js +++ b/e2e/paths/05-ticket-module/12_descriptor.spec.js @@ -30,6 +30,33 @@ describe('Ticket descriptor path', () => { expect(url.hash).toContain('/summary'); }); + it('should open the change shipped hours dialog by using the more menu option', async() => { + const visible = await nightmare + .waitToClick(selectors.ticketDescriptor.moreMenu) + .waitToClick(selectors.ticketDescriptor.moreMenuChangeShippedHour) + .wait(selectors.ticketDescriptor.changeShippedHourInput) + .isVisible(selectors.ticketDescriptor.changeShippedHourInput); + + + expect(visible).toBeTruthy(); + }); + + it(`should update the shipped hour`, async() => { + const result = await nightmare + .write(selectors.ticketDescriptor.changeShippedHourInput, '0815') + .waitToClick(selectors.ticketDescriptor.acceptChangeHourButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Shipped hour updated'); + }); + + it(`should confirm the ticket descriptor shows the correct shipping hour`, async() => { + const result = await nightmare + .waitToGetProperty(selectors.ticketDescriptor.descriptorDeliveryDate, 'innerText'); + + expect(result).toContain('08:15'); + }); + it('should delete the ticket using the descriptor more menu', async() => { const result = await nightmare .waitToClick(selectors.ticketDescriptor.moreMenu) diff --git a/loopback/locale/en.json b/loopback/locale/en.json index da9021e951..c4a1526aa4 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -51,5 +51,6 @@ "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket", "Concept cannot be blank": "Concept cannot be blank", "Ticket id cannot be blank": "Ticket id cannot be blank", - "Weekday cannot be blank": "Weekday cannot be blank" + "Weekday cannot be blank": "Weekday cannot be blank", + "This ticket can not be modified": "This ticket can not be modified" } \ No newline at end of file