salix/e2e/paths/05-ticket-module/01_observations.spec.js

47 lines
1.7 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket Create notes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult(1)
.accessToSection('ticket.card.observation');
});
it('should create a new note', async() => {
let result = await nightmare
.waitToClick(selectors.ticketNotes.addNoteButton)
.autocompleteSearch(selectors.ticketNotes.firstNoteTypeAutocomplete, 'observation one')
.write(selectors.ticketNotes.firstDescriptionInput, 'description')
.waitToClick(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the note is the expected one', async() => {
let result = await nightmare
.reloadSection('ticket.card.observation')
.waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value');
expect(result).toEqual('observation one');
let firstDescription = await nightmare
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
expect(firstDescription).toEqual('description');
});
it('should delete the note', async() => {
let result = await nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
});