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

78 lines
3.0 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
// #1051 Traducciones que fallan
xdescribe('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('Data saved!');
});
it('should confirm the service description was edited correctly', async() => {
const result = await nightmare
.reloadSection('ticket.card.service')
.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('Data saved!');
});
it('should confirm the service was sucessfully removed', async() => {
const result = await nightmare
.reloadSection('ticket.card.service')
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)
.countElement(selectors.ticketService.serviceLine);
expect(result).toEqual(0);
});
});