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

83 lines
3.3 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
describe('Ticket', () => {
describe('Create new tracking state path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.loginAndModule('production', 'ticket');
2018-04-05 12:14:34 +00:00
});
it('should search for the ticket 1', async () => {
let result = await nightmare
.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);
expect(result).toEqual(1);
2018-04-05 12:14:34 +00:00
});
it(`should click on the search result to access to the ticket Tracking`, async () => {
let url = await 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')
.parsedUrl();
expect(url.hash).toContain('tracking/index');
2018-04-05 12:14:34 +00:00
});
it('should access to the create state view by clicking the create floating button', async () => {
let url = await nightmare
2018-10-25 14:44:03 +00:00
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl();
expect(url.hash).toContain('tracking/edit');
2018-04-05 12:14:34 +00:00
});
it(`should attempt create a new state but receive an error if state is empty`, async () => {
let result = await nightmare
2018-10-25 14:44:03 +00:00
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar();
expect(result).toEqual('No changes to save');
2018-04-05 12:14:34 +00:00
});
it(`should attempt create a new state then clear and save it`, async () => {
let result = await 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();
expect(result).toEqual('Data saved!');
});
it('should again access to the create state view by clicking the create floating button', async () => {
let url = await nightmare
2018-10-25 14:44:03 +00:00
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl();
expect(url.hash).toContain('tracking/edit');
2018-04-05 12:14:34 +00:00
});
it(`should create a new state`, async () => {
let result = await nightmare
2018-10-25 14:44:03 +00:00
.waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne)
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
2018-04-05 12:14:34 +00:00
});
});
});