salix/e2e/paths/ticket-module/05_create_new_tracking_stat...

59 lines
2.1 KiB
JavaScript
Raw Normal View History

2018-04-05 12:14:34 +00:00
import selectors from '../../helpers/selectors.js';
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
});
});