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

63 lines
2.4 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => {
describe('Create new tracking state path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.loginAndModule('production', 'ticket')
.accessToSearchResult('id:1')
.accessToSection('ticket.card.tracking.index');
});
it('should access to the create state view by clicking the create floating button', async () => {
let url = await nightmare
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl();
expect(url.hash).toContain('tracking/edit');
});
it(`should attempt create a new state but receive an error if state is empty`, async () => {
let result = await nightmare
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar();
expect(result).toEqual('No changes to save');
});
it(`should attempt create a new state then clear and save it`, async () => {
let result = await nightmare
.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
.click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput)
.parsedUrl();
expect(url.hash).toContain('tracking/edit');
});
it(`should create a new state`, async () => {
let result = await nightmare
.waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne)
.click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
});
});