2018-04-05 12:14:34 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-04-05 12:14:34 +00:00
|
|
|
|
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Create new tracking state path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForLogin('production');
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu', done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.ticketsButton)
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-10-25 14:44:03 +00:00
|
|
|
.parsedUrl()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(url => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it('should search for the ticket 1', done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-10-25 14:44:03 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.ticketsIndex.searchResult)
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(result => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(result).toEqual(1);
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it(`should click on the search result to access to the ticket Tracking`, done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketTracking.trackingButton)
|
|
|
|
.waitForURL('tracking/index')
|
|
|
|
.url()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(url => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(url).toContain('tracking/index');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it('should access to the create state view by clicking the create floating button', done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.ticketTracking.createStateButton)
|
|
|
|
.wait(selectors.createStateView.stateInput)
|
|
|
|
.parsedUrl()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(url => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it(`should attempt create a new state but receive an error if state is empty`, done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(result => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(result).toEqual('No changes to save');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it(`should attempt create a new state then clear and save it`, done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitToClick(selectors.createStateView.stateInput)
|
|
|
|
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
|
|
|
.waitToClick(selectors.createStateView.clearStateInputButton)
|
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(result => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-05-31 09:52:39 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it('should again access to the create state view by clicking the create floating button', done => {
|
2018-05-31 09:52:39 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.ticketTracking.createStateButton)
|
|
|
|
.wait(selectors.createStateView.stateInput)
|
|
|
|
.parsedUrl()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(url => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
|
2018-11-21 13:30:32 +00:00
|
|
|
it(`should create a new state`, done => {
|
2018-04-05 12:14:34 +00:00
|
|
|
return nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitToClick(selectors.createStateView.stateInput)
|
|
|
|
.waitToClick(selectors.createStateView.stateInputOptionOne)
|
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar()
|
2018-11-21 13:30:32 +00:00
|
|
|
.then(result => {
|
2018-10-25 14:44:03 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|