salix/e2e/paths/ticket-module/12_delete_ticket_from_descr...

73 lines
2.7 KiB
JavaScript
Raw Normal View History

2018-11-19 07:57:11 +00:00
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.searchTicketInput)
2018-11-19 07:57:11 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it('should search for a specific ticket', async () => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-19 07:57:11 +00:00
.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')
.parsedUrl();
2018-11-19 07:57:11 +00:00
expect(url.hash).toContain('/summary');
2018-11-19 07:57:11 +00:00
});
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.searchTicketInput)
2018-11-19 07:57:11 +00:00
.type(selectors.ticketsIndex.searchTicketInput, 'id:17')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.wait(selectors.ticketsIndex.searchResultDate)
.waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
2018-11-19 07:57:11 +00:00
expect(result).toContain(2000);
});
});