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
|
|
|
|
2018-12-19 07:42:07 +00:00
|
|
|
describe('Ticket Create new tracking state path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.loginAndModule('production', 'ticket')
|
|
|
|
.accessToSearchResult('id:1')
|
|
|
|
.accessToSection('ticket.card.tracking.index');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it('should access to the create state view by clicking the create floating button', async() => {
|
2018-12-19 07:42:07 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.waitToClick(selectors.ticketTracking.createStateButton)
|
2019-01-07 09:55:23 +00:00
|
|
|
.wait(selectors.createStateView.stateAutocomplete)
|
2018-12-19 07:42:07 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should attempt create a new state but receive an error if state is empty`, async() => {
|
2018-12-19 07:42:07 +00:00
|
|
|
let result = await nightmare
|
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('No changes to save');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should attempt create a new state then clear and save it`, async() => {
|
2018-12-19 07:42:07 +00:00
|
|
|
let result = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
2018-12-19 07:42:07 +00:00
|
|
|
.waitToClick(selectors.createStateView.clearStateInputButton)
|
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it('should again access to the create state view by clicking the create floating button', async() => {
|
2018-12-19 07:42:07 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.click(selectors.ticketTracking.createStateButton)
|
2019-01-07 09:55:23 +00:00
|
|
|
.wait(selectors.createStateView.stateAutocomplete)
|
2018-12-19 07:42:07 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('tracking/edit');
|
|
|
|
});
|
|
|
|
|
2019-01-07 09:55:23 +00:00
|
|
|
it(`should create a new state`, async() => {
|
2018-12-19 07:42:07 +00:00
|
|
|
let result = await nightmare
|
2019-01-07 09:55:23 +00:00
|
|
|
.autocompleteSearch(selectors.createStateView.stateAutocomplete, '¿Fecha?')
|
2018-12-19 07:42:07 +00:00
|
|
|
.click(selectors.createStateView.saveStateButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
2018-04-05 12:14:34 +00:00
|
|
|
});
|
|
|
|
});
|