#179 ticket observations path

This commit is contained in:
Carlos Jimenez 2018-03-19 16:29:55 +01:00
parent 1c8b541e83
commit 559f5fc3ae
3 changed files with 101 additions and 2 deletions

View File

@ -11,7 +11,8 @@ export default {
},
moduleAccessView: {
clientsSectionButton: `${components.vnModuleContainer}[ui-sref="clients"]`,
itemsSectionButton: `${components.vnModuleContainer}[ui-sref="item.index"]`
itemsSectionButton: `${components.vnModuleContainer}[ui-sref="item.index"]`,
ticketsSectionButton: `${components.vnModuleContainer}[ui-sref="ticket.list"]`
},
clientsIndex: {
searchClientInput: `${components.vnTextfield}`,
@ -269,5 +270,25 @@ export default {
niche: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(2) > vn-vertical > p:nth-child(2)`,
botanical: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(3) > vn-vertical > p`,
barcode: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(4) > vn-vertical > p`
},
ticketsIndex: {
createTicketButton: `${components.vnFloatButton}`,
searchResult: `vn-ticket-item a`,
searchTicketInput: `${components.vnTextfield}`,
searchButton: `${components.vnSearchBar} > vn-icon-button > button`
},
ticketNotes: {
notesButton: `${components.vnMenuItem}[ui-sref="ticket.card.observations"]`,
firstNoteRemoveButton: `${components.vnIcon}[icon="remove_circle_outline"]`,
addNoteButton: `${components.vnIcon}[icon="add_circle"]`,
firstNoteSelect: `${components.vnAutocomplete}[field="ticketObservation.observationTypeFk"] input`,
firstNoteSelectSecondOption: `${components.vnAutocomplete}[field="ticketObservation.observationTypeFk"] vn-drop-down ul > li:nth-child(2)`,
firstNoteDisabled: `vn-textfield[label="Observation type"] > div > input`,
firstDescriptionInput: `vn-textfield[label="Description"] > div > input`,
submitNotesButton: `${components.vnSubmit}`
},
ticketPackages: {
packagesButton: `${components.vnMenuItem}[ui-sref="ticket.card.package.list"]`,
firstPackageSelect: `${components.vnAutocomplete}[label="Package"] input`
}
};

View File

@ -0,0 +1,77 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('create item niche path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
it('should access to the tickets index by clicking the tickets button', () => {
return nightmare
.click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.createTicketButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/ticket/list');
});
});
it('should search for the ticket with id 1', () => {
return nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, '1')
.click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countSearchResults(selectors.ticketsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
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('observations')
.url()
.then(url => {
expect(url).toContain('observations');
});
});
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)
.waitForTextInElement(selectors.ticketNotes.firstNoteSelectSecondOption, 'observation two')
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
.type(selectors.ticketNotes.firstDescriptionInput, 'description')
.click(selectors.ticketNotes.submitNotesButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
});
it(`should confirm the note is the expected one`, () => {
return nightmare
.click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketNotes.notesButton)
.waitForTextInInput(selectors.ticketNotes.firstNoteDisabled, 'observation two')
.getInputValue(selectors.ticketNotes.firstNoteDisabled)
.then(result => {
expect(result).toEqual('observation two');
return nightmare
.getInputValue(selectors.ticketNotes.firstDescriptionInput);
})
.then(result => {
expect(result).toEqual('description');
});
});
});

View File

@ -3,7 +3,8 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "ticketObservation"
"table": "ticketObservation",
"database": "vn"
}
},
"properties": {