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

42 lines
1.6 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)
.waitToClick(selectors.ticketNotes.firstNoteSelect)
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
.type(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 firstNoteSelect = await nightmare
.click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketNotes.notesButton)
.waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value');
expect(firstNoteSelect).toEqual('observation one');
let firstDescription = await nightmare
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
expect(firstDescription).toEqual('description');
});
});