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') .click(selectors.ticketNotes.submitNotesButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the note is the expected one`, async() => { let result = await nightmare .click(selectors.ticketPackages.packagesButton) .wait(selectors.ticketPackages.firstPackageAutocomplete) .click(selectors.ticketNotes.notesButton) .waitToGetProperty(`${selectors.ticketNotes.firstNoteTypeAutocomplete} input`, 'value'); expect(result).toEqual('observation one'); let firstDescription = await nightmare .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); expect(firstDescription).toEqual('description'); }); });