From c20cb9af37ea8d63ad983478ed331d9cd1917c78 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 19 Nov 2018 08:57:11 +0100 Subject: [PATCH] #827 E2E seccion ticket/weekly --- .../06_edit_basic_data_steps.spec.js | 2 +- ...iptor.spec.js => 09_ticket_weekly.spec.js} | 62 ---------------- .../12_delete_ticket_from_descriptor.spec.js | 72 +++++++++++++++++++ 3 files changed, 73 insertions(+), 63 deletions(-) rename e2e/paths/ticket-module/{09_ticket_descriptor.spec.js => 09_ticket_weekly.spec.js} (62%) create mode 100644 e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index f089abe267..24e479787c 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -129,7 +129,7 @@ describe('Ticket', () => { return nightmare .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .then(result => { - expect(result).toContain('-€20.65'); + expect(result).toContain('-20.65 €'); done(); }).catch(done.fail); }); diff --git a/e2e/paths/ticket-module/09_ticket_descriptor.spec.js b/e2e/paths/ticket-module/09_ticket_weekly.spec.js similarity index 62% rename from e2e/paths/ticket-module/09_ticket_descriptor.spec.js rename to e2e/paths/ticket-module/09_ticket_weekly.spec.js index 1c2113d1fb..74bdf9e13c 100644 --- a/e2e/paths/ticket-module/09_ticket_descriptor.spec.js +++ b/e2e/paths/ticket-module/09_ticket_weekly.spec.js @@ -106,66 +106,4 @@ describe('Ticket descriptor 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); - }); }); diff --git a/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js new file mode 100644 index 0000000000..b8d0b6bae9 --- /dev/null +++ b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js @@ -0,0 +1,72 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Ticket descriptor path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + nightmare + .waitForLogin('employee'); + }); + + it('should click on the Tickets button of the top bar menu', 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); + }); +});