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