salix/e2e/paths/ticket-module/13_create_ticket_services.s...

72 lines
2.8 KiB
JavaScript

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);
});
});