2018-03-22 14:01:36 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-03-22 14:01:36 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Delete expeditions path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-03-22 14:01:36 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForLogin('production');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-22 14:01:36 +00:00
|
|
|
|
2018-10-29 08:21:33 +00:00
|
|
|
it('should access to the tickets index by clicking the tickets button', async () => {
|
|
|
|
const url = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.moduleAccessView.ticketsSectionButton)
|
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
2018-10-29 08:21:33 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
2018-03-22 14:01:36 +00:00
|
|
|
});
|
|
|
|
|
2018-10-29 08:21:33 +00:00
|
|
|
it('should search for the ticket with id 1', async () => {
|
|
|
|
const result = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
2018-10-29 08:21:33 +00:00
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-03-22 14:01:36 +00:00
|
|
|
});
|
|
|
|
|
2018-10-29 08:21:33 +00:00
|
|
|
it(`should click on the search result to access to the ticket expeditions`, async () => {
|
|
|
|
const url = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketExpedition.expeditionButton)
|
|
|
|
.waitForURL('expedition')
|
2018-10-29 08:21:33 +00:00
|
|
|
.url();
|
|
|
|
|
|
|
|
expect(url).toContain('expedition');
|
2018-03-22 14:01:36 +00:00
|
|
|
});
|
|
|
|
|
2018-10-29 10:07:48 +00:00
|
|
|
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {
|
2018-10-29 08:21:33 +00:00
|
|
|
const result = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
|
2018-10-29 10:07:48 +00:00
|
|
|
.waitToClick(selectors.ticketExpedition.acceptDeleteRowButton)
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.ticketPackages.packagesButton)
|
|
|
|
.wait(selectors.ticketPackages.firstPackageSelect)
|
|
|
|
.click(selectors.ticketExpedition.expeditionButton)
|
2018-10-29 08:21:33 +00:00
|
|
|
.wait(selectors.ticketExpedition.expeditionRow)
|
|
|
|
.countElement(selectors.ticketExpedition.expeditionRow);
|
|
|
|
|
|
|
|
expect(result).toEqual(3);
|
2018-03-22 14:01:36 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|