salix/e2e/paths/05-ticket-module/01_create_ticket_observatio...

39 lines
1.5 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('id:1')
.accessToSection('ticket.card.observation');
});
it(`should click create a new note and delete a former one`, async() => {
let result = await nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.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');
});
});