diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index b4a32bd048..07d0c1c9fb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -301,6 +301,8 @@ export default { ticketDescriptor: { moreMenu: `vn-ticket-descriptor > vn-card > div vn-icon-menu > div > vn-icon`, moreMenuAddToTurn: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(1)`, + moreMenuDeleteTicket: `vn-ticket-descriptor vn-icon-menu > div > vn-drop-down > vn-popover ul > li:nth-child(2)`, + acceptDeleteTicketButton: `vn-ticket-descriptor button[response="ACCEPT"]`, thursdayButton: `vn-ticket-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-tool-bar > vn-button:nth-child(4)` }, ticketNotes: { diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 4fd7b7e78c..5df15fbbec 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -615,17 +615,6 @@ describe('Ticket Edit sale path', () => { expect(result).toEqual(1); }); - - it(`should again click on the search result to access to the ticket Sales`, async () => { - const url = await nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketSales.saleButton) - .waitForURL('/sale') - .url(); - - expect(url).toContain('/sale'); - }); }); describe('when state is preparation and loged as salesPerson', () => { @@ -652,52 +641,5 @@ describe('Ticket Edit sale path', () => { expect(result).toBeFalsy(); }); - - it('should go to another ticket sales section', async () => { - const url = await nightmare - .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) - .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 'id:17') - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26') - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketSales.saleButton) - .waitForURL('/sale') - .url(); - - expect(url).toContain('/sale'); - }); }); }); - -// TAREA #802 e2e ticket.descriptor -/* it(`should be able to delete the ticket`, async () => { - const url = await nightmare - .waitToClick(selectors.ticketSales.moreMenuButton) - .waitToClick(selectors.ticketSales.moreMenuDeleteOption) - .waitToClick(selectors.ticketSales.acceptDeleteTicketButton) - .waitForURL('/ticket/index') - .url(); - - expect(url).toContain('/ticket/index'); -}); - -it(`should search for the deleted ticket`, async () => { - const result = await nightmare - .wait(selectors.ticketsIndex.searchResult) - .type(selectors.ticketsIndex.searchTicketInput, 'id:17') - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult); - - expect(result).toEqual(1); -}); - -it(`should search for the deleted ticket`, async () => { - const result = await nightmare - .wait(selectors.ticketsIndex.searchResultDate) - .getInnerText(selectors.ticketsIndex.searchResultDate); - - expect(result).toContain(2000); -}); */ diff --git a/e2e/paths/ticket-module/09_weekly.spec.js b/e2e/paths/ticket-module/09_ticket_descriptor.spec.js similarity index 62% rename from e2e/paths/ticket-module/09_weekly.spec.js rename to e2e/paths/ticket-module/09_ticket_descriptor.spec.js index 5948161be8..1c2113d1fb 100644 --- a/e2e/paths/ticket-module/09_weekly.spec.js +++ b/e2e/paths/ticket-module/09_ticket_descriptor.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Ticket weekly path', () => { +describe('Ticket descriptor path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -106,4 +106,66 @@ describe('Ticket weekly path', () => { expect(result).toEqual(5); }); + + + it('should naviate to the ticket index', async () => { + const url = await nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.ticketsButton) + .wait(selectors.ticketsIndex.searchResult) + .parsedUrl(); + + expect(url.hash).toEqual('#!/ticket/index'); + }); + + it('should search for a specific ticket', async () => { + const result = await nightmare + .wait(selectors.ticketsIndex.searchResult) + .type(selectors.ticketsIndex.searchTicketInput, 'id:17') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countElement(selectors.ticketsIndex.searchResult); + + expect(result).toEqual(1); + }); + + it(`should click on the search result to access to the ticket Sale`, async () => { + const url = await nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26') + .waitToClick(selectors.ticketsIndex.searchResult) + .waitForURL('/summary') + .url(); + + expect(url).toContain('/summary'); + }); + + it('should delete the ticket using the descriptor more menu', async () => { + const result = await nightmare + .waitToClick(selectors.ticketDescriptor.moreMenu) + .waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket) + .waitToClick(selectors.ticketDescriptor.acceptDeleteTicketButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Ticket deleted'); + }); + + it('should have been relocated to the ticket index', async () => { + const url = await nightmare + .parsedUrl(); + + expect(url.hash).toEqual('#!/ticket/index'); + }); + + it(`should search for the deleted ticket and check it's date`, async () => { + const result = await nightmare + .wait(selectors.ticketsIndex.searchResult) + .type(selectors.ticketsIndex.searchTicketInput, 'id:17') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .wait(selectors.ticketsIndex.searchResultDate) + .getInnerText(selectors.ticketsIndex.searchResultDate); + + expect(result).toContain(2000); + }); });