2018-03-19 15:29:55 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
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-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('employee');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should access to the tickets index by clicking the tickets button', () => {
|
|
|
|
return nightmare
|
|
|
|
.click(selectors.moduleAccessView.ticketsSectionButton)
|
2018-10-20 10:07:48 +00:00
|
|
|
.wait(selectors.ticketsIndex.searchResult)
|
2018-04-05 06:55:47 +00:00
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it('should search for the ticket with id 1', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.ticketsIndex.searchTicketInput)
|
2018-06-07 21:47:19 +00:00
|
|
|
.type(selectors.ticketsIndex.searchTicketInput, 'id:1')
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.ticketsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.ticketsIndex.searchResult)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click on the search result to access to the ticket notes`, () => {
|
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
|
|
|
|
.waitToClick(selectors.ticketsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.ticketNotes.notesButton)
|
|
|
|
.waitForURL('observation')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('observation');
|
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should click create a new note and delete a former one`, () => {
|
|
|
|
return 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)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
it(`should confirm the note is the expected one`, () => {
|
2018-03-19 15:29:55 +00:00
|
|
|
return nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.ticketPackages.packagesButton)
|
|
|
|
.wait(selectors.ticketPackages.firstPackageSelect)
|
|
|
|
.click(selectors.ticketNotes.notesButton)
|
2018-10-19 17:54:46 +00:00
|
|
|
.waitProperty(selectors.ticketNotes.firstNoteSelect, 'value')
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-10-19 17:54:46 +00:00
|
|
|
expect(result).toEqual('observation one');
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
2018-10-19 17:54:46 +00:00
|
|
|
.getProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
|
2018-04-05 06:55:47 +00:00
|
|
|
})
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('description');
|
|
|
|
});
|
2018-03-19 15:29:55 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|