2018-03-19 15:29:55 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-03-19 15:29:55 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Ticket', () => {
|
|
|
|
describe('Create notes path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-03-19 15:29:55 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-11-23 07:05:57 +00:00
|
|
|
.loginAndModule('employee', 'ticket');
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
it('should search for the ticket with id 1', async () => {
|
|
|
|
let result = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
2018-11-22 14:44:33 +00:00
|
|
|
.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
it(`should click on the search result to access to the ticket notes`, async () => {
|
|
|
|
let url = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketNotes.notesButton)
|
|
|
|
.waitForURL('observation')
|
2018-11-22 14:44:33 +00:00
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('observation');
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
it(`should click create a new note and delete a former one`, async () => {
|
|
|
|
let result = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.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)
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-11-22 14:44:33 +00:00
|
|
|
it(`should confirm the note is the expected one`, async () => {
|
|
|
|
let firstNoteSelect = await nightmare
|
2018-10-25 14:44:03 +00:00
|
|
|
.click(selectors.ticketPackages.packagesButton)
|
|
|
|
.wait(selectors.ticketPackages.firstPackageSelect)
|
|
|
|
.click(selectors.ticketNotes.notesButton)
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value');
|
|
|
|
|
|
|
|
expect(firstNoteSelect).toEqual('observation one');
|
|
|
|
|
|
|
|
let firstDescription = await nightmare
|
|
|
|
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
|
|
|
|
|
|
|
expect(firstDescription).toEqual('description');
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|