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

87 lines
3.4 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket services path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'ticket')
.accessToSearchResult('id:1')
.accessToSection('ticket.card.service');
});
it('should edit the first service', async() => {
const result = await nightmare
.clearInput(selectors.ticketService.firstDescriptionInput)
.write(selectors.ticketService.firstDescriptionInput, 'my service')
.clearInput(selectors.ticketService.firstQuantityInput)
.write(selectors.ticketService.firstQuantityInput, 99)
.clearInput(selectors.ticketService.firstPriceInput)
.write(selectors.ticketService.firstPriceInput, 999)
.autocompleteSearch(selectors.ticketService.firstVatTypeAutocomplete, 'Reduced VAT')
.waitForTextInInput(`${selectors.ticketService.firstVatTypeAutocomplete} Input`, 'Reduced VAT')
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('¡Datos guardados!');
// #1051 Traducciones que fallan
// expect(result).toEqual('Data saved!');
});
it('should confirm the service description was edited correctly', async() => {
const result = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitToGetProperty(selectors.ticketService.firstDescriptionInput, 'value');
expect(result).toEqual('my service');
});
it('should confirm the service quantity was edited correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.firstQuantityInput, 'value');
expect(result).toEqual('99');
});
it('should confirm the service price was edited correctly', async() => {
const result = await nightmare
.waitToGetProperty(selectors.ticketService.firstPriceInput, 'value');
expect(result).toEqual('999');
});
it('should confirm the service VAT was edited correctly', async() => {
const result = await nightmare
.waitToGetProperty(`${selectors.ticketService.firstVatTypeAutocomplete} input`, 'value');
expect(result).toEqual('Reduced VAT');
});
it('should delete the service', async() => {
const result = await nightmare
.waitToClick(selectors.ticketService.fistDeleteServiceButton)
.waitToClick(selectors.ticketService.saveServiceButton)
.waitForLastSnackbar();
expect(result).toEqual('¡Datos guardados!');
// #1051 Traducciones que fallan
// expect(result).toEqual('Data saved!');
});
it('should confirm the service was sucessfully removed', async() => {
const result = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton)
.wait(selectors.ticketBasicData.clientAutocomplete)
.click(selectors.ticketService.serviceButton)
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
.countElement(selectors.ticketService.serviceLine);
expect(result).toEqual(0);
});
});