From 5a380ae1d3b0caf830c461acb935eed34a878f89 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 21 Aug 2019 12:23:01 +0200 Subject: [PATCH] #1450 e2e ticket.weekly --- e2e/helpers/selectors.js | 6 ++++- ...icket_weekly.spec.js => 09_weekly.spec.js} | 23 ++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) rename e2e/paths/05-ticket-module/{09_ticket_weekly.spec.js => 09_weekly.spec.js} (84%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d25b036b4..e5800db55 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -326,15 +326,19 @@ export default { advancedSearchInvoiceOut: 'vn-ticket-index vn-searchbar vn-ticket-search-panel vn-textfield[model="filter.refFk"] input', newTicketButton: 'vn-ticket-index > a', searchResult: 'vn-ticket-index vn-card > div > vn-table > div > vn-tbody > a.vn-tr', + searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchResultDate: 'vn-ticket-index vn-table vn-tbody > a:nth-child(1) > vn-td:nth-child(5)', searchTicketInput: `vn-ticket-index ${components.vnTextfield}`, + searchWeeklyTicketInput: `vn-ticket-weekly-index ${components.vnTextfield}`, + searchWeeklyClearInput: 'vn-ticket-weekly-index vn-searchbar i[class="material-icons clear"]', advancedSearchButton: 'vn-ticket-index vn-searchbar > vn-popover vn-ticket-search-panel vn-submit[label="Search"] input', searchButton: 'vn-ticket-index vn-searchbar vn-icon[icon="search"]', + searchWeeklyButton: 'vn-ticket-weekly-index vn-searchbar vn-icon[icon="search"]', moreMenu: 'vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon', moreMenuWeeklyTickets: 'vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li:nth-child(2)', sixthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tr:nth-child(6) vn-autocomplete[field="weekly.weekDay"] input', weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr', - sixthWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(6) vn-icon-button[icon="delete"]', + firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', acceptDeleteTurn: 'vn-ticket-weekly-index > vn-confirm[vn-id="deleteWeekly"] button[response="ACCEPT"]' }, createTicketView: { diff --git a/e2e/paths/05-ticket-module/09_ticket_weekly.spec.js b/e2e/paths/05-ticket-module/09_weekly.spec.js similarity index 84% rename from e2e/paths/05-ticket-module/09_ticket_weekly.spec.js rename to e2e/paths/05-ticket-module/09_weekly.spec.js index aeaac0fa8..bba4a20e7 100644 --- a/e2e/paths/05-ticket-module/09_ticket_weekly.spec.js +++ b/e2e/paths/05-ticket-module/09_weekly.spec.js @@ -9,7 +9,7 @@ describe('Ticket descriptor path', () => { .loginAndModule('employee', 'ticket'); }); - it('should count the mount of tickets in the turns section', async() => { + it('should count the amount of tickets in the turns section', async() => { const result = await nightmare .waitToClick(selectors.ticketsIndex.moreMenu) .waitToClick(selectors.ticketsIndex.moreMenuWeeklyTickets) @@ -32,7 +32,7 @@ describe('Ticket descriptor path', () => { it('should search for the ticket 11', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:11') + .write(selectors.ticketsIndex.searchTicketInput, 11) .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -92,7 +92,7 @@ describe('Ticket descriptor path', () => { it('should now search for the ticket 11', async() => { const result = await nightmare - .write(selectors.ticketsIndex.searchTicketInput, 'id:11') + .write(selectors.ticketsIndex.searchTicketInput, 11) .waitToClick(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .countElement(selectors.ticketsIndex.searchResult); @@ -139,11 +139,19 @@ describe('Ticket descriptor path', () => { expect(result).toEqual('Saturday'); }); - // Test #1450 here + it('should now search for the weekly ticket 11', async() => { + const result = await nightmare + .write(selectors.ticketsIndex.searchWeeklyTicketInput, 11) + .waitToClick(selectors.ticketsIndex.searchWeeklyButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1) + .countElement(selectors.ticketsIndex.searchWeeklyResult); + + expect(result).toEqual(1); + }); it('should delete the weekly ticket 11', async() => { const result = await nightmare - .waitToClick(selectors.ticketsIndex.sixthWeeklyTicketDeleteIcon) + .waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon) .waitToClick(selectors.ticketsIndex.acceptDeleteTurn) .waitForLastSnackbar(); @@ -152,7 +160,10 @@ describe('Ticket descriptor path', () => { it('should confirm the sixth weekly ticket was deleted', async() => { const result = await nightmare - .countElement(selectors.ticketsIndex.weeklyTicket); + .waitToClick('vn-ticket-weekly-index vn-searchbar i[class="material-icons clear"]') + .waitToClick(selectors.ticketsIndex.searchWeeklyButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5) + .countElement(selectors.ticketsIndex.searchWeeklyResult); expect(result).toEqual(5); });