diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 7f9c523b3..c91f6007e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -327,6 +327,7 @@ export default { ticketDescriptor: { moreMenu: `vn-ticket-descriptor vn-icon-menu > div > vn-icon`, moreMenuAddStowaway: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, + moreMenuDeleteStowawayButton: 'vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(4)', moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`, moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(3)`, addStowawayDialogSecondTicket: 'vn-ticket-descriptor > vn-add-stowaway > vn-dialog vn-table vn-tr:nth-child(2)', @@ -336,7 +337,8 @@ export default { 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"]', - acceptDeleteTicketButton: `vn-ticket-descriptor button[response="ACCEPT"]` + acceptDeleteButton: 'vn-ticket-descriptor button[response="ACCEPT"]', + acceptDeleteStowawayButton: 'vn-ticket-descriptor > vn-remove-stowaway button[response="ACCEPT"]' }, ticketNotes: { firstNoteRemoveButton: `vn-icon[icon="delete"]`, diff --git a/e2e/paths/ticket-module/12_descriptor.spec.js b/e2e/paths/ticket-module/12_descriptor.spec.js index 1ef3ea303..b8e610891 100644 --- a/e2e/paths/ticket-module/12_descriptor.spec.js +++ b/e2e/paths/ticket-module/12_descriptor.spec.js @@ -34,7 +34,7 @@ describe('Ticket descriptor path', () => { const result = await nightmare .waitToClick(selectors.ticketDescriptor.moreMenu) .waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket) - .waitToClick(selectors.ticketDescriptor.acceptDeleteTicketButton) + .waitToClick(selectors.ticketDescriptor.acceptDeleteButton) .waitForLastSnackbar(); expect(result).toEqual('Ticket deleted'); @@ -119,5 +119,33 @@ describe('Ticket descriptor path', () => { expect(url.hash).toContain('#!/ticket/20/summary'); }); + + 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') + .parsedUrl(); + + expect(url.hash).toContain('#!/ticket/22/sale'); + }); + + it('should delete the stowaway', async() => { + const result = await nightmare + .waitToClick(selectors.ticketDescriptor.moreMenu) + .waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton) + .waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it(`should confirm the ship buton doesn't exisist any more`, async() => { + const exists = await nightmare + .exists(selectors.ticketDescriptor.shipButton); + + expect(exists).toBeFalsy(); + }); }); });