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

60 lines
2.2 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
.loginAndModule('employee', 'ticket');
2018-11-19 07:57:11 +00:00
});
2019-01-14 10:19:39 +00:00
it('should search for a specific ticket', async() => {
2018-11-19 07:57:11 +00:00
const result = await nightmare
2019-01-23 14:33:25 +00:00
.write(selectors.ticketsIndex.searchTicketInput, 'id:17')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketsIndex.searchButton)
2018-11-19 07:57:11 +00:00
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
expect(result).toEqual(1);
});
2019-01-14 10:19:39 +00:00
it(`should click on the search result to access to the ticket Sale`, async() => {
2018-11-19 07:57:11 +00:00
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
});
2019-01-14 10:19:39 +00:00
it('should delete the ticket using the descriptor more menu', async() => {
2018-11-19 07:57:11 +00:00
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket)
.waitToClick(selectors.ticketDescriptor.acceptDeleteTicketButton)
.waitForLastSnackbar();
expect(result).toEqual('Ticket deleted');
});
2019-01-14 10:19:39 +00:00
it('should have been relocated to the ticket index', async() => {
2018-11-19 07:57:11 +00:00
const url = await nightmare
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-01-14 10:19:39 +00:00
it(`should search for the deleted ticket and check it's date`, async() => {
2018-11-19 07:57:11 +00:00
const result = await nightmare
2019-01-23 14:33:25 +00:00
.write(selectors.ticketsIndex.searchTicketInput, 'id:17')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketsIndex.searchButton)
2018-11-19 07:57:11 +00:00
.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);
});
});