salix/e2e/paths/ticket-module/02_delete_ticket_expedition...

66 lines
2.6 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Ticket', () => {
describe('Delete expeditions path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
2018-10-11 07:14:26 +00:00
.waitForLogin('production');
});
2018-10-22 15:12:41 +00:00
it('should access to the tickets index by clicking the tickets button', done => {
return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchResult)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/ticket/index');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
});
2018-10-22 15:12:41 +00:00
it('should search for the ticket with id 1', done => {
return nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
});
2018-10-22 15:12:41 +00:00
it(`should click on the search result to access to the ticket expeditions`, done => {
return nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition')
.url()
.then(url => {
expect(url).toContain('expedition');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
});
2018-10-22 15:12:41 +00:00
it(`should delete a former expedition and confirm the remaining expedition is the expected one`, done => {
return nightmare
.waitToClick(selectors.ticketExpedition.secondExpeditionRemoveButton)
.click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketExpedition.expeditionButton)
.wait(selectors.ticketExpedition.secondExpeditionText)
.getInnerText(selectors.ticketExpedition.secondExpeditionText)
.then(value => {
expect(value).toContain('Iron Patriot');
expect(value).toContain('root');
2018-10-22 15:12:41 +00:00
done();
}).catch(done.fail);
});
});
});