#827 E2E seccion ticket/weekly

This commit is contained in:
Carlos Jimenez 2018-11-19 09:27:15 +01:00
parent 622a44f133
commit 0b3c898a46
2 changed files with 70 additions and 6 deletions

View File

@ -318,6 +318,7 @@ export default {
searchButton: `vn-ticket-index vn-searchbar vn-icon[icon="search"]`,
moreMenu: `vn-ticket-index vn-icon-menu[vn-id="more-button"] > div > vn-icon`,
moreMenuTurns: `vn-ticket-index vn-icon-menu vn-drop-down > vn-popover li`,
sixthWeeklyTicketTurn: `vn-ticket-weekly > form > div > vn-card > div > vn-table > div > vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(3) > vn-autocomplete > div > div > input`,
weeklyTicket: `vn-ticket-weekly vn-table > div > vn-tbody > vn-tr`,
sixthWeeklyTicketDeleteIcon: `vn-ticket-weekly > form vn-tbody > vn-tr:nth-child(6) > vn-td:nth-child(6) > vn-icon-button[icon="delete"]`
},
@ -326,7 +327,8 @@ export default {
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)`
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)`
},
ticketNotes: {
notesButton: `vn-left-menu a[ui-sref="ticket.card.observation"]`,

View File

@ -61,7 +61,7 @@ describe('Ticket descriptor path', () => {
expect(url).toContain('/summary');
});
it('should add the ticket to sunday turn using the descriptor more menu', async () => {
it('should add the ticket to thirsday turn using the descriptor more menu', async () => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
@ -82,14 +82,76 @@ describe('Ticket descriptor path', () => {
expect(url.hash).toEqual('#!/ticket/index');
});
it('should confirm there is one more ticket in the turns section', async () => {
it('should confirm the ticket 11 was added on thursday', async () => {
const result = await nightmare
.waitToClick(selectors.ticketsIndex.moreMenu)
.waitToClick(selectors.ticketsIndex.moreMenuTurns)
.wait(selectors.ticketsIndex.weeklyTicket)
.countElement(selectors.ticketsIndex.weeklyTicket);
.waitProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value')
.getProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value');
expect(result).toEqual(6);
expect(result).toEqual('Thursday');
});
it('should click on the Tickets button of the top bar menu once more', 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 now search for the ticket 11', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchResult)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.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`, async () => {
const url = await nightmare
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.url();
expect(url).toContain('/summary');
});
it('should add the ticket to saturday turn using the descriptor more menu', async () => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
.waitToClick(selectors.ticketDescriptor.saturdayButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should click on the Tickets button of the top bar menu once again', 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 confirm the ticket 11 was added on saturday', async () => {
const result = await nightmare
.waitToClick(selectors.ticketsIndex.moreMenu)
.waitToClick(selectors.ticketsIndex.moreMenuTurns)
.waitProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value')
.getProperty(selectors.ticketsIndex.sixthWeeklyTicketTurn, 'value');
expect(result).toEqual('Saturday');
});
it('should delete the weekly ticket 11', async () => {