#892 e2e ticket.services

This commit is contained in:
Carlos Jimenez 2019-01-14 11:19:39 +01:00
parent 929a0ee561
commit 6865f606a4
4 changed files with 87 additions and 6 deletions

View File

@ -412,6 +412,16 @@ export default {
actionTaken: 'vn-ticket-log > vn-log > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > div > div:nth-child(3) > span.value.ng-scope.ng-binding',
id: 'vn-ticket-log > vn-log > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr > vn-td.before > vn-one:nth-child(1) > div > span.value.ng-scope.ng-binding'
},
ticketService: {
serviceButton: 'vn-left-menu a[ui-sref="ticket.card.service"]',
addServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(3) > vn-icon-button > button > vn-icon',
descriptionInput: 'vn-ticket-service vn-textfield[label="Description"] input',
quantityInput: 'vn-ticket-service vn-textfield[label="Quantity"] input',
priceInput: 'vn-ticket-service vn-textfield[label="Price"] input',
vatTypeAutocomplete: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
fistDeleteServiceButton: 'vn-ticket-service > form > vn-card > div > vn-one:nth-child(2) > vn-horizontal > vn-auto > vn-icon',
saveServiceButton: `${components.vnSubmit}`
},
createStateView: {
stateAutocomplete: `vn-autocomplete[field="$ctrl.ticket.stateFk"]`,
clearStateInputButton: `vn-autocomplete[field="$ctrl.ticket.stateFk"] > div > div > div > vn-icon > i`,

View File

@ -381,7 +381,7 @@ describe('Ticket Edit sale path', () => {
expect(result).toEqual(3);
});
it('should go back to the original ticket sales section', async() => {
it('should now go back to the original ticket sales section', async() => {
const url = await nightmare
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
.wait(selectors.ticketsIndex.searchTicketInput)

View File

@ -9,7 +9,7 @@ describe('Ticket descriptor path', () => {
.loginAndModule('employee', 'ticket');
});
it('should search for a specific ticket', async () => {
it('should search for a specific ticket', async() => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:17')
@ -20,7 +20,7 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual(1);
});
it(`should click on the search result to access to the ticket Sale`, async () => {
it(`should click on the search result to access to the ticket Sale`, async() => {
const url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26')
.waitToClick(selectors.ticketsIndex.searchResult)
@ -30,7 +30,7 @@ describe('Ticket descriptor path', () => {
expect(url.hash).toContain('/summary');
});
it('should delete the ticket using the descriptor more menu', async () => {
it('should delete the ticket using the descriptor more menu', async() => {
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket)
@ -40,14 +40,14 @@ describe('Ticket descriptor path', () => {
expect(result).toEqual('Ticket deleted');
});
it('should have been relocated to the ticket index', async () => {
it('should have been relocated to the ticket index', async() => {
const url = await nightmare
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
it(`should search for the deleted ticket and check it's date`, async () => {
it(`should search for the deleted ticket and check it's date`, async() => {
const result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:17')

View File

@ -0,0 +1,71 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
// Bug #961 ticket.service fallo en borrado
xdescribe('Ticket services path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult('id:1')
.accessToSection('ticket.card.service');
});
it('should create a new service', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.addServiceButton)
.write(selectors.ticketService.descriptionInput, 'my service')
.clearInput(selectors.ticketService.quantityInput)
.write(selectors.ticketService.quantityInput, 99)
.write(selectors.ticketService.priceInput, 999)
.autocompleteSearch(selectors.ticketService.vatTypeAutocomplete, 'Reduced VAT')
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the service description was created correctly', async() => {
const result = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitToGetProperty(selectors.ticketService.descriptionInput, 'value');
expect(result).toEqual('my service');
});
it('should confirm the service quantity was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.quantityInput, 'value');
expect(result).toEqual('99');
});
it('should confirm the service price was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.priceInput, 'value');
expect(result).toEqual('999');
});
it('should confirm the service VAT was created correctly', async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.ticketService.vatTypeAutocomplete} input`, 'value');
expect(result).toEqual('Reduced VAT');
});
it('should delete the service and check there are none now', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitForNumberOfElements(selectors.ticketService.descriptionInput, 0)
.countElement(selectors.ticketService.descriptionInput);
expect(result).toEqual(0);
});
});